Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -1,159 +1,166 @@
using System;
using Server.Mobiles;
using Server.Items;
using Server.Mobiles;
using Server.Network;
namespace Server.Engines.Quests.Necro
{
public class KronusScroll : QuestItem
{
public override int LabelNumber => 1060149; // Calling of Kronus
public class KronusScroll : QuestItem
{
private static readonly Rectangle2D m_WellOfTearsArea = new Rectangle2D(2080, 1346, 10, 10);
private static readonly Map m_WellOfTearsMap = Map.Malas;
[Constructible]
public KronusScroll() : base( 0x227A )
{
Weight = 1.0;
Hue = 0x44E;
}
[Constructible]
public KronusScroll() : base(0x227A)
{
Weight = 1.0;
Hue = 0x44E;
}
public KronusScroll( Serial serial ) : base( serial )
{
}
public KronusScroll(Serial serial) : base(serial)
{
}
public override bool CanDrop( PlayerMobile player )
{
return !(player.Quest is DarkTidesQuest);
public override int LabelNumber => 1060149; // Calling of Kronus
/*return !( qs.IsObjectiveInProgress( typeof( FindCallingScrollObjective ) )
|| qs.IsObjectiveInProgress( typeof( FindMardothAboutKronusObjective ) )
|| qs.IsObjectiveInProgress( typeof( FindWellOfTearsObjective ) )
|| qs.IsObjectiveInProgress( typeof( UseCallingScrollObjective ) ) );*/
}
public override bool CanDrop(PlayerMobile player)
{
return !(player.Quest is DarkTidesQuest);
private static readonly Rectangle2D m_WellOfTearsArea = new Rectangle2D( 2080, 1346, 10, 10 );
private static readonly Map m_WellOfTearsMap = Map.Malas;
/*return !( qs.IsObjectiveInProgress( typeof( FindCallingScrollObjective ) )
|| qs.IsObjectiveInProgress( typeof( FindMardothAboutKronusObjective ) )
|| qs.IsObjectiveInProgress( typeof( FindWellOfTearsObjective ) )
|| qs.IsObjectiveInProgress( typeof( UseCallingScrollObjective ) ) );*/
}
public override void OnDoubleClick( Mobile from )
{
if ( !IsChildOf( from ) )
return;
public override void OnDoubleClick(Mobile from)
{
if (!IsChildOf(from))
return;
if ( from is PlayerMobile pm )
{
QuestSystem qs = pm.Quest;
if (from is PlayerMobile pm)
{
QuestSystem qs = pm.Quest;
if ( qs is DarkTidesQuest )
{
if ( qs.IsObjectiveInProgress( typeof( FindMardothAboutKronusObjective ) ) )
{
pm.SendLocalizedMessage( 1060151, "", 0x41 ); // You read the scroll, but decide against performing the calling until you are instructed to do so by Mardoth.
}
else if ( qs.IsObjectiveInProgress( typeof( FindWellOfTearsObjective ) ) )
{
pm.SendLocalizedMessage( 1060152, "", 0x41 ); // You must be at the Well of Tears in the city of Necromancers to use this scroll.
}
else if ( qs.IsObjectiveInProgress( typeof( UseCallingScrollObjective ) ) )
{
if ( pm.Map == m_WellOfTearsMap && m_WellOfTearsArea.Contains( pm ) )
{
QuestObjective obj = qs.FindObjective( typeof( UseCallingScrollObjective ) );
if (qs is DarkTidesQuest)
{
if (qs.IsObjectiveInProgress(typeof(FindMardothAboutKronusObjective)))
{
pm.SendLocalizedMessage(1060151, "",
0x41); // You read the scroll, but decide against performing the calling until you are instructed to do so by Mardoth.
}
else if (qs.IsObjectiveInProgress(typeof(FindWellOfTearsObjective)))
{
pm.SendLocalizedMessage(1060152, "",
0x41); // You must be at the Well of Tears in the city of Necromancers to use this scroll.
}
else if (qs.IsObjectiveInProgress(typeof(UseCallingScrollObjective)))
{
if (pm.Map == m_WellOfTearsMap && m_WellOfTearsArea.Contains(pm))
{
QuestObjective obj = qs.FindObjective(typeof(UseCallingScrollObjective));
if ( obj != null && !obj.Completed )
obj.Complete();
if (obj != null && !obj.Completed)
obj.Complete();
Delete();
new CallingTimer( pm ).Start();
}
else
{
pm.SendLocalizedMessage( 1060152, "", 0x41 ); // You must be at the Well of Tears in the city of Necromancers to use this scroll.
}
}
else
{
pm.SendLocalizedMessage( 1060150, "", 0x41 ); // A strange terror grips your heart as you attempt to read the scroll. You decide it would be a bad idea to read it out loud.
}
}
}
}
Delete();
new CallingTimer(pm).Start();
}
else
{
pm.SendLocalizedMessage(1060152, "",
0x41); // You must be at the Well of Tears in the city of Necromancers to use this scroll.
}
}
else
{
pm.SendLocalizedMessage(1060150, "",
0x41); // A strange terror grips your heart as you attempt to read the scroll. You decide it would be a bad idea to read it out loud.
}
}
}
}
private class CallingTimer : Timer
{
private PlayerMobile m_Player;
private int m_Step;
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
public CallingTimer( PlayerMobile player ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 1.0 ), 6 )
{
Priority = TimerPriority.TwentyFiveMS;
writer.Write(0); // version
}
m_Player = player;
m_Step = 0;
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
protected override void OnTick()
{
if ( m_Player.Deleted )
{
Stop();
return;
}
int version = reader.ReadInt();
}
if ( !m_Player.Mounted )
m_Player.Animate( Utility.RandomBool() ? 16 : 17, 7, 1, true, false, 0 );
private class CallingTimer : Timer
{
private PlayerMobile m_Player;
private int m_Step;
if ( m_Step == 4 )
{
int baseX = m_WellOfTearsArea.X;
int baseY = m_WellOfTearsArea.Y;
int width = m_WellOfTearsArea.Width;
int height = m_WellOfTearsArea.Height;
Map map = m_WellOfTearsMap;
public CallingTimer(PlayerMobile player) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0), 6)
{
Priority = TimerPriority.TwentyFiveMS;
Effects.SendLocationParticles( EffectItem.Create( m_Player.Location, m_Player.Map, TimeSpan.FromSeconds( 1.0 ) ), 0, 0, 0, 0x13C4 );
Effects.PlaySound( m_Player.Location, m_Player.Map, 0x243 );
m_Player = player;
m_Step = 0;
}
for ( int i = 0; i < 15; i++ )
{
int x = baseX + Utility.Random( width );
int y = baseY + Utility.Random( height );
int z = map.GetAverageZ( x, y );
protected override void OnTick()
{
if (m_Player.Deleted)
{
Stop();
return;
}
Point3D from = new Point3D( x, y, z + Utility.RandomMinMax( 5, 20 ) );
Point3D to = new Point3D( x, y, z );
if (!m_Player.Mounted)
m_Player.Animate(Utility.RandomBool() ? 16 : 17, 7, 1, true, false, 0);
int hue = Utility.RandomList( 0x481, 0x482, 0x489, 0x497, 0x66D );
if (m_Step == 4)
{
int baseX = m_WellOfTearsArea.X;
int baseY = m_WellOfTearsArea.Y;
int width = m_WellOfTearsArea.Width;
int height = m_WellOfTearsArea.Height;
Map map = m_WellOfTearsMap;
Effects.SendPacket( from, map, new HuedEffect( EffectType.Moving, Serial.Zero, Serial.Zero, 0x36D4, from, to, 0, 0, false, true, hue, 0 ) );
}
}
Effects.SendLocationParticles(
EffectItem.Create(m_Player.Location, m_Player.Map, TimeSpan.FromSeconds(1.0)), 0, 0, 0, 0x13C4);
Effects.PlaySound(m_Player.Location, m_Player.Map, 0x243);
if ( m_Step < 5 )
{
m_Player.Frozen = true;
}
else // Cast completed
{
m_Player.Frozen = false;
for (int i = 0; i < 15; i++)
{
int x = baseX + Utility.Random(width);
int y = baseY + Utility.Random(height);
int z = map.GetAverageZ(x, y);
SummonedPaladin.BeginSummon( m_Player );
}
Point3D from = new Point3D(x, y, z + Utility.RandomMinMax(5, 20));
Point3D to = new Point3D(x, y, z);
m_Step++;
}
}
int hue = Utility.RandomList(0x481, 0x482, 0x489, 0x497, 0x66D);
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
Effects.SendPacket(from, map,
new HuedEffect(EffectType.Moving, Serial.Zero, Serial.Zero, 0x36D4, from, to, 0, 0, false, true,
hue, 0));
}
}
writer.Write( (int) 0 ); // version
}
if (m_Step < 5)
{
m_Player.Frozen = true;
}
else // Cast completed
{
m_Player.Frozen = false;
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
SummonedPaladin.BeginSummon(m_Player);
}
int version = reader.ReadInt();
}
}
}
m_Step++;
}
}
}
}