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,170 +1,169 @@
using System;
using System.Collections.Generic;
using Server.Network;
using Server.Mobiles;
using Server.Network;
using Server.Spells;
namespace Server.Items
{
public class SolenAntHoleComponent : AddonComponent
{
public SolenAntHoleComponent( int itemID ) : base( itemID )
{
}
public class SolenAntHoleComponent : AddonComponent
{
public SolenAntHoleComponent(int itemID) : base(itemID)
{
}
public override void OnDoubleClick( Mobile from )
{
if ( from.InRange( this, 2 ) )
{
Map map = Map;
public SolenAntHoleComponent(Serial serial) : base(serial)
{
}
if ( map == Map.Trammel || map == Map.Felucca )
{
from.MoveToWorld( new Point3D( 5922, 2024, 0 ), map );
PublicOverheadMessage( MessageType.Regular, 0x3B2, true,
$"* {from.Name} dives into the hole and disappears!*");
}
}
else
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
public override void OnDoubleClick(Mobile from)
{
if (from.InRange(this, 2))
{
Map map = Map;
public SolenAntHoleComponent( Serial serial ) : base( serial )
{
}
if (map == Map.Trammel || map == Map.Felucca)
{
from.MoveToWorld(new Point3D(5922, 2024, 0), map);
PublicOverheadMessage(MessageType.Regular, 0x3B2, true,
$"* {from.Name} dives into the hole and disappears!*");
}
}
else
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
int version = reader.ReadEncodedInt();
}
}
public class SolenAntHole : BaseAddon
{
public override bool ShareHue => false;
public override bool HandlesOnMovement => true;
public class SolenAntHole : BaseAddon
{
private List<Mobile> m_Spawned;
private List<Mobile> m_Spawned;
[Constructible]
public SolenAntHole()
{
m_Spawned = new List<Mobile>();
[Constructible]
public SolenAntHole()
{
m_Spawned = new List<Mobile>();
AddComponent(new AddonComponent(0x914), "dirt", 0, 0, 0, 0);
AddComponent(new SolenAntHoleComponent(0x122A), "a hole", 0x1, 0, 0, 0);
AddComponent(new AddonComponent(0x1B23), "dirt", 0x970, 1, 1, 0);
AddComponent(new AddonComponent(0xEE0), "dirt", 0, 1, 0, 0);
AddComponent(new AddonComponent(0x1B24), "dirt", 0x970, 1, -1, 0);
AddComponent(new AddonComponent(0xEE1), "dirt", 0, 0, -1, 0);
AddComponent(new AddonComponent(0x1B25), "dirt", 0x970, -1, -1, 0);
AddComponent(new AddonComponent(0xEE2), "dirt", 0, -1, 0, 0);
AddComponent(new AddonComponent(0x1B26), "dirt", 0x970, -1, 1, 0);
AddComponent(new AddonComponent(0xED3), "dirt", 0, 0, 1, 0);
}
AddComponent( new AddonComponent( 0x914 ), "dirt", 0, 0, 0, 0 );
AddComponent( new SolenAntHoleComponent( 0x122A ), "a hole", 0x1, 0, 0, 0 );
AddComponent( new AddonComponent( 0x1B23 ), "dirt", 0x970, 1, 1, 0 );
AddComponent( new AddonComponent( 0xEE0 ), "dirt", 0, 1, 0, 0 );
AddComponent( new AddonComponent( 0x1B24 ), "dirt", 0x970, 1, -1, 0 );
AddComponent( new AddonComponent( 0xEE1 ), "dirt", 0, 0, -1, 0 );
AddComponent( new AddonComponent( 0x1B25 ), "dirt", 0x970, -1, -1, 0 );
AddComponent( new AddonComponent( 0xEE2 ), "dirt", 0, -1, 0, 0 );
AddComponent( new AddonComponent( 0x1B26 ), "dirt", 0x970, -1, 1, 0 );
AddComponent( new AddonComponent( 0xED3 ), "dirt", 0, 0, 1, 0 );
}
public SolenAntHole(Serial serial) : base(serial)
{
}
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( !m.Player || !m.Alive || m.Hidden || !SpawnKilled() )
return;
public override bool ShareHue => false;
public override bool HandlesOnMovement => true;
if ( Utility.InRange( Location, m.Location, 3 ) && !Utility.InRange( Location, oldLocation, 3 ) )
{
int count = 1 + Utility.Random( 4 );
public override void OnMovement(Mobile m, Point3D oldLocation)
{
if (!m.Player || !m.Alive || m.Hidden || !SpawnKilled())
return;
for ( int i = 0; i < count; i++ )
SpawnAnt();
if (Utility.InRange(Location, m.Location, 3) && !Utility.InRange(Location, oldLocation, 3))
{
int count = 1 + Utility.Random(4);
if ( 0.05 > Utility.RandomDouble() )
SpawnAnt( new Beetle() );
}
}
for (int i = 0; i < count; i++)
SpawnAnt();
public void AddComponent( AddonComponent c, string name, int hue, int x, int y, int z )
{
c.Hue = hue;
c.Name = name;
AddComponent( c, x, y, z );
}
if (0.05 > Utility.RandomDouble())
SpawnAnt(new Beetle());
}
}
public void SpawnAnt()
{
int random = Utility.Random( 3 );
Map map = Map;
public void AddComponent(AddonComponent c, string name, int hue, int x, int y, int z)
{
c.Hue = hue;
c.Name = name;
AddComponent(c, x, y, z);
}
if ( map == Map.Trammel )
{
if ( random < 2 )
SpawnAnt( new RedSolenWorker() );
else
SpawnAnt( new RedSolenWarrior() );
}
else if ( map == Map.Felucca )
{
if ( random < 2 )
SpawnAnt( new BlackSolenWorker() );
else
SpawnAnt( new BlackSolenWarrior() );
}
}
public void SpawnAnt()
{
int random = Utility.Random(3);
Map map = Map;
public void SpawnAnt( BaseCreature ant )
{
m_Spawned.Add( ant );
if (map == Map.Trammel)
{
if (random < 2)
SpawnAnt(new RedSolenWorker());
else
SpawnAnt(new RedSolenWarrior());
}
else if (map == Map.Felucca)
{
if (random < 2)
SpawnAnt(new BlackSolenWorker());
else
SpawnAnt(new BlackSolenWarrior());
}
}
Map map = Map;
Point3D p = Location;
public void SpawnAnt(BaseCreature ant)
{
m_Spawned.Add(ant);
for ( int i = 0; i < 5; i++ )
if ( SpellHelper.FindValidSpawnLocation( map, ref p, false ) )
break;
Map map = Map;
Point3D p = Location;
ant.MoveToWorld( p, map );
ant.Home = Location;
ant.RangeHome = 10;
}
for (int i = 0; i < 5; i++)
if (SpellHelper.FindValidSpawnLocation(map, ref p, false))
break;
public bool SpawnKilled()
{
for ( int i = m_Spawned.Count - 1; i >= 0; i-- )
{
if ( !m_Spawned[ i ].Alive || m_Spawned[ i ].Deleted )
m_Spawned.RemoveAt( i );
}
ant.MoveToWorld(p, map);
ant.Home = Location;
ant.RangeHome = 10;
}
return m_Spawned.Count < 2;
}
public bool SpawnKilled()
{
for (int i = m_Spawned.Count - 1; i >= 0; i--)
if (!m_Spawned[i].Alive || m_Spawned[i].Deleted)
m_Spawned.RemoveAt(i);
public SolenAntHole( Serial serial ) : base( serial )
{
}
return m_Spawned.Count < 2;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
writer.WriteEncodedInt(0); // version
writer.WriteMobileList<Mobile>( m_Spawned );
}
writer.WriteMobileList(m_Spawned);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
int version = reader.ReadEncodedInt();
m_Spawned = reader.ReadStrongMobileList<Mobile>();
}
}
}
m_Spawned = reader.ReadStrongMobileList<Mobile>();
}
}
}