From ce54fe86354a819b78509f53cea9197033346597 Mon Sep 17 00:00:00 2001 From: asayre Date: Sat, 19 Aug 2006 23:24:47 +0000 Subject: [PATCH] Bug fix for : skillcaps and things that exceed it Possible threading issue Addition of Generic FindItemsByType - List findItemsByType() Change to make polymorph not have a timer and instead a toggle skill KiAttack no longer works with ranged weapons Poison strike speed and damage changed Necro spells now affected by FC Must have atleast 50 weapon skill if no shield equipped to use Evasion Stalking bonus capped at 10 + skill/10 Stalking bonus now Clears Bugfix w/Guilds Crashguard Exception message moved closer to the top of the file. Character creation of Pallys and necros using advanced skills now gives skill items Honor no longer works on Players Pre-ML area HitArea attacks nolonger require LoS Serialization fix for BladeOfTheRighteous RidingSwipe now has paralyzation immunity as with NerveStrike and ParaBlow AnkhEast renamed to AnkhNorth LeggingsOfBane no longer have 510 HP ElvenWashBasinEastAddon Fixed AnsellaGryen won't be renamed each time the server Restarts DiseasedCats are properly named Localization fixes in DefBlacksmithy BearMasks/DearMAsks and things that extend from them now can be repaired --- Scripts/Commands/Decorate.cs | 6 +- Scripts/Engines/Craft/Core/Repair.cs | 15 +- Scripts/Engines/Craft/DefBlacksmithy.cs | 4 +- Scripts/Engines/Ethics/Core/Ethic.cs | 2 +- .../Haochi's Trials/Mobiles/DiseasedCat.cs | 5 +- .../Mobiles/AnsellaGryen.cs | 2 + Scripts/Engines/Virtues/Honor.cs | 6 + Scripts/Gumps/HouseGumpAOS.cs | 2 +- .../Items/Addons/ElvenWashbasinEastAddon.cs | 2 +- .../Items/Armor/Artifacts/LeggingsOfBane.cs | 9 +- Scripts/Items/Construction/Ankhs.cs | 17 +- .../Items/Weapons/Abilities/RidingSwipe.cs | 13 +- .../Weapons/Artifacts/BladeOfTheRighteous.cs | 2 +- Scripts/Items/Weapons/BaseWeapon.cs | 6 +- Scripts/Misc/CharacterCreation.cs | 20 + Scripts/Misc/CrashGuard.cs | 9 +- Scripts/Misc/Guild.cs | 21 +- Scripts/Misc/RegenRates.cs | 12 +- Scripts/Multis/Boats/BaseBoat.cs | 3 +- Scripts/Skills/Tracking.cs | 13 +- Scripts/Spells/Bushido/Evasion.cs | 22 +- Scripts/Spells/Necromancy/NecromancerSpell.cs | 2 +- Scripts/Spells/Necromancy/PoisonStrike.cs | 5 +- Scripts/Spells/Ninjitsu/KiAttack.cs | 12 + Scripts/Spells/Seventh/Polymorph.cs | 44 +- Server/Items/Container.cs | 76 + Server/Mobile.cs | 2452 +++++++++-------- Server/Skills.cs | 3 - 28 files changed, 1495 insertions(+), 1290 deletions(-) diff --git a/Scripts/Commands/Decorate.cs b/Scripts/Commands/Decorate.cs index 3beeae1d9..0407f1884 100644 --- a/Scripts/Commands/Decorate.cs +++ b/Scripts/Commands/Decorate.cs @@ -70,7 +70,7 @@ namespace Server.Commands private static Type typeofLocalizedStatic = typeof( LocalizedStatic ); private static Type typeofBaseDoor = typeof( BaseDoor ); private static Type typeofAnkhWest = typeof( AnkhWest ); - private static Type typeofAnkhEast = typeof( AnkhEast ); + private static Type typeofAnkhNorth = typeof( AnkhNorth ); private static Type typeofBeverage = typeof( BaseBeverage ); private static Type typeofLocalizedSign = typeof( LocalizedSign ); private static Type typeofMarkContainer = typeof( MarkContainer ); @@ -129,7 +129,7 @@ namespace Server.Commands item = new LocalizedSign( m_ItemID, labelNumber ); } - else if ( m_Type == typeofAnkhWest || m_Type == typeofAnkhEast ) + else if ( m_Type == typeofAnkhWest || m_Type == typeofAnkhNorth ) { bool bloodied = false; @@ -139,7 +139,7 @@ namespace Server.Commands if ( m_Type == typeofAnkhWest ) item = new AnkhWest( bloodied ); else - item = new AnkhEast( bloodied ); + item = new AnkhNorth( bloodied ); } else if ( m_Type == typeofMarkContainer ) { diff --git a/Scripts/Engines/Craft/Core/Repair.cs b/Scripts/Engines/Craft/Core/Repair.cs index 519ab519e..03f4522d9 100644 --- a/Scripts/Engines/Craft/Core/Repair.cs +++ b/Scripts/Engines/Craft/Core/Repair.cs @@ -99,6 +99,19 @@ namespace Server.Engines.Craft return true; } + private bool IsSpecialClothing( BaseClothing clothing ) + { + // Armor repairable but not craftable + + if( m_CraftSystem is DefTailoring ) + { + return (clothing is BearMask) + || (clothing is DeerMask); + } + + return false; + } + private bool IsSpecialWeapon( BaseWeapon weapon ) { // Weapons repairable but not craftable @@ -345,7 +358,7 @@ namespace Server.Engines.Craft toWeaken = 3; } - if ( m_CraftSystem.CraftItems.SearchForSubclass( clothing.GetType() ) == null ) + if ( m_CraftSystem.CraftItems.SearchForSubclass( clothing.GetType() ) == null && !IsSpecialClothing( clothing )) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } diff --git a/Scripts/Engines/Craft/DefBlacksmithy.cs b/Scripts/Engines/Craft/DefBlacksmithy.cs index d46ff3dad..bed2a2f67 100644 --- a/Scripts/Engines/Craft/DefBlacksmithy.cs +++ b/Scripts/Engines/Craft/DefBlacksmithy.cs @@ -365,10 +365,10 @@ namespace Server.Engines.Craft index = AddCraft( typeof( ElvenSpellblade ), 1011081, 1031564, 70.0, 120.0, typeof( IronIngot ), 1044036, 14, 1044037 ); SetNeededExpansion( index, Expansion.ML ); - index = AddCraft( typeof( AssassinSpike ), 1011081, 1031564, 70.0, 120.0, typeof( IronIngot ), 1044036, 9, 1044037 ); + index = AddCraft( typeof( AssassinSpike ), 1011081, 1031565, 70.0, 120.0, typeof( IronIngot ), 1044036, 9, 1044037 ); SetNeededExpansion( index, Expansion.ML ); - index = AddCraft( typeof( Leafblade ), 1011081, 1031565, 70.0, 120.0, typeof( IronIngot ), 1044036, 12, 1044037 ); + index = AddCraft( typeof( Leafblade ), 1011081, 1031566, 70.0, 120.0, typeof( IronIngot ), 1044036, 12, 1044037 ); SetNeededExpansion( index, Expansion.ML ); index = AddCraft( typeof( RuneBlade ), 1011081, 1031570, 70.0, 120.0, typeof( IronIngot ), 1044036, 15, 1044037 ); diff --git a/Scripts/Engines/Ethics/Core/Ethic.cs b/Scripts/Engines/Ethics/Core/Ethic.cs index 9f6bbfaef..eb5043b8f 100644 --- a/Scripts/Engines/Ethics/Core/Ethic.cs +++ b/Scripts/Engines/Ethics/Core/Ethic.cs @@ -111,7 +111,7 @@ namespace Server.Ethics foreach ( Item item in e.Mobile.GetItemsInRange( 2 ) ) { - if ( item is Items.AnkhEast || item is Items.AnkhWest ) + if ( item is Items.AnkhNorth || item is Items.AnkhWest ) { isNearAnkh = true; break; diff --git a/Scripts/Engines/Quests/Haochi's Trials/Mobiles/DiseasedCat.cs b/Scripts/Engines/Quests/Haochi's Trials/Mobiles/DiseasedCat.cs index 9e1ebd250..8c65d99ec 100644 --- a/Scripts/Engines/Quests/Haochi's Trials/Mobiles/DiseasedCat.cs +++ b/Scripts/Engines/Quests/Haochi's Trials/Mobiles/DiseasedCat.cs @@ -8,7 +8,7 @@ namespace Server.Engines.Quests.Samurai [Constructable] public DiseasedCat() : base( AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4 ) { - Name = "a deseased cat"; + Name = "a diseased cat"; Body = 0xC9; Hue = Utility.RandomAnimalHue(); BaseSoundID = 0x69; @@ -51,6 +51,9 @@ namespace Server.Engines.Quests.Samurai base.Deserialize( reader ); int version = reader.ReadEncodedInt(); + + if( Name == "a deseased cat" ) + Name = "a diseased cat"; } } } \ No newline at end of file diff --git a/Scripts/Engines/Quests/Terrible Hatchlings/Mobiles/AnsellaGryen.cs b/Scripts/Engines/Quests/Terrible Hatchlings/Mobiles/AnsellaGryen.cs index 1cdb0c16a..fa95dca2b 100644 --- a/Scripts/Engines/Quests/Terrible Hatchlings/Mobiles/AnsellaGryen.cs +++ b/Scripts/Engines/Quests/Terrible Hatchlings/Mobiles/AnsellaGryen.cs @@ -134,5 +134,7 @@ namespace Server.Engines.Quests.Zento int version = reader.ReadEncodedInt(); } + + public override void TurnToTokuno() { } } } \ No newline at end of file diff --git a/Scripts/Engines/Virtues/Honor.cs b/Scripts/Engines/Virtues/Honor.cs index 78f4bf56f..65bc9c7be 100644 --- a/Scripts/Engines/Virtues/Honor.cs +++ b/Scripts/Engines/Virtues/Honor.cs @@ -149,6 +149,12 @@ namespace Server return; } + if( Core.ML && target is PlayerMobile ) + { + source.SendLocalizedMessage( 1075614 ); // You cannot honor other players. + return; + } + if ( source.SentHonorContext != null ) source.SentHonorContext.Cancel(); diff --git a/Scripts/Gumps/HouseGumpAOS.cs b/Scripts/Gumps/HouseGumpAOS.cs index 111f2dc65..d02bc7916 100644 --- a/Scripts/Gumps/HouseGumpAOS.cs +++ b/Scripts/Gumps/HouseGumpAOS.cs @@ -377,7 +377,7 @@ namespace Server.Gumps int maxLockdowns = house.GetAosMaxLockdowns(); int curLockdowns = house.GetAosCurLockdowns(); - int bonusStorage = (int)((house.BonusStorageScalar - 1) * 100); + int bonusStorage = (int)((house.BonusStorageScalar * 100)-100); if( bonusStorage > 0 ) { diff --git a/Scripts/Items/Addons/ElvenWashbasinEastAddon.cs b/Scripts/Items/Addons/ElvenWashbasinEastAddon.cs index abb8e6194..dc07b415c 100644 --- a/Scripts/Items/Addons/ElvenWashbasinEastAddon.cs +++ b/Scripts/Items/Addons/ElvenWashbasinEastAddon.cs @@ -11,7 +11,7 @@ namespace Server.Items public ElvenWashBasinEastAddon() { AddComponent( new AddonComponent( 0x30DF ), 0, 0, 0 ); - AddComponent( new AddonComponent( 0x30E0 ), 0, -1, 0 ); + AddComponent( new AddonComponent( 0x30E0 ), 0, 1, 0 ); } public ElvenWashBasinEastAddon( Serial serial ) : base( serial ) diff --git a/Scripts/Items/Armor/Artifacts/LeggingsOfBane.cs b/Scripts/Items/Armor/Artifacts/LeggingsOfBane.cs index f4b0d3f5e..9481952d3 100644 --- a/Scripts/Items/Armor/Artifacts/LeggingsOfBane.cs +++ b/Scripts/Items/Armor/Artifacts/LeggingsOfBane.cs @@ -18,6 +18,7 @@ namespace Server.Items { Hue = 0x4F5; ArmorAttributes.DurabilityBonus = 100; + this.HitPoints = this.MaxHitPoints = 255; //Cause the Durability bonus and such and the min/max hits as well as all other hits being whole #'s... Attributes.BonusStam = 8; Attributes.AttackChance = 20; } @@ -30,7 +31,7 @@ namespace Server.Items { base.Serialize( writer ); - writer.Write( (int) 1 ); + writer.Write( (int) 2 ); } public override void Deserialize(GenericReader reader) @@ -39,6 +40,12 @@ namespace Server.Items int version = reader.ReadInt(); + if( version <= 1 ) + { + if( this.HitPoints > 255 || this.MaxHitPoints > 255 ) + this.HitPoints = this.MaxHitPoints = 255; + } + if ( version < 1 ) { if ( Hue == 0x559 ) diff --git a/Scripts/Items/Construction/Ankhs.cs b/Scripts/Items/Construction/Ankhs.cs index ceb3e1897..05547680a 100644 --- a/Scripts/Items/Construction/Ankhs.cs +++ b/Scripts/Items/Construction/Ankhs.cs @@ -265,24 +265,26 @@ namespace Server.Items } } - public class AnkhEast : Item + [TypeAlias( "Server.Items.AnkhEast" )] + public class AnkhNorth : Item { private InternalItem m_Item; [Constructable] - public AnkhEast() : this( false ) + public AnkhNorth() : this( false ) { } [Constructable] - public AnkhEast( bool bloodied ) : base( bloodied ? 0x1E5D : 0x4 ) + public AnkhNorth( bool bloodied ) : base( bloodied ? 0x1E5D : 0x4 ) { Movable = false; m_Item = new InternalItem( bloodied, this ); } - public AnkhEast( Serial serial ) : base( serial ) + public AnkhNorth( Serial serial ) + : base( serial ) { } @@ -352,9 +354,10 @@ namespace Server.Items private class InternalItem : Item { - private AnkhEast m_Item; + private AnkhNorth m_Item; - public InternalItem( bool bloodied, AnkhEast item ) : base( bloodied ? 0x1E5C : 0x5 ) + public InternalItem( bool bloodied, AnkhNorth item ) + : base( bloodied ? 0x1E5C : 0x5 ) { Movable = false; @@ -426,7 +429,7 @@ namespace Server.Items int version = reader.ReadInt(); - m_Item = reader.ReadItem() as AnkhEast; + m_Item = reader.ReadItem() as AnkhNorth; } } } diff --git a/Scripts/Items/Weapons/Abilities/RidingSwipe.cs b/Scripts/Items/Weapons/Abilities/RidingSwipe.cs index 94e7dcee7..337160314 100644 --- a/Scripts/Items/Weapons/Abilities/RidingSwipe.cs +++ b/Scripts/Items/Weapons/Abilities/RidingSwipe.cs @@ -63,9 +63,18 @@ namespace Server.Items { int amount = 10 + (int)(10.0 * (attacker.Skills[SkillName.Bushido].Value - 50.0) / 70.0 + 5); - AOS.Damage( defender, attacker, amount, 100, 0, 0, 0, 0 ); + AOS.Damage( defender, attacker, amount, 100, 0, 0, 0, 0 ); - defender.Paralyze( TimeSpan.FromSeconds( 3.0 ) ); + if( Server.Items.ParalyzingBlow.IsImmune( defender ) ) //Does it still do damage? + { + attacker.SendLocalizedMessage( 1070804 ); // Your target resists paralysis. + defender.SendLocalizedMessage( 1070813 ); // You resist paralysis. + } + else + { + defender.Paralyze( TimeSpan.FromSeconds( 3.0 ) ); + Server.Items.ParalyzingBlow.BeginImmunity( defender, Server.Items.ParalyzingBlow.FreezeDelayDuration ); + } } } } diff --git a/Scripts/Items/Weapons/Artifacts/BladeOfTheRighteous.cs b/Scripts/Items/Weapons/Artifacts/BladeOfTheRighteous.cs index bbe251484..d5da026a8 100644 --- a/Scripts/Items/Weapons/Artifacts/BladeOfTheRighteous.cs +++ b/Scripts/Items/Weapons/Artifacts/BladeOfTheRighteous.cs @@ -41,7 +41,7 @@ namespace Server.Items int version = reader.ReadInt(); if ( Slayer == SlayerName.None ) - Slayer = SlayerName.DaemonDismissal; + Slayer = SlayerName.Exorcism; } } } \ No newline at end of file diff --git a/Scripts/Items/Weapons/BaseWeapon.cs b/Scripts/Items/Weapons/BaseWeapon.cs index 855db60bc..e1f3b8aca 100644 --- a/Scripts/Items/Weapons/BaseWeapon.cs +++ b/Scripts/Items/Weapons/BaseWeapon.cs @@ -1389,9 +1389,9 @@ namespace Server.Items if ( (m_Slayer == SlayerName.Silver || m_Slayer2 == SlayerName.Silver) && context != null && context.Type != typeof( HorrificBeastSpell ) ) factor *= 1.25; // Every necromancer transformation other than horrific beast takes an additional 25% damage - if ( attacker is PlayerMobile ) + if ( attacker is PlayerMobile && !(Core.ML && defender is PlayerMobile )) { - PlayerMobile pmAttacker = (PlayerMobile) attacker; + PlayerMobile pmAttacker = (PlayerMobile) attacker; if ( pmAttacker.HonorActive && pmAttacker.InRange( defender, 1 ) ) factor *= 1.25; @@ -1797,7 +1797,7 @@ namespace Server.Items foreach ( Mobile m in from.GetMobilesInRange( 10 ) ) { - if ( from != m && defender != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) && from.InLOS( m ) ) + if ( from != m && defender != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) && ( !Core.ML || from.InLOS( m ) ) ) list.Add( m ); } diff --git a/Scripts/Misc/CharacterCreation.cs b/Scripts/Misc/CharacterCreation.cs index 08916fb45..f18d063ac 100644 --- a/Scripts/Misc/CharacterCreation.cs +++ b/Scripts/Misc/CharacterCreation.cs @@ -1428,6 +1428,13 @@ namespace Server.Misc PackItem( new Pitcher( BeverageType.Water ) ); break; } + case SkillName.Chivalry: + { + if( Core.ML ) + PackItem( new BookOfChivalry( (ulong)0x3FF ) ); + + break; + } case SkillName.DetectHidden: { EquipItem( new Cloak( 0x455 ) ); @@ -1570,6 +1577,19 @@ namespace Server.Misc PackInstrument(); break; } + case SkillName.Necromancy: + { + if( Core.ML ) + { + Container regs = new BagOfNecroReagents( 50 ); + + PackItem( regs ); + + regs.LootType = LootType.Regular; + } + + break; + } case SkillName.Ninjitsu: { EquipItem( new Hakama( 0x2C3 ) ); //Only ninjas get the hued one. diff --git a/Scripts/Misc/CrashGuard.cs b/Scripts/Misc/CrashGuard.cs index ea8687e5f..036e6838c 100644 --- a/Scripts/Misc/CrashGuard.cs +++ b/Scripts/Misc/CrashGuard.cs @@ -195,6 +195,10 @@ namespace Server.Misc try { op.WriteLine( "Items: {0}", World.Items.Count ); } catch {} + op.WriteLine( "Exception:" ); + op.WriteLine( e.Exception ); + op.WriteLine(); + op.WriteLine( "Clients:" ); try @@ -226,11 +230,6 @@ namespace Server.Misc { op.WriteLine( "- Failed" ); } - - op.WriteLine(); - - op.WriteLine( "Exception:" ); - op.WriteLine( e.Exception ); } Console.WriteLine( "done" ); diff --git a/Scripts/Misc/Guild.cs b/Scripts/Misc/Guild.cs index af283472e..ae90acb0f 100644 --- a/Scripts/Misc/Guild.cs +++ b/Scripts/Misc/Guild.cs @@ -1053,17 +1053,24 @@ namespace Server.Guilds public bool IsWar( Guild g ) { + if( g == null ) + return false; + if( NewGuildSystem ) { if( FindActiveWar( g ) != null ) return true; - if( Alliance != null && this != Alliance.Leader && Alliance.Leader != null && Alliance.IsMember( this ) ) - if( Alliance.Leader.FindActiveWar( g ) != null ) + AllianceInfo thisAlliace = this.Alliance; + + if( thisAlliace != null && this != thisAlliace.Leader && thisAlliace.Leader != null && thisAlliace.IsMember( this ) ) + if( thisAlliace.Leader.FindActiveWar( g ) != null ) return true; - if( g.Alliance != null && g.Alliance.Leader != null && g.Alliance.Leader != g && g.Alliance.IsMember( g ) ) - if( FindActiveWar( g.Alliance.Leader ) != null ) + AllianceInfo otherAlliance = g.Alliance; + + if( otherAlliance != null && otherAlliance.Leader != null && otherAlliance.Leader != g && otherAlliance.IsMember( g ) ) + if( FindActiveWar( otherAlliance.Leader ) != null ) return true; return false; @@ -1206,7 +1213,11 @@ namespace Server.Guilds } case 0: { - Leader = reader.ReadMobile(); + m_Leader = reader.ReadMobile(); + + if( m_Leader is PlayerMobile ) + ((PlayerMobile)m_Leader).GuildRank = RankDefinition.Leader; + m_Name = reader.ReadString(); m_Abbreviation = reader.ReadString(); diff --git a/Scripts/Misc/RegenRates.cs b/Scripts/Misc/RegenRates.cs index 7156a9dc7..edf7d6a89 100644 --- a/Scripts/Misc/RegenRates.cs +++ b/Scripts/Misc/RegenRates.cs @@ -16,6 +16,7 @@ namespace Server.Misc Mobile.DefaultHitsRate = TimeSpan.FromSeconds( 11.0 ); Mobile.DefaultStamRate = TimeSpan.FromSeconds( 7.0 ); Mobile.DefaultManaRate = TimeSpan.FromSeconds( 7.0 ); +//TODO: Pub 42 regen limits Mobile.ManaRegenRateHandler = new RegenRateHandler( Mobile_ManaRegenRate ); @@ -65,6 +66,7 @@ namespace Server.Misc if ( CheckAnimal( from, typeof( Dog ) ) || CheckAnimal( from, typeof( Cat ) ) ) points += from.Skills[SkillName.Ninjitsu].Fixed / 300; + //TODO: What's the new increased rate? if( Core.ML && from.Race == Race.Human ) points += 2; @@ -82,8 +84,9 @@ namespace Server.Misc CheckBonusSkill( from, from.Stam, from.StamMax, SkillName.Focus ); - int points = AosAttributes.GetValue( from, AosAttribute.RegenStam ) + - (int)(from.Skills[SkillName.Focus].Value * 0.1); + int points =(int)(from.Skills[SkillName.Focus].Value * 0.1); + + points += AosAttributes.GetValue( from, AosAttribute.RegenStam ); if ( CheckTransform( from, typeof( VampiricEmbraceSpell ) ) ) points += 15; @@ -124,8 +127,9 @@ namespace Server.Misc if ( armorPenalty > 0 ) medPoints = 0; // In AOS, wearing any meditation-blocking armor completely removes meditation bonus - double totalPoints = AosAttributes.GetValue( from, AosAttribute.RegenMana ) + - focusPoints + medPoints + (from.Meditating ? (medPoints > 13.0 ? 13.0 : medPoints) : 0.0); + double totalPoints = focusPoints + medPoints + (from.Meditating ? (medPoints > 13.0 ? 13.0 : medPoints) : 0.0); + + totalPoints += AosAttributes.GetValue( from, AosAttribute.RegenMana ); if ( CheckTransform( from, typeof( VampiricEmbraceSpell ) ) ) totalPoints += 3; diff --git a/Scripts/Multis/Boats/BaseBoat.cs b/Scripts/Multis/Boats/BaseBoat.cs index c64e86405..d8619e497 100644 --- a/Scripts/Multis/Boats/BaseBoat.cs +++ b/Scripts/Multis/Boats/BaseBoat.cs @@ -444,6 +444,7 @@ namespace Server.Multis public void Refresh() { m_DecayTime = DateTime.Now + BoatDecayDelay; + if( m_TillerMan != null ) m_TillerMan.InvalidateProperties(); } @@ -1671,4 +1672,4 @@ namespace Server.Multis } } } -} \ No newline at end of file +} diff --git a/Scripts/Skills/Tracking.cs b/Scripts/Skills/Tracking.cs index e598ac757..b5e2d58f0 100644 --- a/Scripts/Skills/Tracking.cs +++ b/Scripts/Skills/Tracking.cs @@ -4,6 +4,7 @@ using Server; using Server.Gumps; using Server.Network; using Server.Spells.Necromancy; +using Server.Spells; namespace Server.SkillHandlers { @@ -51,8 +52,6 @@ namespace Server.SkillHandlers public static double GetStalkingBonus( Mobile tracker, Mobile target ) { - // Note: This is not reset as of publish 35. - TrackingInfo info = null; m_Table.TryGetValue( tracker, out info ); @@ -62,9 +61,17 @@ namespace Server.SkillHandlers int xDelta = info.m_Location.X - target.X; int yDelta = info.m_Location.Y - target.Y; - return Math.Sqrt( (xDelta * xDelta) + (yDelta * yDelta) ); + double bonus = Math.Sqrt( (xDelta * xDelta) + (yDelta * yDelta) ); + + m_Table.Remove( tracker ); //Reset as of Pub 40, counting it as bug for Core.SE. + + if( Core.ML ) + return Math.Min( bonus, 10 + tracker.Skills.Tracking.Value/10 ); + + return bonus; } + public static void ClearTrackingInfo( Mobile tracker ) { m_Table.Remove( tracker ); diff --git a/Scripts/Spells/Bushido/Evasion.cs b/Scripts/Spells/Bushido/Evasion.cs index af597fd9a..b187f405c 100644 --- a/Scripts/Spells/Bushido/Evasion.cs +++ b/Scripts/Spells/Bushido/Evasion.cs @@ -21,14 +21,28 @@ namespace Server.Spells.Bushido public override bool CheckCast() { - if ( Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null ) + + if( Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null ) return base.CheckCast(); - if ( Caster.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon != null ) - return base.CheckCast(); + //Intentional having a Shield check override all. + + BaseWeapon weap = Caster.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon; + + if( weap == null ) + weap = Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon; + + if( weap != null ) + { + if( Core.ML && Caster.Skills[weap.Skill].Value < 50 ) + { + //Does UBW affect this? + Caster.SendLocalizedMessage( 1076206 ); // Your skill with your equipped weapon must be 50 or higher to use Evasion. + return false; + } - if ( Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon != null ) return base.CheckCast(); + } Caster.SendLocalizedMessage( 1062944 ); // You must have a weapon or a shield equipped to use this ability! return false; diff --git a/Scripts/Spells/Necromancy/NecromancerSpell.cs b/Scripts/Spells/Necromancy/NecromancerSpell.cs index ab1d52f0c..1f47a0a67 100644 --- a/Scripts/Spells/Necromancy/NecromancerSpell.cs +++ b/Scripts/Spells/Necromancy/NecromancerSpell.cs @@ -13,7 +13,7 @@ namespace Server.Spells.Necromancy public override bool ClearHandsOnCast{ get{ return false; } } - public override int CastDelayFastScalar{ get{ return 0; } } // Necromancer spells are not effected by fast cast items, though they are by fast cast recovery + public override int CastDelayFastScalar{ get{ return (Core.SE? base.CastDelayFastScalar : 0); } } // Necromancer spells are not effected by fast cast items, though they are by fast cast recovery public NecromancerSpell( Mobile caster, Item scroll, SpellInfo info ) : base( caster, scroll, info ) { diff --git a/Scripts/Spells/Necromancy/PoisonStrike.cs b/Scripts/Spells/Necromancy/PoisonStrike.cs index c135f9eba..6a591e47a 100644 --- a/Scripts/Spells/Necromancy/PoisonStrike.cs +++ b/Scripts/Spells/Necromancy/PoisonStrike.cs @@ -10,7 +10,8 @@ namespace Server.Spells.Necromancy { private static SpellInfo m_Info = new SpellInfo( "Poison Strike", "In Vas Nox", - SpellCircle.Fourth, // 0.5 + 1.0 = 1.5s base cast delay + (Core.ML ? SpellCircle.Fifth : // 0.5 + 1.25 = 1.75s base cast delay + SpellCircle.Fourth), // 0.5 + 1.0 = 1.5s base cast delay 203, 9031, Reagent.NoxCrystal @@ -46,7 +47,7 @@ namespace Server.Spells.Necromancy Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x36B0, 1, 14, 63, 7, 9915, 0 ); Effects.PlaySound( m.Location, m.Map, 0x229 ); - double damage = Utility.RandomMinMax( 36, 40 ) * ((300 + (GetDamageSkill( Caster ) * 9)) / 1000); + double damage = Utility.RandomMinMax( (Core.ML ? 32 : 36), 40 ) * ((300 + (GetDamageSkill( Caster ) * 9)) / 1000); Map map = m.Map; diff --git a/Scripts/Spells/Ninjitsu/KiAttack.cs b/Scripts/Spells/Ninjitsu/KiAttack.cs index 1981d9b2f..c99a616b5 100644 --- a/Scripts/Spells/Ninjitsu/KiAttack.cs +++ b/Scripts/Spells/Ninjitsu/KiAttack.cs @@ -37,6 +37,18 @@ namespace Server.Spells.Ninjitsu return false; } + if( Core.ML ) + { + BaseRanged ranged = from.Weapon as BaseRanged; + + if( ranged != null ) + { + from.SendLocalizedMessage( 1075858 ); // You can only use this with melee attacks. + return false; + } + } + + return base.Validate( from ); } diff --git a/Scripts/Spells/Seventh/Polymorph.cs b/Scripts/Spells/Seventh/Polymorph.cs index d7a8559ba..43f7ed283 100644 --- a/Scripts/Spells/Seventh/Polymorph.cs +++ b/Scripts/Spells/Seventh/Polymorph.cs @@ -61,7 +61,10 @@ namespace Server.Spells.Seventh } else if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) ) { - Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect. + if( Core.ML ) + EndPolymorph( Caster ); + else + Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect. return false; } else if ( m_NewBody == 0 ) @@ -92,7 +95,10 @@ namespace Server.Spells.Seventh } else if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) ) { - Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect. + if( Core.ML ) + EndPolymorph( Caster ); + else + Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect. } else if ( Necromancy.TransformationSpell.UnderTransformation( Caster ) ) { @@ -134,13 +140,16 @@ namespace Server.Spells.Seventh BaseArmor.ValidateMobile( Caster ); BaseClothing.ValidateMobile( Caster ); - StopTimer( Caster ); + if( !Core.ML ) + { + StopTimer( Caster ); - Timer t = new InternalTimer( Caster ); + Timer t = new InternalTimer( Caster ); - m_Timers[Caster] = t; + m_Timers[Caster] = t; - t.Start(); + t.Start(); + } } } else @@ -167,6 +176,19 @@ namespace Server.Spells.Seventh return ( t != null ); } + private static void EndPolymorph( Mobile m ) + { + if( !m.CanBeginAction( typeof( PolymorphSpell ) ) ) + { + m.BodyMod = 0; + m.HueMod = -1; + m.EndAction( typeof( PolymorphSpell ) ); + + BaseArmor.ValidateMobile( m ); + BaseClothing.ValidateMobile( m ); + } + } + private class InternalTimer : Timer { private Mobile m_Owner; @@ -186,15 +208,7 @@ namespace Server.Spells.Seventh protected override void OnTick() { - if ( !m_Owner.CanBeginAction( typeof( PolymorphSpell ) ) ) - { - m_Owner.BodyMod = 0; - m_Owner.HueMod = -1; - m_Owner.EndAction( typeof( PolymorphSpell ) ); - - BaseArmor.ValidateMobile( m_Owner ); - BaseClothing.ValidateMobile( m_Owner ); - } + EndPolymorph( m_Owner ); } } } diff --git a/Server/Items/Container.cs b/Server/Items/Container.cs index 719646a3d..63b011e85 100644 --- a/Server/Items/Container.cs +++ b/Server/Items/Container.cs @@ -1032,6 +1032,82 @@ namespace Server.Items } } + + + + public List FindItemsByType() where T : Item + { + return FindItemsByType( true ); + } + + public List FindItemsByType( bool recurse ) where T : Item + { + if( m_FindItemsList.Count > 0 ) + m_FindItemsList.Clear(); + + List list = new List(); + + RecurseFindItemsByType( this, recurse, list ); + + return list; + } + + private static void RecurseFindItemsByType( Item current, bool recurse, List list ) where T : Item + { + if( current != null && current.Items.Count > 0 ) + { + List items = current.Items; + + for( int i = 0; i < items.Count; ++i ) + { + Item item = items[i]; + + if( typeof( T ).IsAssignableFrom( item.GetType() ) ) + list.Add( (T)item ); + + if( recurse && item is Container ) + RecurseFindItemsByType( item, recurse, list ); + } + } + } + + public T FindItemByType() where T : Item + { + return FindItemByType( true ); + } + + public T FindItemByType( bool recurse ) where T : Item + { + return RecurseFindItemByType( this, recurse ); + } + + private static T RecurseFindItemByType( Item current, bool recurse ) where T : Item + { + if( current != null && current.Items.Count > 0 ) + { + List list = current.Items; + + for( int i = 0; i < list.Count; ++i ) + { + Item item = list[i]; + + if( typeof( T ).IsAssignableFrom( item.GetType() ) ) + { + return (T)item; + } + else if( recurse && item is Container ) + { + T check = RecurseFindItemByType( item, recurse ); + + if( check != null ) + return check; + } + } + } + + return null; + } + public Item[] FindItemsByType( Type[] types ) { return FindItemsByType( types, true ); diff --git a/Server/Mobile.cs b/Server/Mobile.cs index 9291e46b5..cdc67351e 100644 --- a/Server/Mobile.cs +++ b/Server/Mobile.cs @@ -65,7 +65,7 @@ namespace Server public override bool CheckCondition() { - return ( DateTime.Now < m_Expire ); + return (DateTime.Now < m_Expire); } } @@ -83,7 +83,7 @@ namespace Server public override bool CheckCondition() { - return ( !m_Item.Deleted && !m_Mobile.Deleted && m_Item.Parent == m_Mobile ); + return (!m_Item.Deleted && !m_Mobile.Deleted && m_Item.Parent == m_Mobile); } } @@ -122,11 +122,11 @@ namespace Server { m_ObeyCap = value; - if ( m_Owner != null ) + if( m_Owner != null ) { Skill sk = m_Owner.Skills[m_Skill]; - if ( sk != null ) + if( sk != null ) sk.Update(); } } @@ -140,14 +140,14 @@ namespace Server } set { - if ( m_Owner != value ) + if( m_Owner != value ) { - if ( m_Owner != null ) + if( m_Owner != null ) m_Owner.RemoveSkillMod( this ); m_Owner = value; - if ( m_Owner != value ) + if( m_Owner != value ) m_Owner.AddSkillMod( this ); } } @@ -166,21 +166,21 @@ namespace Server } set { - if ( m_Skill != value ) + if( m_Skill != value ) { - Skill oldUpdate = ( m_Owner == null ? m_Owner.Skills[m_Skill] : null ); + Skill oldUpdate = (m_Owner == null ? m_Owner.Skills[m_Skill] : null); m_Skill = value; - if ( m_Owner != null ) + if( m_Owner != null ) { Skill sk = m_Owner.Skills[m_Skill]; - if ( sk != null ) + if( sk != null ) sk.Update(); } - if ( oldUpdate != null ) + if( oldUpdate != null ) oldUpdate.Update(); } } @@ -194,15 +194,15 @@ namespace Server } set { - if ( m_Relative != value ) + if( m_Relative != value ) { m_Relative = value; - if ( m_Owner != null ) + if( m_Owner != null ) { Skill sk = m_Owner.Skills[m_Skill]; - if ( sk != null ) + if( sk != null ) sk.Update(); } } @@ -217,15 +217,15 @@ namespace Server } set { - if ( m_Relative == value ) + if( m_Relative == value ) { m_Relative = !value; - if ( m_Owner != null ) + if( m_Owner != null ) { Skill sk = m_Owner.Skills[m_Skill]; - if ( sk != null ) + if( sk != null ) sk.Update(); } } @@ -240,15 +240,15 @@ namespace Server } set { - if ( m_Value != value ) + if( m_Value != value ) { m_Value = value; - if ( m_Owner != null ) + if( m_Owner != null ) { Skill sk = m_Owner.Skills[m_Skill]; - if ( sk != null ) + if( sk != null ) sk.Update(); } } @@ -275,11 +275,11 @@ namespace Server get { return m_Type; } set { - if ( m_Type != value ) + if( m_Type != value ) { m_Type = value; - if ( m_Owner != null ) + if( m_Owner != null ) m_Owner.UpdateResistances(); } } @@ -290,11 +290,11 @@ namespace Server get { return m_Offset; } set { - if ( m_Offset != value ) + if( m_Offset != value ) { m_Offset = value; - if ( m_Owner != null ) + if( m_Owner != null ) m_Owner.UpdateResistances(); } } @@ -321,10 +321,10 @@ namespace Server public bool HasElapsed() { - if ( m_Duration == TimeSpan.Zero ) + if( m_Duration == TimeSpan.Zero ) return false; - return ( DateTime.Now - m_Added ) >= m_Duration; + return (DateTime.Now - m_Added) >= m_Duration; } public StatMod( StatType type, string name, int offset, TimeSpan duration ) @@ -386,49 +386,49 @@ namespace Server [CustomEnum( new string[] { "North", "Right", "East", "Down", "South", "Left", "West", "Up" } )] public enum Direction : byte { - North = 0x0, - Right = 0x1, - East = 0x2, - Down = 0x3, - South = 0x4, - Left = 0x5, - West = 0x6, - Up = 0x7, + North=0x0, + Right=0x1, + East=0x2, + Down=0x3, + South=0x4, + Left=0x5, + West=0x6, + Up=0x7, - Mask = 0x7, - Running = 0x80, - ValueMask = 0x87 + Mask=0x7, + Running=0x80, + ValueMask=0x87 } [Flags] public enum MobileDelta { - None = 0x00000000, - Name = 0x00000001, - Flags = 0x00000002, - Hits = 0x00000004, - Mana = 0x00000008, - Stam = 0x00000010, - Stat = 0x00000020, - Noto = 0x00000040, - Gold = 0x00000080, - Weight = 0x00000100, - Direction = 0x00000200, - Hue = 0x00000400, - Body = 0x00000800, - Armor = 0x00001000, - StatCap = 0x00002000, - GhostUpdate = 0x00004000, - Followers = 0x00008000, - Properties = 0x00010000, - TithingPoints = 0x00020000, - Resistances = 0x00040000, - WeaponDamage = 0x00080000, - Hair = 0x00100000, - FacialHair = 0x00200000, - Race = 0x00400000, + None=0x00000000, + Name=0x00000001, + Flags=0x00000002, + Hits=0x00000004, + Mana=0x00000008, + Stam=0x00000010, + Stat=0x00000020, + Noto=0x00000040, + Gold=0x00000080, + Weight=0x00000100, + Direction=0x00000200, + Hue=0x00000400, + Body=0x00000800, + Armor=0x00001000, + StatCap=0x00002000, + GhostUpdate=0x00004000, + Followers=0x00008000, + Properties=0x00010000, + TithingPoints=0x00020000, + Resistances=0x00040000, + WeaponDamage=0x00080000, + Hair=0x00100000, + FacialHair=0x00200000, + Race=0x00400000, - Attributes = 0x0000001C + Attributes=0x0000001C } public enum AccessLevel @@ -469,7 +469,8 @@ namespace Server public class MobileNotConnectedException : Exception { - public MobileNotConnectedException( Mobile source, string message ) : base( message ) + public MobileNotConnectedException( Mobile source, string message ) + : base( message ) { this.Source = source.ToString(); } @@ -499,7 +500,7 @@ namespace Server { public int CompareTo( IEntity other ) { - if ( other == null ) + if( other == null ) return -1; return m_Serial.CompareTo( other.Serial ); @@ -507,13 +508,13 @@ namespace Server public int CompareTo( Mobile other ) { - return this.CompareTo( (IEntity) other ); + return this.CompareTo( (IEntity)other ); } public int CompareTo( object other ) { - if ( other == null || other is IEntity ) - return this.CompareTo( (IEntity) other ); + if( other == null || other is IEntity ) + return this.CompareTo( (IEntity)other ); throw new ArgumentException(); } @@ -617,7 +618,7 @@ namespace Server public static TimeSpan GetHitsRegenRate( Mobile m ) { - if ( m_HitsRegenRate == null ) + if( m_HitsRegenRate == null ) return m_DefaultHitsRate; else return m_HitsRegenRate( m ); @@ -625,7 +626,7 @@ namespace Server public static TimeSpan GetStamRegenRate( Mobile m ) { - if ( m_StamRegenRate == null ) + if( m_StamRegenRate == null ) return m_DefaultStamRate; else return m_StamRegenRate( m ); @@ -633,7 +634,7 @@ namespace Server public static TimeSpan GetManaRegenRate( Mobile m ) { - if ( m_ManaRegenRate == null ) + if( m_ManaRegenRate == null ) return m_DefaultManaRate; else return m_ManaRegenRate( m ); @@ -651,7 +652,7 @@ namespace Server { MovementRecord r; - if ( m_InstancePool.Count > 0 ) + if( m_InstancePool.Count > 0 ) { r = m_InstancePool.Dequeue(); @@ -672,9 +673,9 @@ namespace Server public bool Expired() { - bool v = ( DateTime.Now >= m_End ); + bool v = (DateTime.Now >= m_End); - if ( v ) + if( v ) m_InstancePool.Enqueue( this ); return v; @@ -825,7 +826,7 @@ namespace Server { ComputeBaseLightLevels( out global, out personal ); - if ( m_Region != null ) + if( m_Region != null ) m_Region.AlterLightLevel( this, ref global, ref personal ); } @@ -871,37 +872,37 @@ namespace Server public virtual void UpdateResistances() { - if ( m_Resistances == null ) + if( m_Resistances == null ) m_Resistances = new int[5] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue }; bool delta = false; - for ( int i = 0; i < m_Resistances.Length; ++i ) + for( int i = 0; i < m_Resistances.Length; ++i ) { - if ( m_Resistances[i] != int.MinValue ) + if( m_Resistances[i] != int.MinValue ) { m_Resistances[i] = int.MinValue; delta = true; } } - if ( delta ) + if( delta ) Delta( MobileDelta.Resistances ); } public virtual int GetResistance( ResistanceType type ) { - if ( m_Resistances == null ) + if( m_Resistances == null ) m_Resistances = new int[5] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue }; - int v = (int) type; + int v = (int)type; - if ( v < 0 || v >= m_Resistances.Length ) + if( v < 0 || v >= m_Resistances.Length ) return 0; int res = m_Resistances[v]; - if ( res == int.MinValue ) + if( res == int.MinValue ) { ComputeResistances(); res = m_Resistances[v]; @@ -918,7 +919,7 @@ namespace Server public virtual void AddResistanceMod( ResistanceMod toAdd ) { - if ( m_ResistMods == null ) + if( m_ResistMods == null ) m_ResistMods = new List( 2 ); m_ResistMods.Add( toAdd ); @@ -927,11 +928,11 @@ namespace Server public virtual void RemoveResistanceMod( ResistanceMod toRemove ) { - if ( m_ResistMods != null ) + if( m_ResistMods != null ) { m_ResistMods.Remove( toRemove ); - if ( m_ResistMods.Count == 0 ) + if( m_ResistMods.Count == 0 ) m_ResistMods = null; } @@ -944,10 +945,10 @@ namespace Server public virtual void ComputeResistances() { - if ( m_Resistances == null ) + if( m_Resistances == null ) m_Resistances = new int[5] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue }; - for ( int i = 0; i < m_Resistances.Length; ++i ) + for( int i = 0; i < m_Resistances.Length; ++i ) m_Resistances[i] = 0; m_Resistances[0] += this.BasePhysicalResistance; @@ -956,20 +957,20 @@ namespace Server m_Resistances[3] += this.BasePoisonResistance; m_Resistances[4] += this.BaseEnergyResistance; - for ( int i = 0; m_ResistMods != null && i < m_ResistMods.Count; ++i ) + for( int i = 0; m_ResistMods != null && i < m_ResistMods.Count; ++i ) { ResistanceMod mod = m_ResistMods[i]; - int v = (int) mod.Type; + int v = (int)mod.Type; - if ( v >= 0 && v < m_Resistances.Length ) + if( v >= 0 && v < m_Resistances.Length ) m_Resistances[v] += mod.Offset; } - for ( int i = 0; i < m_Items.Count; ++i ) + for( int i = 0; i < m_Items.Count; ++i ) { Item item = m_Items[i]; - if ( item.CheckPropertyConfliction( this ) ) + if( item.CheckPropertyConfliction( this ) ) continue; m_Resistances[0] += item.PhysicalResistance; @@ -979,17 +980,17 @@ namespace Server m_Resistances[4] += item.EnergyResistance; } - for ( int i = 0; i < m_Resistances.Length; ++i ) + for( int i = 0; i < m_Resistances.Length; ++i ) { - int min = GetMinResistance( (ResistanceType) i ); - int max = GetMaxResistance( (ResistanceType) i ); + int min = GetMinResistance( (ResistanceType)i ); + int max = GetMaxResistance( (ResistanceType)i ); - if ( max < min ) + if( max < min ) max = min; - if ( m_Resistances[i] > max ) + if( m_Resistances[i] > max ) m_Resistances[i] = max; - else if ( m_Resistances[i] < min ) + else if( m_Resistances[i] < min ) m_Resistances[i] = min; } } @@ -1001,7 +1002,7 @@ namespace Server public virtual int GetMaxResistance( ResistanceType type ) { - if ( m_Player ) + if( m_Player ) return m_MaxPlayerResistance; return int.MaxValue; @@ -1016,13 +1017,13 @@ namespace Server { ObjectPropertyList opl = this.PropertyList; - if ( opl.Header > 0 ) + if( opl.Header > 0 ) { int hue; - if ( m_NameHue != -1 ) + if( m_NameHue != -1 ) hue = m_NameHue; - else if ( m_AccessLevel > AccessLevel.Player ) + else if( m_AccessLevel > AccessLevel.Player ) hue = 11; else hue = Notoriety.GetHue( Notoriety.Compute( from, this ) ); @@ -1040,24 +1041,24 @@ namespace Server { string name = Name; - if ( name == null ) + if( name == null ) name = String.Empty; string prefix = ""; - if ( ShowFameTitle && ( m_Player || m_Body.IsHuman ) && m_Fame >= 10000 ) + if( ShowFameTitle && (m_Player || m_Body.IsHuman) && m_Fame >= 10000 ) prefix = m_Female ? "Lady" : "Lord"; string suffix = ""; - if ( PropertyTitle && Title != null && Title.Length > 0 ) + if( PropertyTitle && Title != null && Title.Length > 0 ) suffix = Title; BaseGuild guild = m_Guild; - if ( guild != null && ( m_Player || m_DisplayGuildTitle ) ) + if( guild != null && (m_Player || m_DisplayGuildTitle) ) { - if ( suffix.Length > 0 ) + if( suffix.Length > 0 ) suffix = String.Format( "{0} [{1}]", suffix, Utility.FixHtml( guild.Abbreviation ) ); else suffix = String.Format( "[{0}]", Utility.FixHtml( guild.Abbreviation ) ); @@ -1067,23 +1068,23 @@ namespace Server list.Add( 1050045, "{0} \t{1}\t {2}", prefix, name, suffix ); // ~1_PREFIX~~2_NAME~~3_SUFFIX~ - if ( guild != null && ( m_DisplayGuildTitle || ( m_Player && guild.Type != GuildType.Regular ) ) ) + if( guild != null && (m_DisplayGuildTitle || (m_Player && guild.Type != GuildType.Regular)) ) { string type; - if ( guild.Type >= 0 && (int) guild.Type < m_GuildTypes.Length ) - type = m_GuildTypes[(int) guild.Type]; + if( guild.Type >= 0 && (int)guild.Type < m_GuildTypes.Length ) + type = m_GuildTypes[(int)guild.Type]; else type = ""; string title = GuildTitle; - if ( title == null ) + if( title == null ) title = ""; else title = title.Trim(); - if ( title.Length > 0 ) + if( title.Length > 0 ) list.Add( "{0}, {1} Guild{2}", Utility.FixHtml( title ), Utility.FixHtml( guild.Name ), type ); else list.Add( Utility.FixHtml( guild.Name ) ); @@ -1105,11 +1106,11 @@ namespace Server private void UpdateAggrExpire() { - if ( m_Deleted || ( m_Aggressors.Count == 0 && m_Aggressed.Count == 0 ) ) + if( m_Deleted || (m_Aggressors.Count == 0 && m_Aggressed.Count == 0) ) { StopAggrExpire(); } - else if ( m_ExpireAggrTimer == null ) + else if( m_ExpireAggrTimer == null ) { m_ExpireAggrTimer = new ExpireAggressorsTimer( this ); m_ExpireAggrTimer.Start(); @@ -1118,7 +1119,7 @@ namespace Server private void StopAggrExpire() { - if ( m_ExpireAggrTimer != null ) + if( m_ExpireAggrTimer != null ) m_ExpireAggrTimer.Stop(); m_ExpireAggrTimer = null; @@ -1126,14 +1127,14 @@ namespace Server private void CheckAggrExpire() { - for ( int i = m_Aggressors.Count - 1; i >= 0; --i ) + for( int i = m_Aggressors.Count - 1; i >= 0; --i ) { - if ( i >= m_Aggressors.Count ) + if( i >= m_Aggressors.Count ) continue; AggressorInfo info = m_Aggressors[i]; - if ( info.Expired ) + if( info.Expired ) { Mobile attacker = info.Attacker; attacker.RemoveAggressed( this ); @@ -1141,19 +1142,19 @@ namespace Server m_Aggressors.RemoveAt( i ); info.Free(); - if ( m_NetState != null && this.CanSee( attacker ) && Utility.InUpdateRange( m_Location, attacker.m_Location ) ) + if( m_NetState != null && this.CanSee( attacker ) && Utility.InUpdateRange( m_Location, attacker.m_Location ) ) m_NetState.Send( new MobileIncoming( this, attacker ) ); } } - for ( int i = m_Aggressed.Count - 1; i >= 0; --i ) + for( int i = m_Aggressed.Count - 1; i >= 0; --i ) { - if ( i >= m_Aggressed.Count ) + if( i >= m_Aggressed.Count ) continue; AggressorInfo info = m_Aggressed[i]; - if ( info.Expired ) + if( info.Expired ) { Mobile defender = info.Defender; defender.RemoveAggressor( this ); @@ -1161,7 +1162,7 @@ namespace Server m_Aggressed.RemoveAt( i ); info.Free(); - if ( m_NetState != null && this.CanSee( defender ) && Utility.InUpdateRange( m_Location, defender.m_Location ) ) + if( m_NetState != null && this.CanSee( defender ) && Utility.InUpdateRange( m_Location, defender.m_Location ) ) m_NetState.Send( new MobileIncoming( this, defender ) ); } } @@ -1186,7 +1187,7 @@ namespace Server } set { - if ( m_VirtualArmorMod != value ) + if( m_VirtualArmorMod != value ) { m_VirtualArmorMod = value; @@ -1206,24 +1207,24 @@ namespace Server { ValidateSkillMods(); - for ( int i = 0; i < m_SkillMods.Count; ++i ) + for( int i = 0; i < m_SkillMods.Count; ++i ) { SkillMod mod = m_SkillMods[i]; Skill sk = m_Skills[mod.Skill]; - if ( sk != null ) + if( sk != null ) sk.Update(); } } public virtual void ValidateSkillMods() { - for ( int i = 0; i < m_SkillMods.Count; ) + for( int i = 0; i < m_SkillMods.Count; ) { SkillMod mod = m_SkillMods[i]; - if ( mod.CheckCondition() ) + if( mod.CheckCondition() ) ++i; else InternalRemoveSkillMod( mod ); @@ -1232,26 +1233,26 @@ namespace Server public virtual void AddSkillMod( SkillMod mod ) { - if ( mod == null ) + if( mod == null ) return; ValidateSkillMods(); - if ( !m_SkillMods.Contains( mod ) ) + if( !m_SkillMods.Contains( mod ) ) { m_SkillMods.Add( mod ); mod.Owner = this; Skill sk = m_Skills[mod.Skill]; - if ( sk != null ) + if( sk != null ) sk.Update(); } } public virtual void RemoveSkillMod( SkillMod mod ) { - if ( mod == null ) + if( mod == null ) return; ValidateSkillMods(); @@ -1261,14 +1262,14 @@ namespace Server private void InternalRemoveSkillMod( SkillMod mod ) { - if ( m_SkillMods.Contains( mod ) ) + if( m_SkillMods.Contains( mod ) ) { m_SkillMods.Remove( mod ); mod.Owner = null; Skill sk = m_Skills[mod.Skill]; - if ( sk != null ) + if( sk != null ) sk.Update(); } } @@ -1315,23 +1316,23 @@ namespace Server public void DelayChangeWarmode( bool value ) { - if ( m_WarmodeTimer != null ) + if( m_WarmodeTimer != null ) { m_WarmodeTimer.Value = value; return; } - if ( m_Warmode == value ) + if( m_Warmode == value ) return; DateTime now = DateTime.Now, next = m_NextWarmodeChange; - if ( now > next || m_WarmodeChanges == 0 ) + if( now > next || m_WarmodeChanges == 0 ) { m_WarmodeChanges = 1; m_NextWarmodeChange = now + WarmodeSpamCatch; } - else if ( m_WarmodeChanges == WarmodeCatchCount ) + else if( m_WarmodeChanges == WarmodeCatchCount ) { m_WarmodeTimer = new WarmodeTimer( this, value ); m_WarmodeTimer.Start(); @@ -1390,16 +1391,16 @@ namespace Server } set { - if ( m_Skills != null ) + if( m_Skills != null ) m_Skills.Cap = value; } } public bool InLOS( Mobile target ) { - if ( m_Deleted || m_Map == null ) + if( m_Deleted || m_Map == null ) return false; - else if ( target == this || m_AccessLevel > AccessLevel.Player ) + else if( target == this || m_AccessLevel > AccessLevel.Player ) return true; return m_Map.LineOfSight( this, target ); @@ -1407,11 +1408,11 @@ namespace Server public bool InLOS( object target ) { - if ( m_Deleted || m_Map == null ) + if( m_Deleted || m_Map == null ) return false; - else if ( target == this || m_AccessLevel > AccessLevel.Player ) + else if( target == this || m_AccessLevel > AccessLevel.Player ) return true; - else if ( target is Item && ( (Item) target ).RootParent == this ) + else if( target is Item && ((Item)target).RootParent == this ) return true; return m_Map.LineOfSight( this, target ); @@ -1419,9 +1420,9 @@ namespace Server public bool InLOS( Point3D target ) { - if ( m_Deleted || m_Map == null ) + if( m_Deleted || m_Map == null ) return false; - else if ( m_AccessLevel > AccessLevel.Player ) + else if( m_AccessLevel > AccessLevel.Player ) return true; return m_Map.LineOfSight( this, target ); @@ -1454,7 +1455,7 @@ namespace Server public bool BeginAction( object toLock ) { - if ( m_Actions == null ) + if( m_Actions == null ) { m_Actions = new ArrayList( 2 ); @@ -1462,7 +1463,7 @@ namespace Server return true; } - else if ( !m_Actions.Contains( toLock ) ) + else if( !m_Actions.Contains( toLock ) ) { m_Actions.Add( toLock ); @@ -1474,16 +1475,16 @@ namespace Server public bool CanBeginAction( object toLock ) { - return ( m_Actions == null || !m_Actions.Contains( toLock ) ); + return (m_Actions == null || !m_Actions.Contains( toLock )); } public void EndAction( object toLock ) { - if ( m_Actions != null ) + if( m_Actions != null ) { m_Actions.Remove( toLock ); - if ( m_Actions.Count == 0 ) + if( m_Actions.Count == 0 ) m_Actions = null; } } @@ -1512,7 +1513,7 @@ namespace Server { int oldValue = m_Hunger; - if ( oldValue != value ) + if( oldValue != value ) { m_Hunger = value; @@ -1599,26 +1600,26 @@ namespace Server } set { - if ( m_Holding != value ) + if( m_Holding != value ) { - if ( m_Holding != null ) + if( m_Holding != null ) { - UpdateTotal( m_Holding, TotalType.Weight, -( m_Holding.TotalWeight + m_Holding.PileWeight ) ); + UpdateTotal( m_Holding, TotalType.Weight, -(m_Holding.TotalWeight + m_Holding.PileWeight) ); - if ( m_Holding.HeldBy == this ) + if( m_Holding.HeldBy == this ) m_Holding.HeldBy = null; } - if ( value != null && m_Holding != null ) + if( value != null && m_Holding != null ) DropHolding(); m_Holding = value; - if ( m_Holding != null ) + if( m_Holding != null ) { UpdateTotal( m_Holding, TotalType.Weight, m_Holding.TotalWeight + m_Holding.PileWeight ); - if ( m_Holding.HeldBy == null ) + if( m_Holding.HeldBy == null ) m_Holding.HeldBy = this; } } @@ -1646,13 +1647,13 @@ namespace Server } set { - if ( m_Paralyzed != value ) + if( m_Paralyzed != value ) { m_Paralyzed = value; this.SendLocalizedMessage( m_Paralyzed ? 502381 : 502382 ); - if ( m_ParaTimer != null ) + if( m_ParaTimer != null ) { m_ParaTimer.Stop(); m_ParaTimer = null; @@ -1698,11 +1699,11 @@ namespace Server } set { - if ( m_Frozen != value ) + if( m_Frozen != value ) { m_Frozen = value; - if ( m_FrozenTimer != null ) + if( m_FrozenTimer != null ) { m_FrozenTimer.Stop(); m_FrozenTimer = null; @@ -1713,7 +1714,7 @@ namespace Server public void Paralyze( TimeSpan duration ) { - if ( !m_Paralyzed ) + if( !m_Paralyzed ) { Paralyzed = true; @@ -1724,7 +1725,7 @@ namespace Server public void Freeze( TimeSpan duration ) { - if ( !m_Frozen ) + if( !m_Frozen ) { m_Frozen = true; @@ -1745,11 +1746,11 @@ namespace Server } set { - if ( m_StrLock != value ) + if( m_StrLock != value ) { m_StrLock = value; - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.Send( new StatLockInfo( this ) ); } } @@ -1767,11 +1768,11 @@ namespace Server } set { - if ( m_DexLock != value ) + if( m_DexLock != value ) { m_DexLock = value; - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.Send( new StatLockInfo( this ) ); } } @@ -1789,11 +1790,11 @@ namespace Server } set { - if ( m_IntLock != value ) + if( m_IntLock != value ) { m_IntLock = value; - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.Send( new StatLockInfo( this ) ); } } @@ -1838,7 +1839,7 @@ namespace Server public virtual void SendSkillMessage() { - if ( DateTime.Now < m_NextActionMessage ) + if( DateTime.Now < m_NextActionMessage ) return; m_NextActionMessage = DateTime.Now + m_ActionMessageDelay; @@ -1848,7 +1849,7 @@ namespace Server public virtual void SendActionMessage() { - if ( DateTime.Now < m_NextActionMessage ) + if( DateTime.Now < m_NextActionMessage ) return; m_NextActionMessage = DateTime.Now + m_ActionMessageDelay; @@ -1864,11 +1865,11 @@ namespace Server public virtual void ClearHand( Item item ) { - if ( item != null && item.Movable && !item.AllowEquipedCast( this ) ) + if( item != null && item.Movable && !item.AllowEquipedCast( this ) ) { Container pack = this.Backpack; - if ( pack == null ) + if( pack == null ) AddToBackpack( item ); else pack.DropItem( item ); @@ -1886,7 +1887,7 @@ namespace Server public virtual bool RegenThroughPoison { get { return m_GlobalRegenThroughPoison; } } - public virtual bool CanRegenHits { get { return this.Alive && ( RegenThroughPoison || !this.Poisoned ); } } + public virtual bool CanRegenHits { get { return this.Alive && (RegenThroughPoison || !this.Poisoned); } } public virtual bool CanRegenStam { get { return this.Alive; } } public virtual bool CanRegenMana { get { return this.Alive; } } @@ -1905,7 +1906,7 @@ namespace Server protected override void OnTick() { - if ( m_Owner.CanRegenMana )// m_Owner.Alive ) + if( m_Owner.CanRegenMana )// m_Owner.Alive ) m_Owner.Mana++; Delay = Interval = Mobile.GetManaRegenRate( m_Owner ); @@ -1925,7 +1926,7 @@ namespace Server protected override void OnTick() { - if ( m_Owner.CanRegenHits )// m_Owner.Alive && !m_Owner.Poisoned ) + if( m_Owner.CanRegenHits )// m_Owner.Alive && !m_Owner.Poisoned ) m_Owner.Hits++; Delay = Interval = Mobile.GetHitsRegenRate( m_Owner ); @@ -1945,7 +1946,7 @@ namespace Server protected override void OnTick() { - if ( m_Owner.CanRegenStam )// m_Owner.Alive ) + if( m_Owner.CanRegenStam )// m_Owner.Alive ) m_Owner.Stam++; Delay = Interval = Mobile.GetStamRegenRate( m_Owner ); @@ -1965,7 +1966,7 @@ namespace Server protected override void OnTick() { - if ( m_Mobile.m_Map != Map.Internal ) + if( m_Mobile.m_Map != Map.Internal ) { EventSink.InvokeLogout( new LogoutEventArgs( m_Mobile ) ); @@ -2020,18 +2021,18 @@ namespace Server { m_Mobile = m; - if ( !m_Mobile.m_Player && m_Mobile.m_Dex <= 100 ) + if( !m_Mobile.m_Player && m_Mobile.m_Dex <= 100 ) Priority = TimerPriority.FiftyMS; } protected override void OnTick() { - if ( DateTime.Now > m_Mobile.m_NextCombatTime ) + if( DateTime.Now > m_Mobile.m_NextCombatTime ) { Mobile combatant = m_Mobile.Combatant; // If no combatant, wrong map, one of us is a ghost, or cannot see, or deleted, then stop combat - if ( combatant == null || combatant.m_Deleted || m_Mobile.m_Deleted || combatant.m_Map != m_Mobile.m_Map || !combatant.Alive || !m_Mobile.Alive || !m_Mobile.CanSee( combatant ) || combatant.IsDeadBondedPet || m_Mobile.IsDeadBondedPet ) + if( combatant == null || combatant.m_Deleted || m_Mobile.m_Deleted || combatant.m_Map != m_Mobile.m_Map || !combatant.Alive || !m_Mobile.Alive || !m_Mobile.CanSee( combatant ) || combatant.IsDeadBondedPet || m_Mobile.IsDeadBondedPet ) { m_Mobile.Combatant = null; return; @@ -2039,10 +2040,10 @@ namespace Server IWeapon weapon = m_Mobile.Weapon; - if ( !m_Mobile.InRange( combatant, weapon.MaxRange ) ) + if( !m_Mobile.InRange( combatant, weapon.MaxRange ) ) return; - if ( m_Mobile.InLOS( combatant ) ) + if( m_Mobile.InLOS( combatant ) ) { weapon.OnBeforeSwing( m_Mobile, combatant ); //OnBeforeSwing for checking in regards to being hidden and whatnot m_Mobile.RevealingAction(); @@ -2107,7 +2108,7 @@ namespace Server protected override void OnTick() { - if ( m_Mobile.Deleted || ( m_Mobile.Aggressors.Count == 0 && m_Mobile.Aggressed.Count == 0 ) ) + if( m_Mobile.Deleted || (m_Mobile.Aggressors.Count == 0 && m_Mobile.Aggressed.Count == 0) ) m_Mobile.StopAggrExpire(); else m_Mobile.CheckAggrExpire(); @@ -2150,18 +2151,18 @@ namespace Server public bool ChangingCombatant { - get { return ( m_ChangingCombatant > 0 ); } + get { return (m_ChangingCombatant > 0); } } public virtual void Attack( Mobile m ) { - if ( CheckAttack( m ) ) + if( CheckAttack( m ) ) Combatant = m; } public virtual bool CheckAttack( Mobile m ) { - return ( Utility.InUpdateRange( this, m ) && CanSee( m ) && InLOS( m ) ); + return (Utility.InUpdateRange( this, m ) && CanSee( m ) && InLOS( m )); } /// @@ -2177,32 +2178,32 @@ namespace Server } set { - if ( m_Deleted ) + if( m_Deleted ) return; - if ( m_Combatant != value && value != this ) + if( m_Combatant != value && value != this ) { Mobile old = m_Combatant; ++m_ChangingCombatant; m_Combatant = value; - if ( ( m_Combatant != null && !CanBeHarmful( m_Combatant, false ) ) || !Region.OnCombatantChange( this, old, m_Combatant ) ) + if( (m_Combatant != null && !CanBeHarmful( m_Combatant, false )) || !Region.OnCombatantChange( this, old, m_Combatant ) ) { m_Combatant = old; --m_ChangingCombatant; return; } - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.Send( new ChangeCombatant( m_Combatant ) ); - if ( m_Combatant == null ) + if( m_Combatant == null ) { - if ( m_ExpireCombatant != null ) + if( m_ExpireCombatant != null ) m_ExpireCombatant.Stop(); - if ( m_CombatTimer != null ) + if( m_CombatTimer != null ) m_CombatTimer.Stop(); m_ExpireCombatant = null; @@ -2210,22 +2211,22 @@ namespace Server } else { - if ( m_ExpireCombatant == null ) + if( m_ExpireCombatant == null ) m_ExpireCombatant = new ExpireCombatantTimer( this ); m_ExpireCombatant.Start(); - if ( m_CombatTimer == null ) + if( m_CombatTimer == null ) m_CombatTimer = new CombatTimer( this ); m_CombatTimer.Start(); } - if ( m_Combatant != null && CanBeHarmful( m_Combatant, false ) ) + if( m_Combatant != null && CanBeHarmful( m_Combatant, false ) ) { DoHarmful( m_Combatant ); - if ( m_Combatant != null ) + if( m_Combatant != null ) m_Combatant.PlaySound( m_Combatant.GetAngerSound() ); } @@ -2248,7 +2249,7 @@ namespace Server int xDelta = m_Location.m_X - p.m_X; int yDelta = m_Location.m_Y - p.m_Y; - return Math.Sqrt( ( xDelta * xDelta ) + ( yDelta * yDelta ) ); + return Math.Sqrt( (xDelta * xDelta) + (yDelta * yDelta) ); } public double GetDistanceToSqrt( Mobile m ) @@ -2256,7 +2257,7 @@ namespace Server int xDelta = m_Location.m_X - m.m_Location.m_X; int yDelta = m_Location.m_Y - m.m_Location.m_Y; - return Math.Sqrt( ( xDelta * xDelta ) + ( yDelta * yDelta ) ); + return Math.Sqrt( (xDelta * xDelta) + (yDelta * yDelta) ); } public double GetDistanceToSqrt( IPoint2D p ) @@ -2264,7 +2265,7 @@ namespace Server int xDelta = m_Location.m_X - p.X; int yDelta = m_Location.m_Y - p.Y; - return Math.Sqrt( ( xDelta * xDelta ) + ( yDelta * yDelta ) ); + return Math.Sqrt( (xDelta * xDelta) + (yDelta * yDelta) ); } public virtual void AggressiveAction( Mobile aggressor ) @@ -2274,7 +2275,7 @@ namespace Server public virtual void AggressiveAction( Mobile aggressor, bool criminal ) { - if ( aggressor == this ) + if( aggressor == this ) return; AggressiveActionEventArgs args = AggressiveActionEventArgs.Create( this, aggressor, criminal ); @@ -2283,9 +2284,9 @@ namespace Server args.Free(); - if ( Combatant == aggressor ) + if( Combatant == aggressor ) { - if ( m_ExpireCombatant == null ) + if( m_ExpireCombatant == null ) m_ExpireCombatant = new ExpireCombatantTimer( this ); else m_ExpireCombatant.Stop(); @@ -2297,11 +2298,11 @@ namespace Server List list = m_Aggressors; - for ( int i = 0; i < list.Count; ++i ) + for( int i = 0; i < list.Count; ++i ) { AggressorInfo info = list[i]; - if ( info.Attacker == aggressor ) + if( info.Attacker == aggressor ) { info.Refresh(); info.CriminalAggression = criminal; @@ -2313,11 +2314,11 @@ namespace Server list = aggressor.m_Aggressors; - for ( int i = 0; i < list.Count; ++i ) + for( int i = 0; i < list.Count; ++i ) { AggressorInfo info = list[i]; - if ( info.Attacker == this ) + if( info.Attacker == this ) { info.Refresh(); @@ -2329,11 +2330,11 @@ namespace Server list = m_Aggressed; - for ( int i = 0; i < list.Count; ++i ) + for( int i = 0; i < list.Count; ++i ) { AggressorInfo info = list[i]; - if ( info.Defender == aggressor ) + if( info.Defender == aggressor ) { info.Refresh(); @@ -2343,11 +2344,11 @@ namespace Server list = aggressor.m_Aggressed; - for ( int i = 0; i < list.Count; ++i ) + for( int i = 0; i < list.Count; ++i ) { AggressorInfo info = list[i]; - if ( info.Defender == this ) + if( info.Defender == this ) { info.Refresh(); info.CriminalAggression = criminal; @@ -2359,33 +2360,33 @@ namespace Server bool setCombatant = false; - if ( addAggressor ) + if( addAggressor ) { m_Aggressors.Add( AggressorInfo.Create( aggressor, this, criminal ) ); // new AggressorInfo( aggressor, this, criminal, true ) ); - if ( this.CanSee( aggressor ) && m_NetState != null ) + if( this.CanSee( aggressor ) && m_NetState != null ) m_NetState.Send( new MobileIncoming( this, aggressor ) ); - if ( Combatant == null ) + if( Combatant == null ) setCombatant = true; UpdateAggrExpire(); } - if ( addAggressed ) + if( addAggressed ) { aggressor.m_Aggressed.Add( AggressorInfo.Create( aggressor, this, criminal ) ); // new AggressorInfo( aggressor, this, criminal, false ) ); - if ( this.CanSee( aggressor ) && m_NetState != null ) + if( this.CanSee( aggressor ) && m_NetState != null ) m_NetState.Send( new MobileIncoming( this, aggressor ) ); - if ( Combatant == null ) + if( Combatant == null ) setCombatant = true; UpdateAggrExpire(); } - if ( setCombatant ) + if( setCombatant ) Combatant = aggressor; Region.OnAggressed( aggressor, this, criminal ); @@ -2393,21 +2394,21 @@ namespace Server public void RemoveAggressed( Mobile aggressed ) { - if ( m_Deleted ) + if( m_Deleted ) return; List list = m_Aggressed; - for ( int i = 0; i < list.Count; ++i ) + for( int i = 0; i < list.Count; ++i ) { AggressorInfo info = list[i]; - if ( info.Defender == aggressed ) + if( info.Defender == aggressed ) { m_Aggressed.RemoveAt( i ); info.Free(); - if ( m_NetState != null && this.CanSee( aggressed ) ) + if( m_NetState != null && this.CanSee( aggressed ) ) m_NetState.Send( new MobileIncoming( this, aggressed ) ); break; @@ -2419,21 +2420,21 @@ namespace Server public void RemoveAggressor( Mobile aggressor ) { - if ( m_Deleted ) + if( m_Deleted ) return; List list = m_Aggressors; - for ( int i = 0; i < list.Count; ++i ) + for( int i = 0; i < list.Count; ++i ) { AggressorInfo info = list[i]; - if ( info.Attacker == aggressor ) + if( info.Attacker == aggressor ) { m_Aggressors.RemoveAt( i ); info.Free(); - if ( m_NetState != null && this.CanSee( aggressor ) ) + if( m_NetState != null && this.CanSee( aggressor ) ) m_NetState.Send( new MobileIncoming( this, aggressor ) ); break; @@ -2446,7 +2447,7 @@ namespace Server [CommandProperty( AccessLevel.GameMaster )] public int TotalGold { - get{ return GetTotal( TotalType.Gold ); } + get { return GetTotal( TotalType.Gold ); } } [CommandProperty( AccessLevel.GameMaster )] @@ -2470,7 +2471,7 @@ namespace Server } set { - if ( m_TithingPoints != value ) + if( m_TithingPoints != value ) { m_TithingPoints = value; @@ -2488,7 +2489,7 @@ namespace Server } set { - if ( m_Followers != value ) + if( m_Followers != value ) { m_Followers = value; @@ -2506,7 +2507,7 @@ namespace Server } set { - if ( m_FollowersMax != value ) + if( m_FollowersMax != value ) { m_FollowersMax = value; @@ -2517,7 +2518,7 @@ namespace Server public virtual int GetTotal( TotalType type ) { - switch ( type ) + switch( type ) { case TotalType.Gold: return m_TotalGold; @@ -2534,10 +2535,10 @@ namespace Server public virtual void UpdateTotal( Item sender, TotalType type, int delta ) { - if ( delta == 0 || sender.IsVirtualItem ) + if( delta == 0 || sender.IsVirtualItem ) return; - switch ( type ) + switch( type ) { case TotalType.Gold: m_TotalGold += delta; @@ -2558,7 +2559,7 @@ namespace Server public virtual void UpdateTotals() { - if ( m_Items == null ) + if( m_Items == null ) return; int oldWeight = m_TotalWeight; @@ -2567,13 +2568,13 @@ namespace Server m_TotalItems = 0; m_TotalWeight = 0; - for ( int i = 0; i < m_Items.Count; ++i ) + for( int i = 0; i < m_Items.Count; ++i ) { Item item = m_Items[i]; item.UpdateTotals(); - if ( item.IsVirtualItem ) + if( item.IsVirtualItem ) continue; m_TotalGold += item.TotalGold; @@ -2581,10 +2582,10 @@ namespace Server m_TotalWeight += item.TotalWeight + item.PileWeight; } - if ( m_Holding != null ) + if( m_Holding != null ) m_TotalWeight += m_Holding.TotalWeight + m_Holding.PileWeight; - if ( m_TotalWeight != oldWeight ) + if( m_TotalWeight != oldWeight ) OnWeightChange( oldWeight ); } @@ -2624,7 +2625,7 @@ namespace Server protected override void OnTarget( Mobile from, object targeted ) { - if ( m_Callback != null ) + if( m_Callback != null ) m_Callback( from, targeted ); } } @@ -2652,7 +2653,7 @@ namespace Server protected override void OnTarget( Mobile from, object targeted ) { - if ( m_Callback != null ) + if( m_Callback != null ) m_Callback( from, targeted, m_State ); } } @@ -2677,17 +2678,17 @@ namespace Server Target oldTarget = m_Target; Target newTarget = value; - if ( oldTarget == newTarget ) + if( oldTarget == newTarget ) return; m_Target = null; - if ( oldTarget != null && newTarget != null ) + if( oldTarget != null && newTarget != null ) oldTarget.Cancel( this, TargetCancelType.Overriden ); m_Target = newTarget; - if ( newTarget != null && m_NetState != null && !m_TargetLocked ) + if( newTarget != null && m_NetState != null && !m_TargetLocked ) m_NetState.Send( newTarget.GetPacket() ); OnTargetChange(); @@ -2727,7 +2728,7 @@ namespace Server { m_ContextMenu = value; - if ( m_ContextMenu != null ) + if( m_ContextMenu != null ) Send( new DisplayContextMenu( m_ContextMenu ) ); } } @@ -2762,15 +2763,15 @@ namespace Server public override void OnResponse( Mobile from, string text ) { - if ( m_Callback != null ) + if( m_Callback != null ) m_Callback( from, text ); } public override void OnCancel( Mobile from ) { - if ( m_CallbackHandlesCancel && m_Callback != null ) + if( m_CallbackHandlesCancel && m_Callback != null ) m_Callback( from, "" ); - else if ( m_CancelCallback != null ) + else if( m_CancelCallback != null ) m_CancelCallback( from, "" ); } } @@ -2821,15 +2822,15 @@ namespace Server public override void OnResponse( Mobile from, string text ) { - if ( m_Callback != null ) + if( m_Callback != null ) m_Callback( from, text, m_State ); } public override void OnCancel( Mobile from ) { - if ( m_CallbackHandlesCancel && m_Callback != null ) + if( m_CallbackHandlesCancel && m_Callback != null ) m_Callback( from, "", m_State ); - else if ( m_CancelCallback != null ) + else if( m_CancelCallback != null ) m_CancelCallback( from, "", m_State ); } } @@ -2863,24 +2864,24 @@ namespace Server Prompt oldPrompt = m_Prompt; Prompt newPrompt = value; - if ( oldPrompt == newPrompt ) + if( oldPrompt == newPrompt ) return; m_Prompt = null; - if ( oldPrompt != null && newPrompt != null ) + if( oldPrompt != null && newPrompt != null ) oldPrompt.OnCancel( this ); m_Prompt = newPrompt; - if ( newPrompt != null ) + if( newPrompt != null ) Send( new UnicodePrompt( newPrompt ) ); } } private bool InternalOnMove( Direction d ) { - if ( !OnMove( d ) ) + if( !OnMove( d ) ) return false; MovementEventArgs e = MovementEventArgs.Create( this, d ); @@ -2900,9 +2901,9 @@ namespace Server /// True if the move is allowed, false if not. protected virtual bool OnMove( Direction d ) { - if ( m_Hidden && m_AccessLevel == AccessLevel.Player ) + if( m_Hidden && m_AccessLevel == AccessLevel.Player ) { - if ( m_AllowedStealthSteps-- <= 0 || ( d & Direction.Running ) != 0 || this.Mounted ) + if( m_AllowedStealthSteps-- <= 0 || (d & Direction.Running) != 0 || this.Mounted ) RevealingAction(); } @@ -2951,7 +2952,7 @@ namespace Server public virtual void ClearFastwalkStack() { - if ( m_MoveRecords != null && m_MoveRecords.Count > 0 ) + if( m_MoveRecords != null && m_MoveRecords.Count > 0 ) m_MoveRecords.Clear(); m_EndQueue = DateTime.Now; @@ -2964,25 +2965,25 @@ namespace Server public virtual bool Move( Direction d ) { - if ( m_Deleted ) + if( m_Deleted ) return false; BankBox box = FindBankNoCreate(); - if ( box != null && box.Opened ) + if( box != null && box.Opened ) box.Close(); Point3D newLocation = m_Location; Point3D oldLocation = newLocation; - if ( ( m_Direction & Direction.Mask ) == ( d & Direction.Mask ) ) + if( (m_Direction & Direction.Mask) == (d & Direction.Mask) ) { // We are actually moving (not just a direction change) - if ( m_Spell != null && !m_Spell.OnCasterMoving( d ) ) + if( m_Spell != null && !m_Spell.OnCasterMoving( d ) ) return false; - if ( m_Paralyzed || m_Frozen ) + if( m_Paralyzed || m_Frozen ) { SendLocalizedMessage( 500111 ); // You are frozen and can not move. @@ -2991,13 +2992,13 @@ namespace Server int newZ; - if ( CheckMovement( d, out newZ ) ) + if( CheckMovement( d, out newZ ) ) { int x = oldLocation.m_X, y = oldLocation.m_Y; int oldX = x, oldY = y; int oldZ = oldLocation.m_Z; - switch ( d & Direction.Mask ) + switch( d & Direction.Mask ) { case Direction.North: --y; @@ -3037,69 +3038,69 @@ namespace Server Map map = m_Map; - if ( map != null ) + if( map != null ) { Sector oldSector = map.GetSector( oldX, oldY ); Sector newSector = map.GetSector( x, y ); - if ( oldSector != newSector ) + if( oldSector != newSector ) { - for ( int i = 0; i < oldSector.Mobiles.Count; ++i ) + for( int i = 0; i < oldSector.Mobiles.Count; ++i ) { Mobile m = oldSector.Mobiles[i]; - if ( m != this && m.X == oldX && m.Y == oldY && ( m.Z + 15 ) > oldZ && ( oldZ + 15 ) > m.Z && !m.OnMoveOff( this ) ) + if( m != this && m.X == oldX && m.Y == oldY && (m.Z + 15) > oldZ && (oldZ + 15) > m.Z && !m.OnMoveOff( this ) ) return false; } - for ( int i = 0; i < oldSector.Items.Count; ++i ) + for( int i = 0; i < oldSector.Items.Count; ++i ) { Item item = oldSector.Items[i]; - if ( item.AtWorldPoint( oldX, oldY ) && ( item.Z == oldZ || ( ( item.Z + item.ItemData.Height ) > oldZ && ( oldZ + 15 ) > item.Z ) ) && !item.OnMoveOff( this ) ) + if( item.AtWorldPoint( oldX, oldY ) && (item.Z == oldZ || ((item.Z + item.ItemData.Height) > oldZ && (oldZ + 15) > item.Z)) && !item.OnMoveOff( this ) ) return false; } - for ( int i = 0; i < newSector.Mobiles.Count; ++i ) + for( int i = 0; i < newSector.Mobiles.Count; ++i ) { Mobile m = newSector.Mobiles[i]; - if ( m.X == x && m.Y == y && ( m.Z + 15 ) > newZ && ( newZ + 15 ) > m.Z && !m.OnMoveOver( this ) ) + if( m.X == x && m.Y == y && (m.Z + 15) > newZ && (newZ + 15) > m.Z && !m.OnMoveOver( this ) ) return false; } - for ( int i = 0; i < newSector.Items.Count; ++i ) + for( int i = 0; i < newSector.Items.Count; ++i ) { Item item = newSector.Items[i]; - if ( item.AtWorldPoint( x, y ) && ( item.Z == newZ || ( ( item.Z + item.ItemData.Height ) > newZ && ( newZ + 15 ) > item.Z ) ) && !item.OnMoveOver( this ) ) + if( item.AtWorldPoint( x, y ) && (item.Z == newZ || ((item.Z + item.ItemData.Height) > newZ && (newZ + 15) > item.Z)) && !item.OnMoveOver( this ) ) return false; } } else { - for ( int i = 0; i < oldSector.Mobiles.Count; ++i ) + for( int i = 0; i < oldSector.Mobiles.Count; ++i ) { Mobile m = oldSector.Mobiles[i]; - if ( m != this && m.X == oldX && m.Y == oldY && ( m.Z + 15 ) > oldZ && ( oldZ + 15 ) > m.Z && !m.OnMoveOff( this ) ) + if( m != this && m.X == oldX && m.Y == oldY && (m.Z + 15) > oldZ && (oldZ + 15) > m.Z && !m.OnMoveOff( this ) ) return false; - else if ( m.X == x && m.Y == y && ( m.Z + 15 ) > newZ && ( newZ + 15 ) > m.Z && !m.OnMoveOver( this ) ) + else if( m.X == x && m.Y == y && (m.Z + 15) > newZ && (newZ + 15) > m.Z && !m.OnMoveOver( this ) ) return false; } - for ( int i = 0; i < oldSector.Items.Count; ++i ) + for( int i = 0; i < oldSector.Items.Count; ++i ) { Item item = oldSector.Items[i]; - if ( item.AtWorldPoint( oldX, oldY ) && ( item.Z == oldZ || ( ( item.Z + item.ItemData.Height ) > oldZ && ( oldZ + 15 ) > item.Z ) ) && !item.OnMoveOff( this ) ) + if( item.AtWorldPoint( oldX, oldY ) && (item.Z == oldZ || ((item.Z + item.ItemData.Height) > oldZ && (oldZ + 15) > item.Z)) && !item.OnMoveOff( this ) ) return false; - else if ( item.AtWorldPoint( x, y ) && ( item.Z == newZ || ( ( item.Z + item.ItemData.Height ) > newZ && ( newZ + 15 ) > item.Z ) ) && !item.OnMoveOver( this ) ) + else if( item.AtWorldPoint( x, y ) && (item.Z == newZ || ((item.Z + item.ItemData.Height) > newZ && (newZ + 15) > item.Z)) && !item.OnMoveOver( this ) ) return false; } } - if ( !Region.CanMove( this, d, newLocation, oldLocation, m_Map ) ) + if( !Region.CanMove( this, d, newLocation, oldLocation, m_Map ) ) return false; } else @@ -3107,30 +3108,30 @@ namespace Server return false; } - if ( !InternalOnMove( d ) ) + if( !InternalOnMove( d ) ) return false; - if ( m_FwdEnabled && m_NetState != null && m_AccessLevel < m_FwdAccessOverride && ( !m_FwdUOTDOverride || ( m_NetState.Version != null && m_NetState.Version.Type != ClientType.UOTD ) ) ) + if( m_FwdEnabled && m_NetState != null && m_AccessLevel < m_FwdAccessOverride && (!m_FwdUOTDOverride || (m_NetState.Version != null && m_NetState.Version.Type != ClientType.UOTD)) ) { - if ( m_MoveRecords == null ) + if( m_MoveRecords == null ) m_MoveRecords = new Queue( 6 ); - while ( m_MoveRecords.Count > 0 ) + while( m_MoveRecords.Count > 0 ) { MovementRecord r = m_MoveRecords.Peek(); - if ( r.Expired() ) + if( r.Expired() ) m_MoveRecords.Dequeue(); else break; } - if ( m_MoveRecords.Count >= m_FwdMaxSteps ) + if( m_MoveRecords.Count >= m_FwdMaxSteps ) { FastWalkEventArgs fw = new FastWalkEventArgs( m_NetState ); EventSink.InvokeFastWalk( fw ); - if ( fw.Blocked ) + if( fw.Blocked ) return false; } @@ -3143,7 +3144,7 @@ namespace Server DateTime end; - if ( m_MoveRecords.Count > 0 ) + if( m_MoveRecords.Count > 0 ) end = m_EndQueue + delay; else end = DateTime.Now + delay; @@ -3163,30 +3164,30 @@ namespace Server DisruptiveAction(); } - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.Send( MovementAck.Instantiate( m_NetState.Sequence, this ) );//new MovementAck( m_NetState.Sequence, this ) ); SetLocation( newLocation, false ); SetDirection( d ); - if ( m_Map != null ) + if( m_Map != null ) { IPooledEnumerable eable = m_Map.GetObjectsInRange( m_Location, Core.GlobalMaxUpdateRange ); - foreach ( object o in eable ) + foreach( object o in eable ) { - if ( o == this ) + if( o == this ) continue; - if ( o is Mobile ) + if( o is Mobile ) { m_MoveList.Add( o ); } - else if ( o is Item ) + else if( o is Item ) { - Item item = (Item) o; + Item item = (Item)o; - if ( item.HandlesOnMovement ) + if( item.HandlesOnMovement ) m_MoveList.Add( item ); } } @@ -3195,24 +3196,24 @@ namespace Server Packet[] cache = m_MovingPacketCache; - for ( int i = 0; i < cache.Length; ++i ) + for( int i = 0; i < cache.Length; ++i ) Packet.Release( ref cache[i] ); - for ( int i = 0; i < m_MoveList.Count; ++i ) + for( int i = 0; i < m_MoveList.Count; ++i ) { object o = m_MoveList[i]; - if ( o is Mobile ) + if( o is Mobile ) { - Mobile m = (Mobile) m_MoveList[i]; + Mobile m = (Mobile)m_MoveList[i]; NetState ns = m.NetState; - if ( ns != null && Utility.InUpdateRange( m_Location, m.m_Location ) && m.CanSee( this ) ) + if( ns != null && Utility.InUpdateRange( m_Location, m.m_Location ) && m.CanSee( this ) ) { int noto = Notoriety.Compute( m, this ); Packet p = cache[noto]; - if ( p == null ) + if( p == null ) cache[noto] = p = Packet.Acquire( new MobileMoving( this, noto ) ); ns.Send( p ); @@ -3220,16 +3221,16 @@ namespace Server m.OnMovement( this, oldLocation ); } - else if ( o is Item ) + else if( o is Item ) { - ( (Item) o ).OnMovement( this, oldLocation ); + ((Item)o).OnMovement( this, oldLocation ); } } - for ( int i = 0; i < cache.Length; ++i ) + for( int i = 0; i < cache.Length; ++i ) Packet.Release( ref cache[i] ); - if ( m_MoveList.Count > 0 ) + if( m_MoveList.Count > 0 ) m_MoveList.Clear(); } @@ -3278,7 +3279,7 @@ namespace Server /// True if the move is allowed, false if not. public virtual bool OnMoveOver( Mobile m ) { - if ( m_Map == null || m_Deleted ) + if( m_Map == null || m_Deleted ) return true; return m.CheckShove( this ); @@ -3286,26 +3287,26 @@ namespace Server public virtual bool CheckShove( Mobile shoved ) { - if ( ( m_Map.Rules & MapRules.FreeMovement ) == 0 ) + if( (m_Map.Rules & MapRules.FreeMovement) == 0 ) { - if ( !shoved.Alive || !Alive || shoved.IsDeadBondedPet || IsDeadBondedPet ) + if( !shoved.Alive || !Alive || shoved.IsDeadBondedPet || IsDeadBondedPet ) return true; - else if ( shoved.m_Hidden && shoved.m_AccessLevel > AccessLevel.Player ) + else if( shoved.m_Hidden && shoved.m_AccessLevel > AccessLevel.Player ) return true; - if ( !m_Pushing ) + if( !m_Pushing ) { m_Pushing = true; int number; - if ( this.AccessLevel > AccessLevel.Player ) + if( this.AccessLevel > AccessLevel.Player ) { number = shoved.m_Hidden ? 1019041 : 1019040; } else { - if ( Stam == StamMax ) + if( Stam == StamMax ) { number = shoved.m_Hidden ? 1019043 : 1019042; Stam -= 10; @@ -3339,7 +3340,7 @@ namespace Server } set { - if ( m_Spell != null && value != null ) + if( m_Spell != null && value != null ) Console.WriteLine( "Warning: Spell has been overwritten" ); m_Spell = value; @@ -3361,7 +3362,7 @@ namespace Server public virtual void CriminalAction( bool message ) { - if ( m_Deleted ) + if( m_Deleted ) return; Criminal = true; @@ -3371,15 +3372,15 @@ namespace Server public virtual bool CanUseStuckMenu() { - if ( m_StuckMenuUses == null ) + if( m_StuckMenuUses == null ) { return true; } else { - for ( int i = 0; i < m_StuckMenuUses.Length; ++i ) + for( int i = 0; i < m_StuckMenuUses.Length; ++i ) { - if ( ( DateTime.Now - m_StuckMenuUses[i] ) > TimeSpan.FromDays( 1.0 ) ) + if( (DateTime.Now - m_StuckMenuUses[i]) > TimeSpan.FromDays( 1.0 ) ) { return true; } @@ -3391,7 +3392,7 @@ namespace Server public virtual bool IsSnoop( Mobile from ) { - return ( from != this ); + return (from != this); } /// @@ -3421,19 +3422,19 @@ namespace Server public virtual void Resurrect() { - if ( !Alive ) + if( !Alive ) { - if ( !Region.OnResurrect( this ) ) + if( !Region.OnResurrect( this ) ) return; - if ( !CheckResurrect() ) + if( !CheckResurrect() ) return; OnBeforeResurrect(); BankBox box = FindBankNoCreate(); - if ( box != null && box.Opened ) + if( box != null && box.Opened ) box.Close(); Poison = null; @@ -3450,14 +3451,14 @@ namespace Server ProcessDeltaQueue(); - for ( int i = m_Items.Count - 1; i >= 0; --i ) + for( int i = m_Items.Count - 1; i >= 0; --i ) { - if ( i >= m_Items.Count ) + if( i >= m_Items.Count ) continue; Item item = m_Items[i]; - if ( item.ItemID == 0x204E ) + if( item.ItemID == 0x204E ) item.Delete(); } @@ -3504,7 +3505,7 @@ namespace Server } set { - if ( m_VirtualArmor != value ) + if( m_VirtualArmor != value ) { m_VirtualArmor = value; @@ -3526,9 +3527,9 @@ namespace Server { Item holding = m_Holding; - if ( holding != null ) + if( holding != null ) { - if ( !holding.Deleted && holding.Map == Map.Internal ) + if( !holding.Deleted && holding.Map == Map.Internal ) AddToBackpack( holding ); Holding = null; @@ -3538,15 +3539,15 @@ namespace Server public virtual void Delete() { - if ( m_Deleted ) + if( m_Deleted ) return; - else if ( !World.OnDelete( this ) ) + else if( !World.OnDelete( this ) ) return; - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.CancelAllTrades(); - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.Dispose(); DropHolding(); @@ -3560,21 +3561,21 @@ namespace Server OnDelete(); - for ( int i = m_Items.Count - 1; i >= 0; --i ) - if ( i < m_Items.Count ) + for( int i = m_Items.Count - 1; i >= 0; --i ) + if( i < m_Items.Count ) m_Items[i].OnParentDeleted( this ); - for ( int i = 0; i < m_Stabled.Count; i++ ) + for( int i = 0; i < m_Stabled.Count; i++ ) m_Stabled[i].Delete(); SendRemovePacket(); - if ( m_Guild != null ) + if( m_Guild != null ) m_Guild.OnDelete( this ); m_Deleted = true; - if ( m_Map != null ) + if( m_Map != null ) { m_Map.OnLeave( this ); m_Map = null; @@ -3596,7 +3597,7 @@ namespace Server /// public virtual void OnDelete() { - if ( m_Spawner != null ) + if( m_Spawner != null ) { m_Spawner.Remove( this ); m_Spawner = null; @@ -3611,7 +3612,7 @@ namespace Server { get { - return !m_Deleted && ( !m_Player || !m_Body.IsGhost ); + return !m_Deleted && (!m_Player || !m_Body.IsGhost); } } @@ -3651,40 +3652,40 @@ namespace Server CheckAggrExpire(); - if ( m_PoisonTimer != null ) + if( m_PoisonTimer != null ) m_PoisonTimer.Stop(); - if ( m_HitsTimer != null ) + if( m_HitsTimer != null ) m_HitsTimer.Stop(); - if ( m_StamTimer != null ) + if( m_StamTimer != null ) m_StamTimer.Stop(); - if ( m_ManaTimer != null ) + if( m_ManaTimer != null ) m_ManaTimer.Stop(); - if ( m_CombatTimer != null ) + if( m_CombatTimer != null ) m_CombatTimer.Stop(); - if ( m_ExpireCombatant != null ) + if( m_ExpireCombatant != null ) m_ExpireCombatant.Stop(); - if ( m_LogoutTimer != null ) + if( m_LogoutTimer != null ) m_LogoutTimer.Stop(); - if ( m_ExpireCriminal != null ) + if( m_ExpireCriminal != null ) m_ExpireCriminal.Stop(); - if ( m_WarmodeTimer != null ) + if( m_WarmodeTimer != null ) m_WarmodeTimer.Stop(); - if ( m_ParaTimer != null ) + if( m_ParaTimer != null ) m_ParaTimer.Stop(); - if ( m_FrozenTimer != null ) + if( m_FrozenTimer != null ) m_FrozenTimer.Stop(); - if ( m_AutoManifestTimer != null ) + if( m_AutoManifestTimer != null ) m_AutoManifestTimer.Stop(); } @@ -3725,30 +3726,30 @@ namespace Server public virtual void Kill() { - if ( !CanBeDamaged() ) + if( !CanBeDamaged() ) return; - else if ( !Alive || IsDeadBondedPet ) + else if( !Alive || IsDeadBondedPet ) return; - else if ( m_Deleted ) + else if( m_Deleted ) return; - else if ( !Region.OnDeath( this ) ) + else if( !Region.OnDeath( this ) ) return; - else if ( !OnBeforeDeath() ) + else if( !OnBeforeDeath() ) return; BankBox box = FindBankNoCreate(); - if ( box != null && box.Opened ) + if( box != null && box.Opened ) box.Close(); - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.CancelAllTrades(); - if ( m_Spell != null ) + if( m_Spell != null ) m_Spell.OnCasterKilled(); //m_Spell.Disturb( DisturbType.Kill ); - if ( m_Target != null ) + if( m_Target != null ) m_Target.Cancel( this, TargetCancelType.Canceled ); DisruptiveAction(); @@ -3764,19 +3765,19 @@ namespace Server Poison = null; Combatant = null; - if ( Paralyzed ) + if( Paralyzed ) { Paralyzed = false; - if ( m_ParaTimer != null ) + if( m_ParaTimer != null ) m_ParaTimer.Stop(); } - if ( Frozen ) + if( Frozen ) { Frozen = false; - if ( m_FrozenTimer != null ) + if( m_FrozenTimer != null ) m_FrozenTimer.Stop(); } @@ -3788,16 +3789,16 @@ namespace Server Container pack = this.Backpack; - for ( int i = 0; i < itemsCopy.Count; ++i ) + for( int i = 0; i < itemsCopy.Count; ++i ) { Item item = itemsCopy[i]; - if ( item == pack ) + if( item == pack ) continue; DeathMoveResult res = GetParentMoveResultFor( item ); - switch ( res ) + switch( res ) { case DeathMoveResult.MoveToCorpse: { @@ -3813,27 +3814,27 @@ namespace Server } } - if ( pack != null ) + if( pack != null ) { List packCopy = new List( pack.Items ); - for ( int i = 0; i < packCopy.Count; ++i ) + for( int i = 0; i < packCopy.Count; ++i ) { Item item = packCopy[i]; DeathMoveResult res = GetInventoryMoveResultFor( item ); - if ( res == DeathMoveResult.MoveToCorpse ) + if( res == DeathMoveResult.MoveToCorpse ) content.Add( item ); else moveToPack.Add( item ); } - for ( int i = 0; i < moveToPack.Count; ++i ) + for( int i = 0; i < moveToPack.Count; ++i ) { Item item = moveToPack[i]; - if ( RetainPackLocsOnDeath && item.Parent == pack ) + if( RetainPackLocsOnDeath && item.Parent == pack ) continue; pack.DropItem( item ); @@ -3859,25 +3860,25 @@ namespace Server if ( c != null ) c.MoveToWorld( this.Location, this.Map );*/ - if ( m_Map != null ) + if( m_Map != null ) { Packet animPacket = null;//new DeathAnimation( this, c ); Packet remPacket = null;//this.RemovePacket; IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location ); - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { - if ( state != m_NetState ) + if( state != m_NetState ) { - if ( animPacket == null ) + if( animPacket == null ) animPacket = Packet.Acquire( new DeathAnimation( this, c ) ); state.Send( animPacket ); - if ( !state.Mobile.CanSee( this ) ) + if( !state.Mobile.CanSee( this ) ) { - if ( remPacket == null ) + if( remPacket == null ) remPacket = this.RemovePacket; state.Send( remPacket ); @@ -3928,10 +3929,10 @@ namespace Server { int sound = this.GetDeathSound(); - if ( sound >= 0 ) + if( sound >= 0 ) Effects.PlaySound( this, this.Map, sound ); - if ( !m_Player ) + if( !m_Player ) { Delete(); } @@ -3974,7 +3975,7 @@ namespace Server public virtual int GetAngerSound() { - if ( m_BaseSoundID != 0 ) + if( m_BaseSoundID != 0 ) return m_BaseSoundID; return -1; @@ -3982,7 +3983,7 @@ namespace Server public virtual int GetIdleSound() { - if ( m_BaseSoundID != 0 ) + if( m_BaseSoundID != 0 ) return m_BaseSoundID + 1; return -1; @@ -3990,7 +3991,7 @@ namespace Server public virtual int GetAttackSound() { - if ( m_BaseSoundID != 0 ) + if( m_BaseSoundID != 0 ) return m_BaseSoundID + 2; return -1; @@ -3998,7 +3999,7 @@ namespace Server public virtual int GetHurtSound() { - if ( m_BaseSoundID != 0 ) + if( m_BaseSoundID != 0 ) return m_BaseSoundID + 3; return -1; @@ -4006,11 +4007,11 @@ namespace Server public virtual int GetDeathSound() { - if ( m_BaseSoundID != 0 ) + if( m_BaseSoundID != 0 ) { return m_BaseSoundID + 4; } - else if ( m_Body.IsHuman ) + else if( m_Body.IsHuman ) { return Utility.Random( m_Female ? 0x314 : 0x423, m_Female ? 4 : 5 ); } @@ -4046,7 +4047,7 @@ namespace Server protected override void OnTick() { - if ( !m_Mobile.Alive ) + if( !m_Mobile.Alive ) m_Mobile.Warmode = false; } } @@ -4066,68 +4067,68 @@ namespace Server public virtual void Use( Item item ) { - if ( item == null || item.Deleted || this.Deleted ) + if( item == null || item.Deleted || this.Deleted ) return; DisruptiveAction(); - if ( m_Spell != null && !m_Spell.OnCasterUsingObject( item ) ) + if( m_Spell != null && !m_Spell.OnCasterUsingObject( item ) ) return; object root = item.RootParent; bool okay = false; - if ( !Utility.InUpdateRange( this, item.GetWorldLocation() ) ) + if( !Utility.InUpdateRange( this, item.GetWorldLocation() ) ) item.OnDoubleClickOutOfRange( this ); - else if ( !CanSee( item ) ) + else if( !CanSee( item ) ) item.OnDoubleClickCantSee( this ); - else if ( !item.IsAccessibleTo( this ) ) + else if( !item.IsAccessibleTo( this ) ) { Region reg = Region.Find( item.GetWorldLocation(), item.Map ); - if ( reg == null || !reg.SendInaccessibleMessage( item, this ) ) + if( reg == null || !reg.SendInaccessibleMessage( item, this ) ) item.OnDoubleClickNotAccessible( this ); } - else if ( !CheckAlive( false ) ) + else if( !CheckAlive( false ) ) item.OnDoubleClickDead( this ); - else if ( item.InSecureTrade ) + else if( item.InSecureTrade ) item.OnDoubleClickSecureTrade( this ); - else if ( !AllowItemUse( item ) ) + else if( !AllowItemUse( item ) ) okay = false; - else if ( !item.CheckItemUse( this, item ) ) + else if( !item.CheckItemUse( this, item ) ) okay = false; - else if ( root != null && root is Mobile && ( (Mobile) root ).IsSnoop( this ) ) + else if( root != null && root is Mobile && ((Mobile)root).IsSnoop( this ) ) item.OnSnoop( this ); - else if ( this.Region.OnDoubleClick( this, item ) ) + else if( this.Region.OnDoubleClick( this, item ) ) okay = true; - if ( okay ) + if( okay ) { - if ( !item.Deleted ) + if( !item.Deleted ) item.OnItemUsed( this, item ); - if ( !item.Deleted ) + if( !item.Deleted ) item.OnDoubleClick( this ); } } public virtual void Use( Mobile m ) { - if ( m == null || m.Deleted || this.Deleted ) + if( m == null || m.Deleted || this.Deleted ) return; DisruptiveAction(); - if ( m_Spell != null && !m_Spell.OnCasterUsingObject( m ) ) + if( m_Spell != null && !m_Spell.OnCasterUsingObject( m ) ) return; - if ( !Utility.InUpdateRange( this, m ) ) + if( !Utility.InUpdateRange( this, m ) ) m.OnDoubleClickOutOfRange( this ); - else if ( !CanSee( m ) ) + else if( !CanSee( m ) ) m.OnDoubleClickCantSee( this ); - else if ( !CheckAlive( false ) ) + else if( !CheckAlive( false ) ) m.OnDoubleClickDead( this ); - else if ( this.Region.OnDoubleClick( this, m ) && !m.Deleted ) + else if( this.Region.OnDoubleClick( this, m ) && !m.Deleted ) m.OnDoubleClick( this ); } @@ -4136,54 +4137,54 @@ namespace Server rejected = true; reject = LRReason.Inspecific; - if ( item == null ) + if( item == null ) return; Mobile from = this; NetState state = m_NetState; - if ( from.AccessLevel >= AccessLevel.GameMaster || DateTime.Now >= from.NextActionTime ) + if( from.AccessLevel >= AccessLevel.GameMaster || DateTime.Now >= from.NextActionTime ) { - if ( from.CheckAlive() ) + if( from.CheckAlive() ) { from.DisruptiveAction(); - if ( from.Holding != null ) + if( from.Holding != null ) { reject = LRReason.AreHolding; } - else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( item.GetWorldLocation(), 2 ) ) + else if( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( item.GetWorldLocation(), 2 ) ) { reject = LRReason.OutOfRange; } - else if ( !from.CanSee( item ) || !from.InLOS( item ) ) + else if( !from.CanSee( item ) || !from.InLOS( item ) ) { reject = LRReason.OutOfSight; } - else if ( !item.VerifyMove( from ) ) + else if( !item.VerifyMove( from ) ) { reject = LRReason.CannotLift; } - else if ( !item.IsAccessibleTo( from ) ) + else if( !item.IsAccessibleTo( from ) ) { reject = LRReason.CannotLift; } - else if ( !item.CheckLift( from, item, ref reject ) ) + else if( !item.CheckLift( from, item, ref reject ) ) { } else { object root = item.RootParent; - if ( root != null && root is Mobile && !( (Mobile) root ).CheckNonlocalLift( from, item ) ) + if( root != null && root is Mobile && !((Mobile)root).CheckNonlocalLift( from, item ) ) { reject = LRReason.TryToSteal; } - else if ( !from.OnDragLift( item ) || !item.OnDragLift( from ) ) + else if( !from.OnDragLift( item ) || !item.OnDragLift( from ) ) { reject = LRReason.Inspecific; } - else if ( !from.CheckAlive() ) + else if( !from.CheckAlive() ) { reject = LRReason.Inspecific; } @@ -4191,44 +4192,44 @@ namespace Server { item.SetLastMoved(); - if ( item.Spawner != null ) + if( item.Spawner != null ) { item.Spawner.Remove( item ); item.Spawner = null; } - if ( amount == 0 ) + if( amount == 0 ) amount = 1; - if ( amount > item.Amount ) + if( amount > item.Amount ) amount = item.Amount; int oldAmount = item.Amount; //item.Amount = amount; //Set in LiftItemDupe - if ( amount < oldAmount ) + if( amount < oldAmount ) LiftItemDupe( item, amount ); - //item.Dupe( oldAmount - amount ); + //item.Dupe( oldAmount - amount ); Map map = from.Map; - if ( Mobile.DragEffects && map != null && ( root == null || root is Item ) ) + if( Mobile.DragEffects && map != null && (root == null || root is Item) ) { IPooledEnumerable eable = map.GetClientsInRange( from.Location ); Packet p = null; - foreach ( NetState ns in eable ) + foreach( NetState ns in eable ) { - if ( ns.Mobile != from && ns.Mobile.CanSee( from ) ) + if( ns.Mobile != from && ns.Mobile.CanSee( from ) ) { - if ( p == null ) + if( p == null ) { IEntity src; - if ( root == null ) + if( root == null ) src = new Entity( Serial.Zero, item.Location, map ); else - src = new Entity( ( (Item) root ).Serial, ( (Item) root ).Location, map ); + src = new Entity( ((Item)root).Serial, ((Item)root).Location, map ); p = Packet.Acquire( new DragEffect( src, from, item.ItemID, item.Hue, amount ) ); } @@ -4244,7 +4245,7 @@ namespace Server Point3D fixLoc = item.Location; Map fixMap = item.Map; - bool shouldFix = ( item.Parent == null ); + bool shouldFix = (item.Parent == null); item.RecordBounce(); item.OnItemLifted( from, item ); @@ -4254,12 +4255,12 @@ namespace Server int liftSound = item.GetLiftSound( from ); - if ( liftSound != -1 ) + if( liftSound != -1 ) from.Send( new PlaySound( liftSound, from ) ); from.NextActionTime = DateTime.Now + TimeSpan.FromSeconds( 0.5 ); - if ( fixMap != null && shouldFix ) + if( fixMap != null && shouldFix ) fixMap.FixColumn( fixLoc.m_X, fixLoc.m_Y ); reject = LRReason.Inspecific; @@ -4278,18 +4279,18 @@ namespace Server reject = LRReason.Inspecific; } - if ( rejected && state != null ) + if( rejected && state != null ) { state.Send( new LiftRej( reject ) ); - if ( item.Parent is Item ) + if( item.Parent is Item ) state.Send( new ContainerContentUpdate( item ) ); - else if ( item.Parent is Mobile ) + else if( item.Parent is Mobile ) state.Send( new EquipUpdate( item ) ); else item.SendInfoTo( state ); - if ( ObjectPropertyList.Enabled && item.Parent != null ) + if( ObjectPropertyList.Enabled && item.Parent != null ) state.Send( item.OPLPacket ); } } @@ -4322,14 +4323,14 @@ namespace Server oldItem.Amount = amount; oldItem.OnAfterDuped( item ); - - if ( oldItem.Parent is Mobile ) + + if( oldItem.Parent is Mobile ) { - ( (Mobile)oldItem.Parent ).AddItem( item ); + ((Mobile)oldItem.Parent).AddItem( item ); } - else if ( oldItem.Parent is Item ) + else if( oldItem.Parent is Item ) { - ( (Item)oldItem.Parent ).AddItem( item ); + ((Item)oldItem.Parent).AddItem( item ); } item.Delta( ItemDelta.Update ); @@ -4339,28 +4340,28 @@ namespace Server public virtual void SendDropEffect( Item item ) { - if ( Mobile.DragEffects ) + if( Mobile.DragEffects ) { Map map = m_Map; object root = item.RootParent; - if ( map != null && ( root == null || root is Item ) ) + if( map != null && (root == null || root is Item) ) { IPooledEnumerable eable = map.GetClientsInRange( m_Location ); Packet p = null; - foreach ( NetState ns in eable ) + foreach( NetState ns in eable ) { - if ( ns.Mobile != this && ns.Mobile.CanSee( this ) ) + if( ns.Mobile != this && ns.Mobile.CanSee( this ) ) { - if ( p == null ) + if( p == null ) { IEntity trg; - if ( root == null ) + if( root == null ) trg = new Entity( Serial.Zero, item.Location, map ); else - trg = new Entity( ( (Item) root ).Serial, ( (Item) root ).Location, map ); + trg = new Entity( ((Item)root).Serial, ((Item)root).Location, map ); p = Packet.Acquire( new DragEffect( this, trg, item.ItemID, item.Hue, item.Amount ) ); } @@ -4381,7 +4382,7 @@ namespace Server Mobile from = this; Item item = from.Holding; - if ( item == null ) + if( item == null ) return false; from.Holding = null; @@ -4389,14 +4390,14 @@ namespace Server item.SetLastMoved(); - if ( to == null || !item.DropToItem( from, to, loc ) ) + if( to == null || !item.DropToItem( from, to, loc ) ) item.Bounce( from ); else bounced = false; item.ClearBounce(); - if ( !bounced ) + if( !bounced ) SendDropEffect( item ); return !bounced; @@ -4407,7 +4408,7 @@ namespace Server Mobile from = this; Item item = from.Holding; - if ( item == null ) + if( item == null ) return false; from.Holding = null; @@ -4415,14 +4416,14 @@ namespace Server item.SetLastMoved(); - if ( !item.DropToWorld( from, loc ) ) + if( !item.DropToWorld( from, loc ) ) item.Bounce( from ); else bounced = false; item.ClearBounce(); - if ( !bounced ) + if( !bounced ) SendDropEffect( item ); return !bounced; @@ -4433,7 +4434,7 @@ namespace Server Mobile from = this; Item item = from.Holding; - if ( item == null ) + if( item == null ) return false; from.Holding = null; @@ -4441,14 +4442,14 @@ namespace Server item.SetLastMoved(); - if ( to == null || !item.DropToMobile( from, to, loc ) ) + if( to == null || !item.DropToMobile( from, to, loc ) ) item.Bounce( from ); else bounced = false; item.ClearBounce(); - if ( !bounced ) + if( !bounced ) SendDropEffect( item ); return !bounced; @@ -4458,14 +4459,14 @@ namespace Server public virtual bool MutateSpeech( List hears, ref string text, ref object context ) { - if ( Alive ) + if( Alive ) return false; StringBuilder sb = new StringBuilder( text.Length, text.Length ); - for ( int i = 0; i < text.Length; ++i ) + for( int i = 0; i < text.Length; ++i ) { - if ( text[i] != ' ' ) + if( text[i] != ' ' ) sb.Append( m_GhostChars[Utility.Random( m_GhostChars.Length )] ); else sb.Append( ' ' ); @@ -4480,7 +4481,7 @@ namespace Server { Warmode = true; - if ( m_AutoManifestTimer == null ) + if( m_AutoManifestTimer == null ) m_AutoManifestTimer = new AutoManifestTimer( this, delay ); else m_AutoManifestTimer.Stop(); @@ -4490,12 +4491,12 @@ namespace Server public virtual bool CheckSpeechManifest() { - if ( Alive ) + if( Alive ) return false; TimeSpan delay = m_AutoManifestTimeout; - if ( delay > TimeSpan.Zero && ( !Warmode || m_AutoManifestTimer != null ) ) + if( delay > TimeSpan.Zero && (!Warmode || m_AutoManifestTimer != null) ) { Manifest( delay ); return true; @@ -4506,23 +4507,23 @@ namespace Server public virtual bool CheckHearsMutatedSpeech( Mobile m, object context ) { - if ( context == m_GhostMutateContext ) - return ( m.Alive && !m.CanHearGhosts ); + if( context == m_GhostMutateContext ) + return (m.Alive && !m.CanHearGhosts); return true; } private void AddSpeechItemsFrom( ArrayList list, Container cont ) { - for ( int i = 0; i < cont.Items.Count; ++i ) + for( int i = 0; i < cont.Items.Count; ++i ) { Item item = cont.Items[i]; - if ( item.HandlesOnSpeech ) + if( item.HandlesOnSpeech ) list.Add( item ); - if ( item is Container ) - AddSpeechItemsFrom( list, (Container) item ); + if( item is Container ) + AddSpeechItemsFrom( list, (Container)item ); } } @@ -4532,7 +4533,7 @@ namespace Server public static LocationComparer GetInstance( IPoint3D relativeTo ) { - if ( m_Instance == null ) + if( m_Instance == null ) m_Instance = new LocationComparer( relativeTo ); else m_Instance.m_RelativeTo = relativeTo; @@ -4562,7 +4563,7 @@ namespace Server x *= 11; y *= 11; - return ( x * x ) + ( y * y ) + ( z * z ); + return (x * x) + (y * y) + (z * z); } public int Compare( object x, object y ) @@ -4578,7 +4579,7 @@ namespace Server { Map map = m_Map; - if ( map == null ) + if( map == null ) return Server.Map.NullEnumerable.Instance; return map.GetItemsInRange( m_Location, range ); @@ -4588,7 +4589,7 @@ namespace Server { Map map = m_Map; - if ( map == null ) + if( map == null ) return Server.Map.NullEnumerable.Instance; return map.GetObjectsInRange( m_Location, range ); @@ -4598,7 +4599,7 @@ namespace Server { Map map = m_Map; - if ( map == null ) + if( map == null ) return Server.Map.NullEnumerable.Instance; return map.GetMobilesInRange( m_Location, range ); @@ -4608,7 +4609,7 @@ namespace Server { Map map = m_Map; - if ( map == null ) + if( map == null ) return Server.Map.NullEnumerable.Instance; return map.GetClientsInRange( m_Location, range ); @@ -4619,12 +4620,12 @@ namespace Server public virtual void DoSpeech( string text, int[] keywords, MessageType type, int hue ) { - if ( m_Deleted || CommandSystem.Handle( this, text, type ) ) + if( m_Deleted || CommandSystem.Handle( this, text, type ) ) return; int range = 15; - switch ( type ) + switch( type ) { case MessageType.Regular: m_SpeechHue = hue; @@ -4651,64 +4652,64 @@ namespace Server this.Region.OnSpeech( regArgs ); OnSaid( regArgs ); - if ( regArgs.Blocked ) + if( regArgs.Blocked ) return; text = regArgs.Speech; - if ( text == null || text.Length == 0 ) + if( text == null || text.Length == 0 ) return; - if ( m_Hears == null ) + if( m_Hears == null ) m_Hears = new List(); - else if ( m_Hears.Count > 0 ) + else if( m_Hears.Count > 0 ) m_Hears.Clear(); - if ( m_OnSpeech == null ) + if( m_OnSpeech == null ) m_OnSpeech = new ArrayList(); - else if ( m_OnSpeech.Count > 0 ) + else if( m_OnSpeech.Count > 0 ) m_OnSpeech.Clear(); List hears = m_Hears; ArrayList onSpeech = m_OnSpeech; - if ( m_Map != null ) + if( m_Map != null ) { IPooledEnumerable eable = m_Map.GetObjectsInRange( m_Location, range ); - foreach ( object o in eable ) + foreach( object o in eable ) { - if ( o is Mobile ) + if( o is Mobile ) { - Mobile heard = (Mobile) o; + Mobile heard = (Mobile)o; - if ( heard.CanSee( this ) && ( m_NoSpeechLOS || !heard.Player || heard.InLOS( this ) ) ) + if( heard.CanSee( this ) && (m_NoSpeechLOS || !heard.Player || heard.InLOS( this )) ) { - if ( heard.m_NetState != null ) + if( heard.m_NetState != null ) hears.Add( heard ); - if ( heard.HandlesOnSpeech( this ) ) + if( heard.HandlesOnSpeech( this ) ) onSpeech.Add( heard ); - for ( int i = 0; i < heard.Items.Count; ++i ) + for( int i = 0; i < heard.Items.Count; ++i ) { Item item = heard.Items[i]; - if ( item.HandlesOnSpeech ) + if( item.HandlesOnSpeech ) onSpeech.Add( item ); - if ( item is Container ) - AddSpeechItemsFrom( onSpeech, (Container) item ); + if( item is Container ) + AddSpeechItemsFrom( onSpeech, (Container)item ); } } } - else if ( o is Item ) + else if( o is Item ) { - if ( ( (Item) o ).HandlesOnSpeech ) + if( ((Item)o).HandlesOnSpeech ) onSpeech.Add( o ); - if ( o is Container ) - AddSpeechItemsFrom( onSpeech, (Container) o ); + if( o is Container ) + AddSpeechItemsFrom( onSpeech, (Container)o ); } } @@ -4718,7 +4719,7 @@ namespace Server string mutatedText = text; SpeechEventArgs mutatedArgs = null; - if ( MutateSpeech( hears, ref mutatedText, ref mutateContext ) ) + if( MutateSpeech( hears, ref mutatedText, ref mutateContext ) ) mutatedArgs = new SpeechEventArgs( this, mutatedText, type, hue, new int[0] ); CheckSpeechManifest(); @@ -4728,19 +4729,19 @@ namespace Server Packet regp = null; Packet mutp = null; - for ( int i = 0; i < hears.Count; ++i ) + for( int i = 0; i < hears.Count; ++i ) { Mobile heard = hears[i]; - if ( mutatedArgs == null || !CheckHearsMutatedSpeech( heard, mutateContext ) ) + if( mutatedArgs == null || !CheckHearsMutatedSpeech( heard, mutateContext ) ) { heard.OnSpeech( regArgs ); NetState ns = heard.NetState; - if ( ns != null ) + if( ns != null ) { - if ( regp == null ) + if( regp == null ) regp = Packet.Acquire( new UnicodeMessage( m_Serial, Body, type, hue, 3, m_Language, Name, text ) ); ns.Send( regp ); @@ -4752,9 +4753,9 @@ namespace Server NetState ns = heard.NetState; - if ( ns != null ) + if( ns != null ) { - if ( mutp == null ) + if( mutp == null ) mutp = Packet.Acquire( new UnicodeMessage( m_Serial, Body, type, hue, 3, m_Language, Name, mutatedText ) ); ns.Send( mutp ); @@ -4765,25 +4766,25 @@ namespace Server Packet.Release( regp ); Packet.Release( mutp ); - if ( onSpeech.Count > 1 ) + if( onSpeech.Count > 1 ) onSpeech.Sort( LocationComparer.GetInstance( this ) ); - for ( int i = 0; i < onSpeech.Count; ++i ) + for( int i = 0; i < onSpeech.Count; ++i ) { object obj = onSpeech[i]; - if ( obj is Mobile ) + if( obj is Mobile ) { - Mobile heard = (Mobile) obj; + Mobile heard = (Mobile)obj; - if ( mutatedArgs == null || !CheckHearsMutatedSpeech( heard, mutateContext ) ) + if( mutatedArgs == null || !CheckHearsMutatedSpeech( heard, mutateContext ) ) heard.OnSpeech( regArgs ); else heard.OnSpeech( mutatedArgs ); } else { - Item item = (Item) obj; + Item item = (Item)obj; item.OnSpeech( regArgs ); } @@ -4808,7 +4809,7 @@ namespace Server public static Mobile GetDamagerFrom( DamageEntry de ) { - return ( de == null ? null : de.Damager ); + return (de == null ? null : de.Damager); } public Mobile FindMostRecentDamager( bool allowSelf ) @@ -4818,16 +4819,16 @@ namespace Server public DamageEntry FindMostRecentDamageEntry( bool allowSelf ) { - for ( int i = m_DamageEntries.Count - 1; i >= 0; --i ) + for( int i = m_DamageEntries.Count - 1; i >= 0; --i ) { - if ( i >= m_DamageEntries.Count ) + if( i >= m_DamageEntries.Count ) continue; DamageEntry de = m_DamageEntries[i]; - if ( de.HasExpired ) + if( de.HasExpired ) m_DamageEntries.RemoveAt( i ); - else if ( allowSelf || de.Damager != this ) + else if( allowSelf || de.Damager != this ) return de; } @@ -4841,19 +4842,19 @@ namespace Server public DamageEntry FindLeastRecentDamageEntry( bool allowSelf ) { - for ( int i = 0; i < m_DamageEntries.Count; ++i ) + for( int i = 0; i < m_DamageEntries.Count; ++i ) { - if ( i < 0 ) + if( i < 0 ) continue; DamageEntry de = m_DamageEntries[i]; - if ( de.HasExpired ) + if( de.HasExpired ) { m_DamageEntries.RemoveAt( i ); --i; } - else if ( allowSelf || de.Damager != this ) + else if( allowSelf || de.Damager != this ) { return de; } @@ -4871,16 +4872,16 @@ namespace Server { DamageEntry mostTotal = null; - for ( int i = m_DamageEntries.Count - 1; i >= 0; --i ) + for( int i = m_DamageEntries.Count - 1; i >= 0; --i ) { - if ( i >= m_DamageEntries.Count ) + if( i >= m_DamageEntries.Count ) continue; DamageEntry de = m_DamageEntries[i]; - if ( de.HasExpired ) + if( de.HasExpired ) m_DamageEntries.RemoveAt( i ); - else if ( ( allowSelf || de.Damager != this ) && ( mostTotal == null || de.DamageGiven > mostTotal.DamageGiven ) ) + else if( (allowSelf || de.Damager != this) && (mostTotal == null || de.DamageGiven > mostTotal.DamageGiven) ) mostTotal = de; } @@ -4896,16 +4897,16 @@ namespace Server { DamageEntry mostTotal = null; - for ( int i = m_DamageEntries.Count - 1; i >= 0; --i ) + for( int i = m_DamageEntries.Count - 1; i >= 0; --i ) { - if ( i >= m_DamageEntries.Count ) + if( i >= m_DamageEntries.Count ) continue; DamageEntry de = m_DamageEntries[i]; - if ( de.HasExpired ) + if( de.HasExpired ) m_DamageEntries.RemoveAt( i ); - else if ( ( allowSelf || de.Damager != this ) && ( mostTotal == null || de.DamageGiven < mostTotal.DamageGiven ) ) + else if( (allowSelf || de.Damager != this) && (mostTotal == null || de.DamageGiven < mostTotal.DamageGiven) ) mostTotal = de; } @@ -4914,16 +4915,16 @@ namespace Server public DamageEntry FindDamageEntryFor( Mobile m ) { - for ( int i = m_DamageEntries.Count - 1; i >= 0; --i ) + for( int i = m_DamageEntries.Count - 1; i >= 0; --i ) { - if ( i >= m_DamageEntries.Count ) + if( i >= m_DamageEntries.Count ) continue; DamageEntry de = m_DamageEntries[i]; - if ( de.HasExpired ) + if( de.HasExpired ) m_DamageEntries.RemoveAt( i ); - else if ( de.Damager == m ) + else if( de.Damager == m ) return de; } @@ -4939,7 +4940,7 @@ namespace Server { DamageEntry de = FindDamageEntryFor( from ); - if ( de == null ) + if( de == null ) de = new DamageEntry( from ); de.DamageGiven += amount; @@ -4950,27 +4951,27 @@ namespace Server Mobile master = from.GetDamageMaster( this ); - if ( master != null ) + if( master != null ) { List list = de.Responsible; - if ( list == null ) + if( list == null ) de.Responsible = list = new List(); DamageEntry resp = null; - for ( int i = 0; i < list.Count; ++i ) + for( int i = 0; i < list.Count; ++i ) { DamageEntry check = list[i]; - if ( check.Damager == master ) + if( check.Damager == master ) { resp = check; break; } } - if ( resp == null ) + if( resp == null ) list.Add( resp = new DamageEntry( master ) ); resp.DamageGiven += amount; @@ -5016,61 +5017,61 @@ namespace Server public virtual void Damage( int amount, Mobile from, bool informMount ) { - if ( !CanBeDamaged() || m_Deleted ) + if( !CanBeDamaged() || m_Deleted ) return; - if ( !this.Region.OnDamage( this, ref amount ) ) + if( !this.Region.OnDamage( this, ref amount ) ) return; - if ( amount > 0 ) + if( amount > 0 ) { int oldHits = Hits; int newHits = oldHits - amount; - if ( m_Spell != null ) + if( m_Spell != null ) m_Spell.OnCasterHurt(); //if ( m_Spell != null && m_Spell.State == SpellState.Casting ) // m_Spell.Disturb( DisturbType.Hurt, false, true ); - if ( from != null ) + if( from != null ) RegisterDamage( amount, from ); DisruptiveAction(); Paralyzed = false; - switch ( m_VisibleDamageType ) + switch( m_VisibleDamageType ) { case VisibleDamageType.Related: { - NetState ourState = m_NetState, theirState = ( from == null ? null : from.m_NetState ); + NetState ourState = m_NetState, theirState = (from == null ? null : from.m_NetState); - if ( ourState == null ) + if( ourState == null ) { Mobile master = GetDamageMaster( from ); - if ( master != null ) + if( master != null ) ourState = master.m_NetState; } - if ( theirState == null && from != null ) + if( theirState == null && from != null ) { Mobile master = from.GetDamageMaster( this ); - if ( master != null ) + if( master != null ) theirState = master.m_NetState; } - if ( amount > 0 && ( ourState != null || theirState != null ) ) + if( amount > 0 && (ourState != null || theirState != null) ) { Packet p = null;// = new DamagePacket( this, amount ); - if ( ourState != null ) + if( ourState != null ) { - bool newPacket = ( ourState.Version != null && ourState.Version >= DamagePacket.Version ); + bool newPacket = (ourState.Version != null && ourState.Version >= DamagePacket.Version); - if ( newPacket ) + if( newPacket ) p = Packet.Acquire( new DamagePacket( this, amount ) ); else p = Packet.Acquire( new DamagePacketOld( this, amount ) ); @@ -5078,16 +5079,16 @@ namespace Server ourState.Send( p ); } - if ( theirState != null && theirState != ourState ) + if( theirState != null && theirState != ourState ) { - bool newPacket = ( theirState.Version != null && theirState.Version >= DamagePacket.Version ); + bool newPacket = (theirState.Version != null && theirState.Version >= DamagePacket.Version); - if ( newPacket && ( p == null || !( p is DamagePacket ) ) ) + if( newPacket && (p == null || !(p is DamagePacket)) ) { Packet.Release( p ); p = Packet.Acquire( new DamagePacket( this, amount ) ); } - else if ( !newPacket && ( p == null || !( p is DamagePacketOld ) ) ) + else if( !newPacket && (p == null || !(p is DamagePacketOld)) ) { Packet.Release( p ); p = Packet.Acquire( new DamagePacketOld( this, amount ) ); @@ -5114,13 +5115,13 @@ namespace Server if( m != null && informMount ) m.OnRiderDamaged( amount, from, newHits < 0 ); - if ( newHits < 0 ) + if( newHits < 0 ) { m_LastKiller = from; Hits = 0; - if ( oldHits >= 0 ) + if( oldHits >= 0 ) Kill(); } else @@ -5132,12 +5133,12 @@ namespace Server public virtual void SendDamageToAll( int amount ) { - if ( amount < 0 ) + if( amount < 0 ) return; Map map = m_Map; - if ( map == null ) + if( map == null ) return; IPooledEnumerable eable = map.GetClientsInRange( m_Location ); @@ -5145,23 +5146,23 @@ namespace Server Packet pNew = null; Packet pOld = null; - foreach ( NetState ns in eable ) + foreach( NetState ns in eable ) { - if ( ns.Mobile.CanSee( this ) ) + if( ns.Mobile.CanSee( this ) ) { - bool newPacket = ( ns.Version != null && ns.Version >= DamagePacket.Version ); + bool newPacket = (ns.Version != null && ns.Version >= DamagePacket.Version); Packet p; - if ( newPacket ) + if( newPacket ) { - if ( pNew == null ) + if( pNew == null ) pNew = Packet.Acquire( new DamagePacket( this, amount ) ); p = pNew; } else { - if ( pOld == null ) + if( pOld == null ) pOld = Packet.Acquire( new DamagePacketOld( this, amount ) ); p = pOld; @@ -5184,33 +5185,33 @@ namespace Server public void Heal( int amount, bool message ) { - if ( !Alive || IsDeadBondedPet ) + if( !Alive || IsDeadBondedPet ) return; - if ( !Region.OnHeal( this, ref amount ) ) + if( !Region.OnHeal( this, ref amount ) ) return; - if ( ( Hits + amount ) > HitsMax ) + if( (Hits + amount) > HitsMax ) { amount = HitsMax - Hits; } Hits += amount; - if ( message && amount > 0 && m_NetState != null ) + if( message && amount > 0 && m_NetState != null ) m_NetState.Send( new MessageLocalizedAffix( Serial.MinusOne, -1, MessageType.Label, 0x3B2, 3, 1008158, "", AffixType.Append | AffixType.System, amount.ToString(), "" ) ); } public void UsedStuckMenu() { - if ( m_StuckMenuUses == null ) + if( m_StuckMenuUses == null ) { m_StuckMenuUses = new DateTime[2]; } - for ( int i = 0; i < m_StuckMenuUses.Length; ++i ) + for( int i = 0; i < m_StuckMenuUses.Length; ++i ) { - if ( ( DateTime.Now - m_StuckMenuUses[i] ) > TimeSpan.FromDays( 1.0 ) ) + if( (DateTime.Now - m_StuckMenuUses[i]) > TimeSpan.FromDays( 1.0 ) ) { m_StuckMenuUses[i] = DateTime.Now; return; @@ -5235,32 +5236,32 @@ namespace Server { int version = reader.ReadInt(); - switch ( version ) + switch( version ) { case 31: - { - m_LastStrGain = reader.ReadDeltaTime(); - m_LastIntGain = reader.ReadDeltaTime(); - m_LastDexGain = reader.ReadDeltaTime(); + { + m_LastStrGain = reader.ReadDeltaTime(); + m_LastIntGain = reader.ReadDeltaTime(); + m_LastDexGain = reader.ReadDeltaTime(); - goto case 30; - } + goto case 30; + } case 30: - { - byte hairflag = reader.ReadByte(); + { + byte hairflag = reader.ReadByte(); - if( (hairflag & 0x01) != 0 ) - m_Hair = new HairInfo( reader ); - if( (hairflag & 0x02) != 0 ) - m_FacialHair = new FacialHairInfo( reader ); + if( (hairflag & 0x01) != 0 ) + m_Hair = new HairInfo( reader ); + if( (hairflag & 0x02) != 0 ) + m_FacialHair = new FacialHairInfo( reader ); - goto case 29; - } + goto case 29; + } case 29: - { - m_Race = reader.ReadRace(); - goto case 28; - } + { + m_Race = reader.ReadRace(); + goto case 28; + } case 28: { if( version <= 30 ) @@ -5319,7 +5320,7 @@ namespace Server { m_ShortTermMurders = reader.ReadInt(); - if ( version <= 24 ) + if( version <= 24 ) { reader.ReadDateTime(); reader.ReadDateTime(); @@ -5329,7 +5330,7 @@ namespace Server } case 15: { - if ( version < 22 ) + if( version < 22 ) reader.ReadInt(); // followers m_FollowersMax = reader.ReadInt(); @@ -5399,7 +5400,7 @@ namespace Server } case 4: { - if ( version <= 25 ) + if( version <= 25 ) { Poison.Deserialize( reader ); } @@ -5426,19 +5427,19 @@ namespace Server } case 0: { - if ( version < 21 ) + if( version < 21 ) m_Stabled = new List(); - if ( version < 18 ) + if( version < 18 ) m_Virtues = new VirtueInfo(); - if ( version < 11 ) + if( version < 11 ) m_DisplayGuildTitle = true; - if ( version < 3 ) + if( version < 3 ) m_StatCap = 225; - if ( version < 15 ) + if( version < 15 ) { m_Followers = 0; m_FollowersMax = 5; @@ -5458,7 +5459,7 @@ namespace Server m_Female = reader.ReadBool(); m_Warmode = reader.ReadBool(); m_Hidden = reader.ReadBool(); - m_Direction = (Direction) reader.ReadByte(); + m_Direction = (Direction)reader.ReadByte(); m_Hue = reader.ReadInt(); m_Str = reader.ReadInt(); m_Dex = reader.ReadInt(); @@ -5470,7 +5471,7 @@ namespace Server m_Blessed = reader.ReadBool(); m_Fame = reader.ReadInt(); m_Karma = reader.ReadInt(); - m_AccessLevel = (AccessLevel) reader.ReadByte(); + m_AccessLevel = (AccessLevel)reader.ReadByte(); m_Skills = new Skills( this, reader ); @@ -5481,7 +5482,7 @@ namespace Server m_Profile = reader.ReadString(); m_ProfileLocked = reader.ReadBool(); - if ( version <= 18 ) + if( version <= 18 ) { reader.ReadInt(); reader.ReadInt(); @@ -5493,18 +5494,18 @@ namespace Server m_LogoutLocation = reader.ReadPoint3D(); m_LogoutMap = reader.ReadMap(); - m_StrLock = (StatLockType) reader.ReadByte(); - m_DexLock = (StatLockType) reader.ReadByte(); - m_IntLock = (StatLockType) reader.ReadByte(); + m_StrLock = (StatLockType)reader.ReadByte(); + m_DexLock = (StatLockType)reader.ReadByte(); + m_IntLock = (StatLockType)reader.ReadByte(); m_StatMods = new List(); m_SkillMods = new List(); - if ( reader.ReadBool() ) + if( reader.ReadBool() ) { m_StuckMenuUses = new DateTime[reader.ReadInt()]; - for ( int i = 0; i < m_StuckMenuUses.Length; ++i ) + for( int i = 0; i < m_StuckMenuUses.Length; ++i ) { m_StuckMenuUses[i] = reader.ReadDateTime(); } @@ -5514,7 +5515,7 @@ namespace Server m_StuckMenuUses = null; } - if ( m_Player && m_Map != Map.Internal ) + if( m_Player && m_Map != Map.Internal ) { m_LogoutLocation = m_Location; m_LogoutMap = m_Map; @@ -5522,23 +5523,23 @@ namespace Server m_Map = Map.Internal; } - if ( m_Map != null ) + if( m_Map != null ) m_Map.OnEnter( this ); - if ( m_Criminal ) + if( m_Criminal ) { - if ( m_ExpireCriminal == null ) + if( m_ExpireCriminal == null ) m_ExpireCriminal = new ExpireCriminalTimer( this ); m_ExpireCriminal.Start(); } - if ( ShouldCheckStatTimers ) + if( ShouldCheckStatTimers ) CheckStatTimers(); - if ( !m_Player && m_Dex <= 100 && m_CombatTimer != null ) + if( !m_Player && m_Dex <= 100 && m_CombatTimer != null ) m_CombatTimer.Priority = TimerPriority.FiftyMS; - else if ( m_CombatTimer != null ) + else if( m_CombatTimer != null ) m_CombatTimer.Priority = TimerPriority.EveryTick; UpdateRegion(); @@ -5549,7 +5550,7 @@ namespace Server } } - if ( !m_Player ) + if( !m_Player ) Utility.Intern( ref m_Name ); Utility.Intern( ref m_Title ); @@ -5585,19 +5586,19 @@ namespace Server public virtual void CheckStatTimers() { - if ( m_Deleted ) + if( m_Deleted ) return; - if ( Hits < HitsMax ) + if( Hits < HitsMax ) { - if ( CanRegenHits ) + if( CanRegenHits ) { - if ( m_HitsTimer == null ) + if( m_HitsTimer == null ) m_HitsTimer = new HitsTimer( this ); m_HitsTimer.Start(); } - else if ( m_HitsTimer != null ) + else if( m_HitsTimer != null ) { m_HitsTimer.Stop(); } @@ -5607,16 +5608,16 @@ namespace Server Hits = HitsMax; } - if ( Stam < StamMax ) + if( Stam < StamMax ) { - if ( CanRegenStam ) + if( CanRegenStam ) { - if ( m_StamTimer == null ) + if( m_StamTimer == null ) m_StamTimer = new StamTimer( this ); m_StamTimer.Start(); } - else if ( m_StamTimer != null ) + else if( m_StamTimer != null ) { m_StamTimer.Stop(); } @@ -5626,16 +5627,16 @@ namespace Server Stam = StamMax; } - if ( Mana < ManaMax ) + if( Mana < ManaMax ) { - if ( CanRegenMana ) + if( CanRegenMana ) { - if ( m_ManaTimer == null ) + if( m_ManaTimer == null ) m_ManaTimer = new ManaTimer( this ); m_ManaTimer.Start(); } - else if ( m_ManaTimer != null ) + else if( m_ManaTimer != null ) { m_ManaTimer.Stop(); } @@ -5657,17 +5658,19 @@ namespace Server } } - int ISerializable.TypeReference { + int ISerializable.TypeReference + { get { return m_TypeRef; } } - int ISerializable.SerialIdentity { + int ISerializable.SerialIdentity + { get { return m_Serial; } } public virtual void Serialize( GenericWriter writer ) { - writer.Write( (int) 31 ); // version + writer.Write( (int)31 ); // version writer.WriteDeltaTime( m_LastStrGain ); writer.WriteDeltaTime( m_LastIntGain ); @@ -5689,7 +5692,7 @@ namespace Server writer.Write( this.Race ); - writer.Write( (int) m_TithingPoints ); + writer.Write( (int)m_TithingPoints ); writer.Write( m_Corpse ); @@ -5741,7 +5744,7 @@ namespace Server writer.Write( m_Hunger ); writer.Write( m_Location ); - writer.Write( (int) m_Body ); + writer.Write( (int)m_Body ); writer.Write( m_Name ); writer.Write( m_GuildTitle ); writer.Write( m_Criminal ); @@ -5754,7 +5757,7 @@ namespace Server writer.Write( m_Female ); writer.Write( m_Warmode ); writer.Write( m_Hidden ); - writer.Write( (byte) m_Direction ); + writer.Write( (byte)m_Direction ); writer.Write( m_Hue ); writer.Write( m_Str ); writer.Write( m_Dex ); @@ -5768,7 +5771,7 @@ namespace Server writer.Write( m_Blessed ); writer.Write( m_Fame ); writer.Write( m_Karma ); - writer.Write( (byte) m_AccessLevel ); + writer.Write( (byte)m_AccessLevel ); m_Skills.Serialize( writer ); writer.Write( m_Items ); @@ -5782,17 +5785,17 @@ namespace Server writer.Write( m_LogoutLocation ); writer.Write( m_LogoutMap ); - writer.Write( (byte) m_StrLock ); - writer.Write( (byte) m_DexLock ); - writer.Write( (byte) m_IntLock ); + writer.Write( (byte)m_StrLock ); + writer.Write( (byte)m_DexLock ); + writer.Write( (byte)m_IntLock ); - if ( m_StuckMenuUses != null ) + if( m_StuckMenuUses != null ) { writer.Write( true ); writer.Write( m_StuckMenuUses.Length ); - for ( int i = 0; i < m_StuckMenuUses.Length; ++i ) + for( int i = 0; i < m_StuckMenuUses.Length; ++i ) { writer.Write( m_StuckMenuUses[i] ); } @@ -5812,7 +5815,7 @@ namespace Server } set { - if ( m_LightLevel != value ) + if( m_LightLevel != value ) { m_LightLevel = value; @@ -5862,9 +5865,9 @@ namespace Server m_Player = value; InvalidateProperties(); - if ( !m_Player && m_Dex <= 100 && m_CombatTimer != null ) + if( !m_Player && m_Dex <= 100 && m_CombatTimer != null ) m_CombatTimer.Priority = TimerPriority.FiftyMS; - else if ( m_CombatTimer != null ) + else if( m_CombatTimer != null ) m_CombatTimer.Priority = TimerPriority.EveryTick; CheckStatTimers(); @@ -5898,12 +5901,12 @@ namespace Server public static string GetAccessLevelName( AccessLevel level ) { - return m_AccessLevelNames[(int) level]; + return m_AccessLevelNames[(int)level]; } public virtual bool CanPaperdollBeOpenedBy( Mobile from ) { - return ( Body.IsHuman || Body.IsGhost || IsBodyMod ); + return (Body.IsHuman || Body.IsGhost || IsBodyMod); } public virtual void GetChildContextMenuEntries( Mobile from, List list, Item item ) @@ -5912,13 +5915,13 @@ namespace Server public virtual void GetContextMenuEntries( Mobile from, List list ) { - if ( m_Deleted ) + if( m_Deleted ) return; - if ( CanPaperdollBeOpenedBy( from ) ) + if( CanPaperdollBeOpenedBy( from ) ) list.Add( new PaperdollEntry( this ) ); - if ( from == this && Backpack != null && CanSee( Backpack ) && CheckAlive( false ) ) + if( from == this && Backpack != null && CanSee( Backpack ) && CheckAlive( false ) ) list.Add( new OpenBackpackEntry( this ) ); } @@ -5983,15 +5986,15 @@ namespace Server public void AddItem( Item item ) { - if ( item == null || item.Deleted ) + if( item == null || item.Deleted ) return; - if ( item.Parent == this ) + if( item.Parent == this ) return; - else if ( item.Parent is Mobile ) - ( (Mobile) item.Parent ).RemoveItem( item ); - else if ( item.Parent is Item ) - ( (Item) item.Parent ).RemoveItem( item ); + else if( item.Parent is Mobile ) + ((Mobile)item.Parent).RemoveItem( item ); + else if( item.Parent is Item ) + ((Item)item.Parent).RemoveItem( item ); else item.SendRemovePacket(); @@ -6000,7 +6003,7 @@ namespace Server m_Items.Add( item ); - if ( !item.IsVirtualItem ) + if( !item.IsVirtualItem ) { UpdateTotal( item, TotalType.Gold, item.TotalGold ); UpdateTotal( item, TotalType.Items, item.TotalItems + 1 ); @@ -6012,7 +6015,7 @@ namespace Server item.OnAdded( this ); OnItemAdded( item ); - if ( item.PhysicalResistance != 0 || item.FireResistance != 0 || item.ColdResistance != 0 || + if( item.PhysicalResistance != 0 || item.FireResistance != 0 || item.ColdResistance != 0 || item.PoisonResistance != 0 || item.EnergyResistance != 0 ) UpdateResistances(); } @@ -6033,10 +6036,10 @@ namespace Server public void RemoveItem( Item item ) { - if ( item == null || m_Items == null ) + if( item == null || m_Items == null ) return; - if ( m_Items.Contains( item ) ) + if( m_Items.Contains( item ) ) { item.SendRemovePacket(); @@ -6044,11 +6047,11 @@ namespace Server m_Items.Remove( item ); - if ( !item.IsVirtualItem ) + if( !item.IsVirtualItem ) { UpdateTotal( item, TotalType.Gold, -item.TotalGold ); - UpdateTotal( item, TotalType.Items, -( item.TotalItems + 1 ) ); - UpdateTotal( item, TotalType.Weight, -( item.TotalWeight + item.PileWeight ) ); + UpdateTotal( item, TotalType.Items, -(item.TotalItems + 1) ); + UpdateTotal( item, TotalType.Weight, -(item.TotalWeight + item.PileWeight) ); } item.Parent = null; @@ -6056,7 +6059,7 @@ namespace Server item.OnRemoved( this ); OnItemRemoved( item ); - if ( item.PhysicalResistance != 0 || item.FireResistance != 0 || item.ColdResistance != 0 || + if( item.PhysicalResistance != 0 || item.FireResistance != 0 || item.ColdResistance != 0 || item.PoisonResistance != 0 || item.EnergyResistance != 0 ) UpdateResistances(); } @@ -6066,7 +6069,7 @@ namespace Server { Map map = m_Map; - if ( map != null ) + if( map != null ) { ProcessDelta(); @@ -6074,13 +6077,13 @@ namespace Server IPooledEnumerable eable = map.GetClientsInRange( m_Location ); - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { - if ( state.Mobile.CanSee( this ) ) + if( state.Mobile.CanSee( this ) ) { state.Mobile.ProcessDelta(); - if ( p == null ) + if( p == null ) p = Packet.Acquire( new MobileAnimation( this, action, frameCount, repeatCount, forward, repeat, delay ) ); state.Send( p ); @@ -6095,32 +6098,32 @@ namespace Server public void SendSound( int soundID ) { - if ( soundID != -1 && m_NetState != null ) + if( soundID != -1 && m_NetState != null ) Send( new PlaySound( soundID, this ) ); } public void SendSound( int soundID, IPoint3D p ) { - if ( soundID != -1 && m_NetState != null ) + if( soundID != -1 && m_NetState != null ) Send( new PlaySound( soundID, p ) ); } public void PlaySound( int soundID ) { - if ( soundID == -1 ) + if( soundID == -1 ) return; - if ( m_Map != null ) + if( m_Map != null ) { Packet p = null; IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location ); - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { - if ( state.Mobile.CanSee( this ) ) + if( state.Mobile.CanSee( this ) ) { - if ( p == null ) + if( p == null ) p = Packet.Acquire( new PlaySound( soundID, this ) ); state.Send( p ); @@ -6156,7 +6159,7 @@ namespace Server { AccessLevel oldValue = m_AccessLevel; - if ( oldValue != value ) + if( oldValue != value ) { m_AccessLevel = value; Delta( MobileDelta.Noto ); @@ -6187,11 +6190,11 @@ namespace Server { int oldValue = m_Fame; - if ( oldValue != value ) + if( oldValue != value ) { m_Fame = value; - if ( ShowFameTitle && ( m_Player || m_Body.IsHuman ) && ( oldValue >= 10000 ) != ( value >= 10000 ) ) + if( ShowFameTitle && (m_Player || m_Body.IsHuman) && (oldValue >= 10000) != (value >= 10000) ) InvalidateProperties(); OnFameChange( oldValue ); @@ -6214,7 +6217,7 @@ namespace Server { int old = m_Karma; - if ( old != value ) + if( old != value ) { m_Karma = value; OnKarmaChange( old ); @@ -6229,7 +6232,7 @@ namespace Server // Mobile did something which should unhide him public virtual void RevealingAction() { - if ( m_Hidden && m_AccessLevel == AccessLevel.Player ) + if( m_Hidden && m_AccessLevel == AccessLevel.Player ) Hidden = false; DisruptiveAction(); // Anything that unhides you will also distrupt meditation @@ -6366,7 +6369,7 @@ namespace Server } set { - if ( m_Blessed != value ) + if( m_Blessed != value ) { m_Blessed = value; Delta( MobileDelta.Flags ); @@ -6381,17 +6384,17 @@ namespace Server public void SendRemovePacket( bool everyone ) { - if ( m_Map != null ) + if( m_Map != null ) { Packet p = null; IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location ); - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { - if ( state != m_NetState && ( everyone || !state.Mobile.CanSee( this ) ) ) + if( state != m_NetState && (everyone || !state.Mobile.CanSee( this )) ) { - if ( p == null ) + if( p == null ) p = this.RemovePacket; state.Send( p ); @@ -6406,24 +6409,24 @@ namespace Server { NetState ns = m_NetState; - if ( m_Map != null && ns != null ) + if( m_Map != null && ns != null ) { IPooledEnumerable eable = m_Map.GetObjectsInRange( m_Location, Core.GlobalMaxUpdateRange ); - foreach ( object o in eable ) + foreach( object o in eable ) { - if ( o is Mobile ) + if( o is Mobile ) { - Mobile m = (Mobile) o; + Mobile m = (Mobile)o; - if ( m != this && Utility.InUpdateRange( m_Location, m.m_Location ) ) + if( m != this && Utility.InUpdateRange( m_Location, m.m_Location ) ) ns.Send( m.RemovePacket ); } - else if ( o is Item ) + else if( o is Item ) { - Item item = (Item) o; + Item item = (Item)o; - if ( InRange( item.Location, item.GetUpdateRange( this ) ) ) + if( InRange( item.Location, item.GetUpdateRange( this ) ) ) ns.Send( item.RemovePacket ); } } @@ -6439,12 +6442,12 @@ namespace Server public bool Send( Packet p, bool throwOnOffline ) { - if ( m_NetState != null ) + if( m_NetState != null ) { m_NetState.Send( p ); return true; } - else if ( throwOnOffline ) + else if( throwOnOffline ) { throw new MobileNotConnectedException( this, "Packet could not be sent." ); } @@ -6461,12 +6464,12 @@ namespace Server public bool SendHuePicker( HuePicker p, bool throwOnOffline ) { - if ( m_NetState != null ) + if( m_NetState != null ) { p.SendTo( m_NetState ); return true; } - else if ( throwOnOffline ) + else if( throwOnOffline ) { throw new MobileNotConnectedException( this, "Hue picker could not be sent." ); } @@ -6480,13 +6483,13 @@ namespace Server { NetState ns = m_NetState; - if ( ns != null ) + if( ns != null ) { List gumps = ns.Gumps; - for ( int i = 0; i < gumps.Count; ++i ) + for( int i = 0; i < gumps.Count; ++i ) { - if ( gumps[i].GetType() == type ) + if( gumps[i].GetType() == type ) return gumps[i]; } } @@ -6508,18 +6511,18 @@ namespace Server public bool CloseGump( Type type, int buttonID, bool throwOnOffline ) { - if ( m_NetState != null ) + if( m_NetState != null ) { - if ( HasGump( type ) ) + if( HasGump( type ) ) m_NetState.Send( new CloseGump( Gump.GetTypeID( type ), buttonID ) ); Gump gump = FindGump( type ); - if ( gump != null ) + if( gump != null ) { m_NetState.Send( new CloseGump( Gump.GetTypeID( type ), buttonID ) ); - if ( m_NetState.Version > m_SendsReponseOnForcedGumpClose ) + if( m_NetState.Version > m_SendsReponseOnForcedGumpClose ) { m_NetState.Gumps.Remove( gump ); gump.OnResponse( m_NetState, new RelayInfo( buttonID, new int[0], new TextRelay[0] ) ); @@ -6528,7 +6531,7 @@ namespace Server return true; } - else if ( throwOnOffline ) + else if( throwOnOffline ) { throw new MobileNotConnectedException( this, "Gump close packet could not be sent." ); } @@ -6547,20 +6550,20 @@ namespace Server { NetState ns = m_NetState; - if ( ns != null ) + if( ns != null ) { List gumps = ns.Gumps; - for ( int i = 0; i < gumps.Count; ++i ) + for( int i = 0; i < gumps.Count; ++i ) ns.Send( new CloseGump( gumps[i].TypeID, 0 ) ); - for ( int i = gumps.Count - 1; i >= 0; --i ) + for( int i = gumps.Count - 1; i >= 0; --i ) { Gump gump = gumps[i]; ns.Send( new CloseGump( gump.TypeID, 0 ) ); - if ( ns.Version > m_SendsReponseOnForcedGumpClose ) + if( ns.Version > m_SendsReponseOnForcedGumpClose ) { ns.Gumps.Remove( gump ); gump.OnResponse( ns, new RelayInfo( 0, new int[0], new TextRelay[0] ) ); @@ -6569,7 +6572,7 @@ namespace Server return true; } - else if ( throwOnOffline ) + else if( throwOnOffline ) { throw new MobileNotConnectedException( this, "Gump close packets could not be sent." ); } @@ -6588,17 +6591,17 @@ namespace Server { NetState ns = m_NetState; - if ( ns != null ) + if( ns != null ) { bool contains = false; List gumps = ns.Gumps; - for ( int i = 0; !contains && i < gumps.Count; ++i ) - contains = ( gumps[i].GetType() == type ); + for( int i = 0; !contains && i < gumps.Count; ++i ) + contains = (gumps[i].GetType() == type); return contains; } - else if ( throwOnOffline ) + else if( throwOnOffline ) { throw new MobileNotConnectedException( this, "Mobile is not connected." ); } @@ -6615,12 +6618,12 @@ namespace Server public bool SendGump( Gump g, bool throwOnOffline ) { - if ( m_NetState != null ) + if( m_NetState != null ) { g.SendTo( m_NetState ); return true; } - else if ( throwOnOffline ) + else if( throwOnOffline ) { throw new MobileNotConnectedException( this, "Gump could not be sent." ); } @@ -6637,12 +6640,12 @@ namespace Server public bool SendMenu( IMenu m, bool throwOnOffline ) { - if ( m_NetState != null ) + if( m_NetState != null ) { m.SendTo( m_NetState ); return true; } - else if ( throwOnOffline ) + else if( throwOnOffline ) { throw new MobileNotConnectedException( this, "Menu could not be sent." ); } @@ -6658,7 +6661,7 @@ namespace Server /// public virtual void OnSaid( SpeechEventArgs e ) { - if ( m_Squelched ) + if( m_Squelched ) { if( Core.ML ) this.SendLocalizedMessage( 500168 ); // You can not say anything, you have been muted. @@ -6668,7 +6671,7 @@ namespace Server e.Blocked = true; } - if ( !e.Blocked ) + if( !e.Blocked ) RevealingAction(); } @@ -6689,31 +6692,31 @@ namespace Server { NetState ns = m_NetState; - if ( m_Map != null && ns != null ) + if( m_Map != null && ns != null ) { IPooledEnumerable eable = m_Map.GetObjectsInRange( m_Location, Core.GlobalMaxUpdateRange ); - foreach ( object o in eable ) + foreach( object o in eable ) { - if ( o is Item ) + if( o is Item ) { - Item item = (Item) o; + Item item = (Item)o; - if ( CanSee( item ) && InRange( item.Location, item.GetUpdateRange( this ) ) ) + if( CanSee( item ) && InRange( item.Location, item.GetUpdateRange( this ) ) ) item.SendInfoTo( ns ); } - else if ( o is Mobile ) + else if( o is Mobile ) { - Mobile m = (Mobile) o; + Mobile m = (Mobile)o; - if ( CanSee( m ) && Utility.InUpdateRange( m_Location, m.m_Location ) ) + if( CanSee( m ) && Utility.InUpdateRange( m_Location, m.m_Location ) ) { ns.Send( new MobileIncoming( this, m ) ); - if ( m.IsDeadBondedPet ) + if( m.IsDeadBondedPet ) ns.Send( new BondedStatus( 0, m.m_Serial, 1 ) ); - if ( ObjectPropertyList.Enabled ) + if( ObjectPropertyList.Enabled ) { ns.Send( m.OPLPacket ); @@ -6737,17 +6740,17 @@ namespace Server } set { - if ( m_Deleted ) + if( m_Deleted ) return; - if ( m_Map != value ) + if( m_Map != value ) { - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.ValidateAllTrades(); Map oldMap = m_Map; - if ( m_Map != null ) + if( m_Map != null ) { m_Map.OnLeave( this ); @@ -6755,21 +6758,21 @@ namespace Server SendRemovePacket(); } - for ( int i = 0; i < m_Items.Count; ++i ) + for( int i = 0; i < m_Items.Count; ++i ) m_Items[i].Map = value; m_Map = value; UpdateRegion(); - if ( m_Map != null ) + if( m_Map != null ) m_Map.OnEnter( this ); NetState ns = m_NetState; - if ( m_Map != null ) + if( m_Map != null ) { - if ( ns != null && m_Map != null ) + if( ns != null && m_Map != null ) { ns.Sequence = 0; ns.Send( new MapChange( this ) ); @@ -6780,9 +6783,9 @@ namespace Server } } - if ( ns != null ) + if( ns != null ) { - if ( m_Map != null ) + if( m_Map != null ) Send( new ServerChange( this, m_Map ) ); ns.Sequence = 0; @@ -6797,7 +6800,7 @@ namespace Server SendEverything(); SendIncomingPacket(); - if ( ns != null ) + if( ns != null ) { ns.Sequence = 0; ClearFastwalkStack(); @@ -6815,12 +6818,12 @@ namespace Server public void UpdateRegion() { - if ( m_Deleted ) + if( m_Deleted ) return; Region newRegion = Region.Find( m_Location, m_Map ); - if ( newRegion != m_Region ) + if( newRegion != m_Region ) { Region.OnRegionChange( this, m_Region, newRegion ); @@ -6848,26 +6851,26 @@ namespace Server public virtual bool CanBeBeneficial( Mobile target, bool message, bool allowDead ) { - if ( target == null ) + if( target == null ) return false; - if ( m_Deleted || target.m_Deleted || !Alive || IsDeadBondedPet || ( !allowDead && ( !target.Alive || IsDeadBondedPet ) ) ) + if( m_Deleted || target.m_Deleted || !Alive || IsDeadBondedPet || (!allowDead && (!target.Alive || IsDeadBondedPet)) ) { - if ( message ) + if( message ) SendLocalizedMessage( 1001017 ); // You can not perform beneficial acts on your target. return false; } - if ( target == this ) + if( target == this ) return true; - if ( /*m_Player &&*/ !Region.AllowBeneficial( this, target ) ) + if( /*m_Player &&*/ !Region.AllowBeneficial( this, target ) ) { // TODO: Pets //if ( !(target.m_Player || target.Body.IsHuman || target.Body.IsAnimal) ) //{ - if ( message ) + if( message ) SendLocalizedMessage( 1001017 ); // You can not perform beneficial acts on your target. return false; @@ -6879,12 +6882,12 @@ namespace Server public virtual bool IsBeneficialCriminal( Mobile target ) { - if ( this == target ) + if( this == target ) return false; int n = Notoriety.Compute( this, target ); - return ( n == Notoriety.Criminal || n == Notoriety.Murderer ); + return (n == Notoriety.Criminal || n == Notoriety.Murderer); } /// @@ -6892,13 +6895,13 @@ namespace Server /// public virtual void OnBeneficialAction( Mobile target, bool isCriminal ) { - if ( isCriminal ) + if( isCriminal ) CriminalAction( false ); } public virtual void DoBeneficial( Mobile target ) { - if ( target == null ) + if( target == null ) return; OnBeneficialAction( target, IsBeneficialCriminal( target ) ); @@ -6909,7 +6912,7 @@ namespace Server public virtual bool BeneficialCheck( Mobile target ) { - if ( CanBeBeneficial( target, true ) ) + if( CanBeBeneficial( target, true ) ) { DoBeneficial( target ); return true; @@ -6930,24 +6933,24 @@ namespace Server public virtual bool CanBeHarmful( Mobile target, bool message, bool ignoreOurBlessedness ) { - if ( target == null ) + if( target == null ) return false; - if ( m_Deleted || ( !ignoreOurBlessedness && m_Blessed ) || target.m_Deleted || target.m_Blessed || !Alive || IsDeadBondedPet || !target.Alive || target.IsDeadBondedPet ) + if( m_Deleted || (!ignoreOurBlessedness && m_Blessed) || target.m_Deleted || target.m_Blessed || !Alive || IsDeadBondedPet || !target.Alive || target.IsDeadBondedPet ) { - if ( message ) + if( message ) SendLocalizedMessage( 1001018 ); // You can not perform negative acts on your target. return false; } - if ( target == this ) + if( target == this ) return true; // TODO: Pets - if ( /*m_Player &&*/ !Region.AllowHarmful( this, target ) )//(target.m_Player || target.Body.IsHuman) && !Region.AllowHarmful( this, target ) ) + if( /*m_Player &&*/ !Region.AllowHarmful( this, target ) )//(target.m_Player || target.Body.IsHuman) && !Region.AllowHarmful( this, target ) ) { - if ( message ) + if( message ) SendLocalizedMessage( 1001018 ); // You can not perform negative acts on your target. return false; @@ -6963,10 +6966,10 @@ namespace Server public virtual bool IsHarmfulCriminal( Mobile target ) { - if ( this == target ) + if( this == target ) return false; - return ( Notoriety.Compute( this, target ) == Notoriety.Innocent ); + return (Notoriety.Compute( this, target ) == Notoriety.Innocent); } /// @@ -6974,7 +6977,7 @@ namespace Server /// public virtual void OnHarmfulAction( Mobile target, bool isCriminal ) { - if ( isCriminal ) + if( isCriminal ) CriminalAction( false ); } @@ -6985,7 +6988,7 @@ namespace Server public virtual void DoHarmful( Mobile target, bool indirect ) { - if ( target == null || m_Deleted ) + if( target == null || m_Deleted ) return; bool isCriminal = IsHarmfulCriminal( target ); @@ -6996,10 +6999,10 @@ namespace Server this.Region.OnDidHarmful( this, target ); target.Region.OnGotHarmful( this, target ); - if ( !indirect ) + if( !indirect ) Combatant = target; - if ( m_ExpireCombatant == null ) + if( m_ExpireCombatant == null ) m_ExpireCombatant = new ExpireCombatantTimer( this ); else m_ExpireCombatant.Stop(); @@ -7009,7 +7012,7 @@ namespace Server public virtual bool HarmfulCheck( Mobile target ) { - if ( CanBeHarmful( target ) ) + if( CanBeHarmful( target ) ) { DoHarmful( target ); return true; @@ -7027,11 +7030,11 @@ namespace Server public bool RemoveStatMod( string name ) { - for ( int i = 0; i < m_StatMods.Count; ++i ) + for( int i = 0; i < m_StatMods.Count; ++i ) { StatMod check = m_StatMods[i]; - if ( check.Name == name ) + if( check.Name == name ) { m_StatMods.RemoveAt( i ); CheckStatTimers(); @@ -7045,11 +7048,11 @@ namespace Server public StatMod GetStatMod( string name ) { - for ( int i = 0; i < m_StatMods.Count; ++i ) + for( int i = 0; i < m_StatMods.Count; ++i ) { StatMod check = m_StatMods[i]; - if ( check.Name == name ) + if( check.Name == name ) return check; } @@ -7058,11 +7061,11 @@ namespace Server public void AddStatMod( StatMod mod ) { - for ( int i = 0; i < m_StatMods.Count; ++i ) + for( int i = 0; i < m_StatMods.Count; ++i ) { StatMod check = m_StatMods[i]; - if ( check.Name == mod.Name ) + if( check.Name == mod.Name ) { Delta( MobileDelta.Stat | GetStatDelta( check.Type ) ); m_StatMods.RemoveAt( i ); @@ -7079,13 +7082,13 @@ namespace Server { MobileDelta delta = 0; - if ( ( type & StatType.Str ) != 0 ) + if( (type & StatType.Str) != 0 ) delta |= MobileDelta.Hits; - if ( ( type & StatType.Dex ) != 0 ) + if( (type & StatType.Dex) != 0 ) delta |= MobileDelta.Stam; - if ( ( type & StatType.Int ) != 0 ) + if( (type & StatType.Int) != 0 ) delta |= MobileDelta.Mana; return delta; @@ -7098,11 +7101,11 @@ namespace Server { int offset = 0; - for ( int i = 0; i < m_StatMods.Count; ++i ) + for( int i = 0; i < m_StatMods.Count; ++i ) { StatMod mod = m_StatMods[i]; - if ( mod.HasElapsed() ) + if( mod.HasElapsed() ) { m_StatMods.RemoveAt( i ); Delta( MobileDelta.Stat | GetStatDelta( mod.Type ) ); @@ -7110,7 +7113,7 @@ namespace Server --i; } - else if ( ( mod.Type & type ) != 0 ) + else if( (mod.Type & type) != 0 ) { offset += mod.Offset; } @@ -7172,26 +7175,26 @@ namespace Server } set { - if ( value < 1 ) + if( value < 1 ) value = 1; - else if ( value > 65000 ) + else if( value > 65000 ) value = 65000; - if ( m_Str != value ) + if( m_Str != value ) { int oldValue = m_Str; m_Str = value; Delta( MobileDelta.Stat | MobileDelta.Hits ); - if ( Hits < HitsMax ) + if( Hits < HitsMax ) { - if ( m_HitsTimer == null ) + if( m_HitsTimer == null ) m_HitsTimer = new HitsTimer( this ); m_HitsTimer.Start(); } - else if ( Hits > HitsMax ) + else if( Hits > HitsMax ) { Hits = HitsMax; } @@ -7214,16 +7217,16 @@ namespace Server { int value = m_Str + GetStatOffset( StatType.Str ); - if ( value < 1 ) + if( value < 1 ) value = 1; - else if ( value > 65000 ) + else if( value > 65000 ) value = 65000; return value; } set { - if ( m_StatMods.Count == 0 ) + if( m_StatMods.Count == 0 ) RawStr = value; } } @@ -7244,26 +7247,26 @@ namespace Server } set { - if ( value < 1 ) + if( value < 1 ) value = 1; - else if ( value > 65000 ) + else if( value > 65000 ) value = 65000; - if ( m_Dex != value ) + if( m_Dex != value ) { int oldValue = m_Dex; m_Dex = value; Delta( MobileDelta.Stat | MobileDelta.Stam ); - if ( Stam < StamMax ) + if( Stam < StamMax ) { - if ( m_StamTimer == null ) + if( m_StamTimer == null ) m_StamTimer = new StamTimer( this ); m_StamTimer.Start(); } - else if ( Stam > StamMax ) + else if( Stam > StamMax ) { Stam = StamMax; } @@ -7286,16 +7289,16 @@ namespace Server { int value = m_Dex + GetStatOffset( StatType.Dex ); - if ( value < 1 ) + if( value < 1 ) value = 1; - else if ( value > 65000 ) + else if( value > 65000 ) value = 65000; return value; } set { - if ( m_StatMods.Count == 0 ) + if( m_StatMods.Count == 0 ) RawDex = value; } } @@ -7316,26 +7319,26 @@ namespace Server } set { - if ( value < 1 ) + if( value < 1 ) value = 1; - else if ( value > 65000 ) + else if( value > 65000 ) value = 65000; - if ( m_Int != value ) + if( m_Int != value ) { int oldValue = m_Int; m_Int = value; Delta( MobileDelta.Stat | MobileDelta.Mana ); - if ( Mana < ManaMax ) + if( Mana < ManaMax ) { - if ( m_ManaTimer == null ) + if( m_ManaTimer == null ) m_ManaTimer = new ManaTimer( this ); m_ManaTimer.Start(); } - else if ( Mana > ManaMax ) + else if( Mana > ManaMax ) { Mana = ManaMax; } @@ -7358,16 +7361,16 @@ namespace Server { int value = m_Int + GetStatOffset( StatType.Int ); - if ( value < 1 ) + if( value < 1 ) value = 1; - else if ( value > 65000 ) + else if( value > 65000 ) value = 65000; return value; } set { - if ( m_StatMods.Count == 0 ) + if( m_StatMods.Count == 0 ) RawInt = value; } } @@ -7396,43 +7399,43 @@ namespace Server } set { - if ( m_Deleted ) + if( m_Deleted ) return; - if ( value < 0 ) + if( value < 0 ) { value = 0; } - else if ( value >= HitsMax ) + else if( value >= HitsMax ) { value = HitsMax; - if ( m_HitsTimer != null ) + if( m_HitsTimer != null ) m_HitsTimer.Stop(); - for ( int i = 0; i < m_Aggressors.Count; i++ ) //reset reports on full HP + for( int i = 0; i < m_Aggressors.Count; i++ ) //reset reports on full HP m_Aggressors[i].CanReportMurder = false; - if ( m_DamageEntries.Count > 0 ) + if( m_DamageEntries.Count > 0 ) m_DamageEntries.Clear(); // reset damage entries on full HP } - if ( value < HitsMax ) + if( value < HitsMax ) { - if ( CanRegenHits ) + if( CanRegenHits ) { - if ( m_HitsTimer == null ) + if( m_HitsTimer == null ) m_HitsTimer = new HitsTimer( this ); m_HitsTimer.Start(); } - else if ( m_HitsTimer != null ) + else if( m_HitsTimer != null ) { m_HitsTimer.Stop(); } } - if ( m_Hits != value ) + if( m_Hits != value ) { int oldValue = m_Hits; m_Hits = value; @@ -7450,7 +7453,7 @@ namespace Server { get { - return 50 + ( Str / 2 ); + return 50 + (Str / 2); } } @@ -7466,37 +7469,37 @@ namespace Server } set { - if ( m_Deleted ) + if( m_Deleted ) return; - if ( value < 0 ) + if( value < 0 ) { value = 0; } - else if ( value >= StamMax ) + else if( value >= StamMax ) { value = StamMax; - if ( m_StamTimer != null ) + if( m_StamTimer != null ) m_StamTimer.Stop(); } - if ( value < StamMax ) + if( value < StamMax ) { - if ( CanRegenStam ) + if( CanRegenStam ) { - if ( m_StamTimer == null ) + if( m_StamTimer == null ) m_StamTimer = new StamTimer( this ); m_StamTimer.Start(); } - else if ( m_StamTimer != null ) + else if( m_StamTimer != null ) { m_StamTimer.Stop(); } } - if ( m_Stam != value ) + if( m_Stam != value ) { int oldValue = m_Stam; m_Stam = value; @@ -7530,43 +7533,43 @@ namespace Server } set { - if ( m_Deleted ) + if( m_Deleted ) return; - if ( value < 0 ) + if( value < 0 ) { value = 0; } - else if ( value >= ManaMax ) + else if( value >= ManaMax ) { value = ManaMax; - if ( m_ManaTimer != null ) + if( m_ManaTimer != null ) m_ManaTimer.Stop(); - if ( Meditating ) + if( Meditating ) { Meditating = false; SendLocalizedMessage( 501846 ); // You are at peace. } } - if ( value < ManaMax ) + if( value < ManaMax ) { - if ( CanRegenMana ) + if( CanRegenMana ) { - if ( m_ManaTimer == null ) + if( m_ManaTimer == null ) m_ManaTimer = new ManaTimer( this ); m_ManaTimer.Start(); } - else if ( m_ManaTimer != null ) + else if( m_ManaTimer != null ) { m_ManaTimer.Stop(); } } - if ( m_Mana != value ) + if( m_Mana != value ) { int oldValue = m_Mana; m_Mana = value; @@ -7594,7 +7597,7 @@ namespace Server { get { - return ( m_Female ? 0x2107 : 0x2106 ); + return (m_Female ? 0x2107 : 0x2106); } } @@ -7609,7 +7612,7 @@ namespace Server } set { - if ( m_HueMod != value ) + if( m_HueMod != value ) { m_HueMod = value; @@ -7623,7 +7626,7 @@ namespace Server { get { - if ( m_HueMod != -1 ) + if( m_HueMod != -1 ) return m_HueMod; return m_Hue; @@ -7632,7 +7635,7 @@ namespace Server { int oldHue = m_Hue; - if ( oldHue != value ) + if( oldHue != value ) { m_Hue = value; @@ -7656,7 +7659,7 @@ namespace Server } set { - if ( m_Direction != value ) + if( m_Direction != value ) { m_Direction = value; @@ -7668,7 +7671,7 @@ namespace Server public virtual int GetSeason() { - if ( m_Map != null ) + if( m_Map != null ) return m_Map.Season; return 1; @@ -7678,19 +7681,19 @@ namespace Server { int flags = 0x0; - if ( m_Female ) + if( m_Female ) flags |= 0x02; - if ( m_Poison != null ) + if( m_Poison != null ) flags |= 0x04; - if ( m_Blessed || m_YellowHealthbar ) + if( m_Blessed || m_YellowHealthbar ) flags |= 0x08; - if ( m_Warmode ) + if( m_Warmode ) flags |= 0x40; - if ( m_Hidden ) + if( m_Hidden ) flags |= 0x80; return flags; @@ -7705,7 +7708,7 @@ namespace Server } set { - if ( m_Female != value ) + if( m_Female != value ) { m_Female = value; Delta( MobileDelta.Flags ); @@ -7727,12 +7730,12 @@ namespace Server } set { - if ( m_Deleted ) + if( m_Deleted ) return; - if ( m_Warmode != value ) + if( m_Warmode != value ) { - if ( m_AutoManifestTimer != null ) + if( m_AutoManifestTimer != null ) { m_AutoManifestTimer.Stop(); m_AutoManifestTimer = null; @@ -7741,15 +7744,15 @@ namespace Server m_Warmode = value; Delta( MobileDelta.Flags ); - if ( m_NetState != null ) + if( m_NetState != null ) Send( SetWarMode.Instantiate( value ) ); - if ( !m_Warmode ) + if( !m_Warmode ) Combatant = null; - if ( !Alive ) + if( !Alive ) { - if ( value ) + if( value ) Delta( MobileDelta.GhostUpdate ); else SendRemovePacket( false ); @@ -7767,24 +7770,24 @@ namespace Server } set { - if ( m_Hidden != value ) + if( m_Hidden != value ) { m_AllowedStealthSteps = 0; m_Hidden = value; //Delta( MobileDelta.Flags ); - if ( m_Map != null ) + if( m_Map != null ) { Packet p = null; IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location ); - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { - if ( !state.Mobile.CanSee( this ) ) + if( !state.Mobile.CanSee( this ) ) { - if ( p == null ) + if( p == null ) p = this.RemovePacket; state.Send( p ); @@ -7793,10 +7796,10 @@ namespace Server { state.Send( new MobileIncoming( state.Mobile, this ) ); - if ( IsDeadBondedPet ) + if( IsDeadBondedPet ) state.Send( new BondedStatus( 0, m_Serial, 1 ) ); - if ( ObjectPropertyList.Enabled ) + if( ObjectPropertyList.Enabled ) { state.Send( OPLPacket ); @@ -7828,36 +7831,36 @@ namespace Server { get { - if ( m_NetState != null && m_NetState.Socket == null ) + if( m_NetState != null && m_NetState.Socket == null ) NetState = null; return m_NetState; } set { - if ( m_NetState != value ) + if( m_NetState != value ) { - if ( m_Map != null ) + if( m_Map != null ) m_Map.OnClientChange( m_NetState, value, this ); - if ( m_Target != null ) + if( m_Target != null ) m_Target.Cancel( this, TargetCancelType.Disconnected ); - if ( m_QuestArrow != null ) + if( m_QuestArrow != null ) QuestArrow = null; - if ( m_Spell != null ) + if( m_Spell != null ) m_Spell.OnConnectionChanged(); //if ( m_Spell != null ) // m_Spell.FinishSequence(); - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.CancelAllTrades(); BankBox box = FindBankNoCreate(); - if ( box != null && box.Opened ) + if( box != null && box.Opened ) box.Close(); // REMOVED: @@ -7865,14 +7868,14 @@ namespace Server m_NetState = value; - if ( m_NetState == null ) + if( m_NetState == null ) { OnDisconnected(); EventSink.InvokeDisconnected( new DisconnectedEventArgs( this ) ); // Disconnected, start the logout timer - if ( m_LogoutTimer == null ) + if( m_LogoutTimer == null ) m_LogoutTimer = new LogoutTimer( this ); else m_LogoutTimer.Stop(); @@ -7887,30 +7890,30 @@ namespace Server // Connected, stop the logout timer and if needed, move to the world - if ( m_LogoutTimer != null ) + if( m_LogoutTimer != null ) m_LogoutTimer.Stop(); m_LogoutTimer = null; - if ( m_Map == Map.Internal && m_LogoutMap != null ) + if( m_Map == Map.Internal && m_LogoutMap != null ) { Map = m_LogoutMap; Location = m_LogoutLocation; } } - for ( int i = m_Items.Count - 1; i >= 0; --i ) + for( int i = m_Items.Count - 1; i >= 0; --i ) { - if ( i >= m_Items.Count ) + if( i >= m_Items.Count ) continue; Item item = m_Items[i]; - if ( item is SecureTradeContainer ) + if( item is SecureTradeContainer ) { - for ( int j = item.Items.Count - 1; j >= 0; --j ) + for( int j = item.Items.Count - 1; j >= 0; --j ) { - if ( j < item.Items.Count ) + if( j < item.Items.Count ) { item.Items[j].OnSecureTrade( this, this, this, false ); AddToBackpack( item.Items[j] ); @@ -7929,13 +7932,13 @@ namespace Server public virtual bool CanSee( object o ) { - if ( o is Item ) + if( o is Item ) { - return CanSee( (Item) o ); + return CanSee( (Item)o ); } - else if ( o is Mobile ) + else if( o is Mobile ) { - return CanSee( (Mobile) o ); + return CanSee( (Mobile)o ); } else { @@ -7945,58 +7948,58 @@ namespace Server public virtual bool CanSee( Item item ) { - if ( m_Map == Map.Internal ) + if( m_Map == Map.Internal ) return false; - else if ( item.Map == Map.Internal ) + else if( item.Map == Map.Internal ) return false; - if ( item.Parent != null ) + if( item.Parent != null ) { - if ( item.Parent is Item ) + if( item.Parent is Item ) { - if ( !CanSee( (Item) item.Parent ) ) + if( !CanSee( (Item)item.Parent ) ) return false; } - else if ( item.Parent is Mobile ) + else if( item.Parent is Mobile ) { - if ( !CanSee( (Mobile) item.Parent ) ) + if( !CanSee( (Mobile)item.Parent ) ) return false; } } - if ( item is BankBox ) + if( item is BankBox ) { BankBox box = item as BankBox; - if ( box != null && m_AccessLevel <= AccessLevel.Counselor && ( box.Owner != this || !box.Opened ) ) + if( box != null && m_AccessLevel <= AccessLevel.Counselor && (box.Owner != this || !box.Opened) ) return false; } - else if ( item is SecureTradeContainer ) + else if( item is SecureTradeContainer ) { - SecureTrade trade = ( (SecureTradeContainer) item ).Trade; + SecureTrade trade = ((SecureTradeContainer)item).Trade; - if ( trade != null && trade.From.Mobile != this && trade.To.Mobile != this ) + if( trade != null && trade.From.Mobile != this && trade.To.Mobile != this ) return false; } - return !item.Deleted && item.Map == m_Map && ( item.Visible || m_AccessLevel > AccessLevel.Counselor ); + return !item.Deleted && item.Map == m_Map && (item.Visible || m_AccessLevel > AccessLevel.Counselor); } public virtual bool CanSee( Mobile m ) { - if ( m_Deleted || m.m_Deleted || m_Map == Map.Internal || m.m_Map == Map.Internal ) + if( m_Deleted || m.m_Deleted || m_Map == Map.Internal || m.m_Map == Map.Internal ) return false; return this == m || ( m.m_Map == m_Map && - ( !m.Hidden || ( m_AccessLevel != AccessLevel.Player && ( m_AccessLevel >= m.AccessLevel || m_AccessLevel >= AccessLevel.Administrator )) ) && //Admins/devs can still see/find eachother though admin gump, they should be able to see 'em too. - ( ( m.Alive || ( Core.SE && Skills.SpiritSpeak.Value >= 100.0 ) ) || !Alive || m_AccessLevel > AccessLevel.Player || m.Warmode ) ); + (!m.Hidden || (m_AccessLevel != AccessLevel.Player && (m_AccessLevel >= m.AccessLevel || m_AccessLevel >= AccessLevel.Administrator))) && //Admins/devs can still see/find eachother though admin gump, they should be able to see 'em too. + ((m.Alive || (Core.SE && Skills.SpiritSpeak.Value >= 100.0)) || !Alive || m_AccessLevel > AccessLevel.Player || m.Warmode)); } public virtual bool CanBeRenamedBy( Mobile from ) { - return ( from.AccessLevel >= AccessLevel.GameMaster && from.m_AccessLevel > m_AccessLevel ); + return (from.AccessLevel >= AccessLevel.GameMaster && from.m_AccessLevel > m_AccessLevel); } [CommandProperty( AccessLevel.GameMaster )] @@ -8008,7 +8011,7 @@ namespace Server } set { - if ( m_Language != value ) + if( m_Language != value ) m_Language = value; } } @@ -8076,11 +8079,11 @@ namespace Server { string old = m_GuildTitle; - if ( old != value ) + if( old != value ) { m_GuildTitle = value; - if ( m_Guild != null && !m_Guild.Disbanded && m_GuildTitle != null ) + if( m_Guild != null && !m_Guild.Disbanded && m_GuildTitle != null ) this.SendLocalizedMessage( 1018026, true, m_GuildTitle ); // Your guild title has changed : InvalidateProperties(); @@ -8132,7 +8135,7 @@ namespace Server } set { - if ( m_NameMod != value ) + if( m_NameMod != value ) { m_NameMod = value; Delta( MobileDelta.Name ); @@ -8169,14 +8172,14 @@ namespace Server { get { - if ( m_NameMod != null ) + if( m_NameMod != null ) return m_NameMod; return m_Name; } set { - if ( m_Name != value ) // I'm leaving out the && m_NameMod == null + if( m_Name != value ) // I'm leaving out the && m_NameMod == null { m_Name = value; Delta( MobileDelta.Name ); @@ -8256,9 +8259,9 @@ namespace Server { BaseGuild old = m_Guild; - if ( old != value ) + if( old != value ) { - if ( value == null ) + if( value == null ) GuildTitle = null; m_Guild = value; @@ -8294,17 +8297,17 @@ namespace Server m_Poison = value; Delta( MobileDelta.Flags ); - if ( m_PoisonTimer != null ) + if( m_PoisonTimer != null ) { m_PoisonTimer.Stop(); m_PoisonTimer = null; } - if ( m_Poison != null ) + if( m_Poison != null ) { m_PoisonTimer = m_Poison.ConstructTimer( this ); - if ( m_PoisonTimer != null ) + if( m_PoisonTimer != null ) m_PoisonTimer.Start(); } @@ -8341,10 +8344,10 @@ namespace Server /// public virtual void OnPoisoned( Mobile from, Poison poison, Poison oldPoison ) { - if ( poison != null ) + if( poison != null ) { - this.LocalOverheadMessage( MessageType.Regular, 0x21, 1042857 + ( poison.Level * 2 ) ); - this.NonlocalOverheadMessage( MessageType.Regular, 0x21, 1042858 + ( poison.Level * 2 ), Name ); + this.LocalOverheadMessage( MessageType.Regular, 0x21, 1042857 + (poison.Level * 2) ); + this.NonlocalOverheadMessage( MessageType.Regular, 0x21, 1042858 + (poison.Level * 2), Name ); } } @@ -8367,7 +8370,7 @@ namespace Server /// public virtual bool CheckHigherPoison( Mobile from, Poison poison ) { - return ( m_Poison != null && m_Poison.Level >= poison.Level ); + return (m_Poison != null && m_Poison.Level >= poison.Level); } /// @@ -8397,19 +8400,19 @@ namespace Server /// public virtual ApplyPoisonResult ApplyPoison( Mobile from, Poison poison ) { - if ( poison == null ) + if( poison == null ) { CurePoison( from ); return ApplyPoisonResult.Cured; } - if ( CheckHigherPoison( from, poison ) ) + if( CheckHigherPoison( from, poison ) ) { OnHigherPoison( from, poison ); return ApplyPoisonResult.HigherPoisonActive; } - if ( CheckPoisonImmunity( from, poison ) ) + if( CheckPoisonImmunity( from, poison ) ) { OnPoisonImmunity( from, poison ); return ApplyPoisonResult.Immune; @@ -8459,7 +8462,7 @@ namespace Server /// True if poison was cured, false if otherwise. public virtual bool CurePoison( Mobile from ) { - if ( CheckCure( from ) ) + if( CheckCure( from ) ) { Poison oldPoison = m_Poison; this.Poison = null; @@ -8495,7 +8498,7 @@ namespace Server { get { - return ( m_Poison != null ); + return (m_Poison != null); } } @@ -8504,7 +8507,7 @@ namespace Server { get { - return ( m_BodyMod.BodyID != 0 ); + return (m_BodyMod.BodyID != 0); } } @@ -8517,7 +8520,7 @@ namespace Server } set { - if ( m_BodyMod != value ) + if( m_BodyMod != value ) { m_BodyMod = value; @@ -8543,14 +8546,14 @@ namespace Server { get { - if ( IsBodyMod ) + if( IsBodyMod ) return m_BodyMod; return m_Body; } set { - if ( m_Body != value && !IsBodyMod ) + if( m_Body != value && !IsBodyMod ) { m_Body = SafeBody( value ); @@ -8566,10 +8569,10 @@ namespace Server { int delta = -1; - for ( int i = 0; delta < 0 && i < m_InvalidBodies.Length; ++i ) - delta = ( m_InvalidBodies[i] - body ); + for( int i = 0; delta < 0 && i < m_InvalidBodies.Length; ++i ) + delta = (m_InvalidBodies[i] - body); - if ( delta != 0 ) + if( delta != 0 ) return body; return 0; @@ -8646,8 +8649,8 @@ namespace Server { get { - if ( m_Region == null ) - if ( this.Map == null ) + if( m_Region == null ) + if( this.Map == null ) return Map.Internal.DefaultRegion; else return this.Map.DefaultRegion; @@ -8669,7 +8672,7 @@ namespace Server { get { - if ( m_RemovePacket == null ) + if( m_RemovePacket == null ) { m_RemovePacket = new RemoveMobile( this ); m_RemovePacket.SetStatic(); @@ -8685,7 +8688,7 @@ namespace Server { get { - if ( m_OPLPacket == null ) + if( m_OPLPacket == null ) { m_OPLPacket = new OPLInfo( PropertyList ); m_OPLPacket.SetStatic(); @@ -8701,7 +8704,7 @@ namespace Server { get { - if ( m_PropertyList == null ) + if( m_PropertyList == null ) { m_PropertyList = new ObjectPropertyList( this ); @@ -8723,16 +8726,16 @@ namespace Server public void InvalidateProperties() { - if ( !Core.AOS ) + if( !Core.AOS ) return; - if ( m_Map != null && m_Map != Map.Internal && !World.Loading ) + if( m_Map != null && m_Map != Map.Internal && !World.Loading ) { ObjectPropertyList oldList = m_PropertyList; Packet.Release( ref m_PropertyList ); ObjectPropertyList newList = PropertyList; - if ( oldList == null || oldList.Hash != newList.Hash ) + if( oldList == null || oldList.Hash != newList.Hash ) { Packet.Release( ref m_OPLPacket ); Delta( MobileDelta.Properties ); @@ -8750,15 +8753,15 @@ namespace Server public int SolidHueOverride { get { return m_SolidHueOverride; } - set { if ( m_SolidHueOverride == value ) return; m_SolidHueOverride = value; Delta( MobileDelta.Hue | MobileDelta.Body ); } + set { if( m_SolidHueOverride == value ) return; m_SolidHueOverride = value; Delta( MobileDelta.Hue | MobileDelta.Body ); } } public virtual void MoveToWorld( Point3D newLocation, Map map ) { - if ( m_Deleted ) + if( m_Deleted ) return; - if ( m_Map == map ) + if( m_Map == map ) { SetLocation( newLocation, true ); return; @@ -8766,7 +8769,7 @@ namespace Server BankBox box = FindBankNoCreate(); - if ( box != null && box.Opened ) + if( box != null && box.Opened ) box.Close(); Point3D oldLocation = m_Location; @@ -8774,7 +8777,7 @@ namespace Server Region oldRegion = m_Region; - if ( oldMap != null ) + if( oldMap != null ) { oldMap.OnLeave( this ); @@ -8782,7 +8785,7 @@ namespace Server SendRemovePacket(); } - for ( int i = 0; i < m_Items.Count; ++i ) + for( int i = 0; i < m_Items.Count; ++i ) m_Items[i].Map = map; m_Map = map; @@ -8791,13 +8794,13 @@ namespace Server NetState ns = m_NetState; - if ( m_Map != null ) + if( m_Map != null ) { m_Map.OnEnter( this ); UpdateRegion(); - if ( ns != null && m_Map != null ) + if( ns != null && m_Map != null ) { ns.Sequence = 0; ns.Send( new MapChange( this ) ); @@ -8812,9 +8815,9 @@ namespace Server UpdateRegion(); } - if ( ns != null ) + if( ns != null ) { - if ( m_Map != null ) + if( m_Map != null ) Send( new ServerChange( this, m_Map ) ); ns.Sequence = 0; @@ -8829,9 +8832,9 @@ namespace Server SendEverything(); SendIncomingPacket(); - if ( ns != null ) + if( ns != null ) { - m_NetState.Sequence = 0; + ns.Sequence = 0; ClearFastwalkStack(); Send( new MobileIncoming( this, this ) ); @@ -8843,33 +8846,34 @@ namespace Server OnMapChange( oldMap ); OnLocationChange( oldLocation ); - m_Region.OnLocationChanged( this, oldLocation ); + if( m_Region != null ) + m_Region.OnLocationChanged( this, oldLocation ); } public virtual void SetLocation( Point3D newLocation, bool isTeleport ) { - if ( m_Deleted ) + if( m_Deleted ) return; Point3D oldLocation = m_Location; - if ( oldLocation != newLocation ) + if( oldLocation != newLocation ) { m_Location = newLocation; UpdateRegion(); BankBox box = FindBankNoCreate(); - if ( box != null && box.Opened ) + if( box != null && box.Opened ) box.Close(); - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.ValidateAllTrades(); - if ( m_Map != null ) + if( m_Map != null ) m_Map.OnMove( oldLocation, this ); - if ( isTeleport && m_NetState != null ) + if( isTeleport && m_NetState != null ) { m_NetState.Sequence = 0; m_NetState.Send( new MobileUpdate( this ) ); @@ -8878,18 +8882,18 @@ namespace Server Map map = m_Map; - if ( map != null ) + if( map != null ) { // First, send a remove message to everyone who can no longer see us. (inOldRange && !inNewRange) Packet removeThis = null; IPooledEnumerable eable = map.GetClientsInRange( oldLocation ); - foreach ( NetState ns in eable ) + foreach( NetState ns in eable ) { - if ( ns != m_NetState && !Utility.InUpdateRange( newLocation, ns.Mobile.Location ) ) + if( ns != m_NetState && !Utility.InUpdateRange( newLocation, ns.Mobile.Location ) ) { - if ( removeThis == null ) + if( removeThis == null ) removeThis = this.RemovePacket; ns.Send( removeThis ); @@ -8901,40 +8905,40 @@ namespace Server NetState ourState = m_NetState; // Check to see if we are attached to a client - if ( ourState != null ) + if( ourState != null ) { eable = map.GetObjectsInRange( newLocation, Core.GlobalMaxUpdateRange ); // We are attached to a client, so it's a bit more complex. We need to send new items and people to ourself, and ourself to other clients - foreach ( object o in eable ) + foreach( object o in eable ) { - if ( o is Item ) + if( o is Item ) { - Item item = (Item) o; + Item item = (Item)o; int range = item.GetUpdateRange( this ); Point3D loc = item.Location; - if ( !Utility.InRange( oldLocation, loc, range ) && Utility.InRange( newLocation, loc, range ) && CanSee( item ) ) + if( !Utility.InRange( oldLocation, loc, range ) && Utility.InRange( newLocation, loc, range ) && CanSee( item ) ) item.SendInfoTo( ourState ); } - else if ( o != this && o is Mobile ) + else if( o != this && o is Mobile ) { - Mobile m = (Mobile) o; + Mobile m = (Mobile)o; - if ( !Utility.InUpdateRange( newLocation, m.m_Location ) ) + if( !Utility.InUpdateRange( newLocation, m.m_Location ) ) continue; bool inOldRange = Utility.InUpdateRange( oldLocation, m.m_Location ); - if ( ( isTeleport || !inOldRange ) && m.m_NetState != null && m.CanSee( this ) ) + if( (isTeleport || !inOldRange) && m.m_NetState != null && m.CanSee( this ) ) { m.m_NetState.Send( new MobileIncoming( m, this ) ); - if ( IsDeadBondedPet ) + if( IsDeadBondedPet ) m.m_NetState.Send( new BondedStatus( 0, m_Serial, 1 ) ); - if ( ObjectPropertyList.Enabled ) + if( ObjectPropertyList.Enabled ) { m.m_NetState.Send( OPLPacket ); @@ -8943,14 +8947,14 @@ namespace Server } } - if ( !inOldRange && CanSee( m ) ) + if( !inOldRange && CanSee( m ) ) { ourState.Send( new MobileIncoming( this, m ) ); - if ( m.IsDeadBondedPet ) + if( m.IsDeadBondedPet ) ourState.Send( new BondedStatus( 0, m.m_Serial, 1 ) ); - if ( ObjectPropertyList.Enabled ) + if( ObjectPropertyList.Enabled ) { ourState.Send( m.OPLPacket ); @@ -8968,16 +8972,16 @@ namespace Server eable = map.GetClientsInRange( newLocation ); // We're not attached to a client, so simply send an Incoming - foreach ( NetState ns in eable ) + foreach( NetState ns in eable ) { - if ( ( isTeleport || !Utility.InUpdateRange( oldLocation, ns.Mobile.Location ) ) && ns.Mobile.CanSee( this ) ) + if( (isTeleport || !Utility.InUpdateRange( oldLocation, ns.Mobile.Location )) && ns.Mobile.CanSee( this ) ) { ns.Send( new MobileIncoming( ns.Mobile, this ) ); - if ( IsDeadBondedPet ) + if( IsDeadBondedPet ) ns.Send( new BondedStatus( 0, m_Serial, 1 ) ); - if ( ObjectPropertyList.Enabled ) + if( ObjectPropertyList.Enabled ) { ns.Send( OPLPacket ); @@ -9015,8 +9019,8 @@ namespace Server { if( m_Hair == null ) return 0; - - return m_Hair.ItemID; + + return m_Hair.ItemID; } set { @@ -9031,18 +9035,18 @@ namespace Server } } -// [CommandProperty( AccessLevel.GameMaster )] -// public int HairSerial { get { return HairInfo.FakeSerial( this ); } } + // [CommandProperty( AccessLevel.GameMaster )] + // public int HairSerial { get { return HairInfo.FakeSerial( this ); } } [CommandProperty( AccessLevel.GameMaster )] public int FacialHairItemID { - get - { - if( m_FacialHair == null ) + get + { + if( m_FacialHair == null ) return 0; - - return m_FacialHair.ItemID; + + return m_FacialHair.ItemID; } set { @@ -9057,44 +9061,46 @@ namespace Server } } -// [CommandProperty( AccessLevel.GameMaster )] -// public int FacialHairSerial { get { return FacialHairInfo.FakeSerial( this ); } } + // [CommandProperty( AccessLevel.GameMaster )] + // public int FacialHairSerial { get { return FacialHairInfo.FakeSerial( this ); } } [CommandProperty( AccessLevel.GameMaster )] - public int HairHue { - get - { - if( m_Hair == null ) + public int HairHue + { + get + { + if( m_Hair == null ) return 0; - return m_Hair.Hue; - } + return m_Hair.Hue; + } set - { + { if( m_Hair != null ) - { - m_Hair.Hue = value; - Delta( MobileDelta.Hair ); - } - } + { + m_Hair.Hue = value; + Delta( MobileDelta.Hair ); + } + } } [CommandProperty( AccessLevel.GameMaster )] - public int FacialHairHue { - get - { - if( m_FacialHair == null ) + public int FacialHairHue + { + get + { + if( m_FacialHair == null ) return 0; - + return m_FacialHair.Hue; - } - set - { - if( m_FacialHair != null ) - { - m_FacialHair.Hue = value; + } + set + { + if( m_FacialHair != null ) + { + m_FacialHair.Hue = value; Delta( MobileDelta.FacialHair ); - } - } + } + } } public bool HasFreeHand() @@ -9111,18 +9117,18 @@ namespace Server { Item item = m_Weapon as Item; - if ( item != null && !item.Deleted && item.Parent == this && CanSee( item ) ) + if( item != null && !item.Deleted && item.Parent == this && CanSee( item ) ) return m_Weapon; m_Weapon = null; item = FindItemOnLayer( Layer.OneHanded ); - if ( item == null ) + if( item == null ) item = FindItemOnLayer( Layer.TwoHanded ); - if ( item is IWeapon ) - return ( m_Weapon = (IWeapon) item ); + if( item is IWeapon ) + return (m_Weapon = (IWeapon)item); else return GetDefaultWeapon(); } @@ -9140,12 +9146,12 @@ namespace Server { get { - if ( m_BankBox != null && !m_BankBox.Deleted && m_BankBox.Parent == this ) + if( m_BankBox != null && !m_BankBox.Deleted && m_BankBox.Parent == this ) return m_BankBox; m_BankBox = FindItemOnLayer( Layer.Bank ) as BankBox; - if ( m_BankBox == null ) + if( m_BankBox == null ) AddItem( m_BankBox = new BankBox( this ) ); return m_BankBox; @@ -9154,7 +9160,7 @@ namespace Server public BankBox FindBankNoCreate() { - if ( m_BankBox != null && !m_BankBox.Deleted && m_BankBox.Parent == this ) + if( m_BankBox != null && !m_BankBox.Deleted && m_BankBox.Parent == this ) return m_BankBox; m_BankBox = FindItemOnLayer( Layer.Bank ) as BankBox; @@ -9169,10 +9175,10 @@ namespace Server { get { - if ( m_Backpack != null && !m_Backpack.Deleted && m_Backpack.Parent == this ) + if( m_Backpack != null && !m_Backpack.Deleted && m_Backpack.Parent == this ) return m_Backpack; - return ( m_Backpack = ( FindItemOnLayer( Layer.Backpack ) as Container ) ); + return (m_Backpack = (FindItemOnLayer( Layer.Backpack ) as Container)); } } @@ -9183,11 +9189,11 @@ namespace Server List eq = m_Items; int count = eq.Count; - for ( int i = 0; i < count; ++i ) + for( int i = 0; i < count; ++i ) { Item item = eq[i]; - if ( !item.Deleted && item.Layer == layer ) + if( !item.Deleted && item.Layer == layer ) { return item; } @@ -9236,7 +9242,7 @@ namespace Server public void MovingParticles( IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes, int hue, int renderMode, int effect, int explodeEffect, int explodeSound, int unknown ) { - Effects.SendMovingParticles( this, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode, effect, explodeEffect, explodeSound, (EffectLayer) 255, unknown ); + Effects.SendMovingParticles( this, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode, effect, explodeEffect, explodeSound, (EffectLayer)255, unknown ); } public void MovingParticles( IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes, int effect, int explodeEffect, int explodeSound, int unknown ) @@ -9288,20 +9294,20 @@ namespace Server public void SendIncomingPacket() { - if ( m_Map != null ) + if( m_Map != null ) { IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location ); - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { - if ( state.Mobile.CanSee( this ) ) + if( state.Mobile.CanSee( this ) ) { state.Send( new MobileIncoming( state.Mobile, this ) ); - if ( IsDeadBondedPet ) + if( IsDeadBondedPet ) state.Send( new BondedStatus( 0, m_Serial, 1 ) ); - if ( ObjectPropertyList.Enabled ) + if( ObjectPropertyList.Enabled ) { state.Send( OPLPacket ); @@ -9317,7 +9323,7 @@ namespace Server public bool PlaceInBackpack( Item item ) { - if ( item.Deleted ) + if( item.Deleted ) return false; Container pack = this.Backpack; @@ -9327,15 +9333,15 @@ namespace Server public bool AddToBackpack( Item item ) { - if ( item.Deleted ) + if( item.Deleted ) return false; - if ( !PlaceInBackpack( item ) ) + if( !PlaceInBackpack( item ) ) { Point3D loc = m_Location; Map map = m_Map; - if ( ( map == null || map == Map.Internal ) && m_LogoutMap != null ) + if( (map == null || map == Map.Internal) && m_LogoutMap != null ) { loc = m_LogoutLocation; map = m_LogoutMap; @@ -9355,7 +9361,7 @@ namespace Server public virtual bool CheckNonlocalLift( Mobile from, Item item ) { - if ( from == this || ( from.AccessLevel > this.AccessLevel && from.AccessLevel >= AccessLevel.GameMaster ) ) + if( from == this || (from.AccessLevel > this.AccessLevel && from.AccessLevel >= AccessLevel.GameMaster) ) return true; return false; @@ -9365,7 +9371,7 @@ namespace Server { get { - if ( m_NetState != null ) + if( m_NetState != null ) return m_NetState.Trades.Count > 0; return false; @@ -9382,28 +9388,28 @@ namespace Server /// public virtual bool OnDragDrop( Mobile from, Item dropped ) { - if ( from == this ) + if( from == this ) { Container pack = this.Backpack; - if ( pack != null ) + if( pack != null ) return dropped.DropToItem( from, pack, new Point3D( -1, -1, 0 ) ); return false; } - else if ( from.Player && this.Player && from.Alive && this.Alive && from.InRange( Location, 2 ) ) + else if( from.Player && this.Player && from.Alive && this.Alive && from.InRange( Location, 2 ) ) { NetState ourState = m_NetState; NetState theirState = from.m_NetState; - if ( ourState != null && theirState != null ) + if( ourState != null && theirState != null ) { SecureTradeContainer cont = theirState.FindTradeContainer( this ); - if ( !from.CheckTrade( this, dropped, cont, true, true, 0, 0 ) ) + if( !from.CheckTrade( this, dropped, cont, true, true, 0, 0 ) ) return false; - if ( cont == null ) + if( cont == null ) cont = theirState.AddTrade( ourState ); cont.DropItem( dropped ); @@ -9421,8 +9427,8 @@ namespace Server public virtual bool CheckEquip( Item item ) { - for ( int i = 0; i < m_Items.Count; ++i ) - if ( m_Items[i].CheckConflictingLayer( this, item, item.Layer ) || item.CheckConflictingLayer( this, m_Items[i], m_Items[i].Layer ) ) + for( int i = 0; i < m_Items.Count; ++i ) + if( m_Items[i].CheckConflictingLayer( this, item, item.Layer ) || item.CheckConflictingLayer( this, m_Items[i], m_Items[i].Layer ) ) return false; return true; @@ -9515,7 +9521,7 @@ namespace Server public virtual bool CheckNonlocalDrop( Mobile from, Item item, Item target ) { - if ( from == this || ( from.AccessLevel > this.AccessLevel && from.AccessLevel >= AccessLevel.GameMaster ) ) + if( from == this || (from.AccessLevel > this.AccessLevel && from.AccessLevel >= AccessLevel.GameMaster) ) return true; return false; @@ -9541,17 +9547,17 @@ namespace Server public virtual bool AllowEquipFrom( Mobile mob ) { - return ( mob == this || ( mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > this.AccessLevel ) ); + return (mob == this || (mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > this.AccessLevel)); } public virtual bool EquipItem( Item item ) { - if ( item == null || item.Deleted || !item.CanEquip( this ) ) + if( item == null || item.Deleted || !item.CanEquip( this ) ) return false; - if ( CheckEquip( item ) && OnEquip( item ) && item.OnEquip( this ) ) + if( CheckEquip( item ) && OnEquip( item ) && item.OnEquip( this ) ) { - if ( m_Spell != null && !m_Spell.OnCasterEquiping( item ) ) + if( m_Spell != null && !m_Spell.OnCasterEquiping( item ) ) return false; //if ( m_Spell != null && m_Spell.State == SpellState.Casting ) @@ -9578,7 +9584,7 @@ namespace Server Type ourType = this.GetType(); m_TypeRef = World.m_MobileTypes.IndexOf( ourType ); - if ( m_TypeRef == -1 ) + if( m_TypeRef == -1 ) { World.m_MobileTypes.Add( ourType ); m_TypeRef = World.m_MobileTypes.Count - 1; @@ -9597,7 +9603,7 @@ namespace Server Type ourType = this.GetType(); m_TypeRef = World.m_MobileTypes.IndexOf( ourType ); - if ( m_TypeRef == -1 ) + if( m_TypeRef == -1 ) { World.m_MobileTypes.Add( ourType ); m_TypeRef = World.m_MobileTypes.Count - 1; @@ -9631,12 +9637,12 @@ namespace Server public virtual void Delta( MobileDelta flag ) { - if ( m_Map == null || m_Map == Map.Internal || m_Deleted ) + if( m_Map == null || m_Map == Map.Internal || m_Deleted ) return; m_DeltaFlags |= flag; - if ( !m_InDeltaQueue ) + if( !m_InDeltaQueue ) { m_InDeltaQueue = true; @@ -9651,23 +9657,23 @@ namespace Server int dx = m_Location.m_X - x; int dy = m_Location.m_Y - y; - int rx = ( dx - dy ) * 44; - int ry = ( dx + dy ) * 44; + int rx = (dx - dy) * 44; + int ry = (dx + dy) * 44; int ax = Math.Abs( rx ); int ay = Math.Abs( ry ); Direction ret; - if ( ( ( ay >> 1 ) - ax ) >= 0 ) - ret = ( ry > 0 ) ? Direction.Up : Direction.Down; - else if ( ( ( ax >> 1 ) - ay ) >= 0 ) - ret = ( rx > 0 ) ? Direction.Left : Direction.Right; - else if ( rx >= 0 && ry >= 0 ) + if( ((ay >> 1) - ax) >= 0 ) + ret = (ry > 0) ? Direction.Up : Direction.Down; + else if( ((ax >> 1) - ay) >= 0 ) + ret = (rx > 0) ? Direction.Left : Direction.Right; + else if( rx >= 0 && ry >= 0 ) ret = Direction.West; - else if ( rx >= 0 && ry < 0 ) + else if( rx >= 0 && ry < 0 ) ret = Direction.South; - else if ( rx < 0 && ry < 0 ) + else if( rx < 0 && ry < 0 ) ret = Direction.East; else ret = Direction.North; @@ -9687,7 +9693,7 @@ namespace Server public Direction GetDirectionTo( IPoint2D p ) { - if ( p == null ) + if( p == null ) return Direction.North; return GetDirectionTo( p.X, p.Y ); @@ -9700,7 +9706,7 @@ namespace Server delta = m.m_DeltaFlags; - if ( delta == MobileDelta.None ) + if( delta == MobileDelta.None ) return; MobileDelta attrs = delta & MobileDelta.Attributes; @@ -9713,45 +9719,45 @@ namespace Server bool sendUpdate = false, sendRemove = false; bool sendPublicStats = false, sendPrivateStats = false; bool sendMoving = false, sendNonlocalMoving = false; - bool sendOPLUpdate = Core.AOS && ( delta & MobileDelta.Properties ) != 0; + bool sendOPLUpdate = Core.AOS && (delta & MobileDelta.Properties) != 0; bool sendHair = false, sendFacialHair = false, removeHair = false, removeFacialHair = false; - if ( attrs != MobileDelta.None ) + if( attrs != MobileDelta.None ) { sendAny = true; - if ( attrs == MobileDelta.Attributes ) + if( attrs == MobileDelta.Attributes ) { sendAll = true; } else { - sendHits = ( ( attrs & MobileDelta.Hits ) != 0 ); - sendStam = ( ( attrs & MobileDelta.Stam ) != 0 ); - sendMana = ( ( attrs & MobileDelta.Mana ) != 0 ); + sendHits = ((attrs & MobileDelta.Hits) != 0); + sendStam = ((attrs & MobileDelta.Stam) != 0); + sendMana = ((attrs & MobileDelta.Mana) != 0); } } - if ( ( delta & MobileDelta.GhostUpdate ) != 0 ) + if( (delta & MobileDelta.GhostUpdate) != 0 ) { sendNonlocalIncoming = true; } - if ( ( delta & MobileDelta.Hue ) != 0 ) + if( (delta & MobileDelta.Hue) != 0 ) { sendNonlocalIncoming = true; sendUpdate = true; sendRemove = true; } - if ( ( delta & MobileDelta.Direction ) != 0 ) + if( (delta & MobileDelta.Direction) != 0 ) { sendNonlocalMoving = true; sendUpdate = true; } - if ( ( delta & MobileDelta.Body ) != 0 ) + if( (delta & MobileDelta.Body) != 0 ) { sendUpdate = true; sendIncoming = true; @@ -9768,12 +9774,12 @@ namespace Server sendUpdate = true; } else*/ - if ( ( delta & ( MobileDelta.Flags | MobileDelta.Noto ) ) != 0 ) + if( (delta & (MobileDelta.Flags | MobileDelta.Noto)) != 0 ) { sendMoving = true; } - if ( ( delta & MobileDelta.Name ) != 0 ) + if( (delta & MobileDelta.Name) != 0 ) { sendAll = false; sendHits = false; @@ -9781,14 +9787,14 @@ namespace Server sendPublicStats = true; } - if ( ( delta & ( MobileDelta.WeaponDamage | MobileDelta.Resistances | MobileDelta.Stat | MobileDelta.Weight | MobileDelta.Gold | MobileDelta.Armor | MobileDelta.StatCap | MobileDelta.Followers | MobileDelta.TithingPoints | MobileDelta.Race ) ) != 0 ) + if( (delta & (MobileDelta.WeaponDamage | MobileDelta.Resistances | MobileDelta.Stat | MobileDelta.Weight | MobileDelta.Gold | MobileDelta.Armor | MobileDelta.StatCap | MobileDelta.Followers | MobileDelta.TithingPoints | MobileDelta.Race)) != 0 ) { sendPrivateStats = true; } if( (delta & MobileDelta.Hair) != 0 ) { - if ( m.HairItemID <= 0 ) + if( m.HairItemID <= 0 ) removeHair = true; sendHair = true; @@ -9796,7 +9802,7 @@ namespace Server if( (delta & MobileDelta.FacialHair) != 0 ) { - if ( m.FacialHairItemID <= 0 ) + if( m.FacialHairItemID <= 0 ) removeFacialHair = true; sendFacialHair = true; @@ -9804,60 +9810,60 @@ namespace Server Packet[] cache = m_MovingPacketCache; - if ( sendMoving || sendNonlocalMoving ) + if( sendMoving || sendNonlocalMoving ) { - for ( int i = 0; i < cache.Length; ++i ) + for( int i = 0; i < cache.Length; ++i ) Packet.Release( ref cache[i] ); } NetState ourState = m.m_NetState; - if ( ourState != null ) + if( ourState != null ) { - if ( sendUpdate ) + if( sendUpdate ) { ourState.Sequence = 0; ourState.Send( new MobileUpdate( m ) ); ClearFastwalkStack(); } - if ( sendIncoming ) + if( sendIncoming ) ourState.Send( new MobileIncoming( m, m ) ); - if ( sendMoving ) + if( sendMoving ) { int noto = Notoriety.Compute( m, m ); ourState.Send( cache[noto] = Packet.Acquire( new MobileMoving( m, noto ) ) ); } - if ( sendPublicStats || sendPrivateStats ) + if( sendPublicStats || sendPrivateStats ) { ourState.Send( new MobileStatusExtended( m ) ); } - else if ( sendAll ) + else if( sendAll ) { ourState.Send( new MobileAttributes( m ) ); } - else if ( sendAny ) + else if( sendAny ) { - if ( sendHits ) + if( sendHits ) ourState.Send( new MobileHits( m ) ); - if ( sendStam ) + if( sendStam ) ourState.Send( new MobileStam( m ) ); - if ( sendMana ) + if( sendMana ) ourState.Send( new MobileMana( m ) ); } - if ( sendStam || sendMana ) + if( sendStam || sendMana ) { IParty ip = m_Party as IParty; - if ( ip != null && sendStam ) + if( ip != null && sendStam ) ip.OnStamChanged( this ); - if ( ip != null && sendMana ) + if( ip != null && sendMana ) ip.OnManaChanged( this ); } @@ -9877,7 +9883,7 @@ namespace Server ourState.Send( new FacialHairEquipUpdate( m ) ); } - if ( sendOPLUpdate ) + if( sendOPLUpdate ) ourState.Send( OPLPacket ); } @@ -9885,7 +9891,7 @@ namespace Server sendIncoming = sendIncoming || sendNonlocalIncoming; sendHits = sendHits || sendAll; - if( m.m_Map != null && (sendRemove || sendIncoming || sendPublicStats || sendHits || sendMoving || sendOPLUpdate || sendHair || sendFacialHair ) ) + if( m.m_Map != null && (sendRemove || sendIncoming || sendPublicStats || sendHits || sendMoving || sendOPLUpdate || sendHair || sendFacialHair) ) { Mobile beholder; @@ -9896,60 +9902,60 @@ namespace Server Packet deadPacket = null; Packet hairPacket = null, facialhairPacket = null; - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { beholder = state.Mobile; - if ( beholder != m && beholder.CanSee( m ) ) + if( beholder != m && beholder.CanSee( m ) ) { - if ( sendRemove ) + if( sendRemove ) state.Send( m.RemovePacket ); - if ( sendIncoming ) + if( sendIncoming ) { state.Send( new MobileIncoming( beholder, m ) ); - if ( m.IsDeadBondedPet ) + if( m.IsDeadBondedPet ) { - if ( deadPacket == null ) + if( deadPacket == null ) deadPacket = Packet.Acquire( new BondedStatus( 0, m.m_Serial, 1 ) ); state.Send( deadPacket ); } } - if ( sendMoving ) + if( sendMoving ) { int noto = Notoriety.Compute( beholder, m ); Packet p = cache[noto]; - if ( p == null ) + if( p == null ) cache[noto] = p = Packet.Acquire( new MobileMoving( m, noto ) ); state.Send( p ); } - if ( sendPublicStats ) + if( sendPublicStats ) { - if ( m.CanBeRenamedBy( beholder ) ) + if( m.CanBeRenamedBy( beholder ) ) { - if ( statPacketTrue == null ) + if( statPacketTrue == null ) statPacketTrue = Packet.Acquire( new MobileStatusCompact( true, m ) ); state.Send( statPacketTrue ); } else { - if ( statPacketFalse == null ) + if( statPacketFalse == null ) statPacketFalse = Packet.Acquire( new MobileStatusCompact( false, m ) ); state.Send( statPacketFalse ); } } - else if ( sendHits ) + else if( sendHits ) { - if ( hitsPacket == null ) + if( hitsPacket == null ) hitsPacket = Packet.Acquire( new MobileHitsN( m ) ); state.Send( hitsPacket ); @@ -9981,7 +9987,7 @@ namespace Server state.Send( facialhairPacket ); } - if ( sendOPLUpdate ) + if( sendOPLUpdate ) state.Send( OPLPacket ); } } @@ -9991,14 +9997,14 @@ namespace Server Packet.Release( statPacketFalse ); Packet.Release( deadPacket ); Packet.Release( hairPacket ); - Packet.Release( facialhairPacket ); + Packet.Release( facialhairPacket ); eable.Free(); } - if ( sendMoving || sendNonlocalMoving ) + if( sendMoving || sendNonlocalMoving ) { - for ( int i = 0; i < cache.Length; ++i ) + for( int i = 0; i < cache.Length; ++i ) Packet.Release( ref cache[i] ); } } @@ -10008,7 +10014,7 @@ namespace Server int count = m_DeltaQueue.Count; int index = 0; - while ( m_DeltaQueue.Count > 0 && index++ < count ) + while( m_DeltaQueue.Count > 0 && index++ < count ) (m_DeltaQueue.Dequeue()).ProcessDelta(); } @@ -10023,14 +10029,14 @@ namespace Server { int oldValue = m_Kills; - if ( m_Kills != value ) + if( m_Kills != value ) { m_Kills = value; - if ( m_Kills < 0 ) + if( m_Kills < 0 ) m_Kills = 0; - if ( ( oldValue >= 5 ) != ( m_Kills >= 5 ) ) + if( (oldValue >= 5) != (m_Kills >= 5) ) { Delta( MobileDelta.Noto ); InvalidateProperties(); @@ -10054,11 +10060,11 @@ namespace Server } set { - if ( m_ShortTermMurders != value ) + if( m_ShortTermMurders != value ) { m_ShortTermMurders = value; - if ( m_ShortTermMurders < 0 ) + if( m_ShortTermMurders < 0 ) m_ShortTermMurders = 0; } } @@ -10073,23 +10079,23 @@ namespace Server } set { - if ( m_Criminal != value ) + if( m_Criminal != value ) { m_Criminal = value; Delta( MobileDelta.Noto ); InvalidateProperties(); } - if ( m_Criminal ) + if( m_Criminal ) { - if ( m_ExpireCriminal == null ) + if( m_ExpireCriminal == null ) m_ExpireCriminal = new ExpireCriminalTimer( this ); else m_ExpireCriminal.Stop(); m_ExpireCriminal.Start(); } - else if ( m_ExpireCriminal != null ) + else if( m_ExpireCriminal != null ) { m_ExpireCriminal.Stop(); m_ExpireCriminal = null; @@ -10104,9 +10110,9 @@ namespace Server public bool CheckAlive( bool message ) { - if ( !Alive ) + if( !Alive ) { - if ( message ) + if( message ) this.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019048 ); // I am dead and cannot do that. return false; @@ -10126,19 +10132,19 @@ namespace Server public void PublicOverheadMessage( MessageType type, int hue, bool ascii, string text, bool noLineOfSight ) { - if ( m_Map != null ) + if( m_Map != null ) { Packet p = null; IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location ); - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { - if ( state.Mobile.CanSee( this ) && ( noLineOfSight || state.Mobile.InLOS( this ) ) ) + if( state.Mobile.CanSee( this ) && (noLineOfSight || state.Mobile.InLOS( this )) ) { - if ( p == null ) + if( p == null ) { - if ( ascii ) + if( ascii ) p = new AsciiMessage( m_Serial, Body, type, hue, 3, Name, text ); else p = new UnicodeMessage( m_Serial, Body, type, hue, 3, m_Language, Name, text ); @@ -10168,17 +10174,17 @@ namespace Server public void PublicOverheadMessage( MessageType type, int hue, int number, string args, bool noLineOfSight ) { - if ( m_Map != null ) + if( m_Map != null ) { Packet p = null; IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location ); - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { - if ( state.Mobile.CanSee( this ) && ( noLineOfSight || state.Mobile.InLOS( this ) ) ) + if( state.Mobile.CanSee( this ) && (noLineOfSight || state.Mobile.InLOS( this )) ) { - if ( p == null ) + if( p == null ) p = Packet.Acquire( new MessageLocalized( m_Serial, Body, type, hue, 3, number, Name, args ) ); state.Send( p ); @@ -10198,17 +10204,17 @@ namespace Server public void PublicOverheadMessage( MessageType type, int hue, int number, AffixType affixType, string affix, string args, bool noLineOfSight ) { - if ( m_Map != null ) + if( m_Map != null ) { Packet p = null; IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location ); - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { - if ( state.Mobile.CanSee( this ) && ( noLineOfSight || state.Mobile.InLOS( this ) ) ) + if( state.Mobile.CanSee( this ) && (noLineOfSight || state.Mobile.InLOS( this )) ) { - if ( p == null ) + if( p == null ) p = Packet.Acquire( new MessageLocalizedAffix( m_Serial, Body, type, hue, 3, number, Name, affixType, affix, args ) ); state.Send( p ); @@ -10223,10 +10229,10 @@ namespace Server public void PrivateOverheadMessage( MessageType type, int hue, bool ascii, string text, NetState state ) { - if ( state == null ) + if( state == null ) return; - if ( ascii ) + if( ascii ) state.Send( new AsciiMessage( m_Serial, Body, type, hue, 3, Name, text ) ); else state.Send( new UnicodeMessage( m_Serial, Body, type, hue, 3, m_Language, Name, text ) ); @@ -10239,7 +10245,7 @@ namespace Server public void PrivateOverheadMessage( MessageType type, int hue, int number, string args, NetState state ) { - if ( state == null ) + if( state == null ) return; state.Send( new MessageLocalized( m_Serial, Body, type, hue, 3, number, Name, args ) ); @@ -10249,9 +10255,9 @@ namespace Server { NetState ns = m_NetState; - if ( ns != null ) + if( ns != null ) { - if ( ascii ) + if( ascii ) ns.Send( new AsciiMessage( m_Serial, Body, type, hue, 3, Name, text ) ); else ns.Send( new UnicodeMessage( m_Serial, Body, type, hue, 3, m_Language, Name, text ) ); @@ -10267,7 +10273,7 @@ namespace Server { NetState ns = m_NetState; - if ( ns != null ) + if( ns != null ) ns.Send( new MessageLocalized( m_Serial, Body, type, hue, 3, number, Name, args ) ); } @@ -10278,17 +10284,17 @@ namespace Server public void NonlocalOverheadMessage( MessageType type, int hue, int number, string args ) { - if ( m_Map != null ) + if( m_Map != null ) { Packet p = null; IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location ); - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { - if ( state != m_NetState && state.Mobile.CanSee( this ) ) + if( state != m_NetState && state.Mobile.CanSee( this ) ) { - if ( p == null ) + if( p == null ) p = Packet.Acquire( new MessageLocalized( m_Serial, Body, type, hue, 3, number, Name, args ) ); state.Send( p ); @@ -10303,19 +10309,19 @@ namespace Server public void NonlocalOverheadMessage( MessageType type, int hue, bool ascii, string text ) { - if ( m_Map != null ) + if( m_Map != null ) { Packet p = null; IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location ); - foreach ( NetState state in eable ) + foreach( NetState state in eable ) { - if ( state != m_NetState && state.Mobile.CanSee( this ) ) + if( state != m_NetState && state.Mobile.CanSee( this ) ) { - if ( p == null ) + if( p == null ) { - if ( ascii ) + if( ascii ) p = new AsciiMessage( m_Serial, Body, type, hue, 3, Name, text ); else p = new UnicodeMessage( m_Serial, Body, type, hue, 3, Language, Name, text ); @@ -10341,7 +10347,7 @@ namespace Server { NetState ns = m_NetState; - if ( ns != null ) + if( ns != null ) ns.Send( MessageLocalized.InstantiateGeneric( number ) ); } @@ -10352,18 +10358,18 @@ namespace Server public void SendLocalizedMessage( int number, string args, int hue ) { - if ( hue == 0x3B2 && ( args == null || args.Length == 0 ) ) + if( hue == 0x3B2 && (args == null || args.Length == 0) ) { NetState ns = m_NetState; - if ( ns != null ) + if( ns != null ) ns.Send( MessageLocalized.InstantiateGeneric( number ) ); } else { NetState ns = m_NetState; - if ( ns != null ) + if( ns != null ) ns.Send( new MessageLocalized( Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System", args ) ); } } @@ -10382,15 +10388,15 @@ namespace Server { NetState ns = m_NetState; - if ( ns != null ) - ns.Send( new MessageLocalizedAffix( Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System", ( append ? AffixType.Append : AffixType.Prepend ) | AffixType.System, affix, args ) ); + if( ns != null ) + ns.Send( new MessageLocalizedAffix( Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System", (append ? AffixType.Append : AffixType.Prepend) | AffixType.System, affix, args ) ); } #endregion public void LaunchBrowser( string url ) { - if ( m_NetState != null ) + if( m_NetState != null ) m_NetState.LaunchBrowser( url ); } @@ -10410,7 +10416,7 @@ namespace Server { NetState ns = m_NetState; - if ( ns != null ) + if( ns != null ) ns.Send( new UnicodeMessage( Serial.MinusOne, -1, MessageType.Regular, hue, 3, "ENU", "System", text ) ); } @@ -10433,7 +10439,7 @@ namespace Server { NetState ns = m_NetState; - if ( ns != null ) + if( ns != null ) ns.Send( new AsciiMessage( Serial.MinusOne, -1, MessageType.Regular, hue, 3, "System", text ) ); } @@ -10446,26 +10452,26 @@ namespace Server public bool InRange( Point2D p, int range ) { - return ( p.m_X >= ( m_Location.m_X - range ) ) - && ( p.m_X <= ( m_Location.m_X + range ) ) - && ( p.m_Y >= ( m_Location.m_Y - range ) ) - && ( p.m_Y <= ( m_Location.m_Y + range ) ); + return (p.m_X >= (m_Location.m_X - range)) + && (p.m_X <= (m_Location.m_X + range)) + && (p.m_Y >= (m_Location.m_Y - range)) + && (p.m_Y <= (m_Location.m_Y + range)); } public bool InRange( Point3D p, int range ) { - return ( p.m_X >= ( m_Location.m_X - range ) ) - && ( p.m_X <= ( m_Location.m_X + range ) ) - && ( p.m_Y >= ( m_Location.m_Y - range ) ) - && ( p.m_Y <= ( m_Location.m_Y + range ) ); + return (p.m_X >= (m_Location.m_X - range)) + && (p.m_X <= (m_Location.m_X + range)) + && (p.m_Y >= (m_Location.m_Y - range)) + && (p.m_Y <= (m_Location.m_Y + range)); } public bool InRange( IPoint2D p, int range ) { - return ( p.X >= ( m_Location.m_X - range ) ) - && ( p.X <= ( m_Location.m_X + range ) ) - && ( p.Y >= ( m_Location.m_Y - range ) ) - && ( p.Y <= ( m_Location.m_Y + range ) ); + return (p.X >= (m_Location.m_X - range)) + && (p.X <= (m_Location.m_X + range)) + && (p.Y >= (m_Location.m_Y - range)) + && (p.Y <= (m_Location.m_Y + range)); } public void InitStats( int str, int dex, int intel ) @@ -10497,18 +10503,18 @@ namespace Server /// public virtual void OnDoubleClick( Mobile from ) { - if ( this == from && ( !m_DisableDismountInWarmode || !m_Warmode ) ) + if( this == from && (!m_DisableDismountInWarmode || !m_Warmode) ) { IMount mount = Mount; - if ( mount != null ) + if( mount != null ) { mount.Rider = null; return; } } - if ( CanPaperdollBeOpenedBy( from ) ) + if( CanPaperdollBeOpenedBy( from ) ) DisplayPaperdollTo( from ); } @@ -10534,7 +10540,7 @@ namespace Server /// public virtual void OnDoubleClickDead( Mobile from ) { - if ( CanPaperdollBeOpenedBy( from ) ) + if( CanPaperdollBeOpenedBy( from ) ) DisplayPaperdollTo( from ); } @@ -10543,7 +10549,7 @@ namespace Server /// public virtual void OnPaperdollRequest() { - if ( CanPaperdollBeOpenedBy( this ) ) + if( CanPaperdollBeOpenedBy( this ) ) DisplayPaperdollTo( this ); } @@ -10557,15 +10563,15 @@ namespace Server /// public virtual void OnStatsQuery( Mobile from ) { - if ( from.Map == this.Map && Utility.InUpdateRange( this, from ) && from.CanSee( this ) ) + if( from.Map == this.Map && Utility.InUpdateRange( this, from ) && from.CanSee( this ) ) from.Send( new MobileStatus( from, this ) ); - if ( from == this ) + if( from == this ) Send( new StatLockInfo( this ) ); IParty ip = m_Party as IParty; - if ( ip != null ) + if( ip != null ) ip.OnStatsQuery( from, this ); } @@ -10574,7 +10580,7 @@ namespace Server /// public virtual void OnSkillsQuery( Mobile from ) { - if ( from == this ) + if( from == this ) Send( new SkillUpdate( m_Skills ) ); } @@ -10594,11 +10600,11 @@ namespace Server { IMountItem mountItem = null; - if ( m_MountItem != null && !m_MountItem.Deleted && m_MountItem.Parent == this ) - mountItem = (IMountItem) m_MountItem; + if( m_MountItem != null && !m_MountItem.Deleted && m_MountItem.Parent == this ) + mountItem = (IMountItem)m_MountItem; - if ( mountItem == null ) - m_MountItem = ( mountItem = ( FindItemOnLayer( Layer.Mount ) as IMountItem ) ) as Item; + if( mountItem == null ) + m_MountItem = (mountItem = (FindItemOnLayer( Layer.Mount ) as IMountItem)) as Item; return mountItem == null ? null : mountItem.Mount; } @@ -10609,7 +10615,7 @@ namespace Server { get { - return ( Mount != null ); + return (Mount != null); } } @@ -10623,9 +10629,9 @@ namespace Server } set { - if ( m_QuestArrow != value ) + if( m_QuestArrow != value ) { - if ( m_QuestArrow != null ) + if( m_QuestArrow != null ) m_QuestArrow.Stop(); m_QuestArrow = value; @@ -10662,27 +10668,27 @@ namespace Server /// public virtual void OnSingleClick( Mobile from ) { - if ( m_Deleted ) + if( m_Deleted ) return; - else if ( AccessLevel == AccessLevel.Player && DisableHiddenSelfClick && Hidden && from == this ) + else if( AccessLevel == AccessLevel.Player && DisableHiddenSelfClick && Hidden && from == this ) return; - if ( m_GuildClickMessage ) + if( m_GuildClickMessage ) { BaseGuild guild = m_Guild; - if ( guild != null && ( m_DisplayGuildTitle || ( m_Player && guild.Type != GuildType.Regular ) ) ) + if( guild != null && (m_DisplayGuildTitle || (m_Player && guild.Type != GuildType.Regular)) ) { string title = GuildTitle; string type; - if ( title == null ) + if( title == null ) title = ""; else title = title.Trim(); - if ( guild.Type >= 0 && (int) guild.Type < m_GuildTypes.Length ) - type = m_GuildTypes[(int) guild.Type]; + if( guild.Type >= 0 && (int)guild.Type < m_GuildTypes.Length ) + type = m_GuildTypes[(int)guild.Type]; else type = ""; @@ -10694,37 +10700,37 @@ namespace Server int hue; - if ( m_NameHue != -1 ) + if( m_NameHue != -1 ) hue = m_NameHue; - else if ( AccessLevel > AccessLevel.Player ) + else if( AccessLevel > AccessLevel.Player ) hue = 11; else hue = Notoriety.GetHue( Notoriety.Compute( from, this ) ); string name = Name; - if ( name == null ) + if( name == null ) name = String.Empty; string prefix = ""; - if ( ShowFameTitle && ( m_Player || m_Body.IsHuman ) && m_Fame >= 10000 ) - prefix = ( m_Female ? "Lady" : "Lord" ); + if( ShowFameTitle && (m_Player || m_Body.IsHuman) && m_Fame >= 10000 ) + prefix = (m_Female ? "Lady" : "Lord"); string suffix = ""; - if ( ClickTitle && Title != null && Title.Length > 0 ) + if( ClickTitle && Title != null && Title.Length > 0 ) suffix = Title; suffix = ApplyNameSuffix( suffix ); string val; - if ( prefix.Length > 0 && suffix.Length > 0 ) + if( prefix.Length > 0 && suffix.Length > 0 ) val = String.Concat( prefix, " ", name, " ", suffix ); - else if ( prefix.Length > 0 ) + else if( prefix.Length > 0 ) val = String.Concat( prefix, " ", name ); - else if ( suffix.Length > 0 ) + else if( suffix.Length > 0 ) val = String.Concat( name, " ", suffix ); else val = name; @@ -10734,7 +10740,7 @@ namespace Server public bool CheckSkill( SkillName skill, double minSkill, double maxSkill ) { - if ( m_SkillCheckLocationHandler == null ) + if( m_SkillCheckLocationHandler == null ) return false; else return m_SkillCheckLocationHandler( this, skill, minSkill, maxSkill ); @@ -10742,7 +10748,7 @@ namespace Server public bool CheckSkill( SkillName skill, double chance ) { - if ( m_SkillCheckDirectLocationHandler == null ) + if( m_SkillCheckDirectLocationHandler == null ) return false; else return m_SkillCheckDirectLocationHandler( this, skill, chance ); @@ -10750,7 +10756,7 @@ namespace Server public bool CheckTargetSkill( SkillName skill, object target, double minSkill, double maxSkill ) { - if ( m_SkillCheckTargetHandler == null ) + if( m_SkillCheckTargetHandler == null ) return false; else return m_SkillCheckTargetHandler( this, skill, target, minSkill, maxSkill ); @@ -10758,7 +10764,7 @@ namespace Server public bool CheckTargetSkill( SkillName skill, object target, double chance ) { - if ( m_SkillCheckDirectTargetHandler == null ) + if( m_SkillCheckDirectTargetHandler == null ) return false; else return m_SkillCheckDirectTargetHandler( this, skill, target, chance ); @@ -10766,7 +10772,7 @@ namespace Server public virtual void DisruptiveAction() { - if ( Meditating ) + if( Meditating ) { Meditating = false; SendLocalizedMessage( 500134 ); // You stop meditating. @@ -10820,7 +10826,7 @@ namespace Server { Item ar = FindItemOnLayer( Layer.InnerLegs ) as Item; - if ( ar == null ) + if( ar == null ) ar = FindItemOnLayer( Layer.Pants ) as Item; return ar; @@ -10833,7 +10839,7 @@ namespace Server { Item ar = FindItemOnLayer( Layer.InnerTorso ) as Item; - if ( ar == null ) + if( ar == null ) ar = FindItemOnLayer( Layer.Shirt ) as Item; return ar; @@ -10861,7 +10867,7 @@ namespace Server } set { - if ( m_StatCap != value ) + if( m_StatCap != value ) { m_StatCap = value; diff --git a/Server/Skills.cs b/Server/Skills.cs index c40cd9ab2..d992a19a8 100644 --- a/Server/Skills.cs +++ b/Server/Skills.cs @@ -364,9 +364,6 @@ namespace Server if( raceBonus > value ) value = raceBonus; - - if ( value > Cap ) //The offchance someone sets their Cap lower than the racial skill bonus - value = Cap; return value; }