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,304 +1,311 @@
using System;
using Server.Engines.PartySystem;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.Engines.PartySystem;
namespace Server.Engines.Quests.Doom
{
public class Chyloth : BaseQuester
{
public override string DefaultName => "Chyloth";
public class Chyloth : BaseQuester
{
private static int[] m_Offsets =
{
-1, -1,
-1, 0,
-1, 1,
0, -1,
0, 1,
1, -1,
1, 0,
1, 1
};
[Constructible]
public Chyloth() : base( "the Ferryman" )
{
}
[Constructible]
public Chyloth() : base("the Ferryman")
{
}
public Chyloth( Serial serial ) : base( serial )
{
}
public Chyloth(Serial serial) : base(serial)
{
}
public override void InitBody()
{
InitStats( 100, 100, 25 );
public override string DefaultName => "Chyloth";
Hue = 0x8455;
Body = 0x190;
}
public BellOfTheDead Bell{ get; set; }
public override void InitOutfit()
{
EquipItem( new ChylothShroud() );
EquipItem( new ChylothStaff() );
}
public Mobile AngryAt{ get; set; }
public BellOfTheDead Bell { get; set; }
public override void InitBody()
{
InitStats(100, 100, 25);
Hue = 0x8455;
Body = 0x190;
}
public override void InitOutfit()
{
EquipItem(new ChylothShroud());
EquipItem(new ChylothStaff());
}
public Mobile AngryAt { get; set; }
public virtual void BeginGiveWarning()
{
if (Deleted || AngryAt == null)
return;
Timer.DelayCall(TimeSpan.FromSeconds(4.0), EndGiveWarning);
}
public virtual void BeginGiveWarning()
{
if ( Deleted || AngryAt == null )
return;
public virtual void EndGiveWarning()
{
if (Deleted || AngryAt == null)
return;
Timer.DelayCall( TimeSpan.FromSeconds( 4.0 ), EndGiveWarning );
}
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1050013,
AngryAt.Name); // You have summoned me in vain ~1_NAME~! Only the dead may cross!
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1050014); // Why have you disturbed me, mortal?!?
public virtual void EndGiveWarning()
{
if ( Deleted || AngryAt == null )
return;
BeginSummonDragon();
}
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1050013, AngryAt.Name ); // You have summoned me in vain ~1_NAME~! Only the dead may cross!
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1050014 ); // Why have you disturbed me, mortal?!?
public virtual void BeginSummonDragon()
{
if (Deleted || AngryAt == null)
return;
BeginSummonDragon();
}
Timer.DelayCall(TimeSpan.FromSeconds(30.0), EndSummonDragon);
}
public virtual void BeginSummonDragon()
{
if ( Deleted || AngryAt == null )
return;
public virtual void BeginRemove(TimeSpan delay)
{
Timer.DelayCall(delay, EndRemove);
}
Timer.DelayCall( TimeSpan.FromSeconds( 30.0 ), EndSummonDragon );
}
public virtual void EndRemove()
{
if (Deleted)
return;
public virtual void BeginRemove( TimeSpan delay )
{
Timer.DelayCall( delay, EndRemove );
}
Point3D loc = Location;
Map map = Map;
Effects.SendLocationParticles(EffectItem.Create(loc, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 0, 0,
2023, 0);
Effects.PlaySound(loc, map, 0x1FE);
Delete();
}
public virtual void EndRemove()
{
if ( Deleted )
return;
public virtual void EndSummonDragon()
{
if (Deleted || AngryAt == null)
return;
Point3D loc = Location;
Map map = Map;
Map map = AngryAt.Map;
Effects.SendLocationParticles( EffectItem.Create( loc, map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 0, 0, 2023, 0 );
Effects.PlaySound( loc, map, 0x1FE );
if (map == null)
return;
Delete();
}
if (!AngryAt.Region.IsPartOf("Doom"))
return;
private static int[] m_Offsets = {
-1, -1,
-1, 0,
-1, 1,
0, -1,
0, 1,
1, -1,
1, 0,
1, 1
};
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1050015); // Feel the wrath of my legions!!!
PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "MUHAHAHAHA HAHAH HAHA"); // A wee bit crazy, aren't we?
public virtual void EndSummonDragon()
{
if ( Deleted || AngryAt == null )
return;
SkeletalDragon dragon = new SkeletalDragon();
Map map = AngryAt.Map;
int offset = Utility.Random(8) * 2;
if ( map == null )
return;
bool foundLoc = false;
if ( !AngryAt.Region.IsPartOf( "Doom" ) )
return;
for (int i = 0; i < m_Offsets.Length; i += 2)
{
int x = AngryAt.X + m_Offsets[(offset + i) % m_Offsets.Length];
int y = AngryAt.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1050015 ); // Feel the wrath of my legions!!!
PublicOverheadMessage( MessageType.Regular, 0x3B2, false, "MUHAHAHAHA HAHAH HAHA" ); // A wee bit crazy, aren't we?
if (map.CanSpawnMobile(x, y, AngryAt.Z))
{
dragon.MoveToWorld(new Point3D(x, y, AngryAt.Z), map);
foundLoc = true;
break;
}
SkeletalDragon dragon = new SkeletalDragon();
int z = map.GetAverageZ(x, y);
int offset = Utility.Random( 8 ) * 2;
if (map.CanSpawnMobile(x, y, z))
{
dragon.MoveToWorld(new Point3D(x, y, z), map);
foundLoc = true;
break;
}
}
bool foundLoc = false;
if (!foundLoc)
dragon.MoveToWorld(AngryAt.Location, map);
for ( int i = 0; i < m_Offsets.Length; i += 2 )
{
int x = AngryAt.X + m_Offsets[(offset + i) % m_Offsets.Length];
int y = AngryAt.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
dragon.Combatant = AngryAt;
if ( map.CanSpawnMobile( x, y, AngryAt.Z ) )
{
dragon.MoveToWorld( new Point3D( x, y, AngryAt.Z ), map );
foundLoc = true;
break;
}
if (Bell != null)
Bell.Dragon = dragon;
}
int z = map.GetAverageZ( x, y );
public static void TeleportToFerry(Mobile from)
{
Point3D loc = new Point3D(408, 251, 2);
Map map = Map.Malas;
if ( map.CanSpawnMobile( x, y, z ) )
{
dragon.MoveToWorld( new Point3D( x, y, z ), map );
foundLoc = true;
break;
}
}
Effects.SendLocationParticles(EffectItem.Create(loc, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 0, 0,
2023, 0);
Effects.PlaySound(loc, map, 0x1FE);
if ( !foundLoc )
dragon.MoveToWorld( AngryAt.Location, map );
TeleportPets(from, loc, map);
dragon.Combatant = AngryAt;
from.MoveToWorld(loc, map);
}
if ( Bell != null )
Bell.Dragon = dragon;
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (dropped is GoldenSkull)
{
dropped.Delete();
public static void TeleportToFerry( Mobile from )
{
Point3D loc = new Point3D( 408, 251, 2 );
Map map = Map.Malas;
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1050046,
from.Name); // Very well, ~1_NAME~, I accept your token. You may cross.
BeginRemove(TimeSpan.FromSeconds(4.0));
Effects.SendLocationParticles( EffectItem.Create( loc, map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 0, 0, 2023, 0 );
Effects.PlaySound( loc, map, 0x1FE );
Party p = PartySystem.Party.Get(from);
TeleportPets( from, loc, map );
if (p != null)
for (int i = 0; i < p.Members.Count; ++i)
{
PartyMemberInfo pmi = p.Members[i];
Mobile member = pmi.Mobile;
from.MoveToWorld( loc, map );
}
if (member != from && member.Map == Map.Malas && member.Region.IsPartOf("Doom"))
{
if (AngryAt == member)
AngryAt = null;
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( dropped is GoldenSkull )
{
dropped.Delete();
member.CloseGump(typeof(ChylothPartyGump));
member.SendGump(new ChylothPartyGump(from, member));
}
}
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1050046, from.Name ); // Very well, ~1_NAME~, I accept your token. You may cross.
BeginRemove( TimeSpan.FromSeconds( 4.0 ) );
if (AngryAt == from)
AngryAt = null;
Party p = PartySystem.Party.Get( from );
TeleportToFerry(from);
if ( p != null )
{
for ( int i = 0; i < p.Members.Count; ++i )
{
PartyMemberInfo pmi = (PartyMemberInfo)p.Members[i];
Mobile member = pmi.Mobile;
return false;
}
if ( member != from && member.Map == Map.Malas && member.Region.IsPartOf( "Doom" ) )
{
if ( AngryAt == member )
AngryAt = null;
return base.OnDragDrop(from, dropped);
}
member.CloseGump( typeof( ChylothPartyGump ) );
member.SendGump( new ChylothPartyGump( from, member ) );
}
}
}
if ( AngryAt == from )
AngryAt = null;
TeleportToFerry( from );
return false;
}
return base.OnDragDrop( from, dropped );
}
public override bool CanTalkTo( PlayerMobile to )
{
return false;
}
public override void OnTalk( PlayerMobile player, bool contextMenu )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class ChylothPartyGump : Gump
{
private Mobile m_Leader;
private Mobile m_Member;
public ChylothPartyGump( Mobile leader, Mobile member ) : base( 150, 50 )
{
m_Leader = leader;
m_Member = member;
Closable = false;
AddPage( 0 );
AddImage( 0, 0, 3600 );
AddImageTiled( 0, 14, 15, 200, 3603 );
AddImageTiled( 380, 14, 14, 200, 3605 );
AddImage( 0, 201, 3606 );
AddImageTiled( 15, 201, 370, 16, 3607 );
AddImageTiled( 15, 0, 370, 16, 3601 );
AddImage( 380, 0, 3602 );
AddImage( 380, 201, 3608 );
AddImageTiled( 15, 15, 365, 190, 2624 );
AddRadio( 30, 140, 9727, 9730, true, 1 );
AddHtmlLocalized( 65, 145, 300, 25, 1050050, 0x7FFF, false, false ); // Yes, let's go!
AddRadio( 30, 175, 9727, 9730, false, 0 );
AddHtmlLocalized( 65, 178, 300, 25, 1050049, 0x7FFF, false, false ); // No thanks, I'd rather stay here.
AddHtmlLocalized( 30, 20, 360, 35, 1050047, 0x7FFF, false, false ); // Another player has paid Chyloth for your passage across lake Mortis:
AddHtmlLocalized( 30, 105, 345, 40, 1050048, 0x5B2D, false, false ); // Do you wish to accept their invitation at this time?
AddImage( 65, 72, 5605 );
AddImageTiled( 80, 90, 200, 1, 9107 );
AddImageTiled( 95, 92, 200, 1, 9157 );
AddLabel( 90, 70, 1645, leader.Name );
AddButton( 290, 175, 247, 248, 2, GumpButtonType.Reply, 0 );
AddImageTiled( 15, 14, 365, 1, 9107 );
AddImageTiled( 380, 14, 1, 190, 9105 );
AddImageTiled( 15, 205, 365, 1, 9107 );
AddImageTiled( 15, 14, 1, 190, 9105 );
AddImageTiled( 0, 0, 395, 1, 9157 );
AddImageTiled( 394, 0, 1, 217, 9155 );
AddImageTiled( 0, 216, 395, 1, 9157 );
AddImageTiled( 0, 0, 1, 217, 9155 );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( info.ButtonID == 2 && info.IsSwitched( 1 ) )
{
if ( m_Member.Region.IsPartOf( "Doom" ) )
{
m_Leader.SendLocalizedMessage( 1050054, m_Member.Name ); // ~1_NAME~ has accepted your invitation to cross lake Mortis.
Chyloth.TeleportToFerry( m_Member );
}
else
{
m_Member.SendLocalizedMessage( 1050051 ); // The invitation has been revoked.
}
}
else
{
m_Member.SendLocalizedMessage( 1050052 ); // You have declined their invitation.
m_Leader.SendLocalizedMessage( 1050053, m_Member.Name ); // ~1_NAME~ has declined your invitation to cross lake Mortis.
}
}
}
}
public override bool CanTalkTo(PlayerMobile to)
{
return false;
}
public override void OnTalk(PlayerMobile player, bool contextMenu)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class ChylothPartyGump : Gump
{
private Mobile m_Leader;
private Mobile m_Member;
public ChylothPartyGump(Mobile leader, Mobile member) : base(150, 50)
{
m_Leader = leader;
m_Member = member;
Closable = false;
AddPage(0);
AddImage(0, 0, 3600);
AddImageTiled(0, 14, 15, 200, 3603);
AddImageTiled(380, 14, 14, 200, 3605);
AddImage(0, 201, 3606);
AddImageTiled(15, 201, 370, 16, 3607);
AddImageTiled(15, 0, 370, 16, 3601);
AddImage(380, 0, 3602);
AddImage(380, 201, 3608);
AddImageTiled(15, 15, 365, 190, 2624);
AddRadio(30, 140, 9727, 9730, true, 1);
AddHtmlLocalized(65, 145, 300, 25, 1050050, 0x7FFF, false, false); // Yes, let's go!
AddRadio(30, 175, 9727, 9730, false, 0);
AddHtmlLocalized(65, 178, 300, 25, 1050049, 0x7FFF, false, false); // No thanks, I'd rather stay here.
AddHtmlLocalized(30, 20, 360, 35, 1050047, 0x7FFF, false,
false); // Another player has paid Chyloth for your passage across lake Mortis:
AddHtmlLocalized(30, 105, 345, 40, 1050048, 0x5B2D, false,
false); // Do you wish to accept their invitation at this time?
AddImage(65, 72, 5605);
AddImageTiled(80, 90, 200, 1, 9107);
AddImageTiled(95, 92, 200, 1, 9157);
AddLabel(90, 70, 1645, leader.Name);
AddButton(290, 175, 247, 248, 2, GumpButtonType.Reply, 0);
AddImageTiled(15, 14, 365, 1, 9107);
AddImageTiled(380, 14, 1, 190, 9105);
AddImageTiled(15, 205, 365, 1, 9107);
AddImageTiled(15, 14, 1, 190, 9105);
AddImageTiled(0, 0, 395, 1, 9157);
AddImageTiled(394, 0, 1, 217, 9155);
AddImageTiled(0, 216, 395, 1, 9157);
AddImageTiled(0, 0, 1, 217, 9155);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (info.ButtonID == 2 && info.IsSwitched(1))
{
if (m_Member.Region.IsPartOf("Doom"))
{
m_Leader.SendLocalizedMessage(1050054,
m_Member.Name); // ~1_NAME~ has accepted your invitation to cross lake Mortis.
Chyloth.TeleportToFerry(m_Member);
}
else
{
m_Member.SendLocalizedMessage(1050051); // The invitation has been revoked.
}
}
else
{
m_Member.SendLocalizedMessage(1050052); // You have declined their invitation.
m_Leader.SendLocalizedMessage(1050053,
m_Member.Name); // ~1_NAME~ has declined your invitation to cross lake Mortis.
}
}
}
}