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,206 +1,210 @@
using System;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Factions;
using Server.Mobiles;
namespace Server
{
public class SpeedInfo
{
// Should we use the new method of speeds?
private static bool Enabled = true;
public class SpeedInfo
{
// Should we use the new method of speeds?
private static bool Enabled = true;
public double ActiveSpeed { get; set; }
private static Dictionary<Type, SpeedInfo> m_Table;
public double PassiveSpeed { get; set; }
private static SpeedInfo[] m_Speeds =
{
/* Slow */
new SpeedInfo(0.3, 0.6, new[]
{
typeof(AntLion), typeof(ArcticOgreLord), typeof(BogThing),
typeof(Bogle), typeof(BoneKnight), typeof(EarthElemental),
typeof(Ettin), typeof(FrostOoze), typeof(FrostTroll),
typeof(GazerLarva), typeof(Ghoul), typeof(Golem),
typeof(HeadlessOne), typeof(Jwilson), typeof(Mummy),
typeof(Ogre), typeof(OgreLord), typeof(PlagueBeast),
typeof(Quagmire), typeof(Rat), typeof(RottingCorpse),
typeof(SewerRat), typeof(Skeleton), typeof(Slime),
typeof(Zombie), typeof(Walrus), typeof(RestlessSoul),
typeof(CrystalElemental), typeof(DarknightCreeper), typeof(MoundOfMaggots),
typeof(Juggernaut), typeof(Yamandon), typeof(Serado)
}),
/* Fast */
new SpeedInfo(0.2, 0.4, new[]
{
typeof(LordOaks), typeof(Silvani), typeof(AirElemental),
typeof(AncientWyrm), typeof(Balron), typeof(BladeSpirits),
typeof(DreadSpider), typeof(Efreet), typeof(EtherealWarrior),
typeof(Lich), typeof(Nightmare), typeof(OphidianArchmage),
typeof(OphidianMage), typeof(OphidianWarrior), typeof(OphidianMatriarch),
typeof(OphidianKnight), typeof(PoisonElemental), typeof(Revenant),
typeof(SandVortex), typeof(SavageRider), typeof(SavageShaman),
typeof(SnowElemental), typeof(WhiteWyrm), typeof(Wisp),
typeof(DemonKnight), typeof(GiantBlackWidow), typeof(SummonedAirElemental),
typeof(LesserHiryu), typeof(Hiryu), typeof(LadyOfTheSnow),
typeof(RaiJu), typeof(Ronin), typeof(RuneBeetle),
typeof(Changeling),
public Type[] Types { get; set; }
#region ML named mobs - before Paragon speedboost
public SpeedInfo( double activeSpeed, double passiveSpeed, Type[] types )
{
ActiveSpeed = activeSpeed;
PassiveSpeed = passiveSpeed;
Types = types;
}
typeof(LadyJennifyr), typeof(LadyMarai), typeof(MasterJonath),
typeof(MasterMikael), typeof(MasterTheophilus), typeof(RedDeath),
typeof(SirPatrick), typeof(Miasma), typeof(Rend),
typeof(Grobu), typeof(Gnaw), typeof(Guile),
typeof(Irk), typeof(Spite), typeof(LadyLissith),
typeof(LadySabrix), typeof(Malefic), typeof(Silk),
typeof(Virulent)
// TODO: Where to put Lurg, Putrefier, Swoop and Pyre? They seem slower.
public static bool Contains( object obj )
{
if ( !Enabled )
return false;
#endregion
}),
/* Very Fast */
new SpeedInfo(0.175, 0.350, new[]
{
typeof(Barracoon), typeof(Mephitis), typeof(Neira),
typeof(Rikktor), typeof(Semidar), typeof(EnergyVortex),
typeof(EliteNinja), typeof(Pixie), typeof(SilverSerpent),
typeof(VorpalBunny), typeof(FleshRenderer), typeof(KhaldunRevenant),
typeof(FactionDragoon), typeof(FactionKnight), typeof(FactionPaladin),
typeof(FactionHenchman), typeof(FactionMercenary), typeof(FactionNecromancer),
typeof(FactionSorceress), typeof(FactionWizard), typeof(FactionBerserker),
typeof(FactionPaladin), typeof(Leviathan), typeof(FireBeetle),
typeof(FanDancer), typeof(FactionDeathKnight)
}),
/* Medium */
new SpeedInfo(0.25, 0.5, new[]
{
typeof(AcidElemental), typeof(AgapiteElemental), typeof(Alligator),
typeof(AncientLich), typeof(Betrayer), typeof(Bird),
typeof(BlackBear), typeof(BlackSolenInfiltratorQueen), typeof(BlackSolenInfiltratorWarrior),
typeof(BlackSolenQueen), typeof(BlackSolenWarrior), typeof(BlackSolenWorker),
typeof(BloodElemental), typeof(Boar), typeof(Bogling),
typeof(BoneMagi), typeof(Brigand), typeof(BronzeElemental),
typeof(BrownBear), typeof(Bull), typeof(BullFrog),
typeof(Cat), typeof(Centaur), typeof(ChaosDaemon),
typeof(Chicken), typeof(GolemController), typeof(CopperElemental),
typeof(CopperElemental), typeof(Cougar), typeof(Cow),
typeof(Cyclops), typeof(Daemon), typeof(DeepSeaSerpent),
typeof(DesertOstard), typeof(DireWolf), typeof(Dog),
typeof(Dolphin), typeof(Dragon), typeof(Drake),
typeof(DullCopperElemental), typeof(Eagle), typeof(ElderGazer),
typeof(EvilMage), typeof(EvilMageLord), typeof(Executioner),
typeof(Savage), typeof(FireElemental), typeof(FireGargoyle),
typeof(FireSteed), typeof(ForestOstard), typeof(FrenziedOstard),
typeof(FrostSpider), typeof(Gargoyle), typeof(Gazer),
typeof(IceSerpent), typeof(GiantRat), typeof(GiantSerpent),
typeof(GiantSpider), typeof(GiantToad), typeof(Goat),
typeof(GoldenElemental), typeof(Gorilla), typeof(GreatHart),
typeof(GreyWolf), typeof(GrizzlyBear), typeof(Guardian),
typeof(Harpy), typeof(Harrower), typeof(HellHound),
typeof(Hind), typeof(HordeMinion), typeof(Horse),
typeof(Horse), typeof(IceElemental), typeof(IceFiend),
typeof(IceSnake), typeof(Imp), typeof(JackRabbit),
typeof(Kirin), typeof(Kraken), typeof(PredatorHellCat),
typeof(LavaLizard), typeof(LavaSerpent), typeof(LavaSnake),
typeof(Lizardman), typeof(Llama), typeof(Mongbat),
typeof(StrongMongbat), typeof(MountainGoat), typeof(Orc),
typeof(OrcBomber), typeof(OrcBrute), typeof(OrcCaptain),
typeof(OrcishLord), typeof(OrcishMage), typeof(PackHorse),
typeof(PackLlama), typeof(Panther), typeof(Pig),
typeof(PlagueSpawn), typeof(PolarBear), typeof(Rabbit),
typeof(Ratman), typeof(RatmanArcher), typeof(RatmanMage),
typeof(RedSolenInfiltratorQueen), typeof(RedSolenInfiltratorWarrior), typeof(RedSolenQueen),
typeof(RedSolenWarrior), typeof(RedSolenWorker), typeof(RidableLlama),
typeof(Ridgeback), typeof(Scorpion), typeof(SeaSerpent),
typeof(SerpentineDragon), typeof(Shade), typeof(ShadowIronElemental),
typeof(ShadowWisp), typeof(ShadowWyrm), typeof(Sheep),
typeof(SilverSteed), typeof(SkeletalDragon), typeof(SkeletalMage),
typeof(SkeletalMount), typeof(HellCat), typeof(Snake),
typeof(SnowLeopard), typeof(SpectralArmour), typeof(Spectre),
typeof(StoneGargoyle), typeof(StoneHarpy), typeof(SwampDragon),
typeof(ScaledSwampDragon), typeof(SwampTentacle), typeof(TerathanAvenger),
typeof(TerathanDrone), typeof(TerathanMatriarch), typeof(TerathanWarrior),
typeof(TimberWolf), typeof(Titan), typeof(Troll),
typeof(Unicorn), typeof(ValoriteElemental), typeof(VeriteElemental),
typeof(CoMWarHorse), typeof(MinaxWarHorse), typeof(SLWarHorse),
typeof(TBWarHorse), typeof(WaterElemental), typeof(WhippingVine),
typeof(WhiteWolf), typeof(Wraith), typeof(Wyvern),
typeof(KhaldunZealot), typeof(KhaldunSummoner), typeof(SavageRidgeback),
typeof(LichLord), typeof(SkeletalKnight), typeof(SummonedDaemon),
typeof(SummonedEarthElemental), typeof(SummonedWaterElemental), typeof(SummonedFireElemental),
typeof(MeerWarrior), typeof(MeerEternal), typeof(MeerMage),
typeof(MeerCaptain), typeof(JukaLord), typeof(JukaMage),
typeof(JukaWarrior), typeof(AbysmalHorror), typeof(BoneDemon),
typeof(Devourer), typeof(FleshGolem), typeof(Gibberling),
typeof(GoreFiend), typeof(Impaler), typeof(PatchworkSkeleton),
typeof(Ravager), typeof(ShadowKnight), typeof(SkitteringHopper),
typeof(Treefellow), typeof(VampireBat), typeof(WailingBanshee),
typeof(WandererOfTheVoid), typeof(Cursed), typeof(GrimmochDrummel),
typeof(LysanderGathenwale), typeof(MorgBergen), typeof(ShadowFiend),
typeof(SpectralArmour), typeof(TavaraSewel), typeof(ArcaneDaemon),
typeof(Doppleganger), typeof(EnslavedGargoyle), typeof(ExodusMinion),
typeof(ExodusOverseer), typeof(GargoyleDestroyer), typeof(GargoyleEnforcer),
typeof(Moloch), typeof(BakeKitsune), typeof(DeathwatchBeetleHatchling),
typeof(Kappa), typeof(KazeKemono), typeof(DeathwatchBeetle),
typeof(TsukiWolf), typeof(YomotsuElder), typeof(YomotsuPriest),
typeof(YomotsuWarrior), typeof(RevenantLion), typeof(Oni),
typeof(Gaman), typeof(Crane), typeof(Beetle)
})
};
if ( m_Table == null )
LoadTable();
public SpeedInfo(double activeSpeed, double passiveSpeed, Type[] types)
{
ActiveSpeed = activeSpeed;
PassiveSpeed = passiveSpeed;
Types = types;
}
m_Table.TryGetValue( obj.GetType(), out SpeedInfo sp );
public double ActiveSpeed{ get; set; }
return ( sp != null );
}
public double PassiveSpeed{ get; set; }
public static bool GetSpeeds( object obj, ref double activeSpeed, ref double passiveSpeed )
{
if ( !Enabled )
return false;
public Type[] Types{ get; set; }
if ( m_Table == null )
LoadTable();
public static bool Contains(object obj)
{
if (!Enabled)
return false;
m_Table.TryGetValue( obj.GetType(), out SpeedInfo sp );
if (m_Table == null)
LoadTable();
if ( sp == null )
return false;
m_Table.TryGetValue(obj.GetType(), out SpeedInfo sp);
activeSpeed = sp.ActiveSpeed;
passiveSpeed = sp.PassiveSpeed;
return sp != null;
}
return true;
}
public static bool GetSpeeds(object obj, ref double activeSpeed, ref double passiveSpeed)
{
if (!Enabled)
return false;
private static void LoadTable()
{
m_Table = new Dictionary<Type, SpeedInfo>();
if (m_Table == null)
LoadTable();
for ( int i = 0; i < m_Speeds.Length; ++i )
{
SpeedInfo info = m_Speeds[i];
Type[] types = info.Types;
m_Table.TryGetValue(obj.GetType(), out SpeedInfo sp);
for ( int j = 0; j < types.Length; ++j )
m_Table[types[j]] = info;
}
}
if (sp == null)
return false;
private static Dictionary<Type, SpeedInfo> m_Table;
activeSpeed = sp.ActiveSpeed;
passiveSpeed = sp.PassiveSpeed;
private static SpeedInfo[] m_Speeds = {
/* Slow */
new SpeedInfo( 0.3, 0.6, new[]
{
typeof( AntLion ), typeof( ArcticOgreLord ), typeof( BogThing ),
typeof( Bogle ), typeof( BoneKnight ), typeof( EarthElemental ),
typeof( Ettin ), typeof( FrostOoze ), typeof( FrostTroll ),
typeof( GazerLarva ), typeof( Ghoul ), typeof( Golem ),
typeof( HeadlessOne ), typeof( Jwilson ), typeof( Mummy ),
typeof( Ogre ), typeof( OgreLord ), typeof( PlagueBeast ),
typeof( Quagmire ), typeof( Rat ), typeof( RottingCorpse ),
typeof( SewerRat ), typeof( Skeleton ), typeof( Slime ),
typeof( Zombie ), typeof( Walrus ), typeof( RestlessSoul ),
typeof( CrystalElemental ), typeof( DarknightCreeper ), typeof( MoundOfMaggots ),
typeof( Juggernaut ), typeof( Yamandon ), typeof( Serado )
} ),
/* Fast */
new SpeedInfo( 0.2, 0.4, new[]
{
typeof( LordOaks ), typeof( Silvani ), typeof( AirElemental ),
typeof( AncientWyrm ), typeof( Balron ), typeof( BladeSpirits ),
typeof( DreadSpider ), typeof( Efreet ), typeof( EtherealWarrior ),
typeof( Lich ), typeof( Nightmare ), typeof( OphidianArchmage ),
typeof( OphidianMage ), typeof( OphidianWarrior ), typeof( OphidianMatriarch ),
typeof( OphidianKnight ), typeof( PoisonElemental ), typeof( Revenant ),
typeof( SandVortex ), typeof( SavageRider ), typeof( SavageShaman ),
typeof( SnowElemental ), typeof( WhiteWyrm ), typeof( Wisp ),
typeof( DemonKnight ), typeof( GiantBlackWidow ), typeof( SummonedAirElemental ),
typeof( LesserHiryu ), typeof( Hiryu ), typeof( LadyOfTheSnow ),
typeof( RaiJu ), typeof( Ronin ), typeof( RuneBeetle ),
typeof( Changeling ),
#region ML named mobs - before Paragon speedboost
typeof( LadyJennifyr ), typeof( LadyMarai ), typeof( MasterJonath ),
typeof( MasterMikael ), typeof( MasterTheophilus ), typeof( RedDeath ),
typeof( SirPatrick ), typeof( Miasma ), typeof( Rend ),
typeof( Grobu ), typeof( Gnaw ), typeof( Guile ),
typeof( Irk ), typeof( Spite ), typeof( LadyLissith ),
typeof( LadySabrix ), typeof( Malefic ), typeof( Silk ),
typeof( Virulent )
// TODO: Where to put Lurg, Putrefier, Swoop and Pyre? They seem slower.
#endregion
} ),
/* Very Fast */
new SpeedInfo( 0.175, 0.350, new[]
{
typeof( Barracoon ), typeof( Mephitis ), typeof( Neira ),
typeof( Rikktor ), typeof( Semidar ), typeof( EnergyVortex ),
typeof( EliteNinja ), typeof( Pixie ), typeof( SilverSerpent ),
typeof( VorpalBunny ), typeof( FleshRenderer ), typeof( KhaldunRevenant ),
typeof( FactionDragoon ), typeof( FactionKnight ), typeof( FactionPaladin ),
typeof( FactionHenchman ), typeof( FactionMercenary ), typeof( FactionNecromancer ),
typeof( FactionSorceress ), typeof( FactionWizard ), typeof( FactionBerserker ),
typeof( FactionPaladin ), typeof( Leviathan ), typeof( FireBeetle ),
typeof( FanDancer ), typeof( FactionDeathKnight )
} ),
/* Medium */
new SpeedInfo( 0.25, 0.5, new[]
{
typeof( AcidElemental ), typeof( AgapiteElemental ), typeof( Alligator ),
typeof( AncientLich ), typeof( Betrayer ), typeof( Bird ),
typeof( BlackBear ), typeof( BlackSolenInfiltratorQueen ), typeof( BlackSolenInfiltratorWarrior ),
typeof( BlackSolenQueen ), typeof( BlackSolenWarrior ), typeof( BlackSolenWorker ),
typeof( BloodElemental ), typeof( Boar ), typeof( Bogling ),
typeof( BoneMagi ), typeof( Brigand ), typeof( BronzeElemental ),
typeof( BrownBear ), typeof( Bull ), typeof( BullFrog ),
typeof( Cat ), typeof( Centaur ), typeof( ChaosDaemon ),
typeof( Chicken ), typeof( GolemController ), typeof( CopperElemental ),
typeof( CopperElemental ), typeof( Cougar ), typeof( Cow ),
typeof( Cyclops ), typeof( Daemon ), typeof( DeepSeaSerpent ),
typeof( DesertOstard ), typeof( DireWolf ), typeof( Dog ),
typeof( Dolphin ), typeof( Dragon ), typeof( Drake ),
typeof( DullCopperElemental ), typeof( Eagle ), typeof( ElderGazer ),
typeof( EvilMage ), typeof( EvilMageLord ), typeof( Executioner ),
typeof( Savage ), typeof( FireElemental ), typeof( FireGargoyle ),
typeof( FireSteed ), typeof( ForestOstard ), typeof( FrenziedOstard ),
typeof( FrostSpider ), typeof( Gargoyle ), typeof( Gazer ),
typeof( IceSerpent ), typeof( GiantRat ), typeof( GiantSerpent ),
typeof( GiantSpider ), typeof( GiantToad ), typeof( Goat ),
typeof( GoldenElemental ), typeof( Gorilla ), typeof( GreatHart ),
typeof( GreyWolf ), typeof( GrizzlyBear ), typeof( Guardian ),
typeof( Harpy ), typeof( Harrower ), typeof( HellHound ),
typeof( Hind ), typeof( HordeMinion ), typeof( Horse ),
typeof( Horse ), typeof( IceElemental ), typeof( IceFiend ),
typeof( IceSnake ), typeof( Imp ), typeof( JackRabbit ),
typeof( Kirin ), typeof( Kraken ), typeof( PredatorHellCat ),
typeof( LavaLizard ), typeof( LavaSerpent ), typeof( LavaSnake ),
typeof( Lizardman ), typeof( Llama ), typeof( Mongbat ),
typeof( StrongMongbat ), typeof( MountainGoat ), typeof( Orc ),
typeof( OrcBomber ), typeof( OrcBrute ), typeof( OrcCaptain ),
typeof( OrcishLord ), typeof( OrcishMage ), typeof( PackHorse ),
typeof( PackLlama ), typeof( Panther ), typeof( Pig ),
typeof( PlagueSpawn ), typeof( PolarBear ), typeof( Rabbit ),
typeof( Ratman ), typeof( RatmanArcher ), typeof( RatmanMage ),
typeof( RedSolenInfiltratorQueen ), typeof( RedSolenInfiltratorWarrior ), typeof( RedSolenQueen ),
typeof( RedSolenWarrior ), typeof( RedSolenWorker ), typeof( RidableLlama ),
typeof( Ridgeback ), typeof( Scorpion ), typeof( SeaSerpent ),
typeof( SerpentineDragon ), typeof( Shade ), typeof( ShadowIronElemental ),
typeof( ShadowWisp ), typeof( ShadowWyrm ), typeof( Sheep ),
typeof( SilverSteed ), typeof( SkeletalDragon ), typeof( SkeletalMage ),
typeof( SkeletalMount ), typeof( HellCat ), typeof( Snake ),
typeof( SnowLeopard ), typeof( SpectralArmour ), typeof( Spectre ),
typeof( StoneGargoyle ), typeof( StoneHarpy ), typeof( SwampDragon ),
typeof( ScaledSwampDragon ), typeof( SwampTentacle ), typeof( TerathanAvenger ),
typeof( TerathanDrone ), typeof( TerathanMatriarch ), typeof( TerathanWarrior ),
typeof( TimberWolf ), typeof( Titan ), typeof( Troll ),
typeof( Unicorn ), typeof( ValoriteElemental ), typeof( VeriteElemental ),
typeof( CoMWarHorse ), typeof( MinaxWarHorse ), typeof( SLWarHorse ),
typeof( TBWarHorse ), typeof( WaterElemental ), typeof( WhippingVine ),
typeof( WhiteWolf ), typeof( Wraith ), typeof( Wyvern ),
typeof( KhaldunZealot ), typeof( KhaldunSummoner ), typeof( SavageRidgeback ),
typeof( LichLord ), typeof( SkeletalKnight ), typeof( SummonedDaemon ),
typeof( SummonedEarthElemental ), typeof( SummonedWaterElemental ), typeof( SummonedFireElemental ),
typeof( MeerWarrior ), typeof( MeerEternal ), typeof( MeerMage ),
typeof( MeerCaptain ), typeof( JukaLord ), typeof( JukaMage ),
typeof( JukaWarrior ), typeof( AbysmalHorror ), typeof( BoneDemon ),
typeof( Devourer ), typeof( FleshGolem ), typeof( Gibberling ),
typeof( GoreFiend ), typeof( Impaler ), typeof( PatchworkSkeleton ),
typeof( Ravager ), typeof( ShadowKnight ), typeof( SkitteringHopper ),
typeof( Treefellow ), typeof( VampireBat ), typeof( WailingBanshee ),
typeof( WandererOfTheVoid ), typeof( Cursed ), typeof( GrimmochDrummel ),
typeof( LysanderGathenwale ), typeof( MorgBergen ), typeof( ShadowFiend ),
typeof( SpectralArmour ), typeof( TavaraSewel ), typeof( ArcaneDaemon ),
typeof( Doppleganger ), typeof( EnslavedGargoyle ), typeof( ExodusMinion ),
typeof( ExodusOverseer ), typeof( GargoyleDestroyer ), typeof( GargoyleEnforcer ),
typeof( Moloch ), typeof( BakeKitsune ), typeof( DeathwatchBeetleHatchling ),
typeof( Kappa ), typeof( KazeKemono ), typeof( DeathwatchBeetle ),
typeof( TsukiWolf ), typeof( YomotsuElder ), typeof( YomotsuPriest ),
typeof( YomotsuWarrior ), typeof( RevenantLion ), typeof( Oni ),
typeof( Gaman ), typeof( Crane ), typeof( Beetle )
} )
};
}
}
return true;
}
private static void LoadTable()
{
m_Table = new Dictionary<Type, SpeedInfo>();
for (int i = 0; i < m_Speeds.Length; ++i)
{
SpeedInfo info = m_Speeds[i];
Type[] types = info.Types;
for (int j = 0; j < types.Length; ++j)
m_Table[types[j]] = info;
}
}
}
}