From 35c06c09fd48509c30d78174e2b517d910734f5a Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 21 Sep 2019 12:11:16 -0400 Subject: [PATCH] Some refactoring of code. and some cleanups --- .../Framework/Algorithms/DepthFirstSearch.cs | 2 - .../Algorithms/DijkstraShortestPath.cs | 1 - .../Collections/IndexMinPriorityQueue.cs | 2 - Source/Framework/Networking/NetworkThread.cs | 1 - Source/Framework/Realm/RealmManager.cs | 1 - .../RecastDetour/Detour/DetourNavMeshQuery.cs | 1 - Source/Framework/Util/Extensions.cs | 2 - Source/Game/AI/AISelector.cs | 2 +- Source/Game/AI/CoreAI/CreatureAI.cs | 2 +- Source/Game/AI/CoreAI/GuardAI.cs | 2 +- Source/Game/AI/CoreAI/PassiveAI.cs | 2 +- Source/Game/AI/CoreAI/PetAI.cs | 10 +- Source/Game/AI/CoreAI/TotemAI.cs | 2 +- Source/Game/AI/CoreAI/UnitAI.cs | 14 +- Source/Game/AI/PlayerAI/PlayerAI.cs | 4 +- Source/Game/AI/ScriptedAI/ScriptedAI.cs | 4 +- Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs | 10 +- .../Game/AI/ScriptedAI/ScriptedFollowerAI.cs | 2 +- Source/Game/AI/SmartScripts/SmartAI.cs | 5 +- Source/Game/AI/SmartScripts/SmartScript.cs | 6 +- .../Game/Achievements/AchievementManager.cs | 2 +- Source/Game/Achievements/CriteriaHandler.cs | 8 +- Source/Game/BattleFields/BattleField.cs | 11 +- Source/Game/BattleFields/Zones/WinterGrasp.cs | 2 +- Source/Game/BattleGrounds/BattleGround.cs | 12 +- .../Game/BattleGrounds/BattleGroundManager.cs | 2 +- Source/Game/BlackMarket/BlackMarketManager.cs | 1 - Source/Game/Cache/CharacterCache.cs | 1 - Source/Game/Calendar/CalendarManager.cs | 4 +- Source/Game/Chat/Channels/Channel.cs | 8 +- .../Game/Chat/Commands/CharacterCommands.cs | 4 +- Source/Game/Chat/Commands/CheatCommands.cs | 4 +- Source/Game/Chat/Commands/DebugCommands.cs | 10 +- Source/Game/Chat/Commands/GMCommands.cs | 4 +- Source/Game/Chat/Commands/LearnCommands.cs | 2 +- Source/Game/Chat/Commands/MessageCommands.cs | 2 +- Source/Game/Chat/Commands/MiscCommands.cs | 6 +- Source/Game/Chat/Commands/NPCCommands.cs | 10 +- Source/Game/Chat/Commands/PetCommands.cs | 20 +- Source/Game/Chat/Commands/ResetCommands.cs | 4 +- Source/Game/Chat/Commands/SceneCommands.cs | 1 - .../Collision/BoundingIntervalHierarchy.cs | 1 - .../BoundingIntervalHierarchyWrap.cs | 1 - Source/Game/Collision/DynamicTree.cs | 1 - Source/Game/Collision/Models/IModel.cs | 5 +- Source/Game/Collision/RegularGrid2D.cs | 1 - Source/Game/Combat/HostileRegManager.cs | 8 +- Source/Game/Conditions/Condition.cs | 10 +- Source/Game/Conditions/ConditionManager.cs | 9 +- .../DataStorage/AreaTriggerDataStorage.cs | 1 - .../DataStorage/ClientReader/GameTables.cs | 2 +- Source/Game/DataStorage/DB2Manager.cs | 1 - Source/Game/DataStorage/M2Storage.cs | 1 - Source/Game/DataStorage/Structs/F_Records.cs | 1 - Source/Game/DataStorage/Structs/M_Records.cs | 1 - Source/Game/DataStorage/Structs/P_Records.cs | 1 - Source/Game/DataStorage/WhoListStorage.cs | 2 +- Source/Game/DungeonFinding/LFGManager.cs | 6 +- .../Game/Entities/AreaTrigger/AreaTrigger.cs | 13 +- Source/Game/Entities/Conversation.cs | 4 +- Source/Game/Entities/Corpse.cs | 4 +- .../Game/Entities/Creature/Creature.Fields.cs | 2 +- Source/Game/Entities/Creature/Creature.cs | 136 +++++------ Source/Game/Entities/Creature/CreatureData.cs | 1 - .../Game/Entities/Creature/CreatureGroups.cs | 8 +- Source/Game/Entities/Creature/Trainer.cs | 2 +- Source/Game/Entities/DynamicObject.cs | 6 +- Source/Game/Entities/GameObject/GameObject.cs | 53 +++-- .../Entities/GameObject/GameObjectData.cs | 1 - Source/Game/Entities/Item/Bag.cs | 4 +- Source/Game/Entities/Item/Item.cs | 17 +- Source/Game/Entities/Item/ItemTemplate.cs | 4 +- Source/Game/Entities/Object/ObjectGuid.cs | 12 +- Source/Game/Entities/Object/Position.cs | 22 +- .../Game/Entities/Object/Update/UpdateData.cs | 10 +- .../Entities/Object/Update/UpdateField.cs | 12 +- .../Entities/Object/Update/UpdateFields.cs | 8 +- .../Game/Entities/Object/Update/UpdateMask.cs | 3 - Source/Game/Entities/Object/WorldObject.cs | 105 ++++----- Source/Game/Entities/Pet.cs | 158 ++++++------- .../Game/Entities/Player/CinematicManager.cs | 24 +- .../Game/Entities/Player/CollectionManager.cs | 34 +-- Source/Game/Entities/Player/KillRewarder.cs | 36 +-- Source/Game/Entities/Player/Player.Combat.cs | 2 +- Source/Game/Entities/Player/Player.DB.cs | 10 +- Source/Game/Entities/Player/Player.Fields.cs | 2 +- Source/Game/Entities/Player/Player.Groups.cs | 8 +- Source/Game/Entities/Player/Player.Items.cs | 44 ++-- Source/Game/Entities/Player/Player.Map.cs | 4 +- Source/Game/Entities/Player/Player.PvP.cs | 14 +- Source/Game/Entities/Player/Player.Quest.cs | 38 +-- Source/Game/Entities/Player/Player.Spells.cs | 36 +-- Source/Game/Entities/Player/Player.Talents.cs | 2 +- Source/Game/Entities/Player/Player.cs | 217 +++++++++--------- Source/Game/Entities/Player/PlayerTaxi.cs | 10 +- Source/Game/Entities/Player/RestMgr.cs | 16 +- Source/Game/Entities/Player/SceneMgr.cs | 10 +- Source/Game/Entities/Player/SocialMgr.cs | 32 +-- Source/Game/Entities/StatSystem.cs | 34 +-- Source/Game/Entities/TemporarySummon.cs | 25 +- Source/Game/Entities/Totem.cs | 7 +- Source/Game/Entities/Transport.cs | 2 +- Source/Game/Entities/Unit/CharmInfo.cs | 4 +- Source/Game/Entities/Unit/Unit.Combat.cs | 98 ++++---- Source/Game/Entities/Unit/Unit.Fields.cs | 28 +-- Source/Game/Entities/Unit/Unit.Movement.cs | 53 ++--- Source/Game/Entities/Unit/Unit.Pets.cs | 10 +- Source/Game/Entities/Unit/Unit.Spells.cs | 94 ++++---- Source/Game/Entities/Unit/Unit.cs | 121 +++++----- Source/Game/Entities/Vehicle.cs | 2 +- Source/Game/Events/GameEventManager.cs | 2 +- Source/Game/Garrisons/GarrisonMap.cs | 1 - Source/Game/Globals/ObjectAccessor.cs | 1 - Source/Game/Globals/ObjectManager.cs | 1 - Source/Game/Groups/Group.cs | 18 +- Source/Game/Guilds/Guild.cs | 4 +- Source/Game/Guilds/GuildFinderManager.cs | 1 - Source/Game/Handlers/AuctionHandler.cs | 2 +- Source/Game/Handlers/BattleFieldHandler.cs | 2 +- Source/Game/Handlers/BattleGroundHandler.cs | 14 +- Source/Game/Handlers/CharacterHandler.cs | 16 +- Source/Game/Handlers/ChatHandler.cs | 24 +- Source/Game/Handlers/GroupHandler.cs | 2 +- Source/Game/Handlers/GuildHandler.cs | 1 - Source/Game/Handlers/ItemHandler.cs | 4 +- Source/Game/Handlers/LFGHandler.cs | 4 +- Source/Game/Handlers/LootHandler.cs | 3 +- Source/Game/Handlers/MailHandler.cs | 4 +- Source/Game/Handlers/MiscHandler.cs | 2 +- Source/Game/Handlers/NPCHandler.cs | 6 +- Source/Game/Handlers/PetHandler.cs | 20 +- Source/Game/Handlers/QueryHandler.cs | 1 - Source/Game/Handlers/QuestHandler.cs | 11 +- Source/Game/Handlers/RAFHandler.cs | 8 +- Source/Game/Handlers/SpellHandler.cs | 2 +- Source/Game/Handlers/TaxiHandler.cs | 4 +- Source/Game/Handlers/ToyHandler.cs | 2 +- Source/Game/Handlers/TradeHandler.cs | 4 +- Source/Game/Maps/Grid.cs | 1 - Source/Game/Maps/GridMap.cs | 1 - Source/Game/Maps/GridNotifiers.cs | 31 ++- Source/Game/Maps/Instances/InstanceScript.cs | 10 +- Source/Game/Maps/Map.cs | 32 +-- Source/Game/Maps/ObjectGridLoader.cs | 4 +- Source/Game/Miscellaneous/Formulas.cs | 6 +- .../Movement/Generators/ConfusedGenerator.cs | 2 +- .../Movement/Generators/FleeingGenerator.cs | 2 +- .../Game/Movement/Generators/HomeMovement.cs | 2 +- .../Game/Movement/Generators/IdleMovement.cs | 2 +- .../Movement/Generators/MovementGenerators.cs | 4 +- .../Game/Movement/Generators/PathGenerator.cs | 1 - .../Game/Movement/Generators/PointMovement.cs | 14 +- .../Movement/Generators/RandomMovement.cs | 4 +- .../SplineChainMovementGenerator.cs | 7 +- .../Movement/Generators/TargetMovement.cs | 10 +- .../Movement/Generators/WaypointMovement.cs | 12 +- Source/Game/Movement/MotionMaster.cs | 4 +- Source/Game/Movement/MoveSplineInit.cs | 4 +- Source/Game/Movement/Spline.cs | 1 - .../Network/Packets/AchievementPackets.cs | 1 - .../Network/Packets/AuthenticationPackets.cs | 1 - .../Game/Network/Packets/MovementPackets.cs | 1 - Source/Game/Network/Packets/PartyPackets.cs | 6 +- Source/Game/Network/Packets/QueryPackets.cs | 2 +- Source/Game/Network/Packets/SpellPackets.cs | 6 +- Source/Game/Network/Packets/TalentPackets.cs | 2 - Source/Game/Phasing/PhaseShift.cs | 2 - Source/Game/Pools/PoolManager.cs | 2 +- Source/Game/Quest/Quest.cs | 7 +- Source/Game/Reputation/ReputationManager.cs | 10 +- Source/Game/Scripting/ScriptManager.cs | 2 +- Source/Game/Server/WorldSession.cs | 4 +- Source/Game/Spells/Auras/Aura.cs | 14 +- Source/Game/Spells/Auras/AuraEffect.cs | 48 ++-- Source/Game/Spells/Spell.cs | 57 +++-- Source/Game/Spells/SpellEffects.cs | 40 ++-- Source/Game/Spells/SpellInfo.cs | 20 +- Source/Game/Spells/SpellManager.cs | 4 +- Source/Game/SupportSystem/SupportManager.cs | 2 +- Source/Game/Time/GameTime.cs | 2 - Source/Game/Time/Updatetime.cs | 3 - Source/Game/Warden/WardenKeyGeneration.cs | 1 - .../Karazhan/InstanceKarazhan.cs | 2 - .../EasternKingdoms/Karazhan/OperaEvent.cs | 4 +- .../ScarletEnclave/Chapter1.cs | 13 +- .../AzjolNerub/AzjolNerub/BossAnubarak.cs | 2 +- .../AzjolNerub/BossKrikthirTheGatewatcher.cs | 7 +- .../AzjolNerub/AzjolNerub/BossNadronox.cs | 2 +- .../InstanceTrialOfTheChampion.cs | 1 - Source/Scripts/Northrend/Dalaran.cs | 6 +- .../IcecrownCitadel/GunshipBattle.cs | 18 +- .../IcecrownCitadel/IcecrownCitadel.cs | 33 ++- .../InstanceIcecrownCitadel.cs | 5 +- .../IcecrownCitadel/LadyDeathwhisper.cs | 2 +- .../IcecrownCitadel/LordMarrowgar.cs | 2 +- .../Northrend/Ulduar/FlameLeviathan.cs | 4 +- .../Northrend/Ulduar/UlduarInstance.cs | 1 - Source/Scripts/Outlands/HellfirePeninsula.cs | 1 - Source/Scripts/Pets/Hunter.cs | 8 +- Source/Scripts/Pets/Mage.cs | 2 +- Source/Scripts/Spells/DemonHunter.cs | 1 - Source/Scripts/Spells/Druid.cs | 2 +- Source/Scripts/Spells/Generic.cs | 6 +- Source/Scripts/Spells/Hunter.cs | 4 +- Source/Scripts/Spells/Items.cs | 8 +- Source/Scripts/Spells/Paladin.cs | 4 +- Source/Scripts/Spells/Priest.cs | 6 +- Source/Scripts/Spells/Warlock.cs | 2 +- Source/Scripts/Spells/Warrior.cs | 4 +- Source/Scripts/World/Achievements.cs | 2 +- Source/Scripts/World/AreaTrigger.cs | 2 +- Source/Scripts/World/Guards.cs | 6 +- Source/Scripts/World/ItemScripts.cs | 2 +- Source/Scripts/World/NpcSpecial.cs | 12 +- 214 files changed, 1235 insertions(+), 1341 deletions(-) diff --git a/Source/Framework/Algorithms/DepthFirstSearch.cs b/Source/Framework/Algorithms/DepthFirstSearch.cs index a410b9e0f..41e666cc8 100644 --- a/Source/Framework/Algorithms/DepthFirstSearch.cs +++ b/Source/Framework/Algorithms/DepthFirstSearch.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Framework.Collections; namespace Framework.Algorithms diff --git a/Source/Framework/Algorithms/DijkstraShortestPath.cs b/Source/Framework/Algorithms/DijkstraShortestPath.cs index 4bca1946b..3fdb43144 100644 --- a/Source/Framework/Algorithms/DijkstraShortestPath.cs +++ b/Source/Framework/Algorithms/DijkstraShortestPath.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; using Framework.Collections; namespace Framework.Algorithms diff --git a/Source/Framework/Collections/IndexMinPriorityQueue.cs b/Source/Framework/Collections/IndexMinPriorityQueue.cs index 7b4753bd3..50c85e851 100644 --- a/Source/Framework/Collections/IndexMinPriorityQueue.cs +++ b/Source/Framework/Collections/IndexMinPriorityQueue.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace Framework.Collections { diff --git a/Source/Framework/Networking/NetworkThread.cs b/Source/Framework/Networking/NetworkThread.cs index b6415ac8b..25f2607f9 100644 --- a/Source/Framework/Networking/NetworkThread.cs +++ b/Source/Framework/Networking/NetworkThread.cs @@ -16,7 +16,6 @@ */ using System.Collections.Generic; -using System.Linq; using System.Threading; namespace Framework.Networking diff --git a/Source/Framework/Realm/RealmManager.cs b/Source/Framework/Realm/RealmManager.cs index 1814053e1..a97dcecd8 100644 --- a/Source/Framework/Realm/RealmManager.cs +++ b/Source/Framework/Realm/RealmManager.cs @@ -16,7 +16,6 @@ */ using Framework.Constants; -using Framework.Cryptography; using Framework.Database; using Framework.Rest; using Framework.Serialization; diff --git a/Source/Framework/RecastDetour/Detour/DetourNavMeshQuery.cs b/Source/Framework/RecastDetour/Detour/DetourNavMeshQuery.cs index b39797c57..d8628a609 100644 --- a/Source/Framework/RecastDetour/Detour/DetourNavMeshQuery.cs +++ b/Source/Framework/RecastDetour/Detour/DetourNavMeshQuery.cs @@ -36,7 +36,6 @@ using System; using System.Diagnostics; using dtPolyRef = System.UInt64; using dtStatus = System.UInt32; -using System.Linq; // Define DT_VIRTUAL_QUERYFILTER if you wish to derive a custom filter from dtQueryFilter. // On certain platforms indirect or virtual function call is expensive. The default diff --git a/Source/Framework/Util/Extensions.cs b/Source/Framework/Util/Extensions.cs index a1d60959b..da8fd1c74 100644 --- a/Source/Framework/Util/Extensions.cs +++ b/Source/Framework/Util/Extensions.cs @@ -15,13 +15,11 @@ * along with this program. If not, see . */ -using Framework.IO; using System.Collections.Generic; using System.IO; using System.Linq; using System.Numerics; using System.Reflection; -using System.Reflection.Emit; using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; diff --git a/Source/Game/AI/AISelector.cs b/Source/Game/AI/AISelector.cs index addea7873..874ca7cf4 100644 --- a/Source/Game/AI/AISelector.cs +++ b/Source/Game/AI/AISelector.cs @@ -99,7 +99,7 @@ namespace Game.AI public static IMovementGenerator SelectMovementAI(Creature creature) { - switch (creature.m_defaultMovementType) + switch (creature.DefaultMovementType) { case MovementGeneratorType.Random: return new RandomMovementGenerator(); diff --git a/Source/Game/AI/CoreAI/CreatureAI.cs b/Source/Game/AI/CoreAI/CreatureAI.cs index 7700df73c..2a60d4bb3 100644 --- a/Source/Game/AI/CoreAI/CreatureAI.cs +++ b/Source/Game/AI/CoreAI/CreatureAI.cs @@ -72,7 +72,7 @@ namespace Game.AI Unit summoner = creature.ToTempSummon().GetSummoner(); if (summoner != null) { - Unit target = summoner.getAttackerForHelper(); + Unit target = summoner.GetAttackerForHelper(); if (target == null && summoner.CanHaveThreatList() && !summoner.GetThreatManager().isThreatListEmpty()) target = summoner.GetThreatManager().getHostilTarget(); if (target != null && (creature.IsFriendlyTo(summoner) || creature.IsHostileTo(target))) diff --git a/Source/Game/AI/CoreAI/GuardAI.cs b/Source/Game/AI/CoreAI/GuardAI.cs index bcae7334c..857e7b74e 100644 --- a/Source/Game/AI/CoreAI/GuardAI.cs +++ b/Source/Game/AI/CoreAI/GuardAI.cs @@ -34,7 +34,7 @@ namespace Game.AI public override bool CanSeeAlways(WorldObject obj) { - if (!obj.isTypeMask(TypeMask.Unit)) + if (!obj.IsTypeMask(TypeMask.Unit)) return false; var threatList = me.GetThreatManager().getThreatList(); diff --git a/Source/Game/AI/CoreAI/PassiveAI.cs b/Source/Game/AI/CoreAI/PassiveAI.cs index 6247fc856..4f508cb78 100644 --- a/Source/Game/AI/CoreAI/PassiveAI.cs +++ b/Source/Game/AI/CoreAI/PassiveAI.cs @@ -30,7 +30,7 @@ namespace Game.AI public override void UpdateAI(uint diff) { - if (me.IsInCombat() && me.getAttackers().Empty()) + if (me.IsInCombat() && me.GetAttackers().Empty()) EnterEvadeMode(EvadeReason.NoHostiles); } diff --git a/Source/Game/AI/CoreAI/PetAI.cs b/Source/Game/AI/CoreAI/PetAI.cs index 42f88cf9f..ae7c0bf66 100644 --- a/Source/Game/AI/CoreAI/PetAI.cs +++ b/Source/Game/AI/CoreAI/PetAI.cs @@ -56,7 +56,7 @@ namespace Game.AI me.GetMotionMaster().Clear(); me.GetMotionMaster().MoveIdle(); me.CombatStop(); - me.getHostileRefManager().deleteReferences(); + me.GetHostileRefManager().deleteReferences(); return; } @@ -163,9 +163,9 @@ namespace Game.AI // Some spells can target enemy or friendly (DK Ghoul's Leap) // Check for enemy first (pet then owner) - Unit target = me.getAttackerForHelper(); + Unit target = me.GetAttackerForHelper(); if (!target && owner) - target = owner.getAttackerForHelper(); + target = owner.GetAttackerForHelper(); if (target) { @@ -372,7 +372,7 @@ namespace Game.AI return null; // Check pet attackers first so we don't drag a bunch of targets to the owner - Unit myAttacker = me.getAttackerForHelper(); + Unit myAttacker = me.GetAttackerForHelper(); if (myAttacker) if (!myAttacker.HasBreakableByDamageCrowdControlAura()) return myAttacker; @@ -382,7 +382,7 @@ namespace Game.AI return null; // Check owner attackers - Unit ownerAttacker = me.GetCharmerOrOwner().getAttackerForHelper(); + Unit ownerAttacker = me.GetCharmerOrOwner().GetAttackerForHelper(); if (ownerAttacker) if (!ownerAttacker.HasBreakableByDamageCrowdControlAura()) return ownerAttacker; diff --git a/Source/Game/AI/CoreAI/TotemAI.cs b/Source/Game/AI/CoreAI/TotemAI.cs index 38cbe3101..9b8695740 100644 --- a/Source/Game/AI/CoreAI/TotemAI.cs +++ b/Source/Game/AI/CoreAI/TotemAI.cs @@ -54,7 +54,7 @@ namespace Game.AI Unit victim = !i_victimGuid.IsEmpty() ? Global.ObjAccessor.GetUnit(me, i_victimGuid) : null; // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) - if (victim == null || !victim.isTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) || + if (victim == null || !victim.IsTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) || me.IsFriendlyTo(victim) || !me.CanSeeOrDetect(victim)) { var u_check = new NearestAttackableUnitInObjectRangeCheck(me, me.GetCharmerOrOwnerOrSelf(), max_range); diff --git a/Source/Game/AI/CoreAI/UnitAI.cs b/Source/Game/AI/CoreAI/UnitAI.cs index 0ac4596c6..fda7abf7a 100644 --- a/Source/Game/AI/CoreAI/UnitAI.cs +++ b/Source/Game/AI/CoreAI/UnitAI.cs @@ -73,22 +73,22 @@ namespace Game.AI return; //Make sure our attack is ready and we aren't currently casting before checking distance - if (me.isAttackReady()) + if (me.IsAttackReady()) { me.AttackerStateUpdate(victim); - me.resetAttackTimer(); + me.ResetAttackTimer(); } - if (me.haveOffhandWeapon() && me.isAttackReady(WeaponAttackType.OffAttack)) + if (me.HaveOffhandWeapon() && me.IsAttackReady(WeaponAttackType.OffAttack)) { me.AttackerStateUpdate(victim, WeaponAttackType.OffAttack); - me.resetAttackTimer(WeaponAttackType.OffAttack); + me.ResetAttackTimer(WeaponAttackType.OffAttack); } } public bool DoSpellAttackIfReady(uint spell) { - if (me.HasUnitState(UnitState.Casting) || !me.isAttackReady()) + if (me.HasUnitState(UnitState.Casting) || !me.IsAttackReady()) return true; var spellInfo = Global.SpellMgr.GetSpellInfo(spell); @@ -97,7 +97,7 @@ namespace Game.AI if (me.IsWithinCombatRange(me.GetVictim(), spellInfo.GetMaxRange(false))) { me.CastSpell(me.GetVictim(), spellInfo, TriggerCastFlags.None); - me.resetAttackTimer(); + me.ResetAttackTimer(); return true; } } @@ -507,7 +507,7 @@ namespace Game.AI minRange += rangeMod; } - if (_caster.isMoving() && target.isMoving() && !_caster.IsWalking() && !target.IsWalking() && + if (_caster.IsMoving() && target.IsMoving() && !_caster.IsWalking() && !target.IsWalking() && (_spellInfo.RangeEntry.Flags.HasAnyFlag(SpellRangeFlag.Melee) || target.IsTypeId(TypeId.Player))) rangeMod += 8.0f / 3.0f; } diff --git a/Source/Game/AI/PlayerAI/PlayerAI.cs b/Source/Game/AI/PlayerAI/PlayerAI.cs index 5d8cafcce..fcdcb96db 100644 --- a/Source/Game/AI/PlayerAI/PlayerAI.cs +++ b/Source/Game/AI/PlayerAI/PlayerAI.cs @@ -577,7 +577,7 @@ namespace Game.AI if (me.HasUnitState(UnitState.Casting)) return; - if (!me.isAttackReady(WeaponAttackType.RangedAttack)) + if (!me.IsAttackReady(WeaponAttackType.RangedAttack)) return; Unit victim = me.GetVictim(); @@ -610,7 +610,7 @@ namespace Game.AI return; me.CastSpell(victim, rangedAttackSpell, TriggerCastFlags.CastDirectly); - me.resetAttackTimer(WeaponAttackType.RangedAttack); + me.ResetAttackTimer(WeaponAttackType.RangedAttack); } public void DoAutoAttackIfReady() diff --git a/Source/Game/AI/ScriptedAI/ScriptedAI.cs b/Source/Game/AI/ScriptedAI/ScriptedAI.cs index c70e09911..7019df230 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedAI.cs @@ -475,7 +475,7 @@ namespace Game.AI } me.SetCombatPulseDelay(5); - me.setActive(true); + me.SetActive(true); DoZoneInCombat(); ScheduleTasks(); } @@ -565,7 +565,7 @@ namespace Game.AI public override bool CanAIAttack(Unit victim) { return CheckBoundary(victim); } - public void _JustReachedHome() { me.setActive(false); } + public void _JustReachedHome() { me.SetActive(false); } public InstanceScript instance; public SummonList summons; diff --git a/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs b/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs index 7737fbddb..d78308101 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs @@ -21,8 +21,6 @@ using Game.Groups; using System; using System.Collections.Generic; using System.Linq; -using Game.Movement; -using Game.Maps; namespace Game.AI { @@ -101,7 +99,7 @@ namespace Game.AI public override void MoveInLineOfSight(Unit who) { - if (me.HasReactState(ReactStates.Aggressive) && !me.HasUnitState(UnitState.Stunned) && who.isTargetableForAttack() && who.isInAccessiblePlaceFor(me)) + if (me.HasReactState(ReactStates.Aggressive) && !me.HasUnitState(UnitState.Stunned) && who.IsTargetableForAttack() && who.IsInAccessiblePlaceFor(me)) { if (HasEscortState(eEscortState.Escorting) && AssistPlayerInCombatAgainst(who)) return; @@ -256,7 +254,7 @@ namespace Game.AI if (m_bCanInstantRespawn) { - me.setDeathState(DeathState.JustDied); + me.SetDeathState(DeathState.JustDied); me.Respawn(); } else @@ -296,7 +294,7 @@ namespace Game.AI if (m_bCanInstantRespawn) { - me.setDeathState(DeathState.JustDied); + me.SetDeathState(DeathState.JustDied); me.Respawn(); } else @@ -409,7 +407,7 @@ namespace Game.AI } /// todo get rid of this many variables passed in function. - public void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = default(ObjectGuid), Quest quest = null, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true) + public void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = default, Quest quest = null, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true) { if (me.GetVictim()) { diff --git a/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs b/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs index 42a051e4b..862477112 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs @@ -103,7 +103,7 @@ namespace Game.AI public override void MoveInLineOfSight(Unit who) { - if (me.HasReactState(ReactStates.Aggressive) && !me.HasUnitState(UnitState.Stunned) && who.isTargetableForAttack() && who.isInAccessiblePlaceFor(me)) + if (me.HasReactState(ReactStates.Aggressive) && !me.HasUnitState(UnitState.Stunned) && who.IsTargetableForAttack() && who.IsInAccessiblePlaceFor(me)) { if (HasFollowState(eFollowState.Inprogress) && AssistPlayerInCombatAgainst(who)) return; diff --git a/Source/Game/AI/SmartScripts/SmartAI.cs b/Source/Game/AI/SmartScripts/SmartAI.cs index cc2e463f5..abfbc1f3c 100644 --- a/Source/Game/AI/SmartScripts/SmartAI.cs +++ b/Source/Game/AI/SmartScripts/SmartAI.cs @@ -18,9 +18,6 @@ using Framework.Constants; using Game.Entities; using Game.Groups; -using Game.Maps; -using Game.Movement; -using Game.Scripting; using Game.Spells; using System; using System.Collections.Generic; @@ -1065,7 +1062,7 @@ namespace Game.AI { GetScript().OnInitialize(go); // do not call respawn event if go is not spawned - if (go.isSpawned()) + if (go.IsSpawned()) GetScript().ProcessEventsFor(SmartEvents.Respawn); } diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index dc06a014b..f10903997 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -1272,7 +1272,7 @@ namespace Game.AI break; foreach (var obj in targets) - obj.setActive(e.Action.active.state != 0); + obj.SetActive(e.Action.active.state != 0); break; } @@ -1635,7 +1635,7 @@ namespace Game.AI else if (IsGameObject(obj)) { // do not modify respawndelay of already spawned gameobjects - if (obj.ToGameObject().isSpawnedByDefault()) + if (obj.ToGameObject().IsSpawnedByDefault()) obj.ToGameObject().Respawn(); else obj.ToGameObject().SetRespawnTime((int)e.Action.respawnTarget.goRespawnTime); @@ -2256,7 +2256,7 @@ namespace Game.AI foreach (var obj in targets) if (IsCreature(obj)) - obj.ToCreature().setRegeneratingHealth(e.Action.setHealthRegen.regenHealth != 0 ? true : false); + obj.ToCreature().SetRegeneratingHealth(e.Action.setHealthRegen.regenHealth != 0 ? true : false); break; } case SmartActions.SetRoot: diff --git a/Source/Game/Achievements/AchievementManager.cs b/Source/Game/Achievements/AchievementManager.cs index 5041c7468..029480a7b 100644 --- a/Source/Game/Achievements/AchievementManager.cs +++ b/Source/Game/Achievements/AchievementManager.cs @@ -1048,7 +1048,7 @@ namespace Game.Achievements public bool IsRealmCompleted(AchievementRecord achievement) { var time = _allCompletedAchievements.LookupByKey(achievement.Id); - if (time == default(DateTime)) + if (time == default) return false; if (time == DateTime.MinValue) diff --git a/Source/Game/Achievements/CriteriaHandler.cs b/Source/Game/Achievements/CriteriaHandler.cs index 3fe1494bf..5fc79dd2c 100644 --- a/Source/Game/Achievements/CriteriaHandler.cs +++ b/Source/Game/Achievements/CriteriaHandler.cs @@ -171,7 +171,7 @@ namespace Game.Achievements SetCriteriaProgress(criteria, miscValue1, referencePlayer, ProgressType.Highest); break; case CriteriaTypes.ReachLevel: - SetCriteriaProgress(criteria, referencePlayer.getLevel(), referencePlayer); + SetCriteriaProgress(criteria, referencePlayer.GetLevel(), referencePlayer); break; case CriteriaTypes.ReachSkillLevel: uint skillvalue = referencePlayer.GetBaseSkillValue((SkillType)criteria.Entry.Asset); @@ -220,7 +220,7 @@ namespace Game.Achievements { uint counter = 0; - var rewQuests = referencePlayer.getRewardedQuests(); + var rewQuests = referencePlayer.GetRewardedQuests(); foreach (var id in rewQuests) { Quest quest = Global.ObjectMgr.GetQuestTemplate(id); @@ -1334,7 +1334,7 @@ namespace Game.Achievements return false; break; case CriteriaAdditionalCondition.SourceLevel: // 39 - if (referencePlayer.getLevel() != reqValue) + if (referencePlayer.GetLevel() != reqValue) return false; break; case CriteriaAdditionalCondition.TargetLevel: // 40 @@ -1515,7 +1515,7 @@ namespace Game.Achievements } if (obj == null) - return default(T); + return default; return obj; } diff --git a/Source/Game/BattleFields/BattleField.cs b/Source/Game/BattleFields/BattleField.cs index 5780c956b..24292e6fb 100644 --- a/Source/Game/BattleFields/BattleField.cs +++ b/Source/Game/BattleFields/BattleField.cs @@ -25,7 +25,6 @@ using Game.Network; using Game.Network.Packets; using System; using System.Collections.Generic; -using System.Linq; namespace Game.BattleFields { @@ -270,7 +269,7 @@ namespace Game.BattleFields } // If the player does not match minimal level requirements for the battlefield, kick him - if (player.getLevel() < m_MinLevel) + if (player.GetLevel() < m_MinLevel) { if (!m_PlayersWillBeKick[player.GetTeamId()].ContainsKey(player.GetGUID())) m_PlayersWillBeKick[player.GetTeamId()][player.GetGUID()] = Time.UnixTime + 10; @@ -303,7 +302,7 @@ namespace Game.BattleFields { Player player = Global.ObjAccessor.FindPlayer(guid); if (player) - if (player.isAFK()) + if (player.IsAFK()) KickPlayerFromBattlefield(guid); } } @@ -402,7 +401,7 @@ namespace Game.BattleFields m_PlayersInWar[player.GetTeamId()].Add(player.GetGUID()); m_InvitedPlayers[player.GetTeamId()].Remove(player.GetGUID()); - if (player.isAFK()) + if (player.IsAFK()) player.ToggleAFK(); OnPlayerJoinWar(player); //for scripting @@ -689,7 +688,7 @@ namespace Game.BattleFields // Set creature in world map.AddToMap(creature); - creature.setActive(true); + creature.SetActive(true); return creature; } @@ -718,7 +717,7 @@ namespace Game.BattleFields // Add to world map.AddToMap(go); - go.setActive(true); + go.SetActive(true); return go; } diff --git a/Source/Game/BattleFields/Zones/WinterGrasp.cs b/Source/Game/BattleFields/Zones/WinterGrasp.cs index 34d025f7a..2bd51a7c2 100644 --- a/Source/Game/BattleFields/Zones/WinterGrasp.cs +++ b/Source/Game/BattleFields/Zones/WinterGrasp.cs @@ -949,7 +949,7 @@ namespace Game.BattleFields { Player player = Global.ObjAccessor.FindPlayer(guid); if (player) - if (player.getLevel() >= m_MinLevel) + if (player.GetLevel() >= m_MinLevel) player.RemoveAurasDueToSpell(WGSpells.Tenacity); } diff --git a/Source/Game/BattleGrounds/BattleGround.cs b/Source/Game/BattleGrounds/BattleGround.cs index 964bdd876..1a191a0c9 100644 --- a/Source/Game/BattleGrounds/BattleGround.cs +++ b/Source/Game/BattleGrounds/BattleGround.cs @@ -722,7 +722,7 @@ namespace Game.BattleGrounds { //needed cause else in av some creatures will kill the players at the end player.CombatStop(); - player.getHostileRefManager().deleteReferences(); + player.GetHostileRefManager().deleteReferences(); } // remove temporary currency bonus auras before rewarding player @@ -974,7 +974,7 @@ namespace Game.BattleGrounds public virtual void AddPlayer(Player player) { // remove afk from player - if (player.isAFK()) + if (player.IsAFK()) player.ToggleAFK(); // score struct must be created in inherited class @@ -1356,7 +1356,7 @@ namespace Game.BattleGrounds if (obj) { // If doors are open, close it - if (obj.getLootState() == LootState.Activated && obj.GetGoState() != GameObjectState.Ready) + if (obj.GetLootState() == LootState.Activated && obj.GetGoState() != GameObjectState.Ready) { obj.SetLootState(LootState.Ready); obj.SetGoState(GameObjectState.Ready); @@ -1416,7 +1416,7 @@ namespace Game.BattleGrounds obj.SetLootState(LootState.JustDeactivated); else { - if (obj.getLootState() == LootState.JustDeactivated) + if (obj.GetLootState() == LootState.JustDeactivated) // Change state from GO_JUST_DEACTIVATED to GO_READY in case Battleground is starting again obj.SetLootState(LootState.Ready); } @@ -1523,7 +1523,7 @@ namespace Game.BattleGrounds Creature creature = AddCreature(entry, type, x, y, z, o); if (creature) { - creature.setDeathState(DeathState.Dead); + creature.SetDeathState(DeathState.Dead); creature.AddChannelObject(creature.GetGUID()); // aura //todo Fix display here @@ -1578,7 +1578,7 @@ namespace Game.BattleGrounds public void HandleTriggerBuff(ObjectGuid goGuid) { GameObject obj = GetBgMap().GetGameObject(goGuid); - if (!obj || obj.GetGoType() != GameObjectTypes.Trap || !obj.isSpawned()) + if (!obj || obj.GetGoType() != GameObjectTypes.Trap || !obj.IsSpawned()) return; // Change buff type, when buff is used: diff --git a/Source/Game/BattleGrounds/BattleGroundManager.cs b/Source/Game/BattleGrounds/BattleGroundManager.cs index 5d6439015..ce3d93a95 100644 --- a/Source/Game/BattleGrounds/BattleGroundManager.cs +++ b/Source/Game/BattleGrounds/BattleGroundManager.cs @@ -180,7 +180,7 @@ namespace Game.BattleGrounds battlefieldStatus.WaitTime = Time.GetMSTimeDiffToNow(joinTime); } - public void BuildBattlegroundStatusFailed(out BattlefieldStatusFailed battlefieldStatus, Battleground bg, Player pPlayer, uint ticketId, ArenaTypes arenaType, GroupJoinBattlegroundResult result, ObjectGuid errorGuid = default(ObjectGuid)) + public void BuildBattlegroundStatusFailed(out BattlefieldStatusFailed battlefieldStatus, Battleground bg, Player pPlayer, uint ticketId, ArenaTypes arenaType, GroupJoinBattlegroundResult result, ObjectGuid errorGuid = default) { battlefieldStatus = new BattlefieldStatusFailed(); battlefieldStatus.Ticket.RequesterGuid = pPlayer.GetGUID(); diff --git a/Source/Game/BlackMarket/BlackMarketManager.cs b/Source/Game/BlackMarket/BlackMarketManager.cs index 65feba6a9..4493ddac2 100644 --- a/Source/Game/BlackMarket/BlackMarketManager.cs +++ b/Source/Game/BlackMarket/BlackMarketManager.cs @@ -21,7 +21,6 @@ using Game.Entities; using Game.Mails; using Game.Network.Packets; using System.Collections.Generic; -using System.Linq; namespace Game.BlackMarket { diff --git a/Source/Game/Cache/CharacterCache.cs b/Source/Game/Cache/CharacterCache.cs index 8a37be50d..e028e8ba6 100644 --- a/Source/Game/Cache/CharacterCache.cs +++ b/Source/Game/Cache/CharacterCache.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; using Game.Entities; using Framework.Database; using Framework.Constants; diff --git a/Source/Game/Calendar/CalendarManager.cs b/Source/Game/Calendar/CalendarManager.cs index 80574623d..c77ceb1b6 100644 --- a/Source/Game/Calendar/CalendarManager.cs +++ b/Source/Game/Calendar/CalendarManager.cs @@ -397,7 +397,7 @@ namespace Game ObjectGuid invitee = invite.InviteeGuid; Player player = Global.ObjAccessor.FindPlayer(invitee); - uint level = player ? player.getLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(invitee); + uint level = player ? player.GetLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(invitee); SCalendarEventInvite packet = new SCalendarEventInvite(); packet.EventID = calendarEvent != null ? calendarEvent.EventId : 0; @@ -545,7 +545,7 @@ namespace Game ObjectGuid inviteeGuid = calendarInvite.InviteeGuid; Player invitee = Global.ObjAccessor.FindPlayer(inviteeGuid); - uint inviteeLevel = invitee ? invitee.getLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(inviteeGuid); + uint inviteeLevel = invitee ? invitee.GetLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(inviteeGuid); ulong inviteeGuildId = invitee ? invitee.GetGuildId() : Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(inviteeGuid); CalendarEventInviteInfo inviteInfo = new CalendarEventInviteInfo(); diff --git a/Source/Game/Chat/Channels/Channel.cs b/Source/Game/Chat/Channels/Channel.cs index af4241e6a..3c0cd2935 100644 --- a/Source/Game/Chat/Channels/Channel.cs +++ b/Source/Game/Chat/Channels/Channel.cs @@ -218,7 +218,7 @@ namespace Game.Chat bool newChannel = _playersStore.Empty(); PlayerInfo playerInfo = new PlayerInfo(); - playerInfo.SetInvisible(!player.isGMVisible()); + playerInfo.SetInvisible(!player.IsGMVisible()); _playersStore[guid] = playerInfo; /* @@ -696,7 +696,7 @@ namespace Game.Chat } Player newp = Global.ObjAccessor.FindPlayerByName(newname); - if (!newp || !newp.isGMVisible()) + if (!newp || !newp.IsGMVisible()) { ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerNotFoundAppend(newname)); SendToOne(builder, guid); @@ -830,7 +830,7 @@ namespace Game.Chat } } - void SendToAll(MessageBuilder builder, ObjectGuid guid = default(ObjectGuid)) + void SendToAll(MessageBuilder builder, ObjectGuid guid = default) { LocalizedPacketDo localizer = new LocalizedPacketDo(builder); @@ -867,7 +867,7 @@ namespace Game.Chat localizer.Invoke(player); } - void SendToAllWithAddon(MessageBuilder builder, string addonPrefix, ObjectGuid guid = default(ObjectGuid)) + void SendToAllWithAddon(MessageBuilder builder, string addonPrefix, ObjectGuid guid = default) { LocalizedPacketDo localizer = new LocalizedPacketDo(builder); diff --git a/Source/Game/Chat/Commands/CharacterCommands.cs b/Source/Game/Chat/Commands/CharacterCommands.cs index 742277e3c..10de68190 100644 --- a/Source/Game/Chat/Commands/CharacterCommands.cs +++ b/Source/Game/Chat/Commands/CharacterCommands.cs @@ -216,7 +216,7 @@ namespace Game.Chat if (!handler.extractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid, out targetName)) return false; - int oldlevel = (int)(target ? target.getLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(targetGuid)); + int oldlevel = (int)(target ? target.GetLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(targetGuid)); if (!int.TryParse(levelStr, out int newlevel)) newlevel = oldlevel; @@ -750,7 +750,7 @@ namespace Game.Chat if (!handler.extractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid, out targetName)) return false; - int oldlevel = (int)(target ? target.getLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(targetGuid)); + int oldlevel = (int)(target ? target.GetLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(targetGuid)); if (!int.TryParse(levelStr, out int addlevel)) addlevel = 1; diff --git a/Source/Game/Chat/Commands/CheatCommands.cs b/Source/Game/Chat/Commands/CheatCommands.cs index 142983939..d4cbcf8a7 100644 --- a/Source/Game/Chat/Commands/CheatCommands.cs +++ b/Source/Game/Chat/Commands/CheatCommands.cs @@ -145,7 +145,7 @@ namespace Game.Chat.Commands handler.SendSysMessage(CypherStrings.CommandCheatCt, player.GetCommandStatus(PlayerCommandStates.Casttime) ? enabled : disabled); handler.SendSysMessage(CypherStrings.CommandCheatPower, player.GetCommandStatus(PlayerCommandStates.Power) ? enabled : disabled); handler.SendSysMessage(CypherStrings.CommandCheatWw, player.GetCommandStatus(PlayerCommandStates.Waterwalk) ? enabled : disabled); - handler.SendSysMessage(CypherStrings.CommandCheatTaxinodes, player.isTaxiCheater() ? enabled : disabled); + handler.SendSysMessage(CypherStrings.CommandCheatTaxinodes, player.IsTaxiCheater() ? enabled : disabled); return true; } @@ -191,7 +191,7 @@ namespace Game.Chat.Commands return false; if (args.Empty()) - argstr = (chr.isTaxiCheater()) ? "off" : "on"; + argstr = (chr.IsTaxiCheater()) ? "off" : "on"; if (argstr == "off") { diff --git a/Source/Game/Chat/Commands/DebugCommands.cs b/Source/Game/Chat/Commands/DebugCommands.cs index 093b1a98d..15d101219 100644 --- a/Source/Game/Chat/Commands/DebugCommands.cs +++ b/Source/Game/Chat/Commands/DebugCommands.cs @@ -50,15 +50,15 @@ namespace Game.Chat static bool HandleDebugAreaTriggersCommand(StringArguments args, CommandHandler handler) { Player player = handler.GetSession().GetPlayer(); - if (!player.isDebugAreaTriggers) + if (!player.IsDebugAreaTriggers) { handler.SendSysMessage(CypherStrings.DebugAreatriggerOn); - player.isDebugAreaTriggers = true; + player.IsDebugAreaTriggers = true; } else { handler.SendSysMessage(CypherStrings.DebugAreatriggerOff); - player.isDebugAreaTriggers = false; + player.IsDebugAreaTriggers = false; } return true; } @@ -441,7 +441,7 @@ namespace Game.Chat Unit target = handler.getSelectedUnit(); if (!target) target = handler.GetSession().GetPlayer(); - HostileReference refe = target.getHostileRefManager().getFirst(); + HostileReference refe = target.GetHostileRefManager().getFirst(); uint count = 0; handler.SendSysMessage("Hostil reference list of {0} (guid {1})", target.GetName(), target.GetGUID().ToString()); while (refe != null) @@ -485,7 +485,7 @@ namespace Game.Chat return false; handler.SendSysMessage("Loot recipient for creature {0} (GUID {1}, DB GUID {2}) is {3}", target.GetName(), target.GetGUID().ToString(), target.GetSpawnId(), - target.hasLootRecipient() ? (target.GetLootRecipient() ? target.GetLootRecipient().GetName() : "offline") : "no loot recipient"); + target.HasLootRecipient() ? (target.GetLootRecipient() ? target.GetLootRecipient().GetName() : "offline") : "no loot recipient"); return true; } diff --git a/Source/Game/Chat/Commands/GMCommands.cs b/Source/Game/Chat/Commands/GMCommands.cs index e3f6173ff..e63d195e0 100644 --- a/Source/Game/Chat/Commands/GMCommands.cs +++ b/Source/Game/Chat/Commands/GMCommands.cs @@ -64,7 +64,7 @@ namespace Game.Chat { if (args.Empty()) { - if (session.HasPermission(RBACPermissions.ChatUseStaffBadge) && session.GetPlayer().isGMChat()) + if (session.HasPermission(RBACPermissions.ChatUseStaffBadge) && session.GetPlayer().IsGMChat()) session.SendNotification(CypherStrings.GmChatOn); else session.SendNotification(CypherStrings.GmChatOff); @@ -206,7 +206,7 @@ namespace Game.Chat if (args.Empty()) { - handler.SendSysMessage(CypherStrings.YouAre, _player.isGMVisible() ? Global.ObjectMgr.GetCypherString(CypherStrings.Visible) : Global.ObjectMgr.GetCypherString(CypherStrings.Invisible)); + handler.SendSysMessage(CypherStrings.YouAre, _player.IsGMVisible() ? Global.ObjectMgr.GetCypherString(CypherStrings.Visible) : Global.ObjectMgr.GetCypherString(CypherStrings.Invisible)); return true; } diff --git a/Source/Game/Chat/Commands/LearnCommands.cs b/Source/Game/Chat/Commands/LearnCommands.cs index 03bc74732..7de0833da 100644 --- a/Source/Game/Chat/Commands/LearnCommands.cs +++ b/Source/Game/Chat/Commands/LearnCommands.cs @@ -208,7 +208,7 @@ namespace Game.Chat.Commands static void HandleLearnSkillRecipesHelper(Player player, uint skillId) { - uint classmask = player.getClassMask(); + uint classmask = player.GetClassMask(); foreach (var skillLine in CliDB.SkillLineAbilityStorage.Values) { diff --git a/Source/Game/Chat/Commands/MessageCommands.cs b/Source/Game/Chat/Commands/MessageCommands.cs index 853d6efec..7f9fbb577 100644 --- a/Source/Game/Chat/Commands/MessageCommands.cs +++ b/Source/Game/Chat/Commands/MessageCommands.cs @@ -111,7 +111,7 @@ namespace Game.Chat { if (args.Empty()) { - handler.SendSysMessage(CypherStrings.CommandWhisperaccepting, handler.GetSession().GetPlayer().isAcceptWhispers() ? handler.GetCypherString(CypherStrings.On) : handler.GetCypherString(CypherStrings.Off)); + handler.SendSysMessage(CypherStrings.CommandWhisperaccepting, handler.GetSession().GetPlayer().IsAcceptWhispers() ? handler.GetCypherString(CypherStrings.On) : handler.GetCypherString(CypherStrings.Off)); return true; } diff --git a/Source/Game/Chat/Commands/MiscCommands.cs b/Source/Game/Chat/Commands/MiscCommands.cs index 2bb6eb4da..220112b72 100644 --- a/Source/Game/Chat/Commands/MiscCommands.cs +++ b/Source/Game/Chat/Commands/MiscCommands.cs @@ -1394,7 +1394,7 @@ namespace Game.Chat accId = target.GetSession().GetAccountId(); money = target.GetMoney(); totalPlayerTime = target.GetTotalPlayedTime(); - level = target.getLevel(); + level = target.GetLevel(); latency = target.GetSession().GetLatency(); raceid = target.GetRace(); classid = target.GetClass(); @@ -2108,7 +2108,7 @@ namespace Game.Chat return false; target.CombatStop(); - target.getHostileRefManager().deleteReferences(); + target.GetHostileRefManager().deleteReferences(); return true; } @@ -2380,7 +2380,7 @@ namespace Game.Chat { Player player = handler.GetSession().GetPlayer(); - if (player.isPossessing()) + if (player.IsPossessing()) return false; player.StopCastingBindSight(); diff --git a/Source/Game/Chat/Commands/NPCCommands.cs b/Source/Game/Chat/Commands/NPCCommands.cs index 68fa348fe..71cdf1968 100644 --- a/Source/Game/Chat/Commands/NPCCommands.cs +++ b/Source/Game/Chat/Commands/NPCCommands.cs @@ -58,7 +58,7 @@ namespace Game.Chat string defRespawnDelayStr = Time.secsToTimeString(target.GetRespawnDelay(), true); handler.SendSysMessage(CypherStrings.NpcinfoChar, target.GetSpawnId(), target.GetGUID().ToString(), faction, npcflags, Entry, displayid, nativeid); - handler.SendSysMessage(CypherStrings.NpcinfoLevel, target.getLevel()); + handler.SendSysMessage(CypherStrings.NpcinfoLevel, target.GetLevel()); handler.SendSysMessage(CypherStrings.NpcinfoEquipment, target.GetCurrentEquipmentId(), target.GetOriginalEquipmentId()); handler.SendSysMessage(CypherStrings.NpcinfoHealth, target.GetCreateHealth(), target.GetMaxHealth(), target.GetHealth()); handler.SendSysMessage(CypherStrings.NpcinfoInhabitType, cInfo.InhabitType); @@ -166,7 +166,7 @@ namespace Game.Chat creature.GetMotionMaster().Initialize(); if (creature.IsAlive()) // dead creature will reset movement generator at respawn { - creature.setDeathState(DeathState.JustDied); + creature.SetDeathState(DeathState.JustDied); creature.Respawn(); } } @@ -399,7 +399,7 @@ namespace Game.Chat pet.SetReactState(ReactStates.Defensive); // calculate proper level - uint level = (creatureTarget.getLevel() < (player.getLevel() - 5)) ? (player.getLevel() - 5) : creatureTarget.getLevel(); + uint level = (creatureTarget.GetLevel() < (player.GetLevel() - 5)) ? (player.GetLevel() - 5) : creatureTarget.GetLevel(); // prepare visual effect for levelup pet.SetLevel(level - 1); @@ -893,7 +893,7 @@ namespace Game.Chat creature.GetMotionMaster().Initialize(); if (creature.IsAlive()) // dead creature will reset movement generator at respawn { - creature.setDeathState(DeathState.JustDied); + creature.SetDeathState(DeathState.JustDied); creature.Respawn(); } creature.SaveToDB(); @@ -992,7 +992,7 @@ namespace Game.Chat creature.GetMotionMaster().Initialize(); if (creature.IsAlive()) // dead creature will reset movement generator at respawn { - creature.setDeathState(DeathState.JustDied); + creature.SetDeathState(DeathState.JustDied); creature.Respawn(); } diff --git a/Source/Game/Chat/Commands/PetCommands.cs b/Source/Game/Chat/Commands/PetCommands.cs index c15243c96..073063402 100644 --- a/Source/Game/Chat/Commands/PetCommands.cs +++ b/Source/Game/Chat/Commands/PetCommands.cs @@ -59,14 +59,14 @@ namespace Game.Chat return false; } - creatureTarget.setDeathState(DeathState.JustDied); + creatureTarget.SetDeathState(DeathState.JustDied); creatureTarget.RemoveCorpse(); creatureTarget.SetHealth(0); // just for nice GM-mode view pet.SetCreatorGUID(player.GetGUID()); pet.SetFaction(player.GetFaction()); - if (!pet.InitStatsForLevel(creatureTarget.getLevel())) + if (!pet.InitStatsForLevel(creatureTarget.GetLevel())) { Log.outError(LogFilter.ChatSystem, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); handler.SendSysMessage("Error 2"); @@ -74,7 +74,7 @@ namespace Game.Chat } // prepare visual effect for levelup - pet.SetLevel(creatureTarget.getLevel() - 1); + pet.SetLevel(creatureTarget.GetLevel() - 1); pet.GetCharmInfo().SetPetNumber(Global.ObjectMgr.GeneratePetNumber(), true); // this enables pet details window (Shift+P) @@ -84,7 +84,7 @@ namespace Game.Chat pet.GetMap().AddToMap(pet.ToCreature()); // visual effect for levelup - pet.SetLevel(creatureTarget.getLevel()); + pet.SetLevel(creatureTarget.GetLevel()); player.SetMinion(pet, true); pet.SavePetToDB(PetSaveMode.AsCurrent); @@ -125,7 +125,7 @@ namespace Game.Chat return false; } - pet.learnSpell(spellId); + pet.LearnSpell(spellId); handler.SendSysMessage("Pet has learned spell {0}", spellId); return true; @@ -147,7 +147,7 @@ namespace Game.Chat uint spellId = handler.extractSpellIdFromLink(args); if (pet.HasSpell(spellId)) - pet.removeSpell(spellId, false); + pet.RemoveSpell(spellId, false); else handler.SendSysMessage("Pet doesn't have that spell"); @@ -167,18 +167,18 @@ namespace Game.Chat int level = args.NextInt32(); if (level == 0) - level = (int)(owner.getLevel() - pet.getLevel()); + level = (int)(owner.GetLevel() - pet.GetLevel()); if (level == 0 || level < -SharedConst.StrongMaxLevel || level > SharedConst.StrongMaxLevel) { handler.SendSysMessage(CypherStrings.BadValue); return false; } - int newLevel = (int)pet.getLevel() + level; + int newLevel = (int)pet.GetLevel() + level; if (newLevel < 1) newLevel = 1; - else if (newLevel > owner.getLevel()) - newLevel = (int)owner.getLevel(); + else if (newLevel > owner.GetLevel()) + newLevel = (int)owner.GetLevel(); pet.GivePetLevel(newLevel); return true; diff --git a/Source/Game/Chat/Commands/ResetCommands.cs b/Source/Game/Chat/Commands/ResetCommands.cs index f5e27b2a9..0efc18e9f 100644 --- a/Source/Game/Chat/Commands/ResetCommands.cs +++ b/Source/Game/Chat/Commands/ResetCommands.cs @@ -72,7 +72,7 @@ namespace Game.Chat if (!player.HasAuraType(AuraType.ModShapeshift)) player.SetShapeshiftForm(ShapeShiftForm.None); - player.setFactionForRace(player.GetRace()); + player.SetFactionForRace(player.GetRace()); player.SetPowerType(powerType); // reset only if player not in some form; @@ -98,7 +98,7 @@ namespace Game.Chat if (!HandleResetStatsOrLevelHelper(target)) return false; - byte oldLevel = (byte)target.getLevel(); + byte oldLevel = (byte)target.GetLevel(); // set starting level uint startLevel = (uint)(target.GetClass() != Class.Deathknight ? WorldConfig.GetIntValue(WorldCfg.StartPlayerLevel) : WorldConfig.GetIntValue(WorldCfg.StartDeathKnightPlayerLevel)); diff --git a/Source/Game/Chat/Commands/SceneCommands.cs b/Source/Game/Chat/Commands/SceneCommands.cs index b339d5847..127557de7 100644 --- a/Source/Game/Chat/Commands/SceneCommands.cs +++ b/Source/Game/Chat/Commands/SceneCommands.cs @@ -19,7 +19,6 @@ using Framework.Constants; using Framework.IO; using Game.DataStorage; using Game.Entities; -using System; namespace Game.Chat { diff --git a/Source/Game/Collision/BoundingIntervalHierarchy.cs b/Source/Game/Collision/BoundingIntervalHierarchy.cs index 188e6d07a..413f10fc1 100644 --- a/Source/Game/Collision/BoundingIntervalHierarchy.cs +++ b/Source/Game/Collision/BoundingIntervalHierarchy.cs @@ -19,7 +19,6 @@ using Framework.GameMath; using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Runtime.InteropServices; namespace Game.Collision diff --git a/Source/Game/Collision/BoundingIntervalHierarchyWrap.cs b/Source/Game/Collision/BoundingIntervalHierarchyWrap.cs index b566eb44d..b444116a2 100644 --- a/Source/Game/Collision/BoundingIntervalHierarchyWrap.cs +++ b/Source/Game/Collision/BoundingIntervalHierarchyWrap.cs @@ -16,7 +16,6 @@ */ using Framework.GameMath; -using System; using System.Collections.Generic; namespace Game.Collision diff --git a/Source/Game/Collision/DynamicTree.cs b/Source/Game/Collision/DynamicTree.cs index b7faafed2..17321ad02 100644 --- a/Source/Game/Collision/DynamicTree.cs +++ b/Source/Game/Collision/DynamicTree.cs @@ -16,7 +16,6 @@ */ using Framework.GameMath; -using System.Collections.Generic; namespace Game.Collision { diff --git a/Source/Game/Collision/Models/IModel.cs b/Source/Game/Collision/Models/IModel.cs index e169abb06..9d184e9a8 100644 --- a/Source/Game/Collision/Models/IModel.cs +++ b/Source/Game/Collision/Models/IModel.cs @@ -16,15 +16,14 @@ */ using Framework.GameMath; -using System.Collections.Generic; using Framework.Constants; namespace Game.Collision { public class IModel { - public virtual Vector3 getPosition() { return default(Vector3); } - public virtual AxisAlignedBox getBounds() { return default(AxisAlignedBox); } + public virtual Vector3 getPosition() { return default; } + public virtual AxisAlignedBox getBounds() { return default; } public virtual bool IntersectRay(Ray ray, ref float maxDist, bool stopAtFirstHit, PhaseShift phaseShift, ModelIgnoreFlags ignoreFlags) { return false; } public virtual bool IntersectRay(Ray ray, ref float distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags) { return false; } diff --git a/Source/Game/Collision/RegularGrid2D.cs b/Source/Game/Collision/RegularGrid2D.cs index 6df189566..458ecfb77 100644 --- a/Source/Game/Collision/RegularGrid2D.cs +++ b/Source/Game/Collision/RegularGrid2D.cs @@ -18,7 +18,6 @@ using Framework.GameMath; using System; using System.Collections.Generic; -using System.Collections.Concurrent; namespace Game.Collision { diff --git a/Source/Game/Combat/HostileRegManager.cs b/Source/Game/Combat/HostileRegManager.cs index 099ac89a2..94f1931e7 100644 --- a/Source/Game/Combat/HostileRegManager.cs +++ b/Source/Game/Combat/HostileRegManager.cs @@ -115,7 +115,7 @@ namespace Game.Combat { HostileReference nextRef = refe.next(); Unit owner = refe.GetSource().GetOwner(); - if (!owner.isActiveObject() && owner.GetExactDist2dSq(getOwner()) > range) + if (!owner.IsActiveObject() && owner.GetExactDist2dSq(getOwner()) > range) { refe.removeReference(); } @@ -207,11 +207,11 @@ namespace Game.Combat public override void targetObjectBuildLink() { - getTarget().addHatedBy(this); + getTarget().AddHatedBy(this); } public override void targetObjectDestroyLink() { - getTarget().removeHatedBy(this); + getTarget().RemoveHatedBy(this); } public override void sourceObjectDestroyLink() { @@ -277,7 +277,7 @@ namespace Game.Combat ) { Creature creature = getSourceUnit().ToCreature(); - online = getTarget().isInAccessiblePlaceFor(creature); + online = getTarget().IsInAccessiblePlaceFor(creature); if (!online) { if (creature.IsWithinCombatRange(getTarget(), creature.m_CombatDistance)) diff --git a/Source/Game/Conditions/Condition.cs b/Source/Game/Conditions/Condition.cs index 0e3da9ab8..15a349d55 100644 --- a/Source/Game/Conditions/Condition.cs +++ b/Source/Game/Conditions/Condition.cs @@ -91,11 +91,11 @@ namespace Game.Conditions break; case ConditionTypes.Class: if (unit != null) - condMeets = Convert.ToBoolean(unit.getClassMask() & ConditionValue1); + condMeets = Convert.ToBoolean(unit.GetClassMask() & ConditionValue1); break; case ConditionTypes.Race: if (unit != null) - condMeets = Convert.ToBoolean(unit.getRaceMask() & ConditionValue1); + condMeets = Convert.ToBoolean(unit.GetRaceMask() & ConditionValue1); break; case ConditionTypes.Gender: if (player != null) @@ -169,7 +169,7 @@ namespace Game.Conditions break; case ConditionTypes.Level: if (unit != null) - condMeets = MathFunctions.CompareValues((ComparisionType)ConditionValue2, unit.getLevel(), ConditionValue1); + condMeets = MathFunctions.CompareValues((ComparisionType)ConditionValue2, unit.GetLevel(), ConditionValue1); break; case ConditionTypes.DrunkenState: if (player != null) @@ -201,7 +201,7 @@ namespace Game.Conditions } break; case ConditionTypes.TypeMask: - condMeets = Convert.ToBoolean((TypeMask)ConditionValue1 & obj.objectTypeMask); + condMeets = Convert.ToBoolean((TypeMask)ConditionValue1 & obj.ObjectTypeMask); break; case ConditionTypes.RelationTo: { @@ -332,7 +332,7 @@ namespace Game.Conditions { Pet pet = player.GetPet(); if (pet) - condMeets = (((1 << (int)pet.getPetType()) & ConditionValue1) != 0); + condMeets = (((1 << (int)pet.GetPetType()) & ConditionValue1) != 0); } break; } diff --git a/Source/Game/Conditions/ConditionManager.cs b/Source/Game/Conditions/ConditionManager.cs index 0423e1fb9..b56833021 100644 --- a/Source/Game/Conditions/ConditionManager.cs +++ b/Source/Game/Conditions/ConditionManager.cs @@ -25,7 +25,6 @@ using Game.Loots; using Game.Spells; using System; using System.Collections.Generic; -using System.Linq; using Framework.IO; namespace Game @@ -1677,16 +1676,16 @@ namespace Game public static bool IsPlayerMeetingCondition(Player player, PlayerConditionRecord condition) { - if (condition.MinLevel != 0 && player.getLevel() < condition.MinLevel) + if (condition.MinLevel != 0 && player.GetLevel() < condition.MinLevel) return false; - if (condition.MaxLevel != 0 && player.getLevel() > condition.MaxLevel) + if (condition.MaxLevel != 0 && player.GetLevel() > condition.MaxLevel) return false; - if (condition.RaceMask != 0 && !Convert.ToBoolean(player.getRaceMask() & condition.RaceMask)) + if (condition.RaceMask != 0 && !Convert.ToBoolean(player.GetRaceMask() & condition.RaceMask)) return false; - if (condition.ClassMask != 0 && !Convert.ToBoolean(player.getClassMask() & condition.ClassMask)) + if (condition.ClassMask != 0 && !Convert.ToBoolean(player.GetClassMask() & condition.ClassMask)) return false; if (condition.Gender >= 0 && (int)player.GetGender() != condition.Gender) diff --git a/Source/Game/DataStorage/AreaTriggerDataStorage.cs b/Source/Game/DataStorage/AreaTriggerDataStorage.cs index c8f743918..07eef850c 100644 --- a/Source/Game/DataStorage/AreaTriggerDataStorage.cs +++ b/Source/Game/DataStorage/AreaTriggerDataStorage.cs @@ -19,7 +19,6 @@ using Framework.Constants; using Framework.Database; using Framework.GameMath; using Game.Entities; -using System; using System.Collections.Generic; namespace Game.DataStorage diff --git a/Source/Game/DataStorage/ClientReader/GameTables.cs b/Source/Game/DataStorage/ClientReader/GameTables.cs index 683159963..ba1e88e6b 100644 --- a/Source/Game/DataStorage/ClientReader/GameTables.cs +++ b/Source/Game/DataStorage/ClientReader/GameTables.cs @@ -83,7 +83,7 @@ namespace Game.DataStorage public T GetRow(uint row) { if (row >= _data.Count) - return default(T); + return default; return _data[(int)row]; } diff --git a/Source/Game/DataStorage/DB2Manager.cs b/Source/Game/DataStorage/DB2Manager.cs index d0cb33290..211c649f3 100644 --- a/Source/Game/DataStorage/DB2Manager.cs +++ b/Source/Game/DataStorage/DB2Manager.cs @@ -21,7 +21,6 @@ using Framework.GameMath; using System; using System.Collections.Generic; using System.Linq; -using System.Text.RegularExpressions; namespace Game.DataStorage { diff --git a/Source/Game/DataStorage/M2Storage.cs b/Source/Game/DataStorage/M2Storage.cs index d8e6e465c..94442799b 100644 --- a/Source/Game/DataStorage/M2Storage.cs +++ b/Source/Game/DataStorage/M2Storage.cs @@ -19,7 +19,6 @@ using Framework.GameMath; using System; using System.Collections.Generic; using System.IO; -using System.Runtime.InteropServices; namespace Game.DataStorage { diff --git a/Source/Game/DataStorage/Structs/F_Records.cs b/Source/Game/DataStorage/Structs/F_Records.cs index 65695a41a..64be37a53 100644 --- a/Source/Game/DataStorage/Structs/F_Records.cs +++ b/Source/Game/DataStorage/Structs/F_Records.cs @@ -16,7 +16,6 @@ */ using Framework.Constants; -using System; namespace Game.DataStorage { diff --git a/Source/Game/DataStorage/Structs/M_Records.cs b/Source/Game/DataStorage/Structs/M_Records.cs index 01fc91f2e..3fdb87476 100644 --- a/Source/Game/DataStorage/Structs/M_Records.cs +++ b/Source/Game/DataStorage/Structs/M_Records.cs @@ -16,7 +16,6 @@ */ using Framework.Constants; using Framework.GameMath; -using System; namespace Game.DataStorage { diff --git a/Source/Game/DataStorage/Structs/P_Records.cs b/Source/Game/DataStorage/Structs/P_Records.cs index 30bb81471..439bf9e54 100644 --- a/Source/Game/DataStorage/Structs/P_Records.cs +++ b/Source/Game/DataStorage/Structs/P_Records.cs @@ -16,7 +16,6 @@ */ using Framework.Constants; -using System; namespace Game.DataStorage { diff --git a/Source/Game/DataStorage/WhoListStorage.cs b/Source/Game/DataStorage/WhoListStorage.cs index 353bc115f..bf7da0663 100644 --- a/Source/Game/DataStorage/WhoListStorage.cs +++ b/Source/Game/DataStorage/WhoListStorage.cs @@ -85,7 +85,7 @@ namespace Game.DataStorage if (guild) guildGuid = guild.GetGUID(); - _whoListStorage.Add(new WhoListPlayerInfo(player.GetGUID(), player.GetTeam(), player.GetSession().GetSecurity(), player.getLevel(), + _whoListStorage.Add(new WhoListPlayerInfo(player.GetGUID(), player.GetTeam(), player.GetSession().GetSecurity(), player.GetLevel(), player.GetClass(), player.GetRace(), player.GetZoneId(), player.m_playerData.NativeSex, player.IsVisible(), player.IsGameMaster(), playerName, guildName, guildGuid)); } diff --git a/Source/Game/DungeonFinding/LFGManager.cs b/Source/Game/DungeonFinding/LFGManager.cs index d511fbfa7..9b010177f 100644 --- a/Source/Game/DungeonFinding/LFGManager.cs +++ b/Source/Game/DungeonFinding/LFGManager.cs @@ -649,7 +649,7 @@ namespace Game.DungeonFinding return null; } - public void UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid = default(ObjectGuid), LfgRoles roles = LfgRoles.None) + public void UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid = default, LfgRoles roles = LfgRoles.None) { if (gguid.IsEmpty()) return; @@ -1342,7 +1342,7 @@ namespace Game.DungeonFinding if (dungeon.difficulty == Difficulty.Heroic) player.UpdateCriteria(CriteriaTypes.UseLfdToGroupWithPlayers, 1); - LfgReward reward = GetRandomDungeonReward(rDungeonId, player.getLevel()); + LfgReward reward = GetRandomDungeonReward(rDungeonId, player.GetLevel()); if (reward == null) continue; @@ -1496,7 +1496,7 @@ namespace Game.DungeonFinding return lockDic; } - uint level = player.getLevel(); + uint level = player.GetLevel(); Expansion expansion = player.GetSession().GetExpansion(); var dungeons = GetDungeonsByRandom(0); bool denyJoin = !player.GetSession().HasPermission(RBACPermissions.JoinDungeonFinder); diff --git a/Source/Game/Entities/AreaTrigger/AreaTrigger.cs b/Source/Game/Entities/AreaTrigger/AreaTrigger.cs index 65f3746ca..be130c6b6 100644 --- a/Source/Game/Entities/AreaTrigger/AreaTrigger.cs +++ b/Source/Game/Entities/AreaTrigger/AreaTrigger.cs @@ -24,7 +24,6 @@ using Game.Network.Packets; using Game.Spells; using System; using System.Collections.Generic; -using Game; using Framework.Dynamic; using Game.Network; @@ -37,8 +36,8 @@ namespace Game.Entities _previousCheckOrientation = float.PositiveInfinity; _reachedDestination = true; - objectTypeMask |= TypeMask.AreaTrigger; - objectTypeId = TypeId.AreaTrigger; + ObjectTypeMask |= TypeMask.AreaTrigger; + ObjectTypeId = TypeId.AreaTrigger; m_updateFlag.Stationary = true; m_updateFlag.AreaTrigger = true; @@ -79,7 +78,7 @@ namespace Game.Entities } } - public static AreaTrigger CreateAreaTrigger(uint spellMiscId, Unit caster, Unit target, SpellInfo spell, Position pos, int duration, uint spellXSpellVisualId, ObjectGuid castId = default(ObjectGuid), AuraEffect aurEff = null) + public static AreaTrigger CreateAreaTrigger(uint spellMiscId, Unit caster, Unit target, SpellInfo spell, Position pos, int duration, uint spellXSpellVisualId, ObjectGuid castId = default, AuraEffect aurEff = null) { AreaTrigger at = new AreaTrigger(); if (!at.Create(spellMiscId, caster, target, spell, pos, duration, spellXSpellVisualId, castId, aurEff)) @@ -393,7 +392,7 @@ namespace Game.Entities { Player player = unit.ToPlayer(); if (player) - if (player.isDebugAreaTriggers) + if (player.IsDebugAreaTriggers) player.SendSysMessage(CypherStrings.DebugAreatriggerEntered, GetTemplate().Id); DoActions(unit); @@ -408,7 +407,7 @@ namespace Game.Entities { Player player = leavingUnit.ToPlayer(); if (player) - if (player.isDebugAreaTriggers) + if (player.IsDebugAreaTriggers) player.SendSysMessage(CypherStrings.DebugAreatriggerLeft, GetTemplate().Id); UndoActions(leavingUnit); @@ -887,7 +886,7 @@ namespace Game.Entities { Player player = caster.ToPlayer(); if (player) - if (player.isDebugAreaTriggers) + if (player.IsDebugAreaTriggers) player.SummonCreature(1, this, TempSummonType.TimedDespawn, GetTimeToTarget()); } } diff --git a/Source/Game/Entities/Conversation.cs b/Source/Game/Entities/Conversation.cs index 8fd6d516a..b357aec97 100644 --- a/Source/Game/Entities/Conversation.cs +++ b/Source/Game/Entities/Conversation.cs @@ -30,8 +30,8 @@ namespace Game.Entities { _duration = 0; - objectTypeMask |= TypeMask.Conversation; - objectTypeId = TypeId.Conversation; + ObjectTypeMask |= TypeMask.Conversation; + ObjectTypeId = TypeId.Conversation; m_updateFlag.Stationary = true; m_updateFlag.Conversation = true; diff --git a/Source/Game/Entities/Corpse.cs b/Source/Game/Entities/Corpse.cs index e55dc6cf6..7f07eca43 100644 --- a/Source/Game/Entities/Corpse.cs +++ b/Source/Game/Entities/Corpse.cs @@ -32,8 +32,8 @@ namespace Game.Entities public Corpse(CorpseType type = CorpseType.Bones) : base(type != CorpseType.Bones) { m_type = type; - objectTypeId = TypeId.Corpse; - objectTypeMask |= TypeMask.Corpse; + ObjectTypeId = TypeId.Corpse; + ObjectTypeMask |= TypeMask.Corpse; m_updateFlag.Stationary = true; diff --git a/Source/Game/Entities/Creature/Creature.Fields.cs b/Source/Game/Entities/Creature/Creature.Fields.cs index 2433a363b..a16019be3 100644 --- a/Source/Game/Entities/Creature/Creature.Fields.cs +++ b/Source/Game/Entities/Creature/Creature.Fields.cs @@ -42,7 +42,7 @@ namespace Game.Entities public bool m_isTempWorldObject; //true when possessed ReactStates reactState; // for AI, not charmInfo - public MovementGeneratorType m_defaultMovementType { get; set; } + public MovementGeneratorType DefaultMovementType { get; set; } public ulong m_spawnId; byte m_equipmentId; sbyte m_originalEquipmentId; // can be -1 diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 0ec945995..aea54bee6 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -41,11 +41,11 @@ namespace Game.Entities m_corpseDelay = 60; m_boundaryCheckTime = 2500; reactState = ReactStates.Aggressive; - m_defaultMovementType = MovementGeneratorType.Idle; + DefaultMovementType = MovementGeneratorType.Idle; m_regenHealth = true; m_meleeDamageSchoolMask = SpellSchoolMask.Normal; - m_regenTimer = SharedConst.CreatureRegenInterval; + RegenTimer = SharedConst.CreatureRegenInterval; m_SightDistance = SharedConst.SightRangeUnit; @@ -120,11 +120,11 @@ namespace Game.Entities public void RemoveCorpse(bool setSpawnTime = true, bool destroyForNearbyPlayers = true) { - if (getDeathState() != DeathState.Corpse) + if (GetDeathState() != DeathState.Corpse) return; m_corpseRemoveTime = Time.UnixTime; - setDeathState(DeathState.Dead); + SetDeathState(DeathState.Dead); RemoveAllAuras(); DestroyForNearbyPlayers(); // old UpdateObjectVisibility() loot.clear(); @@ -254,9 +254,9 @@ namespace Game.Entities SetHoverHeight(cinfo.HoverHeight); // checked at loading - m_defaultMovementType = (MovementGeneratorType)(data != null ? data.movementType : cinfo.MovementType); - if (m_respawnradius == 0 && m_defaultMovementType == MovementGeneratorType.Random) - m_defaultMovementType = MovementGeneratorType.Idle; + DefaultMovementType = (MovementGeneratorType)(data != null ? data.movementType : cinfo.MovementType); + if (m_respawnradius == 0 && DefaultMovementType == MovementGeneratorType.Random) + DefaultMovementType = MovementGeneratorType.Idle; for (byte i = 0; i < SharedConst.MaxCreatureSpells; ++i) m_spells[i] = GetCreatureTemplate().Spells[i]; @@ -365,8 +365,8 @@ namespace Game.Entities { TriggerJustRespawned = false; GetAI().JustRespawned(); - if (m_vehicleKit != null) - m_vehicleKit.Reset(); + if (VehicleKit != null) + VehicleKit.Reset(); } UpdateMovementFlags(); @@ -514,15 +514,15 @@ namespace Game.Entities if (!IsAlive()) break; - if (m_regenTimer > 0) + if (RegenTimer > 0) { - if (diff >= m_regenTimer) - m_regenTimer = 0; + if (diff >= RegenTimer) + RegenTimer = 0; else - m_regenTimer -= diff; + RegenTimer -= diff; } - if (m_regenTimer == 0) + if (RegenTimer == 0) { bool bInCombat = IsInCombat() && (!GetVictim() || // if IsInCombat() is true and this has no victim !GetVictim().GetCharmerOrOwnerPlayerOrPlayerItself() || // or the victim/owner/charmer is not a player @@ -536,7 +536,7 @@ namespace Game.Entities else Regenerate(PowerType.Mana); - m_regenTimer = SharedConst.CreatureRegenInterval; + RegenTimer = SharedConst.CreatureRegenInterval; } if (CanNotReachTarget() && !IsInEvadeMode() && !GetMap().IsRaid()) @@ -605,7 +605,7 @@ namespace Game.Entities void RegenerateHealth() { - if (!isRegeneratingHealth()) + if (!IsRegeneratingHealth()) return; ulong curValue = GetHealth(); @@ -703,12 +703,12 @@ namespace Game.Entities { if (m_formation == null) GetMotionMaster().Initialize(); - else if (m_formation.getLeader() == this) + else if (m_formation.GetLeader() == this) { m_formation.FormationReset(false); GetMotionMaster().Initialize(); } - else if (m_formation.isFormed()) + else if (m_formation.IsFormed()) GetMotionMaster().MoveIdle(); //wait the order of leader else GetMotionMaster().Initialize(); @@ -840,7 +840,7 @@ namespace Game.Entities SetReactState(ReactStates.Aggressive); } - public bool isCanInteractWithBattleMaster(Player player, bool msg) + public bool CanInteractWithBattleMaster(Player player, bool msg) { if (!IsBattleMaster()) return false; @@ -882,7 +882,7 @@ namespace Game.Entities public bool CanResetTalents(Player player) { - return player.getLevel() >= 15 && player.GetClass() == GetCreatureTemplate().TrainerClass; + return player.GetLevel() >= 15 && player.GetClass() == GetCreatureTemplate().TrainerClass; } public void SetTextRepeatId(byte textGroup, byte id) @@ -977,7 +977,7 @@ namespace Game.Entities AddDynamicFlag(UnitDynFlags.Tapped); } - public bool isTappedBy(Player player) + public bool IsTappedBy(Player player) { if (player.GetGUID() == m_lootRecipient) return true; @@ -1138,7 +1138,7 @@ namespace Game.Entities { CreatureTemplate cInfo = GetCreatureTemplate(); CreatureEliteType rank = IsPet() ? 0 : cInfo.Rank; - CreatureBaseStats stats = Global.ObjectMgr.GetCreatureBaseStats(getLevel(), cInfo.UnitClass); + CreatureBaseStats stats = Global.ObjectMgr.GetCreatureBaseStats(GetLevel(), cInfo.UnitClass); // health float healthmod = _GetHealthMod(rank); @@ -1357,7 +1357,7 @@ namespace Game.Entities SetHealth((m_deathState == DeathState.Alive || m_deathState == DeathState.JustRespawned) ? curhealth : 0); } - public override bool hasQuest(uint quest_id) + public override bool HasQuest(uint quest_id) { var qr = Global.ObjectMgr.GetCreatureQuestRelationBounds(GetEntry()); foreach (var id in qr) @@ -1368,7 +1368,7 @@ namespace Game.Entities return false; } - public override bool hasInvolvedQuest(uint quest_id) + public override bool HasInvolvedQuest(uint quest_id) { var qir = Global.ObjectMgr.GetCreatureQuestInvolvedRelationBounds(GetEntry()); foreach (var id in qir) @@ -1455,7 +1455,7 @@ namespace Game.Entities if (who.IsInCombat() && IsWithinDist(who, SharedConst.AttackDistance)) { - Unit victim = who.getAttackerForHelper(); + Unit victim = who.GetAttackerForHelper(); if (victim != null) if (IsWithinDistInMap(victim, WorldConfig.GetFloatValue(WorldCfg.CreatureFamilyAssistanceRadius))) force = true; @@ -1515,9 +1515,9 @@ namespace Game.Entities return (aggroRadius * aggroRate); } - public override void setDeathState(DeathState s) + public override void SetDeathState(DeathState s) { - base.setDeathState(s); + base.SetDeathState(s); if (s == DeathState.JustDied) { @@ -1528,7 +1528,7 @@ namespace Game.Entities m_respawnTime = Time.UnixTime + m_respawnDelay + m_corpseDelay; // always save boss respawn time at death to prevent crash cheating - if (WorldConfig.GetBoolValue(WorldCfg.SaveRespawnTimeImmediately) || isWorldBoss()) + if (WorldConfig.GetBoolValue(WorldCfg.SaveRespawnTimeImmediately) || IsWorldBoss()) SaveRespawnTime(); ReleaseFocus(null, false); // remove spellcast focus @@ -1540,7 +1540,7 @@ namespace Game.Entities SetMountDisplayId(0); // if creature is mounted on a virtual mount, remove it at death - setActive(false); + SetActive(false); if (HasSearchedAssistance()) { @@ -1549,13 +1549,13 @@ namespace Game.Entities } //Dismiss group if is leader - if (m_formation != null && m_formation.getLeader() == this) + if (m_formation != null && m_formation.GetLeader() == this) m_formation.FormationReset(true); if ((CanFly() || IsFlying())) GetMotionMaster().MoveFall(); - base.setDeathState(DeathState.Corpse); + base.SetDeathState(DeathState.Corpse); } else if (s == DeathState.JustRespawned) { @@ -1598,7 +1598,7 @@ namespace Game.Entities } InitializeMovementAI(); - base.setDeathState(DeathState.Alive); + base.SetDeathState(DeathState.Alive); LoadCreaturesAddon(); } } @@ -1610,14 +1610,14 @@ namespace Game.Entities if (force) { if (IsAlive()) - setDeathState(DeathState.JustDied); - else if (getDeathState() != DeathState.Corpse) - setDeathState(DeathState.Corpse); + SetDeathState(DeathState.JustDied); + else if (GetDeathState() != DeathState.Corpse) + SetDeathState(DeathState.Corpse); } RemoveCorpse(false, false); - if (getDeathState() == DeathState.Dead) + if (GetDeathState() == DeathState.Dead) { if (m_spawnId != 0) GetMap().RemoveCreatureRespawnTime(m_spawnId); @@ -1632,7 +1632,7 @@ namespace Game.Entities else SelectLevel(); - setDeathState(DeathState.JustRespawned); + SetDeathState(DeathState.JustRespawned); CreatureModel display = new CreatureModel(GetNativeDisplayId(), GetNativeDisplayScale(), 1.0f); if (Global.ObjectMgr.GetCreatureModelRandomGender(ref display, GetCreatureTemplate()) != null) @@ -1660,7 +1660,7 @@ namespace Game.Entities UpdateObjectVisibility(); } - public void ForcedDespawn(uint timeMSToDespawn = 0, TimeSpan forceRespawnTimer = default(TimeSpan)) + public void ForcedDespawn(uint timeMSToDespawn = 0, TimeSpan forceRespawnTimer = default) { if (timeMSToDespawn != 0) { @@ -1674,7 +1674,7 @@ namespace Game.Entities DestroyForNearbyPlayers(); if (IsAlive()) - setDeathState(DeathState.JustDied); + SetDeathState(DeathState.JustDied); bool overrideRespawnTime = true; if (forceRespawnTimer > TimeSpan.Zero) @@ -1687,9 +1687,9 @@ namespace Game.Entities RemoveCorpse(overrideRespawnTime, false); } - public void DespawnOrUnsummon(TimeSpan time, TimeSpan forceRespawnTimer = default(TimeSpan)) { DespawnOrUnsummon((uint)time.TotalMilliseconds, forceRespawnTimer); } + public void DespawnOrUnsummon(TimeSpan time, TimeSpan forceRespawnTimer = default) { DespawnOrUnsummon((uint)time.TotalMilliseconds, forceRespawnTimer); } - public void DespawnOrUnsummon(uint msTimeToDespawn = 0, TimeSpan forceRespawnTimer = default(TimeSpan)) + public void DespawnOrUnsummon(uint msTimeToDespawn = 0, TimeSpan forceRespawnTimer = default) { TempSummon summon = ToTempSummon(); if (summon != null) @@ -1759,7 +1759,7 @@ namespace Game.Entities return base.IsImmunedToSpellEffect(spellInfo, index, caster); } - public bool isElite() + public bool IsElite() { if (IsPet()) return false; @@ -1768,7 +1768,7 @@ namespace Game.Entities return rank != CreatureEliteType.Elite && rank != CreatureEliteType.RareElite; } - public bool isWorldBoss() + public bool IsWorldBoss() { if (IsPet()) return false; @@ -1776,7 +1776,7 @@ namespace Game.Entities return Convert.ToBoolean(GetCreatureTemplate().TypeFlags & CreatureTypeFlags.BossMob); } - public SpellInfo reachWithSpellAttack(Unit victim) + public SpellInfo ReachWithSpellAttack(Unit victim) { if (victim == null) return null; @@ -1825,7 +1825,7 @@ namespace Game.Entities return null; } - SpellInfo reachWithSpellCure(Unit victim) + SpellInfo ReachWithSpellCure(Unit victim) { if (victim == null) return null; @@ -2013,7 +2013,7 @@ namespace Game.Entities public bool _IsTargetAcceptable(Unit target) { // if the target cannot be attacked, the target is not acceptable - if (IsFriendlyTo(target) || !target.isTargetableForAttack(false) + if (IsFriendlyTo(target) || !target.IsTargetableForAttack(false) || (m_vehicle != null && (IsOnVehicle(target) || m_vehicle.GetBase().IsOnVehicle(target)))) return false; @@ -2026,8 +2026,8 @@ namespace Game.Entities return false; } - Unit myVictim = getAttackerForHelper(); - Unit targetVictim = target.getAttackerForHelper(); + Unit myVictim = GetAttackerForHelper(); + Unit targetVictim = target.GetAttackerForHelper(); // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable if (GetVictim() == target || IsHostileTo(target)) @@ -2062,7 +2062,7 @@ namespace Game.Entities if (!IsValidAttackTarget(victim)) return false; - if (!victim.isInAccessiblePlaceFor(this)) + if (!victim.IsInAccessiblePlaceFor(this)) return false; if (IsAIEnabled && !GetAI().CanAIAttack(victim)) @@ -2082,7 +2082,7 @@ namespace Game.Entities return true; // don't check distance to home position if recently damaged, this should include taunt auras - if (!isWorldBoss() && (GetLastDamagedTime() > GameTime.GetGameTime() || HasAuraType(AuraType.ModTaunt))) + if (!IsWorldBoss() && (GetLastDamagedTime() > GameTime.GetGameTime() || HasAuraType(AuraType.ModTaunt))) return true; } @@ -2302,7 +2302,7 @@ namespace Game.Entities public void AllLootRemovedFromCorpse() { - if (loot.loot_type != LootType.Skinning && !IsPet() && GetCreatureTemplate().SkinLootId != 0 && hasLootRecipient()) + if (loot.loot_type != LootType.Skinning && !IsPet() && GetCreatureTemplate().SkinLootId != 0 && HasLootRecipient()) if (LootStorage.Skinning.HaveLootFor(GetCreatureTemplate().SkinLootId)) AddUnitFlag(UnitFlags.Skinnable); @@ -2340,7 +2340,7 @@ namespace Game.Entities return 1.0f; uint levelForTarget = GetLevelForTarget(target); - if (getLevel() < levelForTarget) + if (GetLevel() < levelForTarget) return 1.0f; return (float)GetMaxHealthByLevel(levelForTarget) / GetCreateHealth(); @@ -2360,7 +2360,7 @@ namespace Game.Entities uint levelForTarget = GetLevelForTarget(target); - return GetBaseDamageForLevel(levelForTarget) / GetBaseDamageForLevel(getLevel()); + return GetBaseDamageForLevel(levelForTarget) / GetBaseDamageForLevel(GetLevel()); } float GetBaseArmorForLevel(uint level) @@ -2377,7 +2377,7 @@ namespace Game.Entities uint levelForTarget = GetLevelForTarget(target); - return GetBaseArmorForLevel(levelForTarget) / GetBaseArmorForLevel(getLevel()); + return GetBaseArmorForLevel(levelForTarget) / GetBaseArmorForLevel(GetLevel()); } public override uint GetLevelForTarget(WorldObject target) @@ -2385,9 +2385,9 @@ namespace Game.Entities Unit unitTarget = target.ToUnit(); if (unitTarget) { - if (isWorldBoss()) + if (IsWorldBoss()) { - int level = (int)(unitTarget.getLevel() + WorldConfig.GetIntValue(WorldCfg.WorldBossLevelDiff)); + int level = (int)(unitTarget.GetLevel() + WorldConfig.GetIntValue(WorldCfg.WorldBossLevelDiff)); return (uint)MathFunctions.RoundToInterval(ref level, 1u, 255u); } @@ -2395,7 +2395,7 @@ namespace Game.Entities // between UNIT_FIELD_SCALING_LEVEL_MIN and UNIT_FIELD_SCALING_LEVEL_MAX if (HasScalableLevels()) { - int targetLevelWithDelta = (int)unitTarget.getLevel() + m_unitData.ScalingLevelDelta; + int targetLevelWithDelta = (int)unitTarget.GetLevel() + m_unitData.ScalingLevelDelta; if (target.IsPlayer()) targetLevelWithDelta += target.ToPlayer().m_activePlayerData.ScalingPlayerLevelDelta; @@ -2975,7 +2975,7 @@ namespace Game.Entities SetSpawnHealth(); - m_defaultMovementType = (MovementGeneratorType)data.movementType; + DefaultMovementType = (MovementGeneratorType)data.movementType; loot.SetGUID(ObjectGuid.Create(HighGuid.LootObject, data.mapid, data.id, GetMap().GenerateLowGuid(HighGuid.LootObject))); @@ -2984,7 +2984,7 @@ namespace Game.Entities return true; } - public bool hasLootRecipient() { return !m_lootRecipient.IsEmpty() || !m_lootRecipientGroup.IsEmpty(); } + public bool HasLootRecipient() { return !m_lootRecipient.IsEmpty() || !m_lootRecipientGroup.IsEmpty(); } public LootModes GetLootMode() { return m_LootMode; } public bool HasLootMode(LootModes lootMode) { return Convert.ToBoolean(m_LootMode & lootMode); } @@ -2997,8 +2997,8 @@ namespace Game.Entities public void SetNoSearchAssistance(bool val) { m_AlreadySearchedAssistance = val; } public bool HasSearchedAssistance() { return m_AlreadySearchedAssistance; } - MovementGeneratorType GetDefaultMovementType() { return m_defaultMovementType; } - public void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; } + MovementGeneratorType GetDefaultMovementType() { return DefaultMovementType; } + public void SetDefaultMovementType(MovementGeneratorType mgt) { DefaultMovementType = mgt; } public long GetRespawnTime() { return m_respawnTime; } public void SetRespawnTime(uint respawn) { m_respawnTime = respawn != 0 ? Time.UnixTime + respawn : 0; } @@ -3018,8 +3018,8 @@ namespace Game.Entities m_combatPulseTime = delay; } - bool isRegeneratingHealth() { return m_regenHealth; } - public void setRegeneratingHealth(bool regenHealth) { m_regenHealth = regenHealth; } + bool IsRegeneratingHealth() { return m_regenHealth; } + public void SetRegeneratingHealth(bool regenHealth) { m_regenHealth = regenHealth; } public void SetHomePosition(float x, float y, float z, float o) { @@ -3097,7 +3097,7 @@ namespace Game.Entities for (var i = tauntAuras.Count - 1; i >= 0; i--) { caster = tauntAuras[i].GetCaster(); - if (caster != null && CanSeeOrDetect(caster, true) && IsValidAttackTarget(caster) && caster.isInAccessiblePlaceFor(ToCreature())) + if (caster != null && CanSeeOrDetect(caster, true) && IsValidAttackTarget(caster) && caster.IsInAccessiblePlaceFor(ToCreature())) { target = caster; break; @@ -3117,21 +3117,21 @@ namespace Game.Entities else if (!HasReactState(ReactStates.Passive)) { // We have player pet probably - target = getAttackerForHelper(); + target = GetAttackerForHelper(); if (target == null && IsSummon()) { Unit owner = ToTempSummon().GetOwner(); if (owner != null) { if (owner.IsInCombat()) - target = owner.getAttackerForHelper(); + target = owner.GetAttackerForHelper(); if (target == null) { foreach (var unit in owner.m_Controlled) { if (unit.IsInCombat()) { - target = unit.getAttackerForHelper(); + target = unit.GetAttackerForHelper(); if (target) break; } @@ -3247,7 +3247,7 @@ namespace Game.Entities public class ForcedDespawnDelayEvent : BasicEvent { - public ForcedDespawnDelayEvent(Creature owner, TimeSpan respawnTimer = default(TimeSpan)) + public ForcedDespawnDelayEvent(Creature owner, TimeSpan respawnTimer = default) { m_owner = owner; m_respawnTimer = respawnTimer; diff --git a/Source/Game/Entities/Creature/CreatureData.cs b/Source/Game/Entities/Creature/CreatureData.cs index c7045524d..884cdfc6f 100644 --- a/Source/Game/Entities/Creature/CreatureData.cs +++ b/Source/Game/Entities/Creature/CreatureData.cs @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; using Framework.Dynamic; using Game.Network.Packets; -using Game.Network; namespace Game.Entities { diff --git a/Source/Game/Entities/Creature/CreatureGroups.cs b/Source/Game/Entities/Creature/CreatureGroups.cs index f49cfc64f..0a6dd2668 100644 --- a/Source/Game/Entities/Creature/CreatureGroups.cs +++ b/Source/Game/Entities/Creature/CreatureGroups.cs @@ -54,7 +54,7 @@ namespace Game.Entities Log.outDebug(LogFilter.Unit, "Deleting member GUID: {0} from group {1}", group.GetId(), member.GetSpawnId()); group.RemoveMember(member); - if (group.isEmpty()) + if (group.IsEmpty()) { Map map = member.GetMap(); if (!map) @@ -264,10 +264,10 @@ namespace Game.Entities } } - public Creature getLeader() { return m_leader; } + public Creature GetLeader() { return m_leader; } public uint GetId() { return m_groupID; } - public bool isEmpty() { return m_members.Empty(); } - public bool isFormed() { return m_Formed; } + public bool IsEmpty() { return m_members.Empty(); } + public bool IsFormed() { return m_Formed; } Creature m_leader; Dictionary m_members = new Dictionary(); diff --git a/Source/Game/Entities/Creature/Trainer.cs b/Source/Game/Entities/Creature/Trainer.cs index 1acb79612..dfb34ea87 100644 --- a/Source/Game/Entities/Creature/Trainer.cs +++ b/Source/Game/Entities/Creature/Trainer.cs @@ -123,7 +123,7 @@ namespace Game.Entities return TrainerSpellState.Unavailable; // check level requirement - if (player.getLevel() < trainerSpell.ReqLevel) + if (player.GetLevel() < trainerSpell.ReqLevel) return TrainerSpellState.Unavailable; // check ranks diff --git a/Source/Game/Entities/DynamicObject.cs b/Source/Game/Entities/DynamicObject.cs index 95dda4e01..e402918fc 100644 --- a/Source/Game/Entities/DynamicObject.cs +++ b/Source/Game/Entities/DynamicObject.cs @@ -25,8 +25,8 @@ namespace Game.Entities { public DynamicObject(bool isWorldObject) : base(isWorldObject) { - objectTypeMask |= TypeMask.DynamicObject; - objectTypeId = TypeId.DynamicObject; + ObjectTypeMask |= TypeMask.DynamicObject; + ObjectTypeId = TypeId.DynamicObject; m_updateFlag.Stationary = true; @@ -100,7 +100,7 @@ namespace Game.Entities SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.CastTime), GameTime.GetGameTimeMS()); if (IsWorldObject()) - setActive(true); //must before add to map to be put in world container + SetActive(true); //must before add to map to be put in world container Transport transport = caster.GetTransport(); if (transport) diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index 543b4dceb..e68b7d177 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -18,7 +18,6 @@ using Framework.Constants; using Framework.Database; using Framework.GameMath; -using Framework.IO; using Game.AI; using Game.BattleGrounds; using Game.Collision; @@ -39,8 +38,8 @@ namespace Game.Entities { public GameObject() : base(false) { - objectTypeMask |= TypeMask.GameObject; - objectTypeId = TypeId.GameObject; + ObjectTypeMask |= TypeMask.GameObject; + ObjectTypeId = TypeId.GameObject; m_updateFlag.Stationary = true; m_updateFlag.Rotation = true; @@ -50,7 +49,7 @@ namespace Game.Entities m_spawnedByDefault = true; ResetLootMode(); // restore default loot mode - m_stationaryPosition = new Position(); + StationaryPosition = new Position(); m_gameObjectData = new GameObjectFieldData(); } @@ -125,7 +124,7 @@ namespace Game.Entities GetMap().GetGameObjectBySpawnIdStore().Add(m_spawnId, this); // The state can be changed after GameObject.Create but before GameObject.AddToWorld - bool toggledState = GetGoType() == GameObjectTypes.Chest ? getLootState() == LootState.Ready : (GetGoState() == GameObjectState.Ready || IsTransport()); + bool toggledState = GetGoType() == GameObjectTypes.Chest ? GetLootState() == LootState.Ready : (GetGoState() == GameObjectState.Ready || IsTransport()); if (m_model != null) { Transport trans = ToTransport(); @@ -188,7 +187,7 @@ namespace Game.Entities SetMap(map); Relocate(pos); - m_stationaryPosition.Relocate(pos); + StationaryPosition.Relocate(pos); if (!IsPositionValid()) { Log.outError(LogFilter.Server, "Gameobject (Spawn id: {0} Entry: {1}) not created. Suggested coordinates isn't valid (X: {2} Y: {3})", GetSpawnId(), entry, pos.GetPositionX(), pos.GetPositionY()); @@ -583,7 +582,7 @@ namespace Game.Entities } } - if (isSpawned()) + if (IsSpawned()) { GameObjectTemplate goInfo = GetGoInfo(); uint max_charges; @@ -812,7 +811,7 @@ namespace Game.Entities if (m_respawnTime > 0 && m_spawnedByDefault) return; - if (isSpawned()) + if (IsSpawned()) GetMap().AddToMap(this); } @@ -848,7 +847,7 @@ namespace Game.Entities SendMessageToSet(packet, true); } - public void getFishLoot(Loot fishloot, Player loot_owner) + public void GetFishLoot(Loot fishloot, Player loot_owner) { fishloot.clear(); @@ -868,7 +867,7 @@ namespace Game.Entities } } - public void getFishLootJunk(Loot fishloot, Player loot_owner) + public void GetFishLootJunk(Loot fishloot, Player loot_owner) { fishloot.clear(); @@ -1039,7 +1038,7 @@ namespace Game.Entities DB.World.Execute(stmt); } - public override bool hasQuest(uint quest_id) + public override bool HasQuest(uint quest_id) { var qr = Global.ObjectMgr.GetGOQuestRelationBounds(GetEntry()); @@ -1051,7 +1050,7 @@ namespace Game.Entities return false; } - public override bool hasInvolvedQuest(uint quest_id) + public override bool HasInvolvedQuest(uint quest_id) { var qir = Global.ObjectMgr.GetGOQuestInvolvedRelationBounds(GetEntry()); foreach (var id in qir) @@ -1138,7 +1137,7 @@ namespace Game.Entities return true; Unit owner = GetOwner(); - if (owner != null && seer.isTypeMask(TypeMask.Unit) && owner.IsFriendlyTo(seer.ToUnit())) + if (owner != null && seer.IsTypeMask(TypeMask.Unit) && owner.IsFriendlyTo(seer.ToUnit())) return true; } @@ -1151,7 +1150,7 @@ namespace Game.Entities return true; // Despawned - if (!isSpawned()) + if (!IsSpawned()) return true; return false; @@ -1545,7 +1544,7 @@ namespace Game.Entities if (player.GetGUID() != GetOwnerGUID()) return; - switch (getLootState()) + switch (GetLootState()) { case LootState.Ready: // ready for loot { @@ -1752,10 +1751,10 @@ namespace Game.Entities return; //required lvl checks! - uint level = player.getLevel(); + uint level = player.GetLevel(); if (level < info.MeetingStone.minLevel) return; - level = targetPlayer.getLevel(); + level = targetPlayer.GetLevel(); if (level < info.MeetingStone.minLevel) return; @@ -2625,13 +2624,13 @@ namespace Game.Entities m_respawnDelayTime = (uint)(respawn > 0 ? respawn : 0); } - public bool isSpawned() + public bool IsSpawned() { return m_respawnDelayTime == 0 || (m_respawnTime > 0 && !m_spawnedByDefault) || (m_respawnTime == 0 && m_spawnedByDefault); } - public bool isSpawnedByDefault() { return m_spawnedByDefault; } + public bool IsSpawnedByDefault() { return m_spawnedByDefault; } public void SetSpawnedByDefault(bool b) { m_spawnedByDefault = b; } public uint GetRespawnDelay() { return m_respawnDelayTime; } @@ -2648,7 +2647,7 @@ namespace Game.Entities byte GetGoAnimProgress() { return m_gameObjectData.PercentHealth; } public void SetGoAnimProgress(uint animprogress) { SetUpdateFieldValue(m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.PercentHealth), (byte)animprogress); } - public LootState getLootState() { return m_lootState; } + public LootState GetLootState() { return m_lootState; } public LootModes GetLootMode() { return m_LootMode; } bool HasLootMode(LootModes lootMode) { return Convert.ToBoolean(m_LootMode & lootMode); } void SetLootMode(LootModes lootMode) { m_LootMode = lootMode; } @@ -2701,12 +2700,12 @@ namespace Game.Entities public uint GetFaction() { return m_gameObjectData.FactionTemplate; } public void SetFaction(uint faction) { SetUpdateFieldValue(m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.FactionTemplate), faction); } - public override float GetStationaryX() { return m_stationaryPosition.GetPositionX(); } - public override float GetStationaryY() { return m_stationaryPosition.GetPositionY(); } - public override float GetStationaryZ() { return m_stationaryPosition.GetPositionZ(); } - public override float GetStationaryO() { return m_stationaryPosition.GetOrientation(); } + public override float GetStationaryX() { return StationaryPosition.GetPositionX(); } + public override float GetStationaryY() { return StationaryPosition.GetPositionY(); } + public override float GetStationaryZ() { return StationaryPosition.GetPositionZ(); } + public override float GetStationaryO() { return StationaryPosition.GetOrientation(); } - public void RelocateStationaryPosition(float x, float y, float z, float o) { m_stationaryPosition.Relocate(x, y, z, o); } + public void RelocateStationaryPosition(float x, float y, float z, float o) { StationaryPosition.Relocate(x, y, z, o); } //! Object distance/size - overridden from Object._IsWithinDist. Needs to take in account proper GO size. public override bool _IsWithinDist(WorldObject obj, float dist2compare, bool is3D) @@ -2748,7 +2747,7 @@ namespace Game.Entities public ObjectGuid lootingGroupLowGUID; // used to find group which is looting long m_packedRotation; Quaternion m_worldRotation; - public Position m_stationaryPosition { get; set; } + public Position StationaryPosition { get; set; } GameObjectAI m_AI; ushort _animKitId; @@ -2774,7 +2773,7 @@ namespace Game.Entities _owner = owner; } - public override bool IsSpawned() { return _owner.isSpawned(); } + public override bool IsSpawned() { return _owner.IsSpawned(); } public override uint GetDisplayId() { return _owner.GetDisplayId(); } public override byte GetNameSetId() { return _owner.GetNameSetId(); } public override bool IsInPhase(PhaseShift phaseShift) { return _owner.GetPhaseShift().CanSee(phaseShift); } diff --git a/Source/Game/Entities/GameObject/GameObjectData.cs b/Source/Game/Entities/GameObject/GameObjectData.cs index 810958919..d72bfc501 100644 --- a/Source/Game/Entities/GameObject/GameObjectData.cs +++ b/Source/Game/Entities/GameObject/GameObjectData.cs @@ -20,7 +20,6 @@ using Framework.Constants; using Framework.GameMath; using System.Collections.Generic; using System.Runtime.InteropServices; -using Game.Network; using Game.Network.Packets; namespace Game.Entities diff --git a/Source/Game/Entities/Item/Bag.cs b/Source/Game/Entities/Item/Bag.cs index 6984c7698..7e54d885c 100644 --- a/Source/Game/Entities/Item/Bag.cs +++ b/Source/Game/Entities/Item/Bag.cs @@ -25,8 +25,8 @@ namespace Game.Entities { public Bag() { - objectTypeMask |= TypeMask.Container; - objectTypeId = TypeId.Container; + ObjectTypeMask |= TypeMask.Container; + ObjectTypeId = TypeId.Container; m_containerData = new ContainerData(); } diff --git a/Source/Game/Entities/Item/Item.cs b/Source/Game/Entities/Item/Item.cs index 74c661687..2bb46193e 100644 --- a/Source/Game/Entities/Item/Item.cs +++ b/Source/Game/Entities/Item/Item.cs @@ -18,7 +18,6 @@ using Framework.Collections; using Framework.Constants; using Framework.Database; -using Framework.IO; using Game.DataStorage; using Game.Loots; using Game.Network; @@ -36,8 +35,8 @@ namespace Game.Entities { public Item() : base(false) { - objectTypeMask |= TypeMask.Item; - objectTypeId = TypeId.Item; + ObjectTypeMask |= TypeMask.Item; + ObjectTypeId = TypeId.Item; m_itemData = new ItemData(); @@ -911,7 +910,7 @@ namespace Game.Entities return true; } - public void SetEnchantment(EnchantmentSlot slot, uint id, uint duration, uint charges, ObjectGuid caster = default(ObjectGuid)) + public void SetEnchantment(EnchantmentSlot slot, uint id, uint duration, uint charges, ObjectGuid caster = default) { // Better lost small time at check in comparison lost time at item save to DB. if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges)) @@ -922,7 +921,7 @@ namespace Game.Entities { uint oldEnchant = GetEnchantmentId(slot); if (oldEnchant != 0) - owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), ObjectGuid.Empty, GetGUID(), GetEntry(), (uint)oldEnchant, (uint)slot); + owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), ObjectGuid.Empty, GetGUID(), GetEntry(), oldEnchant, (uint)slot); if (id != 0) owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), caster, GetGUID(), GetEntry(), id, (uint)slot); @@ -1893,7 +1892,7 @@ namespace Game.Entities uint minItemLevelCutoff = owner.m_unitData.MinItemLevelCutoff; uint maxItemLevel = GetTemplate().GetFlags3().HasAnyFlag(ItemFlags3.IgnoreItemLevelCapInPvp) ? 0u : owner.m_unitData.MaxItemLevel; bool pvpBonus = owner.IsUsingPvpItemLevels(); - return GetItemLevel(GetTemplate(), _bonusData, owner.getLevel(), GetModifier(ItemModifier.ScalingStatDistributionFixedLevel), GetModifier(ItemModifier.UpgradeId), + return GetItemLevel(GetTemplate(), _bonusData, owner.GetLevel(), GetModifier(ItemModifier.ScalingStatDistributionFixedLevel), GetModifier(ItemModifier.UpgradeId), minItemLevel, minItemLevelCutoff, maxItemLevel, pvpBonus); } @@ -2607,8 +2606,8 @@ namespace Game.Entities uState = state; } - public override bool hasQuest(uint quest_id) { return GetTemplate().GetStartQuest() == quest_id; } - public override bool hasInvolvedQuest(uint quest_id) { return false; } + public override bool HasQuest(uint quest_id) { return GetTemplate().GetStartQuest() == quest_id; } + public override bool HasInvolvedQuest(uint quest_id) { return false; } public bool IsPotion() { return GetTemplate().IsPotion(); } public bool IsVellum() { return GetTemplate().IsVellum(); } public bool IsConjuredConsumable() { return GetTemplate().IsConjuredConsumable(); } @@ -2762,7 +2761,7 @@ namespace Game.Entities count = _count; } - public bool isContainedIn(List vec) + public bool IsContainedIn(List vec) { foreach (var posCount in vec) if (posCount.pos == pos) diff --git a/Source/Game/Entities/Item/ItemTemplate.cs b/Source/Game/Entities/Item/ItemTemplate.cs index bca4a3272..dbc368a9f 100644 --- a/Source/Game/Entities/Item/ItemTemplate.cs +++ b/Source/Game/Entities/Item/ItemTemplate.cs @@ -234,9 +234,9 @@ namespace Game.Entities return false; int levelIndex = 0; - if (player.getLevel() >= 110) + if (player.GetLevel() >= 110) levelIndex = 2; - else if (player.getLevel() > 40) + else if (player.GetLevel() > 40) levelIndex = 1; return Specializations[levelIndex].Get(CalculateItemSpecBit(chrSpecialization)); diff --git a/Source/Game/Entities/Object/ObjectGuid.cs b/Source/Game/Entities/Object/ObjectGuid.cs index 803a9b8b6..f6fdc924a 100644 --- a/Source/Game/Entities/Object/ObjectGuid.cs +++ b/Source/Game/Entities/Object/ObjectGuid.cs @@ -25,6 +25,9 @@ namespace Game.Entities public static ObjectGuid Empty = new ObjectGuid(); public static ObjectGuid TradeItem = Create(HighGuid.Uniq, 10ul); + ulong _low; + ulong _high; + public ObjectGuid(ulong high, ulong low) { _low = low; @@ -321,13 +324,13 @@ namespace Game.Entities return false; } } - - ulong _low; - ulong _high; } public class ObjectGuidGenerator { + ulong _nextGuid; + HighGuid _highGuid; + public ObjectGuidGenerator(HighGuid highGuid, ulong start = 1) { _highGuid = highGuid; @@ -350,8 +353,5 @@ namespace Game.Entities Log.outFatal(LogFilter.Server, "{0} guid overflow!! Can't continue, shutting down server. ", _highGuid); Global.WorldMgr.StopNow(); } - - ulong _nextGuid; - HighGuid _highGuid; } } diff --git a/Source/Game/Entities/Object/Position.cs b/Source/Game/Entities/Object/Position.cs index e3c85938d..a5b294eeb 100644 --- a/Source/Game/Entities/Object/Position.cs +++ b/Source/Game/Entities/Object/Position.cs @@ -23,6 +23,11 @@ namespace Game.Entities { public class Position { + public float posX; + public float posY; + public float posZ; + public float Orientation; + public Position(float x = 0f, float y = 0f, float z = 0f, float o = 0f) { posX = x; @@ -321,15 +326,16 @@ namespace Game.Entities { return $"X: {posX} Y: {posY} Z: {posZ} O: {Orientation}"; } - - public float posX; - public float posY; - public float posZ; - public float Orientation; } public class WorldLocation : Position { + uint _mapId; + Cell currentCell; + public ObjectCellMoveState _moveState; + + public Position _newPosition = new Position(); + public WorldLocation(uint mapId = 0xFFFFFFFF, float x = 0, float y = 0, float z = 0, float o = 0) { _mapId = mapId; @@ -384,11 +390,5 @@ namespace Game.Entities { return this; } - - uint _mapId; - Cell currentCell; - public ObjectCellMoveState _moveState; - - public Position _newPosition = new Position(); } } diff --git a/Source/Game/Entities/Object/Update/UpdateData.cs b/Source/Game/Entities/Object/Update/UpdateData.cs index c1642d498..b102c671e 100644 --- a/Source/Game/Entities/Object/Update/UpdateData.cs +++ b/Source/Game/Entities/Object/Update/UpdateData.cs @@ -24,6 +24,11 @@ namespace Game.Entities { public class UpdateData { + uint MapId; + uint BlockCount; + List outOfRangeGUIDs = new List(); + ByteBuffer data = new ByteBuffer(); + public UpdateData(uint mapId) { MapId = mapId; @@ -82,10 +87,5 @@ namespace Game.Entities public List GetOutOfRangeGUIDs() { return outOfRangeGUIDs; } public void SetMapId(ushort mapId) { MapId = mapId; } - - uint MapId; - uint BlockCount; - List outOfRangeGUIDs = new List(); - ByteBuffer data = new ByteBuffer(); } } diff --git a/Source/Game/Entities/Object/Update/UpdateField.cs b/Source/Game/Entities/Object/Update/UpdateField.cs index 45b91331b..f25711368 100644 --- a/Source/Game/Entities/Object/Update/UpdateField.cs +++ b/Source/Game/Entities/Object/Update/UpdateField.cs @@ -27,6 +27,9 @@ namespace Game.Entities { public class UpdateFieldHolder { + UpdateMask _changesMask = new UpdateMask((int)TypeId.Max); + WorldObject _owner; + public UpdateFieldHolder(WorldObject owner) { _owner = owner; } public BaseUpdateData ModifyValue(BaseUpdateData updateData) @@ -59,9 +62,6 @@ namespace Game.Entities { return _changesMask[(int)index]; } - - UpdateMask _changesMask = new UpdateMask((int)TypeId.Max); - WorldObject _owner; } public interface IUpdateField @@ -430,6 +430,9 @@ namespace Game.Entities public class DynamicUpdateFieldSetter : IUpdateField where T : new() { + DynamicUpdateField _dynamicUpdateField; + int _index; + public DynamicUpdateFieldSetter(DynamicUpdateField dynamicUpdateField, int index) { _dynamicUpdateField = dynamicUpdateField; @@ -447,8 +450,5 @@ namespace Game.Entities { return dynamicUpdateFieldSetter.GetValue(); } - - DynamicUpdateField _dynamicUpdateField; - int _index; } } diff --git a/Source/Game/Entities/Object/Update/UpdateFields.cs b/Source/Game/Entities/Object/Update/UpdateFields.cs index a1ca98a39..2c09f8dfd 100644 --- a/Source/Game/Entities/Object/Update/UpdateFields.cs +++ b/Source/Game/Entities/Object/Update/UpdateFields.cs @@ -19,9 +19,7 @@ using Framework.Constants; using Game.Network; using System; using System.Collections.Generic; -using System.Linq; using Framework.GameMath; -using System.Runtime.CompilerServices; using Game.Spells; using Game.DataStorage; @@ -84,10 +82,10 @@ namespace Game.Entities Creature creature = obj.ToCreature(); if (creature != null) { - if (creature.hasLootRecipient() && !creature.isTappedBy(receiver)) + if (creature.HasLootRecipient() && !creature.IsTappedBy(receiver)) unitDynFlags |= UnitDynFlags.Tapped; - if (!receiver.isAllowedToLoot(creature)) + if (!receiver.IsAllowedToLoot(creature)) unitDynFlags &= ~UnitDynFlags.Lootable; } @@ -1998,7 +1996,7 @@ namespace Game.Entities CreatureTemplate cinfo = unit.ToCreature().GetCreatureTemplate(); // this also applies for transform auras - SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.getTransForm()); + SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.GetTransForm()); if (transform != null) { foreach (SpellEffectInfo effect in transform.GetEffectsForDifficulty(unit.GetMap().GetDifficultyID())) diff --git a/Source/Game/Entities/Object/Update/UpdateMask.cs b/Source/Game/Entities/Object/Update/UpdateMask.cs index d2f4831d0..000d6ddfd 100644 --- a/Source/Game/Entities/Object/Update/UpdateMask.cs +++ b/Source/Game/Entities/Object/Update/UpdateMask.cs @@ -15,9 +15,6 @@ * along with this program. If not, see . */ -using Framework.Constants; -using Framework.IO; -using System.Collections; using System; namespace Game.Entities diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 72cbd3c9f..4122b7810 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -15,26 +15,17 @@ * along with this program. If not, see . */ -using Framework.Collections; using Framework.Constants; using Framework.Dynamic; using Framework.GameMath; -using Framework.IO; using Game.AI; using Game.BattleFields; -using Game.DataStorage; using Game.Maps; using Game.Network; using Game.Network.Packets; using Game.Scenarios; using System; -using System.Collections; using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Linq.Expressions; -using System.Reflection; namespace Game.Entities { @@ -48,8 +39,8 @@ namespace Game.Entities m_serverSideVisibility.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive | GhostVisibilityType.Ghost); m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive); - objectTypeId = TypeId.Object; - objectTypeMask = TypeMask.Object; + ObjectTypeId = TypeId.Object; + ObjectTypeMask = TypeMask.Object; m_values = new UpdateFieldHolder(this); @@ -75,7 +66,7 @@ namespace Game.Entities if (IsInWorld) { Log.outFatal(LogFilter.Misc, "WorldObject.Dispose() {0} deleted but still in world!!", GetGUID().ToString()); - if (isTypeMask(TypeMask.Item)) + if (IsTypeMask(TypeMask.Item)) Log.outFatal(LogFilter.Misc, "Item slot {0}", ((Item)this).GetSlot()); Cypher.Assert(false); } @@ -107,7 +98,7 @@ namespace Game.Entities if (!IsInWorld) return; - if (!objectTypeMask.HasAnyFlag(TypeMask.Item | TypeMask.Container)) + if (!ObjectTypeMask.HasAnyFlag(TypeMask.Item | TypeMask.Container)) DestroyForNearbyPlayers(); IsInWorld = false; @@ -120,8 +111,8 @@ namespace Game.Entities return; UpdateType updateType = UpdateType.CreateObject; - TypeId tempObjectType = objectTypeId; - TypeMask tempObjectTypeMask = objectTypeMask; + TypeId tempObjectType = ObjectTypeId; + TypeMask tempObjectTypeMask = ObjectTypeMask; CreateObjectBits flags = m_updateFlag; if (target == this) @@ -164,7 +155,7 @@ namespace Game.Entities if (flags.Stationary) { // UPDATETYPE_CREATE_OBJECT2 for some gameobject types... - if (isTypeMask(TypeMask.GameObject)) + if (IsTypeMask(TypeMask.GameObject)) { switch (ToGameObject().GetGoType()) { @@ -357,7 +348,7 @@ namespace Game.Entities // HasMovementSpline - marks that spline data is present in packet if (HasSpline) - MovementExtensions.WriteCreateObjectSplineDataBlock(unit.moveSpline, data); + MovementExtensions.WriteCreateObjectSplineDataBlock(unit.MoveSpline, data); } data.WriteInt32(PauseTimesCount); @@ -949,7 +940,7 @@ namespace Game.Entities GetMap().AddObjectToSwitchList(this, on); } - public void setActive(bool on) + public void SetActive(bool on) { if (m_isActive == on) return; @@ -1039,7 +1030,7 @@ namespace Game.Entities public float GetGridActivationRange() { - if (isActiveObject()) + if (IsActiveObject()) { if (GetTypeId() == TypeId.Player && ToPlayer().GetCinematicMgr().IsOnCinematic()) return Math.Max(SharedConst.DefaultVisibilityInstance, GetMap().GetVisibilityRange()); @@ -1057,7 +1048,7 @@ namespace Game.Entities { if (IsVisibilityOverridden() && !IsTypeId(TypeId.Player)) return m_visibilityDistanceOverride.Value; - else if (isActiveObject() && !IsTypeId(TypeId.Player)) + else if (IsActiveObject() && !IsTypeId(TypeId.Player)) return SharedConst.MaxVisibilityDistance; else return GetMap().GetVisibilityRange(); @@ -1071,7 +1062,7 @@ namespace Game.Entities { if (target != null && target.IsVisibilityOverridden() && !target.IsTypeId(TypeId.Player)) return target.m_visibilityDistanceOverride.Value; - else if (target != null && target.isActiveObject() && !target.IsTypeId(TypeId.Player)) + else if (target != null && target.IsActiveObject() && !target.IsTypeId(TypeId.Player)) return SharedConst.MaxVisibilityDistance; else if (ToPlayer().GetCinematicMgr().IsOnCinematic()) return SharedConst.DefaultVisibilityInstance; @@ -1084,7 +1075,7 @@ namespace Game.Entities return SharedConst.SightRangeUnit; } - if (IsTypeId(TypeId.DynamicObject) && isActiveObject()) + if (IsTypeId(TypeId.DynamicObject) && IsActiveObject()) { return GetMap().GetVisibilityRange(); } @@ -1493,7 +1484,7 @@ namespace Game.Entities if (IsTypeId(TypeId.Player) || IsTypeId(TypeId.Unit)) { summon.SetFaction(ToUnit().GetFaction()); - summon.SetLevel(ToUnit().getLevel()); + summon.SetLevel(ToUnit().GetLevel()); } if (AI != null) @@ -1647,7 +1638,7 @@ namespace Game.Entities if (!player.HaveAtClient(this)) continue; - if (isTypeMask(TypeMask.Unit) && (ToUnit().GetCharmerGUID() == player.GetGUID()))// @todo this is for puppet + if (IsTypeMask(TypeMask.Unit) && (ToUnit().GetCharmerGUID() == player.GetGUID()))// @todo this is for puppet continue; DestroyForPlayer(player); @@ -1707,17 +1698,17 @@ namespace Game.Entities public void RemoveDynamicFlag(UnitDynFlags flag) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(m_objectData).ModifyValue(m_objectData.DynamicFlags), (uint)flag); } public void SetDynamicFlags(UnitDynFlags flag) { SetUpdateFieldValue(m_values.ModifyValue(m_objectData).ModifyValue(m_objectData.DynamicFlags), (uint)flag); } - public TypeId GetTypeId() { return objectTypeId; } + public TypeId GetTypeId() { return ObjectTypeId; } public bool IsTypeId(TypeId typeId) { return GetTypeId() == typeId; } - public bool isTypeMask(TypeMask mask) { return Convert.ToBoolean(mask & objectTypeMask); } + public bool IsTypeMask(TypeMask mask) { return Convert.ToBoolean(mask & ObjectTypeMask); } - public virtual bool hasQuest(uint questId) { return false; } - public virtual bool hasInvolvedQuest(uint questId) { return false; } + public virtual bool HasQuest(uint questId) { return false; } + public virtual bool HasInvolvedQuest(uint questId) { return false; } public bool IsCreature() { return GetTypeId() == TypeId.Unit; } public bool IsPlayer() { return GetTypeId() == TypeId.Player; } public bool IsGameObject() { return GetTypeId() == TypeId.GameObject; } - public bool IsUnit() { return isTypeMask(TypeMask.Unit); } + public bool IsUnit() { return IsTypeMask(TypeMask.Unit); } public bool IsCorpse() { return GetTypeId() == TypeId.Corpse; } public bool IsDynObject() { return GetTypeId() == TypeId.DynamicObject; } public bool IsAreaTrigger() { return GetTypeId() == TypeId.AreaTrigger; } @@ -1741,13 +1732,13 @@ namespace Game.Entities public ZoneScript GetZoneScript() { return m_zoneScript; } public void AddToNotify(NotifyFlags f) { m_notifyflags |= f; } - public bool isNeedNotify(NotifyFlags f) { return Convert.ToBoolean(m_notifyflags & f); } + public bool IsNeedNotify(NotifyFlags f) { return Convert.ToBoolean(m_notifyflags & f); } NotifyFlags GetNotifyFlags() { return m_notifyflags; } bool NotifyExecuted(NotifyFlags f) { return Convert.ToBoolean(m_executed_notifies & f); } void SetNotified(NotifyFlags f) { m_executed_notifies |= f; } public void ResetAllNotifies() { m_notifyflags = 0; m_executed_notifies = 0; } - public bool isActiveObject() { return m_isActive; } + public bool IsActiveObject() { return m_isActive; } public bool IsPermanentWorldObject() { return m_isWorldObject; } public Transport GetTransport() { return m_transport; } @@ -2007,12 +1998,12 @@ namespace Game.Entities return (size * size) >= GetExactDist2dSq(pos1.GetPositionX() + (float)Math.Cos(angle) * dist, pos1.GetPositionY() + (float)Math.Sin(angle) * dist); } - public bool isInFront(WorldObject target, float arc = MathFunctions.PI) + public bool IsInFront(WorldObject target, float arc = MathFunctions.PI) { return HasInArc(arc, target); } - public bool isInBack(WorldObject target, float arc = MathFunctions.PI) + public bool IsInBack(WorldObject target, float arc = MathFunctions.PI) { return !HasInArc(2 * MathFunctions.PI - arc, target); } @@ -2333,8 +2324,8 @@ namespace Game.Entities public void SetLocationInstanceId(uint _instanceId) { instanceId = _instanceId; } #region Fields - public TypeMask objectTypeMask { get; set; } - protected TypeId objectTypeId { get; set; } + public TypeMask ObjectTypeMask { get; set; } + protected TypeId ObjectTypeId { get; set; } protected CreateObjectBits m_updateFlag; ObjectGuid m_guid; @@ -2381,11 +2372,21 @@ namespace Game.Entities public class MovementInfo { + public ObjectGuid Guid { get; set; } + MovementFlag flags; + MovementFlag2 flags2; + public Position Pos { get; set; } + public uint Time { get; set; } + public TransportInfo transport; + public float Pitch { get; set; } + public JumpInfo jump; + public float SplineElevation { get; set; } + public MovementInfo() { Guid = ObjectGuid.Empty; - Flags = MovementFlag.None; - Flags2 = MovementFlag2.None; + flags = MovementFlag.None; + flags2 = MovementFlag2.None; Time = 0; Pitch = 0.0f; @@ -2394,17 +2395,17 @@ namespace Game.Entities jump.Reset(); } - public MovementFlag GetMovementFlags() { return Flags; } - public void SetMovementFlags(MovementFlag f) { Flags = f; } - public void AddMovementFlag(MovementFlag f) { Flags |= f; } - public void RemoveMovementFlag(MovementFlag f) { Flags &= ~f; } - public bool HasMovementFlag(MovementFlag f) { return Convert.ToBoolean(Flags & f); } + public MovementFlag GetMovementFlags() { return flags; } + public void SetMovementFlags(MovementFlag f) { flags = f; } + public void AddMovementFlag(MovementFlag f) { flags |= f; } + public void RemoveMovementFlag(MovementFlag f) { flags &= ~f; } + public bool HasMovementFlag(MovementFlag f) { return Convert.ToBoolean(flags & f); } - public MovementFlag2 GetMovementFlags2() { return Flags2; } - public void SetMovementFlags2(MovementFlag2 f) { Flags2 = f; } - public void AddMovementFlag2(MovementFlag2 f) { Flags2 |= f; } - public void RemoveMovementFlag2(MovementFlag2 f) { Flags2 &= ~f; } - public bool HasMovementFlag2(MovementFlag2 f) { return Convert.ToBoolean(Flags2 & f); } + public MovementFlag2 GetMovementFlags2() { return flags2; } + public void SetMovementFlags2(MovementFlag2 f) { flags2 = f; } + public void AddMovementFlag2(MovementFlag2 f) { flags2 |= f; } + public void RemoveMovementFlag2(MovementFlag2 f) { flags2 &= ~f; } + public bool HasMovementFlag2(MovementFlag2 f) { return Convert.ToBoolean(flags2 & f); } public void SetFallTime(uint time) { jump.fallTime = time; } @@ -2418,15 +2419,7 @@ namespace Game.Entities jump.Reset(); } - public ObjectGuid Guid { get; set; } - MovementFlag Flags { get; set; } - MovementFlag2 Flags2 { get; set; } - public Position Pos { get; set; } - public uint Time { get; set; } - public TransportInfo transport; - public float Pitch { get; set; } - public JumpInfo jump; - public float SplineElevation { get; set; } + public struct TransportInfo { diff --git a/Source/Game/Entities/Pet.cs b/Source/Game/Entities/Pet.cs index 23eab8a64..bdc7c0e76 100644 --- a/Source/Game/Entities/Pet.cs +++ b/Source/Game/Entities/Pet.cs @@ -40,13 +40,13 @@ namespace Game.Entities Cypher.Assert(GetOwner().IsTypeId(TypeId.Player)); - m_unitTypeMask |= UnitTypeMask.Pet; + UnitTypeMask |= UnitTypeMask.Pet; if (type == PetType.Hunter) - m_unitTypeMask |= UnitTypeMask.HunterPet; + UnitTypeMask |= UnitTypeMask.HunterPet; - if (!m_unitTypeMask.HasAnyFlag(UnitTypeMask.ControlableGuardian)) + if (!UnitTypeMask.HasAnyFlag(UnitTypeMask.ControlableGuardian)) { - m_unitTypeMask |= UnitTypeMask.ControlableGuardian; + UnitTypeMask |= UnitTypeMask.ControlableGuardian; InitCharmInfo(); } @@ -173,7 +173,7 @@ namespace Game.Entities PhasingHandler.InheritPhaseShift(this, owner); - setPetType(petType); + SetPetType(petType); SetFaction(owner.GetFaction()); SetCreatedBySpell(summonSpellId); @@ -203,10 +203,10 @@ namespace Game.Entities SetNpcFlags2(NPCFlags2.None); SetName(result.Read(8)); - switch (getPetType()) + switch (GetPetType()) { case PetType.Summon: - petlevel = owner.getLevel(); + petlevel = owner.GetLevel(); SetClass(Class.Mage); SetUnitFlags(UnitFlags.PvpAttackable); // this enables popup window (pet dismiss, cancel) @@ -220,7 +220,7 @@ namespace Game.Entities break; default: if (!IsPetGhoul()) - Log.outError(LogFilter.Pet, "Pet have incorrect type ({0}) for pet loading.", getPetType()); + Log.outError(LogFilter.Pet, "Pet have incorrect type ({0}) for pet loading.", GetPetType()); break; } @@ -244,14 +244,14 @@ namespace Game.Entities SetReactState((ReactStates)result.Read(6)); SetCanModifyStats(true); - if (getPetType() == PetType.Summon && !current) //all (?) summon pets come with full health when called, but not when they are current + if (GetPetType() == PetType.Summon && !current) //all (?) summon pets come with full health when called, but not when they are current SetFullPower(PowerType.Mana); else { uint savedhealth = result.Read(10); uint savedmana = result.Read(11); - if (savedhealth == 0 && getPetType() == PetType.Hunter) - setDeathState(DeathState.JustDied); + if (savedhealth == 0 && GetPetType() == PetType.Hunter) + SetDeathState(DeathState.JustDied); else { SetHealth(savedhealth); @@ -335,7 +335,7 @@ namespace Game.Entities SetGroupUpdateFlag(GroupUpdatePetFlags.Full); - if (getPetType() == PetType.Hunter) + if (GetPetType() == PetType.Hunter) { stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_DECLINED_NAME); stmt.AddValue(0, owner.GetGUID().GetCounter()); @@ -353,7 +353,7 @@ namespace Game.Entities } //set last used pet number (for use in BG's) - if (owner.IsTypeId(TypeId.Player) && isControlled() && !isTemporarySummoned() && (getPetType() == PetType.Summon || getPetType() == PetType.Hunter)) + if (owner.IsTypeId(TypeId.Player) && IsControlled() && !IsTemporarySummoned() && (GetPetType() == PetType.Summon || GetPetType() == PetType.Hunter)) owner.ToPlayer().SetLastPetNumber(petId); m_loading = false; @@ -367,7 +367,7 @@ namespace Game.Entities return; // save only fully controlled creature - if (!isControlled()) + if (!IsControlled()) return; // not save not player pets @@ -383,7 +383,7 @@ namespace Game.Entities owner.GetTemporaryUnsummonedPetNumber() != GetCharmInfo().GetPetNumber()) { // pet will lost anyway at restore temporary unsummoned - if (getPetType() == PetType.Hunter) + if (GetPetType() == PetType.Hunter) return; // for warlock case @@ -427,7 +427,7 @@ namespace Game.Entities } // prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT - if (getPetType() == PetType.Hunter && (mode == PetSaveMode.AsCurrent || mode > PetSaveMode.LastStableSlot)) + if (GetPetType() == PetType.Hunter && (mode == PetSaveMode.AsCurrent || mode > PetSaveMode.LastStableSlot)) { stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PET_BY_SLOT); stmt.AddValue(0, ownerLowGUID); @@ -442,7 +442,7 @@ namespace Game.Entities stmt.AddValue(1, GetEntry()); stmt.AddValue(2, ownerLowGUID); stmt.AddValue(3, GetNativeDisplayId()); - stmt.AddValue(4, getLevel()); + stmt.AddValue(4, GetLevel()); stmt.AddValue(5, (uint)m_unitData.PetExperience); stmt.AddValue(6, GetReactState()); stmt.AddValue(7, mode); @@ -453,7 +453,7 @@ namespace Game.Entities stmt.AddValue(12, GenerateActionBarData()); stmt.AddValue(13, Time.UnixTime); stmt.AddValue(14, (uint)m_unitData.CreatedBySpell); - stmt.AddValue(15, getPetType()); + stmt.AddValue(15, GetPetType()); stmt.AddValue(16, m_petSpecialization); trans.Append(stmt); @@ -502,19 +502,19 @@ namespace Game.Entities DB.Characters.CommitTransaction(trans); } - public override void setDeathState(DeathState s) + public override void SetDeathState(DeathState s) { - base.setDeathState(s); - if (getDeathState() == DeathState.Corpse) + base.SetDeathState(s); + if (GetDeathState() == DeathState.Corpse) { - if (getPetType() == PetType.Hunter) + if (GetPetType() == PetType.Hunter) { // pet corpse non lootable and non skinnable SetDynamicFlags(UnitDynFlags.None); RemoveUnitFlag(UnitFlags.Skinnable); } } - else if (getDeathState() == DeathState.Alive) + else if (GetDeathState() == DeathState.Alive) { CastPetAuras(true); } @@ -532,7 +532,7 @@ namespace Game.Entities { case DeathState.Corpse: { - if (getPetType() != PetType.Hunter || m_corpseRemoveTime <= Time.UnixTime) + if (GetPetType() != PetType.Hunter || m_corpseRemoveTime <= Time.UnixTime) { Remove(PetSaveMode.NotInSlot); //hunters' pets never get removed because of death, NEVER! return; @@ -543,18 +543,18 @@ namespace Game.Entities { // unsummon pet that lost owner Player owner = GetOwner(); - if (owner == null || (!IsWithinDistInMap(owner, GetMap().GetVisibilityRange()) && !isPossessed()) || (isControlled() && owner.GetPetGUID().IsEmpty())) + if (owner == null || (!IsWithinDistInMap(owner, GetMap().GetVisibilityRange()) && !IsPossessed()) || (IsControlled() && owner.GetPetGUID().IsEmpty())) { Remove(PetSaveMode.NotInSlot, true); return; } - if (isControlled()) + if (IsControlled()) { if (owner.GetPetGUID() != GetGUID()) { Log.outError(LogFilter.Pet, "Pet {0} is not pet of owner {1}, removed", GetEntry(), GetOwner().GetName()); - Remove(getPetType() == PetType.Hunter ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot); + Remove(GetPetType() == PetType.Hunter ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot); return; } } @@ -565,7 +565,7 @@ namespace Game.Entities m_duration -= (int)diff; else { - Remove(getPetType() != PetType.Summon ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot); + Remove(GetPetType() != PetType.Summon ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot); return; } } @@ -610,7 +610,7 @@ namespace Game.Entities public void GivePetXP(uint xp) { - if (getPetType() != PetType.Hunter) + if (GetPetType() != PetType.Hunter) return; if (xp < 1) @@ -619,8 +619,8 @@ namespace Game.Entities if (!IsAlive()) return; - uint maxlevel = Math.Min(WorldConfig.GetUIntValue(WorldCfg.MaxPlayerLevel), GetOwner().getLevel()); - uint petlevel = getLevel(); + uint maxlevel = Math.Min(WorldConfig.GetUIntValue(WorldCfg.MaxPlayerLevel), GetOwner().GetLevel()); + uint petlevel = GetLevel(); // If pet is detected to be at, or above(?) the players level, don't hand out XP if (petlevel >= maxlevel) @@ -647,10 +647,10 @@ namespace Game.Entities public void GivePetLevel(int level) { - if (level == 0 || level == getLevel()) + if (level == 0 || level == GetLevel()) return; - if (getPetType() == PetType.Hunter) + if (GetPetType() == PetType.Hunter) { SetPetExperience(0); SetPetNextLevelExperience((uint)(Global.ObjectMgr.GetXPForLevel((uint)level) * PetXPFactor)); @@ -714,7 +714,7 @@ namespace Game.Entities SetPetNameTimestamp(0); SetPetExperience(0); - SetPetNextLevelExperience((uint)(Global.ObjectMgr.GetXPForLevel(getLevel() + 1) * PetXPFactor)); + SetPetNextLevelExperience((uint)(Global.ObjectMgr.GetXPForLevel(GetLevel() + 1) * PetXPFactor)); SetNpcFlags(NPCFlags.None); SetNpcFlags2(NPCFlags2.None); @@ -751,13 +751,13 @@ namespace Game.Entities public uint GetCurrentFoodBenefitLevel(uint itemlevel) { // -5 or greater food level - if (getLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect + if (GetLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect return 35000; // -10..-6 - else if (getLevel() <= itemlevel + 10) //pure guess, but sounds good + else if (GetLevel() <= itemlevel + 10) //pure guess, but sounds good return 17000; // -14..-11 - else if (getLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me + else if (GetLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me return 8000; // -15 or less else @@ -786,7 +786,7 @@ namespace Game.Entities { do { - addSpell(result.Read(0), (ActiveStates)result.Read(1), PetSpellState.Unchanged); + AddSpell(result.Read(0), (ActiveStates)result.Read(1), PetSpellState.Unchanged); } while (result.NextRow()); } @@ -992,7 +992,7 @@ namespace Game.Entities } } - bool addSpell(uint spellId, ActiveStates active = ActiveStates.Decide, PetSpellState state = PetSpellState.New, PetSpellType type = PetSpellType.Normal) + bool AddSpell(uint spellId, ActiveStates active = ActiveStates.Decide, PetSpellState state = PetSpellState.New, PetSpellType type = PetSpellType.Normal) { SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); if (spellInfo == null) @@ -1075,7 +1075,7 @@ namespace Game.Entities if (newspell.active == ActiveStates.Enabled) ToggleAutocast(oldRankSpellInfo, false); - unlearnSpell(pair.Key, false, false); + UnlearnSpell(pair.Key, false, false); break; } // ignore new lesser rank @@ -1098,29 +1098,29 @@ namespace Game.Entities return true; } - public bool learnSpell(uint spell_id) + public bool LearnSpell(uint spellId) { // prevent duplicated entires in spell book - if (!addSpell(spell_id)) + if (!AddSpell(spellId)) return false; if (!m_loading) { PetLearnedSpells packet = new PetLearnedSpells(); - packet.Spells.Add(spell_id); + packet.Spells.Add(spellId); GetOwner().SendPacket(packet); GetOwner().PetSpellInitialize(); } return true; } - void learnSpells(List spellIds) + void LearnSpells(List spellIds) { PetLearnedSpells packet = new PetLearnedSpells(); foreach (uint spell in spellIds) { - if (!addSpell(spell)) + if (!AddSpell(spell)) continue; packet.Spells.Add(spell); @@ -1132,7 +1132,7 @@ namespace Game.Entities void InitLevelupSpellsForLevel() { - uint level = getLevel(); + uint level = GetLevel(); var levelupSpells = GetCreatureTemplate().Family != 0 ? Global.SpellMgr.GetPetLevelupSpellList(GetCreatureTemplate().Family) : null; if (levelupSpells != null) { @@ -1141,10 +1141,10 @@ namespace Game.Entities { // will called first if level down if (pair.Key > level) - unlearnSpell(pair.Value, true); // will learn prev rank if any + UnlearnSpell(pair.Value, true); // will learn prev rank if any // will called if level up else - learnSpell(pair.Value); // will unlearn prev rank if any + LearnSpell(pair.Value); // will unlearn prev rank if any } } @@ -1160,22 +1160,22 @@ namespace Game.Entities // will called first if level down if (spellInfo.SpellLevel > level) - unlearnSpell(spellInfo.Id, true); + UnlearnSpell(spellInfo.Id, true); // will called if level up else - learnSpell(spellInfo.Id); + LearnSpell(spellInfo.Id); } } } - bool unlearnSpell(uint spell_id, bool learn_prev, bool clear_ab = true) + bool UnlearnSpell(uint spellId, bool learnPrev, bool clearActionBar = true) { - if (removeSpell(spell_id, learn_prev, clear_ab)) + if (RemoveSpell(spellId, learnPrev, clearActionBar)) { if (!m_loading) { PetUnlearnedSpells packet = new PetUnlearnedSpells(); - packet.Spells.Add(spell_id); + packet.Spells.Add(spellId); GetOwner().SendPacket(packet); } return true; @@ -1183,13 +1183,13 @@ namespace Game.Entities return false; } - void unlearnSpells(List spellIds, bool learn_prev, bool clear_ab) + void UnlearnSpells(List spellIds, bool learnPrev, bool clearActionBar) { PetUnlearnedSpells packet = new PetUnlearnedSpells(); foreach (uint spell in spellIds) { - if (!removeSpell(spell, learn_prev, clear_ab)) + if (!RemoveSpell(spell, learnPrev, clearActionBar)) continue; packet.Spells.Add(spell); @@ -1199,9 +1199,9 @@ namespace Game.Entities GetOwner().SendPacket(packet); } - public bool removeSpell(uint spell_id, bool learn_prev, bool clear_ab = true) + public bool RemoveSpell(uint spellId, bool learnPrev, bool clearActionBar = true) { - var petSpell = m_spells.LookupByKey(spell_id); + var petSpell = m_spells.LookupByKey(spellId); if (petSpell == null) return false; @@ -1209,23 +1209,23 @@ namespace Game.Entities return false; if (petSpell.state == PetSpellState.New) - m_spells.Remove(spell_id); + m_spells.Remove(spellId); else petSpell.state = PetSpellState.Removed; - RemoveAurasDueToSpell(spell_id); + RemoveAurasDueToSpell(spellId); - if (learn_prev) + if (learnPrev) { - uint prev_id = Global.SpellMgr.GetPrevSpellInChain(spell_id); + uint prev_id = Global.SpellMgr.GetPrevSpellInChain(spellId); if (prev_id != 0) - learnSpell(prev_id); + LearnSpell(prev_id); else - learn_prev = false; + learnPrev = false; } // if remove last rank or non-ranked then update action bar at server and client if need - if (GetCharmInfo().RemoveSpellFromActionBar(spell_id) && !learn_prev && clear_ab) + if (GetCharmInfo().RemoveSpellFromActionBar(spellId) && !learnPrev && clearActionBar) { if (!m_loading) { @@ -1313,7 +1313,7 @@ namespace Game.Entities public bool IsPermanentPetFor(Player owner) { - switch (getPetType()) + switch (GetPetType()) { case PetType.Summon: switch (owner.GetClass()) @@ -1378,7 +1378,7 @@ namespace Game.Entities // Passive 01~10, Passive 00 (20782, not used), Ferocious Inspiration (34457) // Scale 01~03 (34902~34904, bonus from owner, not used) foreach (var petSet in petStore) - addSpell(petSet, ActiveStates.Decide, PetSpellState.New, PetSpellType.Family); + AddSpell(petSet, ActiveStates.Decide, PetSpellState.New, PetSpellType.Family); } } @@ -1431,12 +1431,12 @@ namespace Game.Entities return false; } - void learnSpellHighRank(uint spellid) + void LearnSpellHighRank(uint spellid) { - learnSpell(spellid); + LearnSpell(spellid); uint next = Global.SpellMgr.GetNextSpellInChain(spellid); if (next != 0) - learnSpellHighRank(next); + LearnSpellHighRank(next); } public void SynchronizeLevelWithOwner() @@ -1445,12 +1445,12 @@ namespace Game.Entities if (!owner || !owner.IsTypeId(TypeId.Player)) return; - switch (getPetType()) + switch (GetPetType()) { // always same level case PetType.Summon: case PetType.Hunter: - GivePetLevel((int)owner.getLevel()); + GivePetLevel((int)owner.GetLevel()); break; default: break; @@ -1466,16 +1466,16 @@ namespace Game.Entities { base.SetDisplayId(modelId, displayScale); - if (!isControlled()) + if (!IsControlled()) return; SetGroupUpdateFlag(GroupUpdatePetFlags.ModelId); } - public PetType getPetType() { return m_petType; } - public void setPetType(PetType type) { m_petType = type; } - public bool isControlled() { return getPetType() == PetType.Summon || getPetType() == PetType.Hunter; } - public bool isTemporarySummoned() { return m_duration > 0; } + public PetType GetPetType() { return m_petType; } + public void SetPetType(PetType type) { m_petType = type; } + public bool IsControlled() { return GetPetType() == PetType.Summon || GetPetType() == PetType.Hunter; } + public bool IsTemporarySummoned() { return m_duration > 0; } public override bool IsLoading() { return m_loading; } @@ -1522,14 +1522,14 @@ namespace Game.Entities foreach (var specSpell in specSpells) { SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID); - if (spellInfo == null || spellInfo.SpellLevel > getLevel()) + if (spellInfo == null || spellInfo.SpellLevel > GetLevel()) continue; learnedSpells.Add(specSpell.SpellID); } } - learnSpells(learnedSpells); + LearnSpells(learnedSpells); } void RemoveSpecializationSpells(bool clearActionBar) @@ -1561,7 +1561,7 @@ namespace Game.Entities } } - unlearnSpells(unlearnedSpells, true, clearActionBar); + UnlearnSpells(unlearnedSpells, true, clearActionBar); } public void SetSpecialization(uint spec) diff --git a/Source/Game/Entities/Player/CinematicManager.cs b/Source/Game/Entities/Player/CinematicManager.cs index 094cf6fd6..9b749b320 100644 --- a/Source/Game/Entities/Player/CinematicManager.cs +++ b/Source/Game/Entities/Player/CinematicManager.cs @@ -25,6 +25,17 @@ namespace Game.Entities { public class CinematicManager : IDisposable { + // Remote location information + Player player; + + public uint m_cinematicDiff; + public uint m_lastCinematicCheck; + public uint m_activeCinematicCameraId; + public uint m_cinematicLength; + List m_cinematicCamera; + Position m_remoteSightPosition; + TempSummon m_CinematicObject; + public CinematicManager(Player playerref) { player = playerref; @@ -67,7 +78,7 @@ namespace Game.Entities m_CinematicObject = player.SummonCreature(1, pos.posX, pos.posY, pos.posZ, 0.0f, TempSummonType.TimedDespawn, 5 * Time.Minute * Time.InMilliseconds); if (m_CinematicObject) { - m_CinematicObject.setActive(true); + m_CinematicObject.SetActive(true); player.SetViewpoint(m_CinematicObject, true); } @@ -177,16 +188,5 @@ namespace Game.Entities uint GetActiveCinematicCamera() { return m_activeCinematicCameraId; } public void SetActiveCinematicCamera(uint cinematicCameraId = 0) { m_activeCinematicCameraId = cinematicCameraId; } public bool IsOnCinematic() { return (m_cinematicCamera != null); } - - // Remote location information - Player player; - - public uint m_cinematicDiff; - public uint m_lastCinematicCheck; - public uint m_activeCinematicCameraId; - public uint m_cinematicLength; - List m_cinematicCamera; - Position m_remoteSightPosition; - TempSummon m_CinematicObject; } } diff --git a/Source/Game/Entities/Player/CollectionManager.cs b/Source/Game/Entities/Player/CollectionManager.cs index 6ada6fc9b..e04a452b4 100644 --- a/Source/Game/Entities/Player/CollectionManager.cs +++ b/Source/Game/Entities/Player/CollectionManager.cs @@ -22,11 +22,22 @@ using Game.Network.Packets; using System; using System.Collections.Generic; using System.Linq; +using System.Collections; namespace Game.Entities { public class CollectionMgr { + static Dictionary FactionSpecificMounts = new Dictionary(); + + WorldSession _owner; + Dictionary _toys = new Dictionary(); + Dictionary _heirlooms = new Dictionary(); + Dictionary _mounts = new Dictionary(); + BitSet _appearances; + MultiMap _temporaryAppearances = new MultiMap(); + Dictionary _favoriteAppearances = new Dictionary(); + public static void LoadMountDefinitions() { uint oldMSTime = Time.GetMSTime(); @@ -64,7 +75,7 @@ namespace Game.Entities public CollectionMgr(WorldSession owner) { _owner = owner; - _appearances = new System.Collections.BitSet(0); + _appearances = new BitSet(0); } public void LoadToys() @@ -483,7 +494,7 @@ namespace Game.Entities } while (knownAppearances.NextRow()); - _appearances = new System.Collections.BitSet(blocks); + _appearances = new BitSet(blocks); } if (!favoriteAppearances.IsEmpty()) @@ -664,7 +675,7 @@ namespace Game.Entities return false; } if (itemTemplate.GetInventoryType() != InventoryType.Cloak) - if (!Convert.ToBoolean(PlayerClassByArmorSubclass[itemTemplate.GetSubClass()] & _owner.GetPlayer().getClassMask())) + if (!Convert.ToBoolean(PlayerClassByArmorSubclass[itemTemplate.GetSubClass()] & _owner.GetPlayer().GetClassMask())) return false; break; } @@ -857,17 +868,6 @@ namespace Game.Entities public Dictionary GetAccountToys() { return _toys; } public Dictionary GetAccountHeirlooms() { return _heirlooms; } public Dictionary GetAccountMounts() { return _mounts; } - - WorldSession _owner; - - Dictionary _toys = new Dictionary(); - Dictionary _heirlooms = new Dictionary(); - Dictionary _mounts = new Dictionary(); - System.Collections.BitSet _appearances; - MultiMap _temporaryAppearances = new MultiMap(); - Dictionary _favoriteAppearances = new Dictionary(); - - static Dictionary FactionSpecificMounts = new Dictionary(); } enum FavoriteAppearanceState @@ -879,13 +879,13 @@ namespace Game.Entities public class HeirloomData { + public HeirloomPlayerFlags flags; + public uint bonusId; + public HeirloomData(HeirloomPlayerFlags _flags = 0, uint _bonusId = 0) { flags = _flags; bonusId = _bonusId; } - - public HeirloomPlayerFlags flags; - public uint bonusId; } } diff --git a/Source/Game/Entities/Player/KillRewarder.cs b/Source/Game/Entities/Player/KillRewarder.cs index 877ff1561..c157510fe 100644 --- a/Source/Game/Entities/Player/KillRewarder.cs +++ b/Source/Game/Entities/Player/KillRewarder.cs @@ -26,6 +26,19 @@ namespace Game.Entities { public class KillRewarder { + Player _killer; + Unit _victim; + Group _group; + float _groupRate; + Player _maxNotGrayMember; + uint _count; + uint _sumLevel; + uint _xp; + bool _isFullXP; + byte _maxLevel; + bool _isBattleground; + bool _isPvP; + public KillRewarder(Player killer, Unit victim, bool isBattleground) { _killer = killer; @@ -106,7 +119,7 @@ namespace Game.Entities { if (_killer == member || (member.IsAtGroupRewardDistance(_victim) && member.IsAlive())) { - uint lvl = member.getLevel(); + uint lvl = member.GetLevel(); // 2.1. _count - number of alive group members within reward distance; ++_count; // 2.2. _sumLevel - sum of levels of alive group members within reward distance; @@ -117,14 +130,14 @@ namespace Game.Entities // 2.4. _maxNotGrayMember - maximum level of alive group member within reward distance, // for whom victim is not gray; uint grayLevel = Formulas.GetGrayLevel(lvl); - if (_victim.GetLevelForTarget(member) > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember.getLevel() < lvl)) + if (_victim.GetLevelForTarget(member) > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember.GetLevel() < lvl)) _maxNotGrayMember = member; } } } // 2.5. _isFullXP - flag identifying that for all group members victim is not gray, // so 100% XP will be rewarded (50% otherwise). - _isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember.getLevel()); + _isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember.GetLevel()); } else _count = 1; @@ -157,7 +170,7 @@ namespace Game.Entities // * set to 0 if player's level is more than maximum level of not gray member; // * cut XP in half if _isFullXP is false. if (_maxNotGrayMember != null && player.IsAlive() && - _maxNotGrayMember.getLevel() >= player.getLevel()) + _maxNotGrayMember.GetLevel() >= player.GetLevel()) xp = _isFullXP ? (uint)(xp * rate) : // Reward FULL XP if all group members are not gray. (uint)(xp * rate / 2) + 1; // Reward only HALF of XP if some of group members are gray. @@ -215,7 +228,7 @@ namespace Game.Entities // Give reputation and kill credit only in PvE. if (!_isPvP || _isBattleground) { - float rate = _group ? _groupRate * player.getLevel() / _sumLevel : 1.0f; + float rate = _group ? _groupRate * player.GetLevel() / _sumLevel : 1.0f; if (_xp != 0) // 4.2. Give XP. _RewardXP(player, rate); @@ -265,18 +278,5 @@ namespace Game.Entities } } } - - Player _killer; - Unit _victim; - Group _group; - float _groupRate; - Player _maxNotGrayMember; - uint _count; - uint _sumLevel; - uint _xp; - bool _isFullXP; - byte _maxLevel; - bool _isBattleground; - bool _isPvP; } } diff --git a/Source/Game/Entities/Player/Player.Combat.cs b/Source/Game/Entities/Player/Player.Combat.cs index 9de1f5a9a..5258241ca 100644 --- a/Source/Game/Entities/Player/Player.Combat.cs +++ b/Source/Game/Entities/Player/Player.Combat.cs @@ -94,7 +94,7 @@ namespace Game.Entities float GetRatingMultiplier(CombatRating cr) { - GtCombatRatingsRecord Rating = CliDB.CombatRatingsGameTable.GetRow(getLevel()); + GtCombatRatingsRecord Rating = CliDB.CombatRatingsGameTable.GetRow(GetLevel()); if (Rating == null) return 1.0f; diff --git a/Source/Game/Entities/Player/Player.DB.cs b/Source/Game/Entities/Player/Player.DB.cs index 75c7cb9b6..061bebd10 100644 --- a/Source/Game/Entities/Player/Player.DB.cs +++ b/Source/Game/Entities/Player/Player.DB.cs @@ -813,7 +813,7 @@ namespace Game.Entities { ItemTemplate rewardProto = Global.ObjectMgr.GetItemTemplate(questPackageItem.ItemID); if (rewardProto != null) - if (rewardProto.ItemSpecClassMask.HasAnyFlag(getClassMask())) + if (rewardProto.ItemSpecClassMask.HasAnyFlag(GetClassMask())) GetSession().GetCollectionMgr().AddItemAppearance(questPackageItem.ItemID); } } @@ -2085,7 +2085,7 @@ namespace Game.Entities void _SaveStats(SQLTransaction trans) { // check if stat saving is enabled and if char level is high enough - if (WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave) == 0 || getLevel() < WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave)) + if (WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave) == 0 || GetLevel() < WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave)) return; PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_STATS); @@ -2886,7 +2886,7 @@ namespace Game.Entities InitTalentForLevel(); LearnDefaultSkills(); LearnCustomSpells(); - if (getLevel() < PlayerConst.LevelMinHonor) + if (GetLevel() < PlayerConst.LevelMinHonor) ResetPvpTalents(); // must be before inventory (some items required reputation check) @@ -3107,7 +3107,7 @@ namespace Game.Entities stmt.AddValue(index++, (byte)GetRace()); stmt.AddValue(index++, (byte)GetClass()); stmt.AddValue(index++, (byte)m_playerData.NativeSex); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect - stmt.AddValue(index++, getLevel()); + stmt.AddValue(index++, GetLevel()); stmt.AddValue(index++, (uint)m_activePlayerData.XP); stmt.AddValue(index++, GetMoney()); stmt.AddValue(index++, (byte)m_playerData.SkinID); @@ -3238,7 +3238,7 @@ namespace Game.Entities stmt.AddValue(index++, (byte)GetRace()); stmt.AddValue(index++, (byte)GetClass()); stmt.AddValue(index++, (byte)m_playerData.NativeSex); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect - stmt.AddValue(index++, getLevel()); + stmt.AddValue(index++, GetLevel()); stmt.AddValue(index++, (uint)m_activePlayerData.XP); stmt.AddValue(index++, GetMoney()); stmt.AddValue(index++, (byte)m_playerData.SkinID); diff --git a/Source/Game/Entities/Player/Player.Fields.cs b/Source/Game/Entities/Player/Player.Fields.cs index abb42cd80..68d29328b 100644 --- a/Source/Game/Entities/Player/Player.Fields.cs +++ b/Source/Game/Entities/Player/Player.Fields.cs @@ -212,7 +212,7 @@ namespace Game.Entities PlayerExtraFlags m_ExtraFlags; - public bool isDebugAreaTriggers { get; set; } + public bool IsDebugAreaTriggers { get; set; } uint m_zoneUpdateId; uint m_areaUpdateId; uint m_zoneUpdateTimer; diff --git a/Source/Game/Entities/Player/Player.Groups.cs b/Source/Game/Entities/Player/Player.Groups.cs index 346202239..499436d9c 100644 --- a/Source/Game/Entities/Player/Player.Groups.cs +++ b/Source/Game/Entities/Player/Player.Groups.cs @@ -49,7 +49,7 @@ namespace Game.Entities return nearMembers[randTarget]; } - public PartyResult CanUninviteFromGroup(ObjectGuid guidMember = default(ObjectGuid)) + public PartyResult CanUninviteFromGroup(ObjectGuid guidMember = default) { Group grp = GetGroup(); if (!grp) @@ -99,12 +99,12 @@ namespace Game.Entities return PartyResult.Ok; } - public bool isUsingLfg() + public bool IsUsingLfg() { return Global.LFGMgr.GetState(GetGUID()) != LfgState.None; } - bool inRandomLfgDungeon() + bool InRandomLfgDungeon() { if (Global.LFGMgr.selectedRandomLfgDungeon(GetGUID())) { @@ -263,7 +263,7 @@ namespace Game.Entities } public void RemoveFromGroup(RemoveMethod method = RemoveMethod.Default) { RemoveFromGroup(GetGroup(), GetGUID(), method); } - public static void RemoveFromGroup(Group group, ObjectGuid guid, RemoveMethod method = RemoveMethod.Default, ObjectGuid kicker = default(ObjectGuid), string reason = null) + public static void RemoveFromGroup(Group group, ObjectGuid guid, RemoveMethod method = RemoveMethod.Default, ObjectGuid kicker = default, string reason = null) { if (!group) return; diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index 5418379e7..b4fa96fd6 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -1284,7 +1284,7 @@ namespace Game.Entities item = StoreItem(pos, item, update); - item.SetFixedLevel(getLevel()); + item.SetFixedLevel(GetLevel()); item.SetItemRandomBonusList(randomPropertyId); if (allowedLooters != null && allowedLooters.Count > 1 && item.GetTemplate().GetMaxStackSize() == 1 && item.IsSoulBound()) @@ -1412,7 +1412,7 @@ namespace Game.Entities if (pItem.IsBindedNotWith(this)) return InventoryResult.NotOwner; - if (getLevel() < pItem.GetRequiredLevel()) + if (GetLevel() < pItem.GetRequiredLevel()) return InventoryResult.CantEquipLevelI; InventoryResult res = CanUseItem(pProto); @@ -1468,7 +1468,7 @@ namespace Game.Entities if (Convert.ToBoolean(proto.GetFlags2() & ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance) return InventoryResult.CantEquipEver; - if ((proto.GetAllowableClass() & getClassMask()) == 0 || (proto.GetAllowableRace() & (long)getRaceMask()) == 0) + if ((proto.GetAllowableClass() & GetClassMask()) == 0 || (proto.GetAllowableRace() & (long)GetRaceMask()) == 0) return InventoryResult.CantEquipEver; if (proto.GetRequiredSkill() != 0) @@ -1482,7 +1482,7 @@ namespace Game.Entities if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell())) return InventoryResult.ProficiencyNeeded; - if (getLevel() < proto.GetBaseRequiredLevel()) + if (GetLevel() < proto.GetBaseRequiredLevel()) return InventoryResult.CantEquipLevelI; // If World Event is not active, prevent using event dependant items @@ -3321,7 +3321,7 @@ namespace Game.Entities return InventoryResult.ItemNotFound; // Used by group, function GroupLoot, to know if a prototype can be used by a player - if ((proto.GetAllowableClass() & getClassMask()) == 0 || (proto.GetAllowableRace() & (long)getRaceMask()) == 0) + if ((proto.GetAllowableClass() & GetClassMask()) == 0 || (proto.GetAllowableRace() & (long)GetRaceMask()) == 0) return InventoryResult.CantEquipEver; if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell())) @@ -3344,7 +3344,7 @@ namespace Game.Entities { if (_class == Class.Warrior || _class == Class.Paladin || _class == Class.Deathknight) { - if (getLevel() < 40) + if (GetLevel() < 40) { if (proto.GetSubClass() != (uint)ItemSubClassArmor.Mail) return InventoryResult.ClientLockedOut; @@ -3354,7 +3354,7 @@ namespace Game.Entities } else if (_class == Class.Hunter || _class == Class.Shaman) { - if (getLevel() < 40) + if (GetLevel() < 40) { if (proto.GetSubClass() != (uint)ItemSubClassArmor.Leather) return InventoryResult.ClientLockedOut; @@ -3605,7 +3605,7 @@ namespace Game.Entities return false; } - if (!Convert.ToBoolean(pProto.GetAllowableClass() & getClassMask()) && pProto.GetBonding() == ItemBondingType.OnAcquire && !IsGameMaster()) + if (!Convert.ToBoolean(pProto.GetAllowableClass() & GetClassMask()) && pProto.GetBonding() == ItemBondingType.OnAcquire && !IsGameMaster()) { SendBuyError(BuyResult.CantFindItem, null, item); return false; @@ -4251,7 +4251,7 @@ namespace Game.Entities if (spellproto == null) continue; - if (spellproto.HasAura(GetMap().GetDifficultyID(), AuraType.ModXpPct) && !GetSession().GetCollectionMgr().CanApplyHeirloomXpBonus(item.GetEntry(), getLevel()) + if (spellproto.HasAura(GetMap().GetDifficultyID(), AuraType.ModXpPct) && !GetSession().GetCollectionMgr().CanApplyHeirloomXpBonus(item.GetEntry(), GetLevel()) && Global.DB2Mgr.GetHeirloomByItemId(item.GetEntry()) != null) continue; @@ -4520,7 +4520,7 @@ namespace Game.Entities need_space = count; ItemPosCount newPosition = new ItemPosCount((ushort)(InventorySlots.Bag0 << 8 | j), need_space); - if (!newPosition.isContainedIn(dest)) + if (!newPosition.IsContainedIn(dest)) { dest.Add(newPosition); count -= need_space; @@ -4598,7 +4598,7 @@ namespace Game.Entities need_space = count; ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | slot), need_space); - if (!newPosition.isContainedIn(dest)) + if (!newPosition.IsContainedIn(dest)) { dest.Add(newPosition); count -= need_space; @@ -4938,7 +4938,7 @@ namespace Game.Entities need_space = count; ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | j), need_space); - if (!newPosition.isContainedIn(dest)) + if (!newPosition.IsContainedIn(dest)) { dest.Add(newPosition); count -= need_space; @@ -5151,7 +5151,7 @@ namespace Game.Entities ScalingStatDistributionRecord ssd = CliDB.ScalingStatDistributionStorage.LookupByKey(pItem.GetScalingStatDistribution()); // check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items) - if (ssd != null && ssd.MaxLevel < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel) && ssd.MaxLevel < getLevel() && Global.DB2Mgr.GetHeirloomByItemId(pProto.GetId()) == null) + if (ssd != null && ssd.MaxLevel < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel) && ssd.MaxLevel < GetLevel() && Global.DB2Mgr.GetHeirloomByItemId(pProto.GetId()) == null) return InventoryResult.NotEquippable; byte eslot = FindEquipSlot(pProto, slot, swap); @@ -6190,7 +6190,7 @@ namespace Game.Entities // We store the level of our player in the gold field // We retrieve this information at Player.SendLoot() - bones.loot.gold = getLevel(); + bones.loot.gold = GetLevel(); bones.lootRecipient = looterPlr; looterPlr.SendLoot(bones.GetGUID(), LootType.Insignia); } @@ -6225,7 +6225,7 @@ namespace Game.Entities // not check distance for GO in case owned GO (fishing bobber case, for example) // And permit out of range GO with no owner in case fishing hole if (!go || (loot_type != LootType.Fishinghole && ((loot_type != LootType.Fishing && loot_type != LootType.FishingJunk) || go.GetOwnerGUID() != GetGUID()) - && !go.IsWithinDistInMap(this, SharedConst.InteractionDistance)) || (loot_type == LootType.Corpse && go.GetRespawnTime() != 0 && go.isSpawnedByDefault())) + && !go.IsWithinDistInMap(this, SharedConst.InteractionDistance)) || (loot_type == LootType.Corpse && go.GetRespawnTime() != 0 && go.IsSpawnedByDefault())) { SendLootRelease(guid); return; @@ -6235,10 +6235,10 @@ namespace Game.Entities // loot was generated and respawntime has passed since then, allow to recreate loot // to avoid bugs, this rule covers spawned gameobjects only - if (go.isSpawnedByDefault() && go.getLootState() == LootState.Activated && !go.loot.isLooted() && go.GetLootGenerationTime() + go.GetRespawnDelay() < Time.UnixTime) + if (go.IsSpawnedByDefault() && go.GetLootState() == LootState.Activated && !go.loot.isLooted() && go.GetLootGenerationTime() + go.GetRespawnDelay() < Time.UnixTime) go.SetLootState(LootState.Ready); - if (go.getLootState() == LootState.Ready) + if (go.GetLootState() == LootState.Ready) { uint lootid = go.GetGoInfo().GetLootId(); Battleground bg = GetBattleground(); @@ -6278,9 +6278,9 @@ namespace Game.Entities } if (loot_type == LootType.Fishing) - go.getFishLoot(loot, this); + go.GetFishLoot(loot, this); else if (loot_type == LootType.FishingJunk) - go.getFishLootJunk(loot, this); + go.GetFishLootJunk(loot, this); if (go.GetGoInfo().type == GameObjectTypes.Chest && go.GetGoInfo().Chest.usegrouplootrules != 0) { @@ -6305,7 +6305,7 @@ namespace Game.Entities go.SetLootState(LootState.Activated, this); } - if (go.getLootState() == LootState.Activated) + if (go.GetLootState() == LootState.Activated) { Group group = GetGroup(); if (group) @@ -6442,8 +6442,8 @@ namespace Game.Entities loot.FillLoot(lootid, LootStorage.Pickpocketing, this, true); // Generate extra money for pick pocket loot - uint a = RandomHelper.URand(0, creature.getLevel() / 2); - uint b = RandomHelper.URand(0, getLevel() / 2); + uint a = RandomHelper.URand(0, creature.GetLevel() / 2); + uint b = RandomHelper.URand(0, GetLevel() / 2); loot.gold = (uint)(10 * (a + b) * WorldConfig.GetFloatValue(WorldCfg.RateDropMoney)); permission = PermissionTypes.Owner; } diff --git a/Source/Game/Entities/Player/Player.Map.cs b/Source/Game/Entities/Player/Player.Map.cs index f66540c04..af52bc57d 100644 --- a/Source/Game/Entities/Player/Player.Map.cs +++ b/Source/Game/Entities/Player/Player.Map.cs @@ -456,9 +456,9 @@ namespace Game.Entities if (!WorldConfig.GetBoolValue(WorldCfg.InstanceIgnoreLevel)) { - if (ar.levelMin != 0 && getLevel() < ar.levelMin) + if (ar.levelMin != 0 && GetLevel() < ar.levelMin) LevelMin = ar.levelMin; - if (ar.levelMax != 0 && getLevel() > ar.levelMax) + if (ar.levelMax != 0 && GetLevel() > ar.levelMax) LevelMax = ar.levelMax; } diff --git a/Source/Game/Entities/Player/Player.PvP.cs b/Source/Game/Entities/Player/Player.PvP.cs index e554864b6..1e6ec19e4 100644 --- a/Source/Game/Entities/Player/Player.PvP.cs +++ b/Source/Game/Entities/Player/Player.PvP.cs @@ -103,7 +103,7 @@ namespace Game.Entities if (GetTeam() == plrVictim.GetTeam() && !Global.WorldMgr.IsFFAPvPRealm()) return false; - byte k_level = (byte)getLevel(); + byte k_level = (byte)GetLevel(); byte k_grey = (byte)Formulas.GetGrayLevel(k_level); byte v_level = (byte)victim.GetLevelForTarget(this); @@ -263,7 +263,7 @@ namespace Game.Entities uint newHonorXP = currentHonorXP + xp; uint honorLevel = GetHonorLevel(); - if (xp < 1 || getLevel() < PlayerConst.LevelMinHonor || IsMaxHonorLevel()) + if (xp < 1 || GetLevel() < PlayerConst.LevelMinHonor || IsMaxHonorLevel()) return; while (newHonorXP >= nextHonorLevelXP) @@ -340,10 +340,10 @@ namespace Game.Entities if (talentInfo.SpecID != GetPrimarySpecialization()) return TalentLearnResult.FailedUnknown; - if (talentInfo.LevelRequired > getLevel()) + if (talentInfo.LevelRequired > GetLevel()) return TalentLearnResult.FailedUnknown; - if (Global.DB2Mgr.GetRequiredLevelForPvpTalentSlot(slot, GetClass()) > getLevel()) + if (Global.DB2Mgr.GetRequiredLevelForPvpTalentSlot(slot, GetClass()) > GetLevel()) return TalentLearnResult.FailedUnknown; PvpTalentCategoryRecord talentCategory = CliDB.PvpTalentCategoryStorage.LookupByKey(talentInfo.PvpTalentCategoryID); @@ -654,7 +654,7 @@ namespace Game.Entities // BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet // Note: Mount, stealth and invisibility will be removed when used - return (!isTotalImmune() && // Damage immune + return (!IsTotalImmune() && // Damage immune !HasAura(BattlegroundConst.SpellRecentlyDroppedFlag) && // Still has recently held flag debuff IsAlive()); // Alive } @@ -669,7 +669,7 @@ namespace Game.Entities public void SetBattlegroundEntryPoint() { // Taxi path store - if (!m_taxi.empty()) + if (!m_taxi.Empty()) { m_bgData.mountSpell = 0; m_bgData.taxiPath[0] = m_taxi.GetTaxiSource(); @@ -830,7 +830,7 @@ namespace Game.Entities return false; // limit check leel to dbc compatible level range - uint level = getLevel(); + uint level = GetLevel(); if (level > WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) level = WorldConfig.GetUIntValue(WorldCfg.MaxPlayerLevel); diff --git a/Source/Game/Entities/Player/Player.Quest.cs b/Source/Game/Entities/Player/Player.Quest.cs index 3d2bc6b49..f1a74b104 100644 --- a/Source/Game/Entities/Player/Player.Quest.cs +++ b/Source/Game/Entities/Player/Player.Quest.cs @@ -41,8 +41,8 @@ namespace Game.Entities void AddTimedQuest(uint questId) { m_timedquests.Add(questId); } public void RemoveTimedQuest(uint questId) { m_timedquests.Remove(questId); } - public List getRewardedQuests() { return m_RewardedQuests; } - Dictionary getQuestStatusMap() { return m_QuestStatus; } + public List GetRewardedQuests() { return m_RewardedQuests; } + Dictionary GetQuestStatusMap() { return m_QuestStatus; } public int GetQuestMinLevel(Quest quest) { @@ -65,7 +65,7 @@ namespace Game.Entities { int minLevel = GetQuestMinLevel(quest); int maxLevel = quest.MaxScalingLevel; - int level = (int)getLevel(); + int level = (int)GetLevel(); if (level >= minLevel) return Math.Min(level, maxLevel); return minLevel; @@ -325,7 +325,7 @@ namespace Game.Entities // @todo verify if check for !quest.IsDaily() is really correct (possibly not) else { - if (!source.hasQuest(questId) && !source.hasInvolvedQuest(questId)) + if (!source.HasQuest(questId) && !source.HasInvolvedQuest(questId)) { PlayerTalkClass.SendCloseGossip(); return; @@ -410,7 +410,7 @@ namespace Game.Entities SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) && SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(quest, false)) { - return getLevel() + WorldConfig.GetIntValue(WorldCfg.QuestHighLevelHideDiff) >= GetQuestMinLevel(quest); + return GetLevel() + WorldConfig.GetIntValue(WorldCfg.QuestHighLevelHideDiff) >= GetQuestMinLevel(quest); } return false; @@ -778,7 +778,7 @@ namespace Game.Entities { SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.SourceSpellID); Unit caster = this; - if (questGiver != null && questGiver.isTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnAccept) && !spellInfo.HasTargetType(Targets.UnitCaster) && !spellInfo.HasTargetType(Targets.DestCasterSummon)) + if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnAccept) && !spellInfo.HasTargetType(Targets.UnitCaster) && !spellInfo.HasTargetType(Targets.DestCasterSummon)) { Unit unit = questGiver.ToUnit(); if (unit != null) @@ -867,7 +867,7 @@ namespace Game.Entities case QuestPackageFilter.LootSpecialization: return rewardProto.IsUsableByLootSpecialization(this, true); case QuestPackageFilter.Class: - return rewardProto.ItemSpecClassMask == 0 || (rewardProto.ItemSpecClassMask & getClassMask()) != 0; + return rewardProto.ItemSpecClassMask == 0 || (rewardProto.ItemSpecClassMask & GetClassMask()) != 0; case QuestPackageFilter.Everyone: return true; default: @@ -1017,7 +1017,7 @@ namespace Game.Entities uint XP = GetQuestXPReward(quest); int moneyRew = 0; - if (getLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) + if (GetLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) GiveXP(XP, null); else moneyRew = (int)(quest.GetRewMoneyMaxLevel() * WorldConfig.GetFloatValue(WorldCfg.RateDropMoney)); @@ -1033,7 +1033,7 @@ namespace Game.Entities } // honor reward - uint honor = quest.CalculateHonorGain(getLevel()); + uint honor = quest.CalculateHonorGain(GetLevel()); if (honor != 0) RewardHonor(null, 0, (int)honor); @@ -1091,7 +1091,7 @@ namespace Game.Entities { SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell); Unit caster = this; - if (questGiver != null && questGiver.isTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster)) + if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster)) { Unit unit = questGiver.ToUnit(); if (unit != null) @@ -1108,7 +1108,7 @@ namespace Game.Entities { SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardDisplaySpell[i]); Unit caster = this; - if (questGiver != null && questGiver.isTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster)) + if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster)) { Unit unit = questGiver.ToUnit(); if (unit != null) @@ -1263,7 +1263,7 @@ namespace Game.Entities public bool SatisfyQuestLevel(Quest qInfo, bool msg) { - if (getLevel() < GetQuestMinLevel(qInfo)) + if (GetLevel() < GetQuestMinLevel(qInfo)) { if (msg) { @@ -1273,7 +1273,7 @@ namespace Game.Entities return false; } - if (qInfo.MaxLevel > 0 && getLevel() > qInfo.MaxLevel) + if (qInfo.MaxLevel > 0 && GetLevel() > qInfo.MaxLevel) { if (msg) { @@ -1392,7 +1392,7 @@ namespace Game.Entities if (reqClass == 0) return true; - if ((reqClass & getClassMask()) == 0) + if ((reqClass & GetClassMask()) == 0) { if (msg) { @@ -1412,7 +1412,7 @@ namespace Game.Entities if (reqraces == -1) return true; - if ((reqraces & (long)getRaceMask()) == 0) + if ((reqraces & (long)GetRaceMask()) == 0) { if (msg) { @@ -1909,7 +1909,7 @@ namespace Game.Entities { if (SatisfyQuestLevel(quest, false)) { - if (getLevel() <= (GetQuestLevel(quest) + WorldConfig.GetIntValue(WorldCfg.QuestLowLevelHideDiff))) + if (GetLevel() <= (GetQuestLevel(quest) + WorldConfig.GetIntValue(WorldCfg.QuestLowLevelHideDiff))) { if (quest.IsDaily()) result2 = QuestGiverStatus.AvailableRep; @@ -2189,7 +2189,7 @@ namespace Game.Entities KilledMonsterCredit(cInfo.KillCredit[i]); } - public void KilledMonsterCredit(uint entry, ObjectGuid guid = default(ObjectGuid)) + public void KilledMonsterCredit(uint entry, ObjectGuid guid = default) { ushort addKillCount = 1; uint real_entry = entry; @@ -2287,7 +2287,7 @@ namespace Game.Entities } } - public void KillCreditGO(uint entry, ObjectGuid guid = default(ObjectGuid)) + public void KillCreditGO(uint entry, ObjectGuid guid = default) { ushort addCastCount = 1; for (byte i = 0; i < SharedConst.MaxQuestLogSize; ++i) @@ -2747,7 +2747,7 @@ namespace Game.Entities uint moneyReward; - if (getLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) + if (GetLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) { moneyReward = GetQuestMoneyReward(quest); } diff --git a/Source/Game/Entities/Player/Player.Spells.cs b/Source/Game/Entities/Player/Player.Spells.cs index f1d34052b..4657e512c 100644 --- a/Source/Game/Entities/Player/Player.Spells.cs +++ b/Source/Game/Entities/Player/Player.Spells.cs @@ -342,7 +342,7 @@ namespace Game.Entities { SpecializationSpellsRecord specSpell = specSpells[j]; SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID); - if (spellInfo == null || spellInfo.SpellLevel > getLevel()) + if (spellInfo == null || spellInfo.SpellLevel > GetLevel()) continue; LearnSpell(specSpell.SpellID, false); @@ -568,7 +568,7 @@ namespace Game.Entities if (!ignore_condition && pEnchant.ConditionID != 0 && !EnchantmentFitsRequirements(pEnchant.ConditionID, -1)) return; - if (pEnchant.MinLevel > getLevel()) + if (pEnchant.MinLevel > GetLevel()) return; if (pEnchant.RequiredSkillID > 0 && pEnchant.RequiredSkillRank > GetSkillValue((SkillType)pEnchant.RequiredSkillID)) @@ -640,12 +640,12 @@ namespace Game.Entities scalingClass = pEnchant.ScalingClassRestricted; uint minLevel = ((uint)(pEnchant.Flags)).HasAnyFlag(0x20u) ? 1 : 60u; - uint scalingLevel = getLevel(); + uint scalingLevel = GetLevel(); byte maxLevel = (byte)(pEnchant.MaxLevel != 0 ? pEnchant.MaxLevel : CliDB.SpellScalingGameTable.GetTableRowCount() - 1); - if (minLevel > getLevel()) + if (minLevel > GetLevel()) scalingLevel = minLevel; - else if (maxLevel < getLevel()) + else if (maxLevel < GetLevel()) scalingLevel = maxLevel; GtSpellScalingRecord spellScaling = CliDB.SpellScalingGameTable.GetRow(scalingLevel); @@ -665,12 +665,12 @@ namespace Game.Entities scalingClass = pEnchant.ScalingClassRestricted; uint minLevel = ((uint)(pEnchant.Flags)).HasAnyFlag(0x20u) ? 1 : 60u; - uint scalingLevel = getLevel(); + uint scalingLevel = GetLevel(); byte maxLevel = (byte)(pEnchant.MaxLevel != 0 ? pEnchant.MaxLevel : CliDB.SpellScalingGameTable.GetTableRowCount() - 1); - if (minLevel > getLevel()) + if (minLevel > GetLevel()) scalingLevel = minLevel; - else if (maxLevel < getLevel()) + else if (maxLevel < GetLevel()) scalingLevel = maxLevel; GtSpellScalingRecord spellScaling = CliDB.SpellScalingGameTable.GetRow(scalingLevel); @@ -911,7 +911,7 @@ namespace Game.Entities WorldObject target = GetViewpoint(); if (target) { - if (target.isTypeMask(TypeMask.Unit)) + if (target.IsTypeMask(TypeMask.Unit)) { ((Unit)target).RemoveAurasByType(AuraType.BindSight, GetGUID()); ((Unit)target).RemoveAurasByType(AuraType.ModPossess, GetGUID()); @@ -1610,8 +1610,8 @@ namespace Game.Entities void LearnSkillRewardedSpells(uint skillId, uint skillValue) { - ulong raceMask = getRaceMask(); - uint classMask = getClassMask(); + ulong raceMask = GetRaceMask(); + uint classMask = GetClassMask(); List skillLineAbilities = Global.DB2Mgr.GetSkillLineAbilitiesBySkill(skillId); foreach (var ability in skillLineAbilities) @@ -1639,7 +1639,7 @@ namespace Game.Entities continue; // check level, skip class spells if not high enough - if (getLevel() < spellInfo.SpellLevel) + if (GetLevel() < spellInfo.SpellLevel) continue; // need unlearn spell @@ -1932,7 +1932,7 @@ namespace Game.Entities if (HasSkill((SkillType)rcInfo.SkillID)) continue; - if (rcInfo.MinLevel > getLevel()) + if (rcInfo.MinLevel > GetLevel()) continue; LearnDefaultSkill(rcInfo); @@ -1954,7 +1954,7 @@ namespace Game.Entities if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue)) skillValue = maxValue; else if (GetClass() == Class.Deathknight) - skillValue = (ushort)Math.Min(Math.Max(1, (getLevel() - 1) * 5), maxValue); + skillValue = (ushort)Math.Min(Math.Max(1, (GetLevel() - 1) * 5), maxValue); else if (skillId == SkillType.FistWeapons) skillValue = Math.Max((ushort)1, GetSkillValue(SkillType.Unarmed)); @@ -1972,7 +1972,7 @@ namespace Game.Entities if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue)) skillValue = maxValue; else if (GetClass() == Class.Deathknight) - skillValue = (ushort)Math.Min(Math.Max(1, (getLevel() - 1) * 5), maxValue); + skillValue = (ushort)Math.Min(Math.Max(1, (GetLevel() - 1) * 5), maxValue); SetSkill(skillId, 1, skillValue, maxValue); break; @@ -3291,7 +3291,7 @@ namespace Game.Entities } // not allow proc extra attack spell at extra attack - if (m_extraAttacks != 0 && spellInfo.HasEffect(SpellEffectName.AddExtraAttacks)) + if (ExtraAttacks != 0 && spellInfo.HasEffect(SpellEffectName.AddExtraAttacks)) return; float chance = spellInfo.ProcChance; @@ -3404,9 +3404,9 @@ namespace Game.Entities { // normalized proc chance for weapon attack speed // (odd formula...) - if (isAttackReady(WeaponAttackType.BaseAttack)) + if (IsAttackReady(WeaponAttackType.BaseAttack)) return (GetBaseAttackTime(WeaponAttackType.BaseAttack) * 1.8f / 1000.0f); - else if (haveOffhandWeapon() && isAttackReady(WeaponAttackType.OffAttack)) + else if (HaveOffhandWeapon() && IsAttackReady(WeaponAttackType.OffAttack)) return (GetBaseAttackTime(WeaponAttackType.OffAttack) * 1.6f / 1000.0f); return 0; } diff --git a/Source/Game/Entities/Player/Player.Talents.cs b/Source/Game/Entities/Player/Player.Talents.cs index afa992eb0..8288ecac9 100644 --- a/Source/Game/Entities/Player/Player.Talents.cs +++ b/Source/Game/Entities/Player/Player.Talents.cs @@ -28,7 +28,7 @@ namespace Game.Entities { public void InitTalentForLevel() { - uint level = getLevel(); + uint level = GetLevel(); // talents base at level diff (talents = level - 9 but some can be used already) if (level < PlayerConst.MinSpecializationLevel) ResetTalentSpecialization(); diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 1a4400ec8..0e27614a9 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -45,8 +45,8 @@ namespace Game.Entities { public Player(WorldSession session) : base(true) { - objectTypeMask |= TypeMask.Player; - objectTypeId = TypeId.Player; + ObjectTypeMask |= TypeMask.Player; + ObjectTypeId = TypeId.Player; m_playerData = new PlayerData(); m_activePlayerData = new ActivePlayerData(); @@ -536,11 +536,11 @@ namespace Game.Entities // default combat reach 10 // TODO add weapon, skill check - if (isAttackReady(WeaponAttackType.BaseAttack)) + if (IsAttackReady(WeaponAttackType.BaseAttack)) { if (!IsWithinMeleeRange(victim)) { - setAttackTimer(WeaponAttackType.BaseAttack, 100); + SetAttackTimer(WeaponAttackType.BaseAttack, 100); if (m_swingErrorMsg != 1) // send single time (client auto repeat) { SendAttackSwingNotInRange(); @@ -550,7 +550,7 @@ namespace Game.Entities //120 degrees of radiant range, if player is not in boundary radius else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathFunctions.PI / 3, victim)) { - setAttackTimer(WeaponAttackType.BaseAttack, 100); + SetAttackTimer(WeaponAttackType.BaseAttack, 100); if (m_swingErrorMsg != 2) // send single time (client auto repeat) { SendAttackSwingBadFacingAttack(); @@ -562,31 +562,31 @@ namespace Game.Entities m_swingErrorMsg = 0; // reset swing error state // prevent base and off attack in same time, delay attack at 0.2 sec - if (haveOffhandWeapon()) - if (getAttackTimer(WeaponAttackType.OffAttack) < SharedConst.AttackDisplayDelay) - setAttackTimer(WeaponAttackType.OffAttack, SharedConst.AttackDisplayDelay); + if (HaveOffhandWeapon()) + if (GetAttackTimer(WeaponAttackType.OffAttack) < SharedConst.AttackDisplayDelay) + SetAttackTimer(WeaponAttackType.OffAttack, SharedConst.AttackDisplayDelay); // do attack AttackerStateUpdate(victim, WeaponAttackType.BaseAttack); - resetAttackTimer(WeaponAttackType.BaseAttack); + ResetAttackTimer(WeaponAttackType.BaseAttack); } } - if (!IsInFeralForm() && haveOffhandWeapon() && isAttackReady(WeaponAttackType.OffAttack)) + if (!IsInFeralForm() && HaveOffhandWeapon() && IsAttackReady(WeaponAttackType.OffAttack)) { if (!IsWithinMeleeRange(victim)) - setAttackTimer(WeaponAttackType.OffAttack, 100); + SetAttackTimer(WeaponAttackType.OffAttack, 100); else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathFunctions.PI / 3, victim)) - setAttackTimer(WeaponAttackType.BaseAttack, 100); + SetAttackTimer(WeaponAttackType.BaseAttack, 100); else { // prevent base and off attack in same time, delay attack at 0.2 sec - if (getAttackTimer(WeaponAttackType.BaseAttack) < SharedConst.AttackDisplayDelay) - setAttackTimer(WeaponAttackType.BaseAttack, SharedConst.AttackDisplayDelay); + if (GetAttackTimer(WeaponAttackType.BaseAttack) < SharedConst.AttackDisplayDelay) + SetAttackTimer(WeaponAttackType.BaseAttack, SharedConst.AttackDisplayDelay); // do attack AttackerStateUpdate(victim, WeaponAttackType.OffAttack); - resetAttackTimer(WeaponAttackType.OffAttack); + ResetAttackTimer(WeaponAttackType.OffAttack); } } } @@ -643,7 +643,7 @@ namespace Game.Entities if (IsAlive()) { - m_regenTimer += diff; + RegenTimer += diff; RegenerateAll(); } @@ -722,7 +722,7 @@ namespace Game.Entities SendUpdateToOutOfRangeGroupMembers(); Pet pet = GetPet(); - if (pet != null && !pet.IsWithinDistInMap(this, GetMap().GetVisibilityRange()) && !pet.isPossessed()) + if (pet != null && !pet.IsWithinDistInMap(this, GetMap().GetVisibilityRange()) && !pet.IsPossessed()) RemovePet(pet, PetSaveMode.NotInSlot, true); if (IsAlive()) @@ -731,7 +731,7 @@ namespace Game.Entities { m_hostileReferenceCheckTimer = 15 * Time.InMilliseconds; if (!GetMap().IsDungeon()) - getHostileRefManager().deleteReferencesOutOfRange(GetVisibilityRange()); + GetHostileRefManager().deleteReferencesOutOfRange(GetVisibilityRange()); } else m_hostileReferenceCheckTimer -= diff; @@ -743,7 +743,7 @@ namespace Game.Entities TeleportTo(teleportDest, m_teleport_options); } - public override void setDeathState(DeathState s) + public override void SetDeathState(DeathState s) { bool oldIsAlive = IsAlive(); @@ -775,7 +775,7 @@ namespace Game.Entities ResetCriteria(CriteriaTypes.GetKillingBlows, (uint)CriteriaCondition.NoDeath); } - base.setDeathState(s); + base.SetDeathState(s); if (IsAlive() && !oldIsAlive) //clear aura case after resurrection by another way (spells will be applied before next death) @@ -1001,7 +1001,7 @@ namespace Game.Entities public void SetInvSlot(uint slot, ObjectGuid guid) { SetUpdateFieldValue(ref m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.InvSlots, (int)slot), guid); } //Taxi - public void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(GetRace(), GetClass(), getLevel()); } + public void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(GetRace(), GetClass(), GetLevel()); } //Cheat Commands public bool GetCommandStatus(PlayerCommandStates command) { return (_activeCheats & command) != 0; } @@ -1031,7 +1031,7 @@ namespace Game.Entities if (!pet) return; - if (m_temporaryUnsummonedPetNumber == 0 && pet.isControlled() && !pet.isTemporarySummoned()) + if (m_temporaryUnsummonedPetNumber == 0 && pet.IsControlled() && !pet.IsTemporarySummoned()) { m_temporaryUnsummonedPetNumber = pet.GetCharmInfo().GetPetNumber(); m_oldpetspell = pet.m_unitData.CreatedBySpell; @@ -1528,7 +1528,7 @@ namespace Game.Entities break; } - if (rate != 1.0f && creatureOrQuestLevel < Formulas.GetGrayLevel(getLevel())) + if (rate != 1.0f && creatureOrQuestLevel < Formulas.GetGrayLevel(GetLevel())) percent *= rate; if (percent <= 0.0f) @@ -1958,7 +1958,7 @@ namespace Game.Entities // remove auras that need water/land RemoveAurasWithInterruptFlags((apply ? SpellAuraInterruptFlags.NotAbovewater : SpellAuraInterruptFlags.NotUnderwater)); - getHostileRefManager().updateThreatTables(); + GetHostileRefManager().updateThreatTables(); } public void ValidateMovementInfo(MovementInfo mi) { @@ -2177,7 +2177,7 @@ namespace Game.Entities } //GM - public bool isAcceptWhispers() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.AcceptWhispers); } + public bool IsAcceptWhispers() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.AcceptWhispers); } public void SetAcceptWhispers(bool on) { if (on) @@ -2200,13 +2200,13 @@ namespace Game.Entities if (pet != null) { pet.SetFaction(35); - pet.getHostileRefManager().setOnlineOfflineState(false); + pet.GetHostileRefManager().setOnlineOfflineState(false); } RemovePvpFlag(UnitPVPStateFlags.FFAPvp); ResetContestedPvP(); - getHostileRefManager().setOnlineOfflineState(false); + GetHostileRefManager().setOnlineOfflineState(false); CombatStopWithPets(); PhasingHandler.SetAlwaysVisible(GetPhaseShift(), true); @@ -2225,7 +2225,7 @@ namespace Game.Entities if (pet != null) { pet.SetFaction(GetFaction()); - pet.getHostileRefManager().setOnlineOfflineState(true); + pet.GetHostileRefManager().setOnlineOfflineState(true); } // restore FFA PvP Server state @@ -2235,13 +2235,13 @@ namespace Game.Entities // restore FFA PvP area state, remove not allowed for GM mounts UpdateArea(m_areaUpdateId); - getHostileRefManager().setOnlineOfflineState(true); + GetHostileRefManager().setOnlineOfflineState(true); m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.GM, AccountTypes.Player); } UpdateObjectVisibility(); } - public bool isGMChat() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMChat); } + public bool IsGMChat() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMChat); } public void SetGMChat(bool on) { if (on) @@ -2249,7 +2249,7 @@ namespace Game.Entities else m_ExtraFlags &= ~PlayerExtraFlags.GMChat; } - public bool isTaxiCheater() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.TaxiCheat); } + public bool IsTaxiCheater() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.TaxiCheat); } public void SetTaxiCheater(bool on) { if (on) @@ -2257,7 +2257,7 @@ namespace Game.Entities else m_ExtraFlags &= ~PlayerExtraFlags.TaxiCheat; } - public bool isGMVisible() { return !m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMInvisible); } + public bool IsGMVisible() { return !m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMInvisible); } public void SetGMVisible(bool on) { if (on) @@ -2347,7 +2347,7 @@ namespace Game.Entities return; break; case GossipOption.Battlefield: - if (!creature.isCanInteractWithBattleMaster(this, false)) + if (!creature.CanInteractWithBattleMaster(this, false)) canTalk = false; break; case GossipOption.Stablepet: @@ -3506,7 +3506,7 @@ namespace Game.Entities (newCustomDisplay[2] == null || (newCustomDisplay[2].Data == customDisplay[2]))) return 0; - GtBarberShopCostBaseRecord bsc = CliDB.BarberShopCostBaseGameTable.GetRow(getLevel()); + GtBarberShopCostBaseRecord bsc = CliDB.BarberShopCostBaseGameTable.GetRow(GetLevel()); if (bsc == null) // shouldn't happen return 0xFFFFFFFF; @@ -3535,7 +3535,7 @@ namespace Game.Entities uint GetChampioningFaction() { return m_ChampioningFaction; } public void SetChampioningFaction(uint faction) { m_ChampioningFaction = faction; } - public void setFactionForRace(Race race) + public void SetFactionForRace(Race race) { m_team = TeamForRace(race); @@ -3643,7 +3643,7 @@ namespace Game.Entities SendPacket(packet); } - public bool isAllowedToLoot(Creature creature) + public bool IsAllowedToLoot(Creature creature) { if (!creature.IsDead() || !creature.IsDamageEnoughForLootingAndReward()) return false; @@ -3706,7 +3706,7 @@ namespace Game.Entities void RegenerateAll() { - m_regenTimerCount += m_regenTimer; + m_regenTimerCount += RegenTimer; for (PowerType power = PowerType.Mana; power < PowerType.Max; power++)// = power + 1) if (power != PowerType.Runes) @@ -3721,9 +3721,9 @@ namespace Game.Entities { byte runeToRegen = m_runes.CooldownOrder[regenIndex]; uint runeCooldown = GetRuneCooldown(runeToRegen); - if (runeCooldown > m_regenTimer) + if (runeCooldown > RegenTimer) { - SetRuneCooldown(runeToRegen, runeCooldown - m_regenTimer); + SetRuneCooldown(runeToRegen, runeCooldown - RegenTimer); ++regenIndex; } else @@ -3742,7 +3742,7 @@ namespace Game.Entities m_regenTimerCount -= 2000; } - m_regenTimer = 0; + RegenTimer = 0; } void Regenerate(PowerType power) { @@ -3769,10 +3769,10 @@ namespace Game.Entities if (powerType.RegenInterruptTimeMS != 0 && Time.GetMSTimeDiffToNow(m_combatExitTime) < powerType.RegenInterruptTimeMS) return; - addvalue = (powerType.RegenPeace + m_unitData.PowerRegenFlatModifier[(int)powerIndex]) * 0.001f * m_regenTimer; + addvalue = (powerType.RegenPeace + m_unitData.PowerRegenFlatModifier[(int)powerIndex]) * 0.001f * RegenTimer; } else - addvalue = (powerType.RegenCombat + m_unitData.PowerRegenInterruptedFlatModifier[(int)powerIndex]) * 0.001f * m_regenTimer; + addvalue = (powerType.RegenCombat + m_unitData.PowerRegenInterruptedFlatModifier[(int)powerIndex]) * 0.001f * RegenTimer; WorldCfg[] RatesForPower = { @@ -3804,7 +3804,7 @@ namespace Game.Entities if (power != PowerType.Mana) { addvalue *= GetTotalAuraMultiplierByMiscValue(AuraType.ModPowerRegenPercent, (int)power); - addvalue += GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)power) * ((power != PowerType.Energy) ? m_regenTimerCount : m_regenTimer) / (5 * Time.InMilliseconds); + addvalue += GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)power) * ((power != PowerType.Energy) ? m_regenTimerCount : RegenTimer) / (5 * Time.InMilliseconds); } int minPower = powerType.MinPower; @@ -3898,8 +3898,8 @@ namespace Game.Entities addValue = HealthIncreaseRate; if (!IsInCombat()) { - if (getLevel() < 15) - addValue = (0.20f * (GetMaxHealth()) / getLevel() * HealthIncreaseRate); + if (GetLevel() < 15) + addValue = (0.20f * (GetMaxHealth()) / GetLevel() * HealthIncreaseRate); else addValue = 0.015f * (GetMaxHealth()) * HealthIncreaseRate; @@ -4116,7 +4116,7 @@ namespace Game.Entities bool IsImmuneToEnvironmentalDamage() { // check for GM and death state included in isAttackableByAOE - return (!isTargetableForAttack(false)); + return (!IsTargetableForAttack(false)); } public uint EnvironmentalDamage(EnviromentalDamage type, uint damage) { @@ -4168,7 +4168,7 @@ namespace Game.Entities return final_damage; } - bool isTotalImmune() + bool IsTotalImmune() { var immune = GetAuraEffectsByType(AuraType.SchoolImmunity); @@ -4273,7 +4273,7 @@ namespace Game.Entities public bool IsMirrorTimerActive(MirrorTimerType type) { - return m_MirrorTimer[(int)type] == getMaxTimer(type); + return m_MirrorTimer[(int)type] == GetMaxTimer(type); } void HandleDrowning(uint time_diff) @@ -4291,7 +4291,7 @@ namespace Game.Entities // Breath timer not activated - activate it if (m_MirrorTimer[breathTimer] == -1) { - m_MirrorTimer[breathTimer] = getMaxTimer(MirrorTimerType.Breath); + m_MirrorTimer[breathTimer] = GetMaxTimer(MirrorTimerType.Breath); SendMirrorTimer(MirrorTimerType.Breath, m_MirrorTimer[breathTimer], m_MirrorTimer[breathTimer], -1); } else // If activated - do tick @@ -4303,16 +4303,16 @@ namespace Game.Entities m_MirrorTimer[breathTimer] += 1 * Time.InMilliseconds; // Calculate and deal damage // @todo Check this formula - uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, getLevel() - 1)); + uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, GetLevel() - 1)); EnvironmentalDamage(EnviromentalDamage.Drowning, damage); } else if (!m_MirrorTimerFlagsLast.HasAnyFlag(PlayerUnderwaterState.InWater)) // Update time in client if need - SendMirrorTimer(MirrorTimerType.Breath, getMaxTimer(MirrorTimerType.Breath), m_MirrorTimer[breathTimer], -1); + SendMirrorTimer(MirrorTimerType.Breath, GetMaxTimer(MirrorTimerType.Breath), m_MirrorTimer[breathTimer], -1); } } else if (m_MirrorTimer[breathTimer] != -1) // Regen timer { - int UnderWaterTime = getMaxTimer(MirrorTimerType.Breath); + int UnderWaterTime = GetMaxTimer(MirrorTimerType.Breath); // Need breath regen m_MirrorTimer[breathTimer] += (int)(10 * time_diff); if (m_MirrorTimer[breathTimer] >= UnderWaterTime || !IsAlive()) @@ -4327,7 +4327,7 @@ namespace Game.Entities // Fatigue timer not activated - activate it if (m_MirrorTimer[fatigueTimer] == -1) { - m_MirrorTimer[fatigueTimer] = getMaxTimer(MirrorTimerType.Fatigue); + m_MirrorTimer[fatigueTimer] = GetMaxTimer(MirrorTimerType.Fatigue); SendMirrorTimer(MirrorTimerType.Fatigue, m_MirrorTimer[fatigueTimer], m_MirrorTimer[fatigueTimer], -1); } else @@ -4339,19 +4339,19 @@ namespace Game.Entities m_MirrorTimer[fatigueTimer] += 1 * Time.InMilliseconds; if (IsAlive()) // Calculate and deal damage { - uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, getLevel() - 1)); + uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, GetLevel() - 1)); EnvironmentalDamage(EnviromentalDamage.Exhausted, damage); } else if (HasPlayerFlag(PlayerFlags.Ghost)) // Teleport ghost to graveyard RepopAtGraveyard(); } else if (!m_MirrorTimerFlagsLast.HasAnyFlag(PlayerUnderwaterState.InDarkWater)) - SendMirrorTimer(MirrorTimerType.Fatigue, getMaxTimer(MirrorTimerType.Fatigue), m_MirrorTimer[fatigueTimer], -1); + SendMirrorTimer(MirrorTimerType.Fatigue, GetMaxTimer(MirrorTimerType.Fatigue), m_MirrorTimer[fatigueTimer], -1); } } else if (m_MirrorTimer[fatigueTimer] != -1) // Regen timer { - int DarkWaterTime = getMaxTimer(MirrorTimerType.Fatigue); + int DarkWaterTime = GetMaxTimer(MirrorTimerType.Fatigue); m_MirrorTimer[fatigueTimer] += (int)(10 * time_diff); if (m_MirrorTimer[fatigueTimer] >= DarkWaterTime || !IsAlive()) StopMirrorTimer(MirrorTimerType.Fatigue); @@ -4363,7 +4363,7 @@ namespace Game.Entities { // Breath timer not activated - activate it if (m_MirrorTimer[fireTimer] == -1) - m_MirrorTimer[fireTimer] = getMaxTimer(MirrorTimerType.Fire); + m_MirrorTimer[fireTimer] = GetMaxTimer(MirrorTimerType.Fire); else { m_MirrorTimer[fireTimer] -= (int)time_diff; @@ -4425,7 +4425,7 @@ namespace Game.Entities SendPacket(new StopMirrorTimer(Type)); } - int getMaxTimer(MirrorTimerType timer) + int GetMaxTimer(MirrorTimerType timer) { switch (timer) { @@ -4476,7 +4476,7 @@ namespace Game.Entities if (GetSession().IsARecruiter() || (GetSession().GetRecruiterId() != 0)) AddDynamicFlag(UnitDynFlags.ReferAFriend); - setDeathState(DeathState.Alive); + SetDeathState(DeathState.Alive); // add the flag to make sure opcode is always sent AddUnitMovementFlag(MovementFlag.WaterWalk); @@ -4525,15 +4525,15 @@ namespace Game.Entities //Characters level 20 and up suffer from ten minutes of sickness. int startLevel = WorldConfig.GetIntValue(WorldCfg.DeathSicknessLevel); - if (getLevel() >= startLevel) + if (GetLevel() >= startLevel) { // set resurrection sickness CastSpell(this, 15007, true); // not full duration - if (getLevel() < startLevel + 9) + if (GetLevel() < startLevel + 9) { - int delta = (int)(getLevel() - startLevel + 1) * Time.Minute; + int delta = (int)(GetLevel() - startLevel + 1) * Time.Minute; Aura aur = GetAura(15007, GetGUID()); if (aur != null) aur.SetDuration(delta * Time.InMilliseconds); @@ -4551,7 +4551,7 @@ namespace Game.Entities StopMirrorTimers(); //disable timers(bars) - setDeathState(DeathState.Corpse); + SetDeathState(DeathState.Corpse); SetDynamicFlags(UnitDynFlags.None); if (!CliDB.MapStorage.LookupByKey(GetMapId()).Instanceable() && !HasAuraType(AuraType.PreventResurrection)) @@ -4847,7 +4847,7 @@ namespace Game.Entities pet.SetFaction(GetFaction()); pet.SetNpcFlags(NPCFlags.None); pet.SetNpcFlags2(NPCFlags2.None); - pet.InitStatsForLevel(getLevel()); + pet.InitStatsForLevel(GetLevel()); SetMinion(pet, true); @@ -4954,7 +4954,7 @@ namespace Game.Entities pet.AddObjectToRemoveList(); pet.m_removed = true; - if (pet.isControlled()) + if (pet.IsControlled()) { SendPacket(new PetSpells()); @@ -5149,10 +5149,10 @@ namespace Game.Entities } // Used in triggers for check "Only to targets that grant experience or honor" req - public bool isHonorOrXPTarget(Unit victim) + public bool IsHonorOrXPTarget(Unit victim) { uint v_level = victim.GetLevelForTarget(this); - uint k_grey = Formulas.GetGrayLevel(getLevel()); + uint k_grey = Formulas.GetGrayLevel(GetLevel()); // Victim level less gray level if (v_level < k_grey) @@ -5167,8 +5167,8 @@ namespace Game.Entities return true; } - public void setRegenTimerCount(uint time) { m_regenTimerCount = time; } - void setWeaponChangeTimer(uint time) { m_weaponChangeTimer = time; } + public void SetRegenTimerCount(uint time) { m_regenTimerCount = time; } + void SetWeaponChangeTimer(uint time) { m_weaponChangeTimer = time; } //Team public static Team TeamForRace(Race race) @@ -5257,13 +5257,6 @@ namespace Game.Entities DB.Characters.Execute(stmt); } } - void SetFactionForRace(Race race) - { - m_team = TeamForRace(race); - - var rEntry = CliDB.ChrRacesStorage.LookupByKey(race); - SetFaction(rEntry.FactionID); - } //Guild public void SetInGuild(ulong guildId) @@ -5301,7 +5294,7 @@ namespace Game.Entities public void SetFreePrimaryProfessions(uint profs) { SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.CharacterPoints), profs); } public void GiveLevel(uint level) { - var oldLevel = getLevel(); + var oldLevel = GetLevel(); if (level == oldLevel) return; @@ -5384,7 +5377,7 @@ namespace Game.Entities if (pet) pet.SynchronizeLevelWithOwner(); - MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)getRaceMask()); + MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)GetRaceMask()); if (mailReward != null) { //- TODO: Poor design of mail system @@ -5423,33 +5416,33 @@ namespace Game.Entities public void ToggleAFK() { - if (isAFK()) + if (IsAFK()) RemovePlayerFlag(PlayerFlags.AFK); else AddPlayerFlag(PlayerFlags.AFK); // afk player not allowed in Battleground - if (!IsGameMaster() && isAFK() && InBattleground() && !InArena()) + if (!IsGameMaster() && IsAFK() && InBattleground() && !InArena()) LeaveBattleground(); } public void ToggleDND() { - if (isDND()) + if (IsDND()) RemovePlayerFlag(PlayerFlags.DND); else AddPlayerFlag(PlayerFlags.DND); } - public bool isAFK() { return HasPlayerFlag(PlayerFlags.AFK); } - public bool isDND() { return HasPlayerFlag(PlayerFlags.DND); } + public bool IsAFK() { return HasPlayerFlag(PlayerFlags.AFK); } + public bool IsDND() { return HasPlayerFlag(PlayerFlags.DND); } public ChatFlags GetChatFlags() { ChatFlags tag = ChatFlags.None; - if (isGMChat()) + if (IsGMChat()) tag |= ChatFlags.GM; - if (isDND()) + if (IsDND()) tag |= ChatFlags.DND; - if (isAFK()) + if (IsAFK()) tag |= ChatFlags.AFK; if (HasPlayerFlag(PlayerFlags.Developer)) tag |= ChatFlags.Dev; @@ -5823,12 +5816,12 @@ namespace Game.Entities _RemoveAllStatBonuses(); uint basemana; - Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), getLevel(), out basemana); + Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), GetLevel(), out basemana); - PlayerLevelInfo info = Global.ObjectMgr.GetPlayerLevelInfo(GetRace(), GetClass(), getLevel()); + PlayerLevelInfo info = Global.ObjectMgr.GetPlayerLevelInfo(GetRace(), GetClass(), GetLevel()); SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.MaxLevel), WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)); - SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.NextLevelXP), Global.ObjectMgr.GetXPForLevel(getLevel())); + SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.NextLevelXP), Global.ObjectMgr.GetXPForLevel(GetLevel())); // reset before any aura state sources (health set/aura apply) SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.AuraState), 0u); @@ -6052,7 +6045,7 @@ namespace Game.Entities // target aura duration for caster show only if target exist at caster client // send data at target visibility change (adding to client) - if (target.isTypeMask(TypeMask.Unit)) + if (target.IsTypeMask(TypeMask.Unit)) SendInitialVisiblePackets(target.ToUnit()); } } @@ -6311,17 +6304,17 @@ namespace Game.Entities if (areaEntry.ExplorationLevel > 0) { - if (getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) + if (GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) { SendExplorationExperience(areaId, 0); } else { - int diff = (int)(getLevel() - areaEntry.ExplorationLevel); + int diff = (int)(GetLevel() - areaEntry.ExplorationLevel); uint XP = 0; if (diff < -5) { - XP = (uint)(Global.ObjectMgr.GetBaseXP(getLevel() + 5) * WorldConfig.GetFloatValue(WorldCfg.RateXpExplore)); + XP = (uint)(Global.ObjectMgr.GetBaseXP(GetLevel() + 5) * WorldConfig.GetFloatValue(WorldCfg.RateXpExplore)); } else if (diff > 5) { @@ -6453,16 +6446,16 @@ namespace Game.Entities data.Initialize(ChatMsg.WhisperInform, language, target, target, text); SendPacket(data); - if (!isAcceptWhispers() && !IsGameMaster() && !target.IsGameMaster()) + if (!IsAcceptWhispers() && !IsGameMaster() && !target.IsGameMaster()) { SetAcceptWhispers(true); SendSysMessage(CypherStrings.CommandWhisperon); } // announce afk or dnd message - if (target.isAFK()) + if (target.IsAFK()) SendSysMessage(CypherStrings.PlayerAfk, target.GetName(), target.autoReplyMsg); - else if (target.isDND()) + else if (target.IsDND()) SendSysMessage(CypherStrings.PlayerDnd, target.GetName(), target.autoReplyMsg); } @@ -6496,8 +6489,8 @@ namespace Game.Entities m_lastFallZ = z; } - public byte getCinematic() { return m_cinematic; } - public void setCinematic(byte cine) { m_cinematic = cine; } + public byte GetCinematic() { return m_cinematic; } + public void SetCinematic(byte cine) { m_cinematic = cine; } public uint GetMovie() { return m_movie; } public void SetMovie(uint movie) { m_movie = movie; } @@ -6536,7 +6529,7 @@ namespace Game.Entities int playerLevelDelta = 0; // If XP < 50%, player should see scaling creature with -1 level except for level max - if (getLevel() < SharedConst.MaxLevel && xp < (m_activePlayerData.NextLevelXP / 2)) + if (GetLevel() < SharedConst.MaxLevel && xp < (m_activePlayerData.NextLevelXP / 2)) playerLevelDelta = -1; SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ScalingPlayerLevelDelta), playerLevelDelta); @@ -6553,10 +6546,10 @@ namespace Game.Entities if (HasPlayerFlag(PlayerFlags.NoXPGain)) return; - if (victim != null && victim.IsTypeId(TypeId.Unit) && !victim.ToCreature().hasLootRecipient()) + if (victim != null && victim.IsTypeId(TypeId.Unit) && !victim.ToCreature().HasLootRecipient()) return; - uint level = getLevel(); + uint level = GetLevel(); Global.ScriptMgr.OnGivePlayerXP(this, xp, victim); @@ -6593,7 +6586,7 @@ namespace Game.Entities if (level < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) GiveLevel(level + 1); - level = getLevel(); + level = GetLevel(); nextLvlXP = m_activePlayerData.NextLevelXP; } @@ -6757,7 +6750,7 @@ namespace Game.Entities if (GetDisplayId() != GetNativeDisplayId()) RestoreDisplayId(true); - if (IsDisallowedMountForm(getTransForm(), ShapeShiftForm.None, GetDisplayId())) + if (IsDisallowedMountForm(GetTransForm(), ShapeShiftForm.None, GetDisplayId())) { GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerShapeshifted); return false; @@ -6931,7 +6924,7 @@ namespace Game.Entities m_taxi.ClearTaxiDestinations(); // not destinations, clear source node Dismount(); RemoveUnitFlag(UnitFlags.RemoveClientControl | UnitFlags.TaxiFlight); - getHostileRefManager().setOnlineOfflineState(true); + GetHostileRefManager().setOnlineOfflineState(true); } public void ContinueTaxiFlight() @@ -6989,7 +6982,7 @@ namespace Game.Entities public bool GetsRecruitAFriendBonus(bool forXP) { bool recruitAFriend = false; - if (getLevel() <= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel) || !forXP) + if (GetLevel() <= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel) || !forXP) { Group group = GetGroup(); if (group) @@ -7006,12 +6999,12 @@ namespace Game.Entities if (forXP) { // level must be allowed to get RaF bonus - if (player.getLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel)) + if (player.GetLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel)) continue; // level difference must be small enough to get RaF bonus, UNLESS we are lower level - if (player.getLevel() < getLevel()) - if (getLevel() - player.getLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevelDifference)) + if (player.GetLevel() < GetLevel()) + if (GetLevel() - player.GetLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevelDifference)) continue; } @@ -7109,8 +7102,8 @@ namespace Game.Entities } public bool IsSpellFitByClassAndRace(uint spell_id) { - ulong racemask = getRaceMask(); - uint classmask = getClassMask(); + ulong racemask = GetRaceMask(); + uint classmask = GetClassMask(); var bounds = Global.SpellMgr.GetSkillLineAbilityMapBounds(spell_id); @@ -7202,7 +7195,7 @@ namespace Game.Entities // farsight dynobj or puppet may be very far away UpdateVisibilityOf(target); - if (target.isTypeMask(TypeMask.Unit) && target != GetVehicleBase()) + if (target.IsTypeMask(TypeMask.Unit) && target != GetVehicleBase()) target.ToUnit().AddPlayerToVision(this); SetSeer(target); } @@ -7218,7 +7211,7 @@ namespace Game.Entities SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.FarsightObject), ObjectGuid.Empty); - if (target.isTypeMask(TypeMask.Unit) && target != GetVehicleBase()) + if (target.IsTypeMask(TypeMask.Unit) && target != GetVehicleBase()) target.ToUnit().RemovePlayerFromVision(this); //must immediately set seer back otherwise may crash diff --git a/Source/Game/Entities/Player/PlayerTaxi.cs b/Source/Game/Entities/Player/PlayerTaxi.cs index 956f5f953..0d46521da 100644 --- a/Source/Game/Entities/Player/PlayerTaxi.cs +++ b/Source/Game/Entities/Player/PlayerTaxi.cs @@ -27,6 +27,10 @@ namespace Game.Entities { public class PlayerTaxi { + public byte[] m_taximask = new byte[PlayerConst.TaxiMaskSize]; + List m_TaxiDestinations = new List(); + uint m_flightMasterFactionId; + public void InitTaxiNodesForLevel(Race race, Class chrClass, uint level) { // class specific initial known nodes @@ -261,10 +265,6 @@ namespace Game.Entities return GetTaxiDestination(); } public List GetPath() { return m_TaxiDestinations; } - public bool empty() { return m_TaxiDestinations.Empty(); } - - public byte[] m_taximask = new byte[PlayerConst.TaxiMaskSize]; - List m_TaxiDestinations = new List(); - uint m_flightMasterFactionId; + public bool Empty() { return m_TaxiDestinations.Empty(); } } } diff --git a/Source/Game/Entities/Player/RestMgr.cs b/Source/Game/Entities/Player/RestMgr.cs index 67dcdd116..49d9e2643 100644 --- a/Source/Game/Entities/Player/RestMgr.cs +++ b/Source/Game/Entities/Player/RestMgr.cs @@ -4,6 +4,12 @@ namespace Game.Entities { public class RestMgr { + Player _player; + long _restTime; + uint _innAreaTriggerId; + float[] _restBonus = new float[(int)RestTypes.Max]; + RestFlag _restFlagMask; + public RestMgr(Player player) { _player = player; @@ -18,7 +24,7 @@ namespace Game.Entities { case RestTypes.XP: // Reset restBonus (XP only) for max level players - if (_player.getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) + if (_player.GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) restBonus = 0; next_level_xp = _player.m_activePlayerData.NextLevelXP; @@ -67,7 +73,7 @@ namespace Game.Entities public void AddRestBonus(RestTypes restType, float restBonus) { // Don't add extra rest bonus to max level players. Note: Might need different condition in next expansion for honor XP (PLAYER_LEVEL_MIN_HONOR perhaps). - if (_player.getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) + if (_player.GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) restBonus = 0; float totalRestBonus = GetRestBonus(restType) + restBonus; @@ -153,11 +159,5 @@ namespace Game.Entities public float GetRestBonus(RestTypes restType) { return _restBonus[(int)restType]; } public bool HasRestFlag(RestFlag restFlag) { return (_restFlagMask & restFlag) != 0; } public uint GetInnTriggerId() { return _innAreaTriggerId; } - - Player _player; - long _restTime; - uint _innAreaTriggerId; - float[] _restBonus = new float[(int)RestTypes.Max]; - RestFlag _restFlagMask; } } diff --git a/Source/Game/Entities/Player/SceneMgr.cs b/Source/Game/Entities/Player/SceneMgr.cs index 706c835df..b850fad85 100644 --- a/Source/Game/Entities/Player/SceneMgr.cs +++ b/Source/Game/Entities/Player/SceneMgr.cs @@ -25,6 +25,11 @@ namespace Game.Entities { public class SceneMgr { + Player _player; + Dictionary _scenesByInstance = new Dictionary(); + uint _standaloneSceneInstanceID; + bool _isDebuggingScenes; + public SceneMgr(Player player) { _player = player; @@ -237,10 +242,5 @@ namespace Game.Entities public void ToggleDebugSceneMode() { _isDebuggingScenes = !_isDebuggingScenes; } public bool IsInDebugSceneMode() { return _isDebuggingScenes; } - - Player _player; - Dictionary _scenesByInstance = new Dictionary(); - uint _standaloneSceneInstanceID; - bool _isDebuggingScenes; } } diff --git a/Source/Game/Entities/Player/SocialMgr.cs b/Source/Game/Entities/Player/SocialMgr.cs index 3bc3f3720..0a33a117f 100644 --- a/Source/Game/Entities/Player/SocialMgr.cs +++ b/Source/Game/Entities/Player/SocialMgr.cs @@ -26,6 +26,8 @@ namespace Game.Entities { public class SocialManager : Singleton { + Dictionary _socialMap = new Dictionary(); + SocialManager() { } public const int FriendLimit = 50; @@ -62,15 +64,15 @@ namespace Game.Entities if (target.IsVisibleGloballyFor(player)) { - if (target.isDND()) + if (target.IsDND()) friendInfo.Status = FriendStatus.DND; - else if (target.isAFK()) + else if (target.IsAFK()) friendInfo.Status = FriendStatus.AFK; else friendInfo.Status = FriendStatus.Online; friendInfo.Area = target.GetZoneId(); - friendInfo.Level = target.getLevel(); + friendInfo.Level = target.GetLevel(); friendInfo.Class = target.GetClass(); } } @@ -141,12 +143,13 @@ namespace Game.Entities } public void RemovePlayerSocial(ObjectGuid guid) { _socialMap.Remove(guid); } - - Dictionary _socialMap = new Dictionary(); } public class PlayerSocial { + public Dictionary _playerSocialMap = new Dictionary(); + ObjectGuid m_playerGUID; + uint GetNumberOfSocialsWithFlag(SocialFlag flag) { uint counter = 0; @@ -277,13 +280,18 @@ namespace Game.Entities ObjectGuid GetPlayerGUID() { return m_playerGUID; } public void SetPlayerGUID(ObjectGuid guid) { m_playerGUID = guid; } - - public Dictionary _playerSocialMap = new Dictionary(); - ObjectGuid m_playerGUID; } public class FriendInfo { + public ObjectGuid WowAccountGuid; + public FriendStatus Status; + public SocialFlag Flags; + public uint Area; + public uint Level; + public Class Class; + public string Note; + public FriendInfo() { Status = FriendStatus.Offline; @@ -297,14 +305,6 @@ namespace Game.Entities Flags = flags; Note = note; } - - public ObjectGuid WowAccountGuid; - public FriendStatus Status; - public SocialFlag Flags; - public uint Area; - public uint Level; - public Class Class; - public string Note; } public enum FriendStatus diff --git a/Source/Game/Entities/StatSystem.cs b/Source/Game/Entities/StatSystem.cs index dc643e51f..e40419062 100644 --- a/Source/Game/Entities/StatSystem.cs +++ b/Source/Game/Entities/StatSystem.cs @@ -344,9 +344,9 @@ namespace Game.Entities public ulong GetHealth() { return m_unitData.Health; } public void SetHealth(ulong val) { - if (getDeathState() == DeathState.JustDied) + if (GetDeathState() == DeathState.JustDied) val = 0; - else if (IsTypeId(TypeId.Player) && getDeathState() == DeathState.Dead) + else if (IsTypeId(TypeId.Player) && GetDeathState() == DeathState.Dead) val = 1; else { @@ -367,7 +367,7 @@ namespace Game.Entities else if (IsPet()) { Pet pet = ToCreature().ToPet(); - if (pet.isControlled()) + if (pet.IsControlled()) pet.SetGroupUpdateFlag(GroupUpdatePetFlags.CurHp); } } @@ -389,7 +389,7 @@ namespace Game.Entities else if (IsPet()) { Pet pet = ToCreature().ToPet(); - if (pet.isControlled()) + if (pet.IsControlled()) pet.SetGroupUpdateFlag(GroupUpdatePetFlags.MaxHp); } @@ -605,7 +605,7 @@ namespace Game.Entities //calculate miss chance float missChance = victim.GetUnitMissChance(attType); - if (spellId == 0 && haveOffhandWeapon() && !IsInFeralForm()) + if (spellId == 0 && HaveOffhandWeapon() && !IsInFeralForm()) missChance += 19; // Calculate hit chance @@ -622,9 +622,9 @@ namespace Game.Entities missChance += hitChance - 100.0f; if (attType == WeaponAttackType.RangedAttack) - missChance -= m_modRangedHitChance; + missChance -= ModRangedHitChance; else - missChance -= m_modMeleeHitChance; + missChance -= ModMeleeHitChance; // Limit miss chance from 0 to 77% if (missChance < 0.0f) @@ -1024,7 +1024,7 @@ namespace Game.Entities // Get base of Mana Pool in sBaseMPGameTable uint basemana; - Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), getLevel(), out basemana); + Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), GetLevel(), out basemana); float base_regen = basemana / 100.0f; base_regen += GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)PowerType.Mana); @@ -1070,7 +1070,7 @@ namespace Game.Entities public override void UpdateAttackPowerAndDamage(bool ranged = false) { float val2 = 0.0f; - float level = getLevel(); + float level = GetLevel(); var entry = CliDB.ChrClassesStorage.LookupByKey(GetClass()); UnitMods unitMod = ranged ? UnitMods.AttackPowerRanged : UnitMods.AttackPower; @@ -1626,20 +1626,20 @@ namespace Game.Entities public void UpdateMeleeHitChances() { - m_modMeleeHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance); - m_modMeleeHitChance += GetRatingBonusValue(CombatRating.HitMelee); + ModMeleeHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance); + ModMeleeHitChance += GetRatingBonusValue(CombatRating.HitMelee); } public void UpdateRangedHitChances() { - m_modRangedHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance); - m_modRangedHitChance += GetRatingBonusValue(CombatRating.HitRanged); + ModRangedHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance); + ModRangedHitChance += GetRatingBonusValue(CombatRating.HitRanged); } public void UpdateSpellHitChances() { - m_modSpellHitChance = 15.0f + GetTotalAuraModifier(AuraType.ModSpellHitChance); - m_modSpellHitChance += GetRatingBonusValue(CombatRating.HitSpell); + ModSpellHitChance = 15.0f + GetTotalAuraModifier(AuraType.ModSpellHitChance); + ModSpellHitChance += GetRatingBonusValue(CombatRating.HitSpell); } public override void UpdateMaxHealth() { @@ -1656,7 +1656,7 @@ namespace Game.Entities { // Taken from PaperDollFrame.lua - 6.0.3.19085 float ratio = 10.0f; - GtHpPerStaRecord hpBase = CliDB.HpPerStaGameTable.GetRow(getLevel()); + GtHpPerStaRecord hpBase = CliDB.HpPerStaGameTable.GetRow(GetLevel()); if (hpBase != null) ratio = hpBase.Health; @@ -1869,7 +1869,7 @@ namespace Game.Entities break; } - if (attType == WeaponAttackType.OffAttack && !haveOffhandWeapon()) + if (attType == WeaponAttackType.OffAttack && !HaveOffhandWeapon()) { minDamage = 0.0f; maxDamage = 0.0f; diff --git a/Source/Game/Entities/TemporarySummon.cs b/Source/Game/Entities/TemporarySummon.cs index 686342d77..5bddfef1c 100644 --- a/Source/Game/Entities/TemporarySummon.cs +++ b/Source/Game/Entities/TemporarySummon.cs @@ -18,7 +18,6 @@ using Framework.Constants; using Framework.Dynamic; using Game.DataStorage; -using System; using System.Collections.Generic; namespace Game.Entities @@ -31,7 +30,7 @@ namespace Game.Entities m_type = TempSummonType.ManualDespawn; m_summonerGUID = owner != null ? owner.GetGUID() : ObjectGuid.Empty; - m_unitTypeMask |= UnitTypeMask.Summon; + UnitTypeMask |= UnitTypeMask.Summon; } public Unit GetSummoner() @@ -188,7 +187,7 @@ namespace Game.Entities if (owner != null && IsTrigger() && m_spells[0] != 0) { SetFaction(owner.GetFaction()); - SetLevel(owner.getLevel()); + SetLevel(owner.GetLevel()); if (owner.IsTypeId(TypeId.Player)) m_ControlledByPlayer = true; } @@ -314,7 +313,7 @@ namespace Game.Entities { m_owner = owner; Cypher.Assert(m_owner); - m_unitTypeMask |= UnitTypeMask.Minion; + UnitTypeMask |= UnitTypeMask.Minion; m_followAngle = SharedConst.PetFollowAngle; /// @todo: Find correct way InitCharmInfo(); @@ -378,10 +377,10 @@ namespace Game.Entities { m_bonusSpellDamage = 0; - m_unitTypeMask |= UnitTypeMask.Guardian; + UnitTypeMask |= UnitTypeMask.Guardian; if (properties != null && (properties.Title == SummonType.Pet || properties.Control == SummonCategory.Pet)) { - m_unitTypeMask |= UnitTypeMask.ControlableGuardian; + UnitTypeMask |= UnitTypeMask.ControlableGuardian; InitCharmInfo(); } } @@ -390,7 +389,7 @@ namespace Game.Entities { base.InitStats(duration); - InitStatsForLevel(GetOwner().getLevel()); + InitStatsForLevel(GetOwner().GetLevel()); if (GetOwner().IsTypeId(TypeId.Player) && HasUnitTypeMask(UnitTypeMask.ControlableGuardian)) GetCharmInfo().InitCharmCreateSpells(); @@ -430,7 +429,7 @@ namespace Game.Entities else if (GetOwner().GetClass() == Class.Hunter) { petType = PetType.Hunter; - m_unitTypeMask |= UnitTypeMask.HunterPet; + UnitTypeMask |= UnitTypeMask.HunterPet; } else { @@ -453,12 +452,12 @@ namespace Game.Entities if (cFamily != null && cFamily.MinScale > 0.0f && petType == PetType.Hunter) { float scale; - if (getLevel() >= cFamily.MaxScaleLevel) + if (GetLevel() >= cFamily.MaxScaleLevel) scale = cFamily.MaxScale; - else if (getLevel() <= cFamily.MinScaleLevel) + else if (GetLevel() <= cFamily.MinScaleLevel) scale = cFamily.MinScale; else - scale = cFamily.MinScale + (float)(getLevel() - cFamily.MinScaleLevel) / cFamily.MaxScaleLevel * (cFamily.MaxScale - cFamily.MinScale); + scale = cFamily.MinScale + (float)(GetLevel() - cFamily.MinScaleLevel) / cFamily.MaxScaleLevel * (cFamily.MaxScale - cFamily.MinScale); SetObjectScale(scale); } @@ -979,14 +978,14 @@ namespace Game.Entities public Puppet(SummonPropertiesRecord properties, Unit owner) : base(properties, owner, false) { Cypher.Assert(owner.IsTypeId(TypeId.Player)); - m_unitTypeMask |= UnitTypeMask.Puppet; + UnitTypeMask |= UnitTypeMask.Puppet; } public override void InitStats(uint duration) { base.InitStats(duration); - SetLevel(GetOwner().getLevel()); + SetLevel(GetOwner().GetLevel()); SetReactState(ReactStates.Passive); } diff --git a/Source/Game/Entities/Totem.cs b/Source/Game/Entities/Totem.cs index 40fcf0b02..57e980cbf 100644 --- a/Source/Game/Entities/Totem.cs +++ b/Source/Game/Entities/Totem.cs @@ -20,7 +20,6 @@ using Game.DataStorage; using Game.Groups; using Game.Network.Packets; using Game.Spells; -using System.Linq; namespace Game.Entities { @@ -28,7 +27,7 @@ namespace Game.Entities { public Totem(SummonPropertiesRecord properties, Unit owner) : base(properties, owner, false) { - m_unitTypeMask |= UnitTypeMask.Totem; + UnitTypeMask |= UnitTypeMask.Totem; m_type = TotemType.Passive; } @@ -78,12 +77,12 @@ namespace Game.Entities // Get spell cast by totem SpellInfo totemSpell = Global.SpellMgr.GetSpellInfo(GetSpell()); if (totemSpell != null) - if (totemSpell.CalcCastTime(getLevel()) != 0) // If spell has cast time . its an active totem + if (totemSpell.CalcCastTime(GetLevel()) != 0) // If spell has cast time . its an active totem m_type = TotemType.Active; m_duration = duration; - SetLevel(GetOwner().getLevel()); + SetLevel(GetOwner().GetLevel()); } public override void InitSummon() diff --git a/Source/Game/Entities/Transport.cs b/Source/Game/Entities/Transport.cs index df69e627d..b07731a72 100644 --- a/Source/Game/Entities/Transport.cs +++ b/Source/Game/Entities/Transport.cs @@ -519,7 +519,7 @@ namespace Game.Entities Cell oldCell = new Cell(GetPositionX(), GetPositionY()); Relocate(x, y, z, o); - m_stationaryPosition.SetOrientation(o); + StationaryPosition.SetOrientation(o); UpdateModelPosition(); UpdatePassengerPositions(_passengers); diff --git a/Source/Game/Entities/Unit/CharmInfo.cs b/Source/Game/Entities/Unit/CharmInfo.cs index bb8c4f1aa..cf417c5d9 100644 --- a/Source/Game/Entities/Unit/CharmInfo.cs +++ b/Source/Game/Entities/Unit/CharmInfo.cs @@ -310,9 +310,9 @@ namespace Game.Entities public void SaveStayPosition() { //! At this point a new spline destination is enabled because of Unit.StopMoving() - Vector3 stayPos = _unit.moveSpline.FinalDestination(); + Vector3 stayPos = _unit.MoveSpline.FinalDestination(); - if (_unit.moveSpline.onTransport) + if (_unit.MoveSpline.onTransport) { float o = 0; ITransport transport = _unit.GetDirectTransport(); diff --git a/Source/Game/Entities/Unit/Unit.Combat.cs b/Source/Game/Entities/Unit/Unit.Combat.cs index 5eaaf0238..e9eb2f961 100644 --- a/Source/Game/Entities/Unit/Unit.Combat.cs +++ b/Source/Game/Entities/Unit/Unit.Combat.cs @@ -95,7 +95,7 @@ namespace Game.Entities } } - var attackers = getAttackers(); + var attackers = GetAttackers(); for (var i = 0; i < attackers.Count;) { var unit = attackers[i]; @@ -108,7 +108,7 @@ namespace Game.Entities ++i; } - getHostileRefManager().deleteReferencesForFaction(factionId); + GetHostileRefManager().deleteReferencesForFaction(factionId); foreach (var control in m_Controlled) control.StopAttackFaction(factionId); @@ -116,10 +116,10 @@ namespace Game.Entities public void HandleProcExtraAttackFor(Unit victim) { - while (m_extraAttacks != 0) + while (ExtraAttacks != 0) { AttackerStateUpdate(victim, WeaponAttackType.BaseAttack, true); - --m_extraAttacks; + --ExtraAttacks; } } @@ -229,7 +229,7 @@ namespace Game.Entities { // iterate attackers List toRemove = new List(); - foreach (Unit attacker in getAttackers()) + foreach (Unit attacker in GetAttackers()) if (!attacker.IsValidAttackTarget(this)) toRemove.Add(attacker); @@ -267,7 +267,7 @@ namespace Game.Entities } public void ClearInCombat() { - m_CombatTimer = 0; + combatTimer = 0; RemoveUnitFlag(UnitFlags.InCombat); // Player's state will be cleared in Player.UpdateContestedPvP @@ -316,11 +316,11 @@ namespace Game.Entities } } - public void addHatedBy(HostileReference pHostileReference) + public void AddHatedBy(HostileReference pHostileReference) { - m_HostileRefManager.InsertFirst(pHostileReference); + hostileRefManager.InsertFirst(pHostileReference); } - public void removeHatedBy(HostileReference pHostileReference) { } //nothing to do yet + public void RemoveHatedBy(HostileReference pHostileReference) { } //nothing to do yet public void AddThreat(Unit victim, float fThreat, SpellSchoolMask schoolMask = SpellSchoolMask.Normal, SpellInfo threatSpell = null) { @@ -338,7 +338,7 @@ namespace Game.Entities return fThreat * m_threatModifier[(int)school]; } - public bool isTargetableForAttack(bool checkFakeDeath = true) + public bool IsTargetableForAttack(bool checkFakeDeath = true) { if (!IsAlive()) return false; @@ -352,7 +352,7 @@ namespace Game.Entities return !HasUnitState(UnitState.Unattackable) && (!checkFakeDeath || !HasUnitState(UnitState.Died)); } - public DeathState getDeathState() + public DeathState GetDeathState() { return m_deathState; } @@ -392,9 +392,9 @@ namespace Game.Entities if (HasAuraType(AuraType.ModUnattackable)) RemoveAurasByType(AuraType.ModUnattackable); - if (m_attacking != null) + if (attacking != null) { - if (m_attacking == victim) + if (attacking == victim) { // switch to melee attack from ranged/magic if (meleeAttack) @@ -421,11 +421,11 @@ namespace Game.Entities ClearUnitState(UnitState.MeleeAttacking); } - if (m_attacking != null) - m_attacking._removeAttacker(this); + if (attacking != null) + attacking._removeAttacker(this); - m_attacking = victim; - m_attacking._addAttacker(this); + attacking = victim; + attacking._addAttacker(this); // Set our target SetTarget(victim.GetGUID()); @@ -450,8 +450,8 @@ namespace Game.Entities } // delay offhand weapon attack to next attack time - if (haveOffhandWeapon() && GetTypeId() != TypeId.Player) - resetAttackTimer(WeaponAttackType.OffAttack); + if (HaveOffhandWeapon() && GetTypeId() != TypeId.Player) + ResetAttackTimer(WeaponAttackType.OffAttack); if (meleeAttack) SendMeleeAttackStart(victim); @@ -488,13 +488,13 @@ namespace Game.Entities public virtual void SetTarget(ObjectGuid guid) { } public bool AttackStop() { - if (m_attacking == null) + if (attacking == null) return false; - Unit victim = m_attacking; + Unit victim = attacking; - m_attacking._removeAttacker(this); - m_attacking = null; + attacking._removeAttacker(this); + attacking = null; // Clear our target SetTarget(ObjectGuid.Empty); @@ -529,9 +529,9 @@ namespace Game.Entities } public Unit GetVictim() { - return m_attacking; + return attacking; } - public Unit getAttackerForHelper() + public Unit GetAttackerForHelper() { if (GetVictim() != null) return GetVictim(); @@ -541,7 +541,7 @@ namespace Game.Entities return null; } - public List getAttackers() + public List GetAttackers() { return attackerList; } @@ -551,26 +551,26 @@ namespace Game.Entities public float GetBoundingRadius() { return m_unitData.BoundingRadius; } public void SetBoundingRadius(float boundingRadius) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.BoundingRadius), boundingRadius); } - public bool haveOffhandWeapon() + public bool HaveOffhandWeapon() { if (IsTypeId(TypeId.Player)) return ToPlayer().GetWeaponForAttack(WeaponAttackType.OffAttack, true) != null; else return m_canDualWield; } - public void resetAttackTimer(WeaponAttackType type = WeaponAttackType.BaseAttack) + public void ResetAttackTimer(WeaponAttackType type = WeaponAttackType.BaseAttack) { m_attackTimer[(int)type] = (uint)(GetBaseAttackTime(type) * m_modAttackSpeedPct[(int)type]); } - public void setAttackTimer(WeaponAttackType type, uint time) + public void SetAttackTimer(WeaponAttackType type, uint time) { m_attackTimer[(int)type] = time; } - public uint getAttackTimer(WeaponAttackType type) + public uint GetAttackTimer(WeaponAttackType type) { return m_attackTimer[(int)type]; } - public bool isAttackReady(WeaponAttackType type = WeaponAttackType.BaseAttack) + public bool IsAttackReady(WeaponAttackType type = WeaponAttackType.BaseAttack) { return m_attackTimer[(int)type] == 0; } @@ -803,19 +803,19 @@ namespace Game.Entities (!IsTypeId(TypeId.Unit) || !ToCreature().GetCreatureTemplate().FlagsExtra.HasAnyFlag(CreatureFlagsExtra.NoParryHasten))) { // Get attack timers - float offtime = victim.getAttackTimer(WeaponAttackType.OffAttack); - float basetime = victim.getAttackTimer(WeaponAttackType.BaseAttack); + float offtime = victim.GetAttackTimer(WeaponAttackType.OffAttack); + float basetime = victim.GetAttackTimer(WeaponAttackType.BaseAttack); // Reduce attack time - if (victim.haveOffhandWeapon() && offtime < basetime) + if (victim.HaveOffhandWeapon() && offtime < basetime) { float percent20 = victim.GetBaseAttackTime(WeaponAttackType.OffAttack) * 0.20f; float percent60 = 3.0f * percent20; if (offtime > percent20 && offtime <= percent60) - victim.setAttackTimer(WeaponAttackType.OffAttack, (uint)percent20); + victim.SetAttackTimer(WeaponAttackType.OffAttack, (uint)percent20); else if (offtime > percent60) { offtime -= 2.0f * percent20; - victim.setAttackTimer(WeaponAttackType.OffAttack, (uint)offtime); + victim.SetAttackTimer(WeaponAttackType.OffAttack, (uint)offtime); } } else @@ -823,11 +823,11 @@ namespace Game.Entities float percent20 = victim.GetBaseAttackTime(WeaponAttackType.BaseAttack) * 0.20f; float percent60 = 3.0f * percent20; if (basetime > percent20 && basetime <= percent60) - victim.setAttackTimer(WeaponAttackType.BaseAttack, (uint)percent20); + victim.SetAttackTimer(WeaponAttackType.BaseAttack, (uint)percent20); else if (basetime > percent60) { basetime -= 2.0f * percent20; - victim.setAttackTimer(WeaponAttackType.BaseAttack, (uint)basetime); + victim.SetAttackTimer(WeaponAttackType.BaseAttack, (uint)basetime); } } } @@ -839,14 +839,14 @@ namespace Game.Entities // If this is a creature and it attacks from behind it has a probability to daze it's victim if ((damageInfo.hitOutCome == MeleeHitOutcome.Crit || damageInfo.hitOutCome == MeleeHitOutcome.Crushing || damageInfo.hitOutCome == MeleeHitOutcome.Normal || damageInfo.hitOutCome == MeleeHitOutcome.Glancing) && !IsTypeId(TypeId.Player) && !ToCreature().IsControlledByPlayer() && !victim.HasInArc(MathFunctions.PI, this) - && (victim.IsTypeId(TypeId.Player) || !victim.ToCreature().isWorldBoss()) && !victim.IsVehicle()) + && (victim.IsTypeId(TypeId.Player) || !victim.ToCreature().IsWorldBoss()) && !victim.IsVehicle()) { // -probability is between 0% and 40% // 20% base chance float Probability = 20.0f; // there is a newbie protection, at level 10 just 7% base chance; assuming linear function - if (victim.getLevel() < 30) + if (victim.GetLevel() < 30) Probability = 0.65f * victim.GetLevelForTarget(this) + 0.5f; uint VictimDefense = victim.GetMaxSkillValueForLevel(this); @@ -1076,7 +1076,7 @@ namespace Game.Entities } else if (!victim.IsControlledByPlayer() || victim.IsVehicle()) { - if (!victim.ToCreature().hasLootRecipient()) + if (!victim.ToCreature().HasLootRecipient()) victim.ToCreature().SetLootRecipient(this); if (IsControlledByPlayer()) @@ -1352,7 +1352,7 @@ namespace Game.Entities if (PvP) { - m_CombatTimer = 5000; + combatTimer = 5000; Player me = ToPlayer(); if (me) me.EnablePvpRules(true); @@ -1519,7 +1519,7 @@ namespace Game.Entities player.UpdateCriteria(CriteriaTypes.GetKillingBlows, 1, 0, 0, victim); Log.outDebug(LogFilter.Unit, "SET JUST_DIED"); - victim.setDeathState(DeathState.JustDied); + victim.SetDeathState(DeathState.JustDied); // Inform pets (if any) when player kills target) // MUST come after victim.setDeathState(JUST_DIED); or pet next target @@ -1527,7 +1527,7 @@ namespace Game.Entities if (player != null) { Pet pet = player.GetPet(); - if (pet != null && pet.IsAlive() && pet.isControlled()) + if (pet != null && pet.IsAlive() && pet.IsControlled()) pet.GetAI().KilledUnit(victim); } @@ -1975,7 +1975,7 @@ namespace Game.Entities damageInfo.HitInfo |= HitInfo.Block; damageInfo.originalDamage = damageInfo.damage; // 30% damage blocked, double blocked amount if block is critical - damageInfo.blocked_amount = MathFunctions.CalculatePct(damageInfo.damage, damageInfo.target.isBlockCritical() ? damageInfo.target.GetBlockPercent() * 2 : damageInfo.target.GetBlockPercent()); + damageInfo.blocked_amount = MathFunctions.CalculatePct(damageInfo.damage, damageInfo.target.IsBlockCritical() ? damageInfo.target.GetBlockPercent() * 2 : damageInfo.target.GetBlockPercent()); damageInfo.damage -= damageInfo.blocked_amount; damageInfo.cleanDamage += damageInfo.blocked_amount; break; @@ -1983,7 +1983,7 @@ namespace Game.Entities damageInfo.HitInfo |= HitInfo.Glancing; damageInfo.TargetState = VictimState.Hit; damageInfo.originalDamage = damageInfo.damage; - int leveldif = (int)victim.getLevel() - (int)getLevel(); + int leveldif = (int)victim.GetLevel() - (int)GetLevel(); if (leveldif > 3) leveldif = 3; @@ -2207,7 +2207,7 @@ namespace Game.Entities } public float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type) { - if (attType == WeaponAttackType.OffAttack && !haveOffhandWeapon()) + if (attType == WeaponAttackType.OffAttack && !HaveOffhandWeapon()) return 0.0f; return m_weaponDamage[(int)attType][(int)type]; @@ -2972,7 +2972,7 @@ namespace Game.Entities return (uint)Math.Max(tmpDamage, 0.0f); } - bool isBlockCritical() + bool IsBlockCritical() { if (RandomHelper.randChance(GetTotalAuraModifier(AuraType.ModBlockCritChance))) return true; @@ -3056,7 +3056,7 @@ namespace Game.Entities // visibility checks // skip visibility check for GO casts, needs removal when go cast is implemented. Also ignore for gameobject and dynauras - if (GetEntry() != SharedConst.WorldTrigger && (!obj || !obj.isTypeMask(TypeMask.GameObject | TypeMask.DynamicObject))) + if (GetEntry() != SharedConst.WorldTrigger && (!obj || !obj.IsTypeMask(TypeMask.GameObject | TypeMask.DynamicObject))) { // can't attack invisible if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible)) diff --git a/Source/Game/Entities/Unit/Unit.Fields.cs b/Source/Game/Entities/Unit/Unit.Fields.cs index fbef402f2..6f1476ad2 100644 --- a/Source/Game/Entities/Unit/Unit.Fields.cs +++ b/Source/Game/Entities/Unit/Unit.Fields.cs @@ -41,7 +41,7 @@ namespace Game.Entities //Movement protected float[] m_speed_rate = new float[(int)UnitMoveType.Max]; RefManager m_FollowingRefManager; - public MoveSpline moveSpline { get; set; } + public MoveSpline MoveSpline { get; set; } MotionMaster i_motionMaster; public uint m_movementCounter; //< Incrementing counter used in movement packets TimeTrackerSmall movesplineTimer; @@ -59,18 +59,18 @@ namespace Game.Entities protected uint[] m_attackTimer = new uint[(int)WeaponAttackType.Max]; ThreatManager threatManager; - HostileRefManager m_HostileRefManager; + HostileRefManager hostileRefManager; RedirectThreatInfo _redirectThreatInfo; - protected Unit m_attacking; + protected Unit attacking; - public float m_modMeleeHitChance { get; set; } - public float m_modRangedHitChance { get; set; } - public float m_modSpellHitChance { get; set; } + public float ModMeleeHitChance { get; set; } + public float ModRangedHitChance { get; set; } + public float ModSpellHitChance { get; set; } bool m_canDualWield; - public int m_baseSpellCritChance { get; set; } - public uint m_regenTimer { get; set; } - uint m_CombatTimer; - public uint m_extraAttacks { get; set; } + public int BaseSpellCritChance { get; set; } + public uint RegenTimer { get; set; } + uint combatTimer; + public uint ExtraAttacks { get; set; } //Charm public List m_Controlled = new List(); @@ -119,14 +119,14 @@ namespace Game.Entities public ObjectGuid[] m_SummonSlot = new ObjectGuid[7]; public ObjectGuid[] m_ObjectSlot = new ObjectGuid[4]; public EventSystem m_Events = new EventSystem(); - public UnitTypeMask m_unitTypeMask { get; set; } + public UnitTypeMask UnitTypeMask { get; set; } UnitState m_state; protected LiquidTypeRecord _lastLiquid; protected DeathState m_deathState; public Vehicle m_vehicle { get; set; } - public Vehicle m_vehicleKit { get; set; } + public Vehicle VehicleKit { get; set; } bool canModifyStats; - public uint m_lastSanctuaryTime { get; set; } + public uint LastSanctuaryTime { get; set; } uint m_transform; bool m_cleanupDone; // lock made to not add stuff after cleanup before delete bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world @@ -449,7 +449,7 @@ namespace Game.Entities public class SpellNonMeleeDamage { - public SpellNonMeleeDamage(Unit _attacker, Unit _target, uint _SpellID, uint _SpellXSpellVisualID, SpellSchoolMask _schoolMask, ObjectGuid _castId = default(ObjectGuid)) + public SpellNonMeleeDamage(Unit _attacker, Unit _target, uint _SpellID, uint _SpellXSpellVisualID, SpellSchoolMask _schoolMask, ObjectGuid _castId = default) { target = _target; attacker = _attacker; diff --git a/Source/Game/Entities/Unit/Unit.Movement.cs b/Source/Game/Entities/Unit/Unit.Movement.cs index d071d00cc..a3f695fc1 100644 --- a/Source/Game/Entities/Unit/Unit.Movement.cs +++ b/Source/Game/Entities/Unit/Unit.Movement.cs @@ -39,17 +39,14 @@ namespace Game.Entities return m_movementInfo.HasMovementFlag(MovementFlag.Walking); } bool IsHovering() { return m_movementInfo.HasMovementFlag(MovementFlag.Hover); } - public bool isStopped() - { - return !(HasUnitState(UnitState.Moving)); - } - public bool isMoving() { return m_movementInfo.HasMovementFlag(MovementFlag.MaskMoving); } - public bool isTurning() { return m_movementInfo.HasMovementFlag(MovementFlag.MaskTurning); } + public bool IsStopped() { return !HasUnitState(UnitState.Moving); } + public bool IsMoving() { return m_movementInfo.HasMovementFlag(MovementFlag.MaskMoving); } + public bool IsTurning() { return m_movementInfo.HasMovementFlag(MovementFlag.MaskTurning); } public virtual bool CanFly() { return false; } public bool IsFlying() { return m_movementInfo.HasMovementFlag(MovementFlag.Flying | MovementFlag.DisableGravity); } public bool IsFalling() { - return m_movementInfo.HasMovementFlag(MovementFlag.Falling | MovementFlag.FallingFar) || moveSpline.isFalling(); + return m_movementInfo.HasMovementFlag(MovementFlag.Falling | MovementFlag.FallingFar) || MoveSpline.isFalling(); } public virtual bool CanSwim() { @@ -71,7 +68,7 @@ namespace Game.Entities return GetMap().IsUnderWater(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ()); } - void propagateSpeedChange() { GetMotionMaster().propagateSpeedChange(); } + void PropagateSpeedChange() { GetMotionMaster().propagateSpeedChange(); } public float GetSpeed(UnitMoveType mtype) { @@ -92,7 +89,7 @@ namespace Game.Entities m_speed_rate[(int)mtype] = rate; - propagateSpeedChange(); + PropagateSpeedChange(); // Spline packets are for creatures and move_update are for players ServerOpcodes[,] moveTypeToOpcode = new ServerOpcodes[(int)UnitMoveType.Max, 3] @@ -154,7 +151,7 @@ namespace Game.Entities ClearUnitState(UnitState.Moving); // not need send any packets if not in world or not moving - if (!IsInWorld || moveSpline.Finalized()) + if (!IsInWorld || MoveSpline.Finalized()) return; MoveSplineInit init = new MoveSplineInit(this); @@ -608,7 +605,7 @@ namespace Game.Entities if (combat_reach < 0.1f) combat_reach = SharedConst.DefaultCombatReach; - int attacker_number = getAttackers().Count; + int attacker_number = GetAttackers().Count; if (attacker_number > 0) --attacker_number; GetNearPoint(obj, out x, out y, out z, obj.GetCombatReach(), distance2dMin + (distance2dMax - distance2dMin) * (float)RandomHelper.NextDouble() @@ -1014,16 +1011,16 @@ namespace Game.Entities return distsq < maxdist * maxdist; } - public bool isInFrontInMap(Unit target, float distance, float arc = MathFunctions.PI) + public bool IsInFrontInMap(Unit target, float distance, float arc = MathFunctions.PI) { return IsWithinDistInMap(target, distance) && HasInArc(arc, target); } - public bool isInBackInMap(Unit target, float distance, float arc = MathFunctions.PI) + public bool IsInBackInMap(Unit target, float distance, float arc = MathFunctions.PI) { return IsWithinDistInMap(target, distance) && !HasInArc(MathFunctions.TwoPi - arc, target); } - public bool isInAccessiblePlaceFor(Creature c) + public bool IsInAccessiblePlaceFor(Creature c) { if (IsInWater()) return c.CanSwim(); @@ -1220,7 +1217,7 @@ namespace Game.Entities if (!fearAuras.Empty()) caster = Global.ObjAccessor.GetUnit(this, fearAuras[0].GetCasterGUID()); if (caster == null) - caster = getAttackerForHelper(); + caster = GetAttackerForHelper(); GetMotionMaster().MoveFleeing(caster, (uint)(fearAuras.Empty() ? WorldConfig.GetIntValue(WorldCfg.CreatureFamilyFleeDelay) : 0)); // caster == NULL processed in MoveFleeing } else @@ -1370,9 +1367,9 @@ namespace Game.Entities if (vehInfo == null) return false; - m_vehicleKit = new Vehicle(this, vehInfo, creatureEntry); + VehicleKit = new Vehicle(this, vehInfo, creatureEntry); m_updateFlag.Vehicle = true; - m_unitTypeMask |= UnitTypeMask.Vehicle; + UnitTypeMask |= UnitTypeMask.Vehicle; if (!loading) SendSetVehicleRecId(id); @@ -1382,18 +1379,18 @@ namespace Game.Entities public void RemoveVehicleKit(bool onRemoveFromWorld = false) { - if (m_vehicleKit == null) + if (VehicleKit == null) return; if (!onRemoveFromWorld) SendSetVehicleRecId(0); - m_vehicleKit.Uninstall(); + VehicleKit.Uninstall(); - m_vehicleKit = null; + VehicleKit = null; m_updateFlag.Vehicle = false; - m_unitTypeMask &= ~UnitTypeMask.Vehicle; + UnitTypeMask &= ~UnitTypeMask.Vehicle; RemoveNpcFlag(NPCFlags.SpellClick | NPCFlags.PlayerVehicle); } @@ -1630,17 +1627,17 @@ namespace Game.Entities //Spline public bool IsSplineEnabled() { - return moveSpline.Initialized() && !moveSpline.Finalized(); + return MoveSpline.Initialized() && !MoveSpline.Finalized(); } void UpdateSplineMovement(uint diff) { int positionUpdateDelay = 400; - if (moveSpline.Finalized()) + if (MoveSpline.Finalized()) return; - moveSpline.updateState((int)diff); - bool arrived = moveSpline.Finalized(); + MoveSpline.updateState((int)diff); + bool arrived = MoveSpline.Finalized(); if (arrived) DisableSpline(); @@ -1649,13 +1646,13 @@ namespace Game.Entities if (movesplineTimer.Passed() || arrived) { movesplineTimer.Reset(positionUpdateDelay); - Vector4 loc = moveSpline.ComputePosition(); + Vector4 loc = MoveSpline.ComputePosition(); float x = loc.X; float y = loc.Y; float z = loc.Z; float o = loc.W; - if (moveSpline.onTransport) + if (MoveSpline.onTransport) { m_movementInfo.transport.pos.Relocate(x, y, z, o); @@ -1672,7 +1669,7 @@ namespace Game.Entities public void DisableSpline() { m_movementInfo.RemoveMovementFlag(MovementFlag.Forward); - moveSpline.Interrupt(); + MoveSpline.Interrupt(); } //Transport diff --git a/Source/Game/Entities/Unit/Unit.Pets.cs b/Source/Game/Entities/Unit/Unit.Pets.cs index 0cbc46ff5..9eecd65a5 100644 --- a/Source/Game/Entities/Unit/Unit.Pets.cs +++ b/Source/Game/Entities/Unit/Unit.Pets.cs @@ -88,7 +88,7 @@ namespace Game.Entities if (IsCharmed()) { i_disabledAI = i_AI; - if (isPossessed() || IsVehicle()) + if (IsPossessed() || IsVehicle()) i_AI = new PossessedAI(ToCreature()); else i_AI = new PetAI(ToCreature()); @@ -381,7 +381,7 @@ namespace Game.Entities Player player = ToPlayer(); if (player) { - if (player.isAFK()) + if (player.IsAFK()) player.ToggleAFK(); if (charmer.IsTypeId(TypeId.Unit)) // we are charmed by a creature @@ -477,7 +477,7 @@ namespace Game.Entities CastStop(); CombatStop(); // @todo CombatStop(true) may cause crash (interrupt spells) - getHostileRefManager().deleteReferences(); + GetHostileRefManager().deleteReferences(); DeleteThreatList(); if (_oldFactionId != 0) @@ -760,7 +760,7 @@ namespace Game.Entities if (!pet.CreateBaseAtCreature(creatureTarget)) return null; - uint level = creatureTarget.GetLevelForTarget(this) + 5 < getLevel() ? (getLevel() - 5) : creatureTarget.GetLevelForTarget(this); + uint level = creatureTarget.GetLevelForTarget(this) + 5 < GetLevel() ? (GetLevel() - 5) : creatureTarget.GetLevelForTarget(this); InitTamedPet(pet, level, spell_id); @@ -778,7 +778,7 @@ namespace Game.Entities Pet pet = new Pet(ToPlayer(), PetType.Hunter); - if (!pet.CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, getLevel(), spell_id)) + if (!pet.CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, GetLevel(), spell_id)) return null; return pet; diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index f5c4c5f31..b44133761 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -648,7 +648,7 @@ namespace Game.Entities else if (IsTypeId(TypeId.Player)) crit_chance = ToPlayer().m_activePlayerData.SpellCritPercentage; else - crit_chance = m_baseSpellCritChance; + crit_chance = BaseSpellCritChance; // taken if (victim) @@ -703,7 +703,7 @@ namespace Game.Entities // Spell crit suppression if (victim.GetTypeId() == TypeId.Unit) { - int levelDiff = (int)(victim.GetLevelForTarget(this) - getLevel()); + int levelDiff = (int)(victim.GetLevelForTarget(this) - GetLevel()); crit_chance -= levelDiff * 1.0f; } } @@ -1019,7 +1019,7 @@ namespace Game.Entities return SpellMissInfo.None; } - public void CastSpell(SpellCastTargets targets, SpellInfo spellInfo, Dictionary values, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid)) + public void CastSpell(SpellCastTargets targets, SpellInfo spellInfo, Dictionary values, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { if (spellInfo == null) { @@ -1036,11 +1036,11 @@ namespace Game.Entities spell.m_CastItem = castItem; spell.prepare(targets, triggeredByAura); } - public void CastSpell(Unit victim, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid)) + public void CastSpell(Unit victim, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { CastSpell(victim, spellId, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster); } - public void CastSpell(Unit victim, uint spellId, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid)) + public void CastSpell(Unit victim, uint spellId, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); if (spellInfo == null) @@ -1051,17 +1051,17 @@ namespace Game.Entities CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster); } - public void CastSpell(Unit victim, SpellInfo spellInfo, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid)) + public void CastSpell(Unit victim, SpellInfo spellInfo, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { CastSpell(victim, spellInfo, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster); } - public void CastSpell(Unit victim, SpellInfo spellInfo, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid)) + public void CastSpell(Unit victim, SpellInfo spellInfo, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { SpellCastTargets targets = new SpellCastTargets(); targets.SetUnitTarget(victim); CastSpell(targets, spellInfo, null, triggerFlags, castItem, triggeredByAura, originalCaster); } - public void CastSpell(float x, float y, float z, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid)) + public void CastSpell(float x, float y, float z, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); if (spellInfo == null) @@ -1074,7 +1074,7 @@ namespace Game.Entities CastSpell(targets, spellInfo, null, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster); } - public void CastSpell(GameObject go, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid)) + public void CastSpell(GameObject go, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); if (spellInfo == null) @@ -1088,7 +1088,7 @@ namespace Game.Entities CastSpell(targets, spellInfo, null, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster); } - public void CastCustomSpell(Unit target, uint spellId, int bp0, int bp1, int bp2, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid)) + public void CastCustomSpell(Unit target, uint spellId, int bp0, int bp1, int bp2, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { Dictionary values = new Dictionary(); if (bp0 != 0) @@ -1099,19 +1099,19 @@ namespace Game.Entities values.Add(SpellValueMod.BasePoint2, bp2); CastCustomSpell(spellId, values, target, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster); } - public void CastCustomSpell(uint spellId, SpellValueMod mod, int value, Unit target, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid)) + public void CastCustomSpell(uint spellId, SpellValueMod mod, int value, Unit target, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { Dictionary values = new Dictionary(); values.Add(mod, value); CastCustomSpell(spellId, values, target, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster); } - public void CastCustomSpell(uint spellId, SpellValueMod mod, int value, Unit target = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid)) + public void CastCustomSpell(uint spellId, SpellValueMod mod, int value, Unit target = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { Dictionary values = new Dictionary(); values.Add(mod, value); CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster); } - public void CastCustomSpell(uint spellId, Dictionary values, Unit victim = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid)) + public void CastCustomSpell(uint spellId, Dictionary values, Unit victim = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) { SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); if (spellInfo == null) @@ -1273,7 +1273,7 @@ namespace Game.Entities public SpellHistory GetSpellHistory() { return _spellHistory; } - public static ProcFlagsHit createProcHitMask(SpellNonMeleeDamage damageInfo, SpellMissInfo missCondition) + public static ProcFlagsHit CreateProcHitMask(SpellNonMeleeDamage damageInfo, SpellMissInfo missCondition) { ProcFlagsHit hitMask = ProcFlagsHit.None; // Check victim state @@ -1501,7 +1501,7 @@ namespace Game.Entities int overEnergize = damage - gain; SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); - victim.getHostileRefManager().threatAssist(this, damage * 0.5f, spellInfo); + victim.GetHostileRefManager().threatAssist(this, damage * 0.5f, spellInfo); SendEnergizeSpellLog(victim, spellId, damage, overEnergize, powerType); } @@ -1997,7 +1997,7 @@ namespace Game.Entities public ushort GetMaxSkillValueForLevel(Unit target = null) { - return (ushort)(target != null ? GetLevelForTarget(target) : getLevel() * 5); + return (ushort)(target != null ? GetLevelForTarget(target) : GetLevel() * 5); } public Player GetSpellModOwner() { @@ -2044,7 +2044,7 @@ namespace Game.Entities InterruptSpell(CurrentSpellTypes.AutoRepeat); m_AutoRepeatFirstCast = true; } - if (pSpell.m_spellInfo.CalcCastTime(getLevel()) > 0) + if (pSpell.m_spellInfo.CalcCastTime(GetLevel()) > 0) AddUnitState(UnitState.Casting); break; @@ -2163,7 +2163,7 @@ namespace Game.Entities return (uint)crit_bonus; } - bool isSpellBlocked(Unit victim, SpellInfo spellProto, WeaponAttackType attackType = WeaponAttackType.BaseAttack) + bool IsSpellBlocked(Unit victim, SpellInfo spellProto, WeaponAttackType attackType = WeaponAttackType.BaseAttack) { // These spells can't be blocked if (spellProto != null && (spellProto.HasAttribute(SpellAttr0.ImpossibleDodgeParryBlock) || spellProto.HasAttribute(SpellAttr3.IgnoreHitResult))) @@ -2190,15 +2190,13 @@ namespace Game.Entities } } - public uint getTransForm() { return m_transform; } - public bool HasStealthAura() { return HasAuraType(AuraType.ModStealth); } public bool HasInvisibilityAura() { return HasAuraType(AuraType.ModInvisibility); } - public bool isFeared() { return HasAuraType(AuraType.ModFear); } - public bool isFrozen() { return HasAuraState(AuraStateType.Frozen); } + public bool IsFeared() { return HasAuraType(AuraType.ModFear); } + public bool IsFrozen() { return HasAuraState(AuraStateType.Frozen); } public bool IsPolymorphed() { - uint transformId = getTransForm(); + uint transformId = GetTransForm(); if (transformId == 0) return false; @@ -2359,7 +2357,7 @@ namespace Game.Entities if (!spellInfo.HasAttribute(SpellAttr3.BlockableSpell)) { // Get blocked status - blocked = isSpellBlocked(victim, spellInfo, attackType); + blocked = IsSpellBlocked(victim, spellInfo, attackType); } } @@ -2387,7 +2385,7 @@ namespace Game.Entities { // double blocked amount if block is critical uint value = victim.GetBlockPercent(); - if (victim.isBlockCritical()) + if (victim.IsBlockCritical()) value *= 2; // double blocked percent damageInfo.blocked = (uint)MathFunctions.CalculatePct(damage, value); if (damage <= damageInfo.blocked) @@ -3008,13 +3006,13 @@ namespace Game.Entities return result; } - public bool HasAura(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0) + public bool HasAura(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0) { if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask) != null) return true; return false; } - public bool HasAuraEffect(uint spellId, uint effIndex, ObjectGuid casterGUID = default(ObjectGuid)) + public bool HasAuraEffect(uint spellId, uint effIndex, ObjectGuid casterGUID = default) { var range = m_appliedAuras.LookupByKey(spellId); if (!range.Empty()) @@ -3103,17 +3101,17 @@ namespace Game.Entities return false; } - public bool HasNegativeAuraWithInterruptFlag(SpellAuraInterruptFlags flag, ObjectGuid guid = default(ObjectGuid)) + public bool HasNegativeAuraWithInterruptFlag(SpellAuraInterruptFlags flag, ObjectGuid guid = default) { return HasNegativeAuraWithInterruptFlag((uint)flag, 0, guid); } - public bool HasNegativeAuraWithInterruptFlag(SpellAuraInterruptFlags2 flag, ObjectGuid guid = default(ObjectGuid)) + public bool HasNegativeAuraWithInterruptFlag(SpellAuraInterruptFlags2 flag, ObjectGuid guid = default) { return HasNegativeAuraWithInterruptFlag((uint)flag, 1, guid); } - public bool HasNegativeAuraWithInterruptFlag(uint flag, int index, ObjectGuid guid = default(ObjectGuid)) + public bool HasNegativeAuraWithInterruptFlag(uint flag, int index, ObjectGuid guid = default) { if (!Convert.ToBoolean(m_interruptMask[index] & flag)) return false; @@ -3126,7 +3124,7 @@ namespace Game.Entities } return false; } - bool HasNegativeAuraWithAttribute(SpellAttr0 flag, ObjectGuid guid = default(ObjectGuid)) + bool HasNegativeAuraWithAttribute(SpellAttr0 flag, ObjectGuid guid = default) { foreach (var list in GetAppliedAuras()) { @@ -3151,12 +3149,12 @@ namespace Game.Entities return count; } - public Aura GetAuraOfRankedSpell(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0) + public Aura GetAuraOfRankedSpell(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0) { var aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask); return aurApp?.GetBase(); } - AuraApplication GetAuraApplicationOfRankedSpell(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0, AuraApplication except = null) + AuraApplication GetAuraApplicationOfRankedSpell(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0, AuraApplication except = null) { uint rankSpell = Global.SpellMgr.GetFirstSpellInChain(spellId); while (rankSpell != 0) @@ -3358,7 +3356,7 @@ namespace Game.Entities } } } - public void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID = default(ObjectGuid), Aura except = null, bool negative = true, bool positive = true) + public void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID = default, Aura except = null, bool negative = true, bool positive = true) { var list = m_modAuras[auraType]; for (var i = 0; i < list.Count; i++) @@ -3427,7 +3425,7 @@ namespace Game.Entities aura._Remove(removeMode); } - public void RemoveOwnedAura(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default) + public void RemoveOwnedAura(uint spellId, ObjectGuid casterGUID = default, uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default) { foreach (var pair in GetOwnedAuras()) { @@ -3467,7 +3465,7 @@ namespace Game.Entities Cypher.Assert(false); } - public void RemoveAurasDueToSpell(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default) + public void RemoveAurasDueToSpell(uint spellId, ObjectGuid casterGUID = default, uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default) { foreach (var pair in GetAppliedAuras()) { @@ -3507,7 +3505,7 @@ namespace Game.Entities } } } - public void RemoveAuraFromStack(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), AuraRemoveMode removeMode = AuraRemoveMode.Default, ushort num = 1) + public void RemoveAuraFromStack(uint spellId, ObjectGuid casterGUID = default, AuraRemoveMode removeMode = AuraRemoveMode.Default, ushort num = 1) { var range = m_ownedAuras.LookupByKey(spellId); foreach (var aura in range) @@ -3531,7 +3529,7 @@ namespace Game.Entities if (aura.GetOwner() == this) aura.Remove(mode); } - public void RemoveAura(uint spellId, ObjectGuid caster = default(ObjectGuid), uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default) + public void RemoveAura(uint spellId, ObjectGuid caster = default, uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default) { var range = m_appliedAuras.LookupByKey(spellId); foreach (var iter in range) @@ -3685,7 +3683,7 @@ namespace Game.Entities foreach (var pair in GetOwnedAuras()) { var appMap = pair.Value.GetApplicationMap(); - foreach (var aurApp in appMap.Values) + foreach (var aurApp in appMap.Values.ToList()) { Unit target = aurApp.GetTarget(); if (target == this) @@ -3951,7 +3949,7 @@ namespace Game.Entities if (aurApp.GetRemoveMode() == AuraRemoveMode.Expire && IsTypeId(TypeId.Unit) && IsTotem()) { if (ToTotem().GetSpell() == aura.GetId() && ToTotem().GetTotemType() == TotemType.Passive) - ToTotem().setDeathState(DeathState.JustDied); + ToTotem().SetDeathState(DeathState.JustDied); } // Remove aurastates only if were not found @@ -3980,7 +3978,7 @@ namespace Game.Entities Cypher.Assert(false); } - public AuraEffect GetAuraEffect(uint spellId, uint effIndex, ObjectGuid casterGUID = default(ObjectGuid)) + public AuraEffect GetAuraEffect(uint spellId, uint effIndex, ObjectGuid casterGUID = default) { var range = m_appliedAuras.LookupByKey(spellId); if (!range.Empty()) @@ -3996,7 +3994,7 @@ namespace Game.Entities } return null; } - public AuraEffect GetAuraEffectOfRankedSpell(uint spellId, uint effIndex, ObjectGuid casterGUID = default(ObjectGuid)) + public AuraEffect GetAuraEffectOfRankedSpell(uint spellId, uint effIndex, ObjectGuid casterGUID = default) { uint rankSpell = Global.SpellMgr.GetFirstSpellInChain(spellId); while (rankSpell != 0) @@ -4010,7 +4008,7 @@ namespace Game.Entities } // spell mustn't have familyflags - public AuraEffect GetAuraEffect(AuraType type, SpellFamilyNames family, FlagArray128 familyFlag, ObjectGuid casterGUID = default(ObjectGuid)) + public AuraEffect GetAuraEffect(AuraType type, SpellFamilyNames family, FlagArray128 familyFlag, ObjectGuid casterGUID = default) { var auras = GetAuraEffectsByType(type); foreach (var aura in auras) @@ -4027,7 +4025,7 @@ namespace Game.Entities } - public AuraApplication GetAuraApplication(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0, AuraApplication except = null) + public AuraApplication GetAuraApplication(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0, AuraApplication except = null) { var range = m_appliedAuras.LookupByKey(spellId); if (!range.Empty()) @@ -4044,7 +4042,7 @@ namespace Game.Entities } return null; } - public Aura GetAura(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0) + public Aura GetAura(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0) { AuraApplication aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask); return aurApp?.GetBase(); @@ -4144,7 +4142,7 @@ namespace Game.Entities } } } - public Aura _TryStackingOrRefreshingExistingAura(SpellInfo newAura, uint effMask, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1) + public Aura _TryStackingOrRefreshingExistingAura(SpellInfo newAura, uint effMask, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, int castItemLevel = -1) { Cypher.Assert(!casterGUID.IsEmpty() || caster); @@ -4323,7 +4321,7 @@ namespace Game.Entities return true; } - public Aura GetOwnedAura(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0, Aura except = null) + public Aura GetOwnedAura(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0, Aura except = null) { var range = m_ownedAuras.LookupByKey(spellId); foreach (var aura in range) @@ -4574,7 +4572,7 @@ namespace Game.Entities else if (IsPet()) { Pet pet = ToPet(); - if (pet.isControlled()) + if (pet.IsControlled()) pet.SetGroupUpdateFlag(GroupUpdatePetFlags.Auras); } } diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index d5bd4587b..801db9911 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -18,7 +18,6 @@ using Framework.Constants; using Framework.Dynamic; using Framework.GameMath; -using Framework.IO; using Game.AI; using Game.BattleGrounds; using Game.Chat; @@ -39,16 +38,16 @@ namespace Game.Entities { public Unit(bool isWorldObject) : base(isWorldObject) { - moveSpline = new MoveSpline(); + MoveSpline = new MoveSpline(); i_motionMaster = new MotionMaster(this); threatManager = new ThreatManager(this); - m_unitTypeMask = UnitTypeMask.None; - m_HostileRefManager = new HostileRefManager(this); + UnitTypeMask = UnitTypeMask.None; + hostileRefManager = new HostileRefManager(this); _spellHistory = new SpellHistory(this); m_FollowingRefManager = new RefManager(); - objectTypeId = TypeId.Unit; - objectTypeMask |= TypeMask.Unit; + ObjectTypeId = TypeId.Unit; + ObjectTypeMask |= TypeMask.Unit; m_updateFlag.MovementUpdate = true; m_modAttackSpeedPct = new float[] { 1.0f, 1.0f, 1.0f }; @@ -70,11 +69,11 @@ namespace Game.Entities if (IsTypeId(TypeId.Player)) { - m_modMeleeHitChance = 7.5f; - m_modRangedHitChance = 7.5f; - m_modSpellHitChance = 15.0f; + ModMeleeHitChance = 7.5f; + ModRangedHitChance = 7.5f; + ModSpellHitChance = 15.0f; } - m_baseSpellCritChance = 5; + BaseSpellCritChance = 5; for (byte i = 0; i < (int)SpellSchools.Max; ++i) m_threatModifier[i] = 1.0f; @@ -111,7 +110,7 @@ namespace Game.Entities //i_motionMaster = null; m_charmInfo = null; - moveSpline = null; + MoveSpline = null; _spellHistory = null; /*ASSERT(!m_duringRemoveFromWorld); @@ -152,24 +151,24 @@ namespace Game.Entities // Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away // targets without stopping half way there and running off. // These flags are reset after target dies or another command is given. - if (m_HostileRefManager.IsEmpty()) + if (hostileRefManager.IsEmpty()) { // m_CombatTimer set at aura start and it will be freeze until aura removing - if (m_CombatTimer <= diff) + if (combatTimer <= diff) ClearInCombat(); else - m_CombatTimer -= diff; + combatTimer -= diff; } } uint att; // not implemented before 3.0.2 - if ((att = getAttackTimer(WeaponAttackType.BaseAttack)) != 0) - setAttackTimer(WeaponAttackType.BaseAttack, (diff >= att ? 0 : att - diff)); - if ((att = getAttackTimer(WeaponAttackType.RangedAttack)) != 0) - setAttackTimer(WeaponAttackType.RangedAttack, (diff >= att ? 0 : att - diff)); - if ((att = getAttackTimer(WeaponAttackType.OffAttack)) != 0) - setAttackTimer(WeaponAttackType.OffAttack, (diff >= att ? 0 : att - diff)); + if ((att = GetAttackTimer(WeaponAttackType.BaseAttack)) != 0) + SetAttackTimer(WeaponAttackType.BaseAttack, (diff >= att ? 0 : att - diff)); + if ((att = GetAttackTimer(WeaponAttackType.RangedAttack)) != 0) + SetAttackTimer(WeaponAttackType.RangedAttack, (diff >= att ? 0 : att - diff)); + if ((att = GetAttackTimer(WeaponAttackType.OffAttack)) != 0) + SetAttackTimer(WeaponAttackType.OffAttack, (diff >= att ? 0 : att - diff)); // update abilities available only for fraction of time UpdateReactives(diff); @@ -227,7 +226,7 @@ namespace Game.Entities for (var i = 0; i < m_gameObj.Count; ++i) { GameObject go = m_gameObj[i]; - if (!go.isSpawned()) + if (!go.IsSpawned()) { go.SetOwnerGUID(ObjectGuid.Empty); go.SetRespawnTime(0); @@ -256,12 +255,12 @@ namespace Game.Entities public bool IsInDisallowedMountForm() { - return IsDisallowedMountForm(getTransForm(), GetShapeshiftForm(), GetDisplayId()); + return IsDisallowedMountForm(GetTransForm(), GetShapeshiftForm(), GetDisplayId()); } public bool IsDisallowedMountForm(uint spellId, ShapeShiftForm form, uint displayId) { - SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(getTransForm()); + SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(GetTransForm()); if (transformSpellInfo != null) if (transformSpellInfo.HasAttribute(SpellAttr0.CastableWhileMounted)) return false; @@ -313,7 +312,7 @@ namespace Game.Entities { if (m_sharedVision.Empty()) { - setActive(true); + SetActive(true); SetWorldObject(true); } m_sharedVision.Add(player); @@ -325,7 +324,7 @@ namespace Game.Entities m_sharedVision.Remove(player); if (m_sharedVision.Empty()) { - setActive(false); + SetActive(false); SetWorldObject(false); } } @@ -485,7 +484,7 @@ namespace Game.Entities m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map.RemoveAllObjectsInRemoveList CombatStop(); DeleteThreatList(); - getHostileRefManager().deleteReferences(); + GetHostileRefManager().deleteReferences(); GetMotionMaster().Clear(false); // remove different non-standard movement generators. } public override void CleanupsBeforeDelete(bool finalCleanup = true) @@ -495,10 +494,10 @@ namespace Game.Entities base.CleanupsBeforeDelete(finalCleanup); } - public void setTransForm(uint spellid) { m_transform = spellid; } + public void SetTransForm(uint spellid) { m_transform = spellid; } public uint GetTransForm() { return m_transform; } - public Vehicle GetVehicleKit() { return m_vehicleKit; } + public Vehicle GetVehicleKit() { return VehicleKit; } public Vehicle GetVehicle() { return m_vehicle; } public void SetVehicle(Vehicle vehicle) { m_vehicle = vehicle; } public Unit GetVehicleBase() @@ -965,8 +964,8 @@ namespace Game.Entities if (HasUnitTypeMask(UnitTypeMask.Accessory)) { // Vehicle just died, we die too - if (vehicle.GetBase().getDeathState() == DeathState.JustDied) - setDeathState(DeathState.JustDied); + if (vehicle.GetBase().GetDeathState() == DeathState.JustDied) + SetDeathState(DeathState.JustDied); // If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon else ToTempSummon().UnSummon(2000); // Approximation @@ -1083,11 +1082,11 @@ namespace Game.Entities public UnitAI GetAI() { return i_AI; } void SetAI(UnitAI newAI) { i_AI = newAI; } - public bool isPossessing() + public bool IsPossessing() { Unit u = GetCharm(); if (u != null) - return u.isPossessed(); + return u.IsPossessed(); else return false; } @@ -1107,9 +1106,9 @@ namespace Game.Entities return null; } public bool IsCharmed() { return !GetCharmerGUID().IsEmpty(); } - public bool isPossessed() { return HasUnitState(UnitState.Possessed); } + public bool IsPossessed() { return HasUnitState(UnitState.Possessed); } - public HostileRefManager getHostileRefManager() { return m_HostileRefManager; } + public HostileRefManager GetHostileRefManager() { return hostileRefManager; } public void OnPhaseChange() { @@ -1118,7 +1117,7 @@ namespace Game.Entities if (IsTypeId(TypeId.Unit) || !ToPlayer().GetSession().PlayerLogout()) { - HostileRefManager refManager = getHostileRefManager(); + HostileRefManager refManager = GetHostileRefManager(); HostileReference refe = refManager.getFirst(); while (refe != null) @@ -1149,7 +1148,7 @@ namespace Game.Entities { Unit unit = host.getTarget(); if (unit != null) - unit.getHostileRefManager().setOnlineOfflineState(ToCreature(), unit.IsInPhase(this)); + unit.GetHostileRefManager().setOnlineOfflineState(ToCreature(), unit.IsInPhase(this)); } } } @@ -1595,7 +1594,7 @@ namespace Game.Entities public Totem ToTotem() { return IsTotem() ? (this as Totem) : null; } public TempSummon ToTempSummon() { return IsSummon() ? (this as TempSummon) : null; } - public virtual void setDeathState(DeathState s) + public virtual void SetDeathState(DeathState s) { // Death state needs to be updated before RemoveAllAurasOnDeath() is called, to prevent entering combat m_deathState = s; @@ -1604,7 +1603,7 @@ namespace Game.Entities { CombatStop(); DeleteThreatList(); - getHostileRefManager().deleteReferences(); + GetHostileRefManager().deleteReferences(); if (IsNonMeleeSpellCast(false)) InterruptNonMeleeSpells(false); @@ -1829,7 +1828,7 @@ namespace Game.Entities // check "realtime" interrupts // don't cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect - if (((IsTypeId(TypeId.Player) && ToPlayer().isMoving()) || IsNonMeleeSpellCast(false, false, true, autoRepeatSpellInfo.Id == 75)) && + if (((IsTypeId(TypeId.Player) && ToPlayer().IsMoving()) || IsNonMeleeSpellCast(false, false, true, autoRepeatSpellInfo.Id == 75)) && !HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, autoRepeatSpellInfo)) { // cancel wand shoot @@ -1840,12 +1839,12 @@ namespace Game.Entities } // apply delay (Auto Shot (spellID 75) not affected) - if (m_AutoRepeatFirstCast && getAttackTimer(WeaponAttackType.RangedAttack) < 500 && autoRepeatSpellInfo.Id != 75) - setAttackTimer(WeaponAttackType.RangedAttack, 500); + if (m_AutoRepeatFirstCast && GetAttackTimer(WeaponAttackType.RangedAttack) < 500 && autoRepeatSpellInfo.Id != 75) + SetAttackTimer(WeaponAttackType.RangedAttack, 500); m_AutoRepeatFirstCast = false; // castroutine - if (isAttackReady(WeaponAttackType.RangedAttack)) + if (IsAttackReady(WeaponAttackType.RangedAttack)) { // Check if able to cast SpellCastResult result = m_currentSpells[CurrentSpellTypes.AutoRepeat].CheckCast(true); @@ -1864,7 +1863,7 @@ namespace Game.Entities spell.prepare(m_currentSpells[CurrentSpellTypes.AutoRepeat].m_targets); // all went good, reset attack - resetAttackTimer(WeaponAttackType.RangedAttack); + ResetAttackTimer(WeaponAttackType.RangedAttack); } } @@ -1914,7 +1913,7 @@ namespace Game.Entities Pet pet = ToPet(); if (pet) { - if (pet.getPetType() == PetType.Hunter) // Hunter pets have focus + if (pet.GetPetType() == PetType.Hunter) // Hunter pets have focus displayPower = PowerType.Focus; else if (pet.IsPetGhoul() || pet.IsPetAbomination()) // DK pets have energy displayPower = PowerType.Energy; @@ -1961,11 +1960,11 @@ namespace Game.Entities public bool IsCharmedOwnedByPlayerOrPlayer() { return GetCharmerOrOwnerOrOwnGUID().IsPlayer(); } - public void addFollower(FollowerReference pRef) + public void AddFollower(FollowerReference pRef) { m_FollowingRefManager.InsertFirst(pRef); } - public void removeFollower(FollowerReference pRef) { } //nothing to do yet + public void RemoveFollower(FollowerReference pRef) { } //nothing to do yet public uint GetCreatureTypeMask() { @@ -2088,15 +2087,15 @@ namespace Game.Entities Global.CharacterCacheStorage.UpdateCharacterLevel(ToPlayer().GetGUID(), (byte)lvl); } } - public uint getLevel() { return m_unitData.Level; } - public override uint GetLevelForTarget(WorldObject target) { return getLevel(); } + public uint GetLevel() { return m_unitData.Level; } + public override uint GetLevelForTarget(WorldObject target) { return GetLevel(); } public Race GetRace() { return (Race)(byte)m_unitData.Race; } public void SetRace(Race race) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Race), (byte)race); } - public ulong getRaceMask() { return 1ul << ((int)GetRace() - 1); } + public ulong GetRaceMask() { return 1ul << ((int)GetRace() - 1); } public Class GetClass() { return (Class)(byte)m_unitData.ClassId; } public void SetClass(Class classId) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.ClassId), (byte)classId); } - public uint getClassMask() { return (uint)(1 << ((int)GetClass() - 1)); } + public uint GetClassMask() { return (uint)(1 << ((int)GetClass() - 1)); } public Gender GetGender() { return (Gender)(byte)m_unitData.Sex; } public void SetGender(Gender sex) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Sex), (byte)sex); } @@ -2289,7 +2288,7 @@ namespace Game.Entities public SheathState GetSheath() { return (SheathState)(byte)m_unitData.SheatheState; } public void SetSheath(SheathState sheathed) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.SheatheState), (byte)sheathed); } - public uint GetCombatTimer() { return m_CombatTimer; } + public uint GetCombatTimer() { return combatTimer; } public UnitPVPStateFlags GetPvpFlags() { return (UnitPVPStateFlags)(byte)m_unitData.PvpFlags; } public bool HasPvpFlag(UnitPVPStateFlags flags) { return (m_unitData.PvpFlags & (uint)flags) != 0; } public void AddPvpFlag(UnitPVPStateFlags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.PvpFlags), (byte)flags); } @@ -2342,20 +2341,18 @@ namespace Game.Entities SetDisplayId(GetNativeDisplayId()); } - public bool IsStopped() { return !HasUnitState(UnitState.Moving); } - - public bool HasUnitTypeMask(UnitTypeMask mask) { return Convert.ToBoolean(mask & m_unitTypeMask); } - public void AddUnitTypeMask(UnitTypeMask mask) { m_unitTypeMask |= mask; } + public bool HasUnitTypeMask(UnitTypeMask mask) { return Convert.ToBoolean(mask & UnitTypeMask); } + public void AddUnitTypeMask(UnitTypeMask mask) { UnitTypeMask |= mask; } public bool IsAlive() { return m_deathState == DeathState.Alive; } public bool IsDying() { return m_deathState == DeathState.JustDied; } public bool IsDead() { return (m_deathState == DeathState.Dead || m_deathState == DeathState.Corpse); } - public bool IsSummon() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.Summon); } - public bool IsGuardian() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.Guardian); } - public bool IsPet() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.Pet); } - public bool IsHunterPet() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.HunterPet); } - public bool IsTotem() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.Totem); } - public bool IsVehicle() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.Vehicle); } + public bool IsSummon() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Summon); } + public bool IsGuardian() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Guardian); } + public bool IsPet() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Pet); } + public bool IsHunterPet() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.HunterPet); } + public bool IsTotem() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Totem); } + public bool IsVehicle() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Vehicle); } public void AddUnitState(UnitState f) { @@ -2541,7 +2538,7 @@ namespace Game.Entities public void RestoreFaction() { if (IsTypeId(TypeId.Player)) - ToPlayer().setFactionForRace(GetRace()); + ToPlayer().SetFactionForRace(GetRace()); else { if (HasUnitTypeMask(UnitTypeMask.Minion)) diff --git a/Source/Game/Entities/Vehicle.cs b/Source/Game/Entities/Vehicle.cs index 0a85c203d..a8b8654a2 100644 --- a/Source/Game/Entities/Vehicle.cs +++ b/Source/Game/Entities/Vehicle.cs @@ -138,7 +138,7 @@ namespace Game.Entities _me.ApplySpellImmune(0, SpellImmunity.Effect, SpellEffectName.KnockBackDest, true); // Mechanical units & vehicles ( which are not Bosses, they have own immunities in DB ) should be also immune on healing ( exceptions in switch below ) - if (_me.IsTypeId(TypeId.Unit) && _me.ToCreature().GetCreatureTemplate().CreatureType == CreatureType.Mechanical && !_me.ToCreature().isWorldBoss()) + if (_me.IsTypeId(TypeId.Unit) && _me.ToCreature().GetCreatureTemplate().CreatureType == CreatureType.Mechanical && !_me.ToCreature().IsWorldBoss()) { // Heal & dispel ... _me.ApplySpellImmune(0, SpellImmunity.Effect, SpellEffectName.Heal, true); diff --git a/Source/Game/Events/GameEventManager.cs b/Source/Game/Events/GameEventManager.cs index 0aedc1f73..8d0f23ea4 100644 --- a/Source/Game/Events/GameEventManager.cs +++ b/Source/Game/Events/GameEventManager.cs @@ -1202,7 +1202,7 @@ namespace Game if (pGameobject) { // @todo find out when it is add to map - if (pGameobject.isSpawnedByDefault()) + if (pGameobject.IsSpawnedByDefault()) map.AddToMap(pGameobject); } } diff --git a/Source/Game/Garrisons/GarrisonMap.cs b/Source/Game/Garrisons/GarrisonMap.cs index 2f576d08c..f30442f4f 100644 --- a/Source/Game/Garrisons/GarrisonMap.cs +++ b/Source/Game/Garrisons/GarrisonMap.cs @@ -19,7 +19,6 @@ using Framework.Constants; using Game.Entities; using Game.Maps; using System.Collections.Generic; -using System.Linq; namespace Game.Garrisons { diff --git a/Source/Game/Globals/ObjectAccessor.cs b/Source/Game/Globals/ObjectAccessor.cs index e258472bf..ede9a5161 100644 --- a/Source/Game/Globals/ObjectAccessor.cs +++ b/Source/Game/Globals/ObjectAccessor.cs @@ -20,7 +20,6 @@ using Game; using Game.Entities; using Game.Maps; using System; -using System.Collections.Concurrent; using System.Collections.Generic; public class ObjectAccessor : Singleton diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index f5ad6a1e7..d31cefb7c 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -33,7 +33,6 @@ using System.Linq; using System.Runtime.InteropServices; using Framework.Dynamic; using Framework.IO; -using Game.Network; namespace Game { diff --git a/Source/Game/Groups/Group.cs b/Source/Game/Groups/Group.cs index ea3cb5f99..21b2f24f0 100644 --- a/Source/Game/Groups/Group.cs +++ b/Source/Game/Groups/Group.cs @@ -471,7 +471,7 @@ namespace Game.Groups return true; } - public bool RemoveMember(ObjectGuid guid, RemoveMethod method = RemoveMethod.Default, ObjectGuid kicker = default(ObjectGuid), string reason = null) + public bool RemoveMember(ObjectGuid guid, RemoveMethod method = RemoveMethod.Default, ObjectGuid kicker = default, string reason = null) { BroadcastGroupUpdate(); @@ -1478,7 +1478,7 @@ namespace Game.Groups } } - public void BroadcastAddonMessagePacket(ServerPacket packet, string prefix, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignore = default(ObjectGuid)) + public void BroadcastAddonMessagePacket(ServerPacket packet, string prefix, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignore = default) { for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) { @@ -1492,7 +1492,7 @@ namespace Game.Groups } } - public void BroadcastPacket(ServerPacket packet, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignore = default(ObjectGuid)) + public void BroadcastPacket(ServerPacket packet, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignore = default) { for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) { @@ -1732,7 +1732,7 @@ namespace Game.Groups if (!reference) return GroupJoinBattlegroundResult.JoinFailed; - PvpDifficultyRecord bracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bgOrTemplate.GetMapId(), reference.getLevel()); + PvpDifficultyRecord bracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bgOrTemplate.GetMapId(), reference.GetLevel()); if (bracketEntry == null) return GroupJoinBattlegroundResult.JoinFailed; @@ -1756,7 +1756,7 @@ namespace Game.Groups return GroupJoinBattlegroundResult.JoinTimedOut; } // not in the same Battleground level braket, don't let join - PvpDifficultyRecord memberBracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bracketEntry.MapID, member.getLevel()); + PvpDifficultyRecord memberBracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bracketEntry.MapID, member.GetLevel()); if (memberBracketEntry != bracketEntry) return GroupJoinBattlegroundResult.JoinRangeIndex; // don't let join rated matches if the arena team id doesn't match @@ -1778,7 +1778,7 @@ namespace Game.Groups if (!member.HasFreeBattlegroundQueueId()) return GroupJoinBattlegroundResult.TooManyQueues; // not blizz-like // check if someone in party is using dungeon system - if (member.isUsingLfg()) + if (member.IsUsingLfg()) return GroupJoinBattlegroundResult.LfgCantUseBattleground; // check Freeze debuff if (member.HasAura(9454)) @@ -2258,7 +2258,7 @@ namespace Game.Groups member.readyChecked = false; } - public void AddRaidMarker(byte markerId, uint mapId, float positionX, float positionY, float positionZ, ObjectGuid transportGuid = default(ObjectGuid)) + public void AddRaidMarker(byte markerId, uint mapId, float positionX, float positionY, float positionZ, ObjectGuid transportGuid = default) { if (markerId >= MapConst.RaidMarkersCount || m_markers[markerId] != null) return; @@ -2678,7 +2678,7 @@ namespace Game.Groups BonusData bonusData = new BonusData(itemInstance); ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemid); - uint itemLevel = Item.GetItemLevel(itemTemplate, bonusData, player.getLevel(), 0, lootItemInSlot.upgradeId, 0, 0, 0, false); + uint itemLevel = Item.GetItemLevel(itemTemplate, bonusData, player.GetLevel(), 0, lootItemInSlot.upgradeId, 0, 0, 0, false); return Item.GetDisenchantLoot(itemTemplate, (uint)bonusData.Quality, itemLevel); } @@ -2710,7 +2710,7 @@ namespace Game.Groups public class RaidMarker { - public RaidMarker(uint mapId, float positionX, float positionY, float positionZ, ObjectGuid transportGuid = default(ObjectGuid)) + public RaidMarker(uint mapId, float positionX, float positionY, float positionZ, ObjectGuid transportGuid = default) { Location = new WorldLocation(mapId, positionX, positionY, positionZ); TransportGUID = transportGuid; diff --git a/Source/Game/Guilds/Guild.cs b/Source/Game/Guilds/Guild.cs index 41a601b0f..76cbdee50 100644 --- a/Source/Game/Guilds/Guild.cs +++ b/Source/Game/Guilds/Guild.cs @@ -2480,7 +2480,7 @@ namespace Game.Guilds public void SetStats(Player player) { m_name = player.GetName(); - m_level = (byte)player.getLevel(); + m_level = (byte)player.GetLevel(); m_class = player.GetClass(); _gender = (Gender)(byte)player.m_playerData.NativeSex; m_zoneId = player.GetZoneId(); @@ -3751,7 +3751,7 @@ namespace Game.Guilds // Reserve space ItemPosCount pos = new ItemPosCount(slotId, requiredSpace); - if (!pos.isContainedIn(m_vec)) + if (!pos.IsContainedIn(m_vec)) { m_vec.Add(pos); count -= requiredSpace; diff --git a/Source/Game/Guilds/GuildFinderManager.cs b/Source/Game/Guilds/GuildFinderManager.cs index 55bb65a44..84ebdfeb0 100644 --- a/Source/Game/Guilds/GuildFinderManager.cs +++ b/Source/Game/Guilds/GuildFinderManager.cs @@ -22,7 +22,6 @@ using Game.Entities; using Game.Network.Packets; using System; using System.Collections.Generic; -using System.Linq; namespace Game.Guilds { diff --git a/Source/Game/Handlers/AuctionHandler.cs b/Source/Game/Handlers/AuctionHandler.cs index 21105e99c..da6c14474 100644 --- a/Source/Game/Handlers/AuctionHandler.cs +++ b/Source/Game/Handlers/AuctionHandler.cs @@ -49,7 +49,7 @@ namespace Game public void SendAuctionHello(ObjectGuid guid, Creature unit) { - if (GetPlayer().getLevel() < WorldConfig.GetIntValue(WorldCfg.AuctionLevelReq)) + if (GetPlayer().GetLevel() < WorldConfig.GetIntValue(WorldCfg.AuctionLevelReq)) { SendNotification(Global.ObjectMgr.GetCypherString(CypherStrings.AuctionReq), WorldConfig.GetIntValue(WorldCfg.AuctionLevelReq)); return; diff --git a/Source/Game/Handlers/BattleFieldHandler.cs b/Source/Game/Handlers/BattleFieldHandler.cs index be98432bc..536fed718 100644 --- a/Source/Game/Handlers/BattleFieldHandler.cs +++ b/Source/Game/Handlers/BattleFieldHandler.cs @@ -79,7 +79,7 @@ namespace Game public void SendBfEntered(ulong queueId, bool relocated, bool onOffense) { BFMgrEntering bfMgrEntering = new BFMgrEntering(); - bfMgrEntering.ClearedAFK = _player.isAFK(); + bfMgrEntering.ClearedAFK = _player.IsAFK(); bfMgrEntering.Relocated = relocated; bfMgrEntering.OnOffense = onOffense; bfMgrEntering.QueueID = queueId; diff --git a/Source/Game/Handlers/BattleGroundHandler.cs b/Source/Game/Handlers/BattleGroundHandler.cs index adbbb2243..558484e8a 100644 --- a/Source/Game/Handlers/BattleGroundHandler.cs +++ b/Source/Game/Handlers/BattleGroundHandler.cs @@ -92,7 +92,7 @@ namespace Game return; // expected bracket entry - PvpDifficultyRecord bracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bg.GetMapId(), GetPlayer().getLevel()); + PvpDifficultyRecord bracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bg.GetMapId(), GetPlayer().GetLevel()); if (bracketEntry == null) return; @@ -104,7 +104,7 @@ namespace Game // check queue conditions if (grp == null) { - if (GetPlayer().isUsingLfg()) + if (GetPlayer().IsUsingLfg()) { Global.BattlegroundMgr.BuildBattlegroundStatusFailed(out battlefieldStatusFailed, bg, GetPlayer(), 0, 0, GroupJoinBattlegroundResult.LfgCantUseBattleground); SendPacket(battlefieldStatusFailed); @@ -303,7 +303,7 @@ namespace Game bgTypeId = bg.GetTypeID(); // expected bracket entry - PvpDifficultyRecord bracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bg.GetMapId(), GetPlayer().getLevel()); + PvpDifficultyRecord bracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bg.GetMapId(), GetPlayer().GetLevel()); if (bracketEntry == null) return; @@ -321,10 +321,10 @@ namespace Game Log.outDebug(LogFilter.Battleground, "Player {0} ({1}) has a deserter debuff, do not port him to Battleground!", GetPlayer().GetName(), GetPlayer().GetGUID().ToString()); } //if player don't match Battlegroundmax level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue - if (GetPlayer().getLevel() > bg.GetMaxLevel()) + if (GetPlayer().GetLevel() > bg.GetMaxLevel()) { Log.outDebug(LogFilter.Network, "Player {0} ({1}) has level ({2}) higher than maxlevel ({3}) of Battleground({4})! Do not port him to Battleground!", - GetPlayer().GetName(), GetPlayer().GetGUID().ToString(), GetPlayer().getLevel(), bg.GetMaxLevel(), bg.GetTypeID()); + GetPlayer().GetName(), GetPlayer().GetGUID().ToString(), GetPlayer().GetLevel(), bg.GetMaxLevel(), bg.GetTypeID()); battlefieldPort.AcceptedInvite = false; } } @@ -467,7 +467,7 @@ namespace Game continue; // expected bracket entry - PvpDifficultyRecord bracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bg.GetMapId(), GetPlayer().getLevel()); + PvpDifficultyRecord bracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bg.GetMapId(), GetPlayer().GetLevel()); if (bracketEntry == null) continue; @@ -504,7 +504,7 @@ namespace Game BattlegroundTypeId bgTypeId = bg.GetTypeID(); BattlegroundQueueTypeId bgQueueTypeId = Global.BattlegroundMgr.BGQueueTypeId(bgTypeId, arenatype); - PvpDifficultyRecord bracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bg.GetMapId(), GetPlayer().getLevel()); + PvpDifficultyRecord bracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bg.GetMapId(), GetPlayer().GetLevel()); if (bracketEntry == null) return; diff --git a/Source/Game/Handlers/CharacterHandler.cs b/Source/Game/Handlers/CharacterHandler.cs index c52c20663..5786b03e6 100644 --- a/Source/Game/Handlers/CharacterHandler.cs +++ b/Source/Game/Handlers/CharacterHandler.cs @@ -450,7 +450,7 @@ namespace Game } if ((haveSameRace && skipCinematics == 1) || skipCinematics == 2) - newChar.setCinematic(1); // not show intro + newChar.SetCinematic(1); // not show intro newChar.atLoginFlags = AtLoginFlags.FirstLogin; // First login @@ -478,7 +478,7 @@ namespace Game Log.outInfo(LogFilter.Player, "Account: {0} (IP: {1}) Create Character: {2} {3}", GetAccountId(), GetRemoteAddress(), createInfo.Name, newChar.GetGUID().ToString()); Global.ScriptMgr.OnPlayerCreate(newChar); - Global.CharacterCacheStorage.AddCharacterCacheEntry(newChar.GetGUID(), GetAccountId(), newChar.GetName(), newChar.m_playerData.NativeSex, (byte)newChar.GetRace(), (byte)newChar.GetClass(), (byte)newChar.getLevel(), false); + Global.CharacterCacheStorage.AddCharacterCacheEntry(newChar.GetGUID(), GetAccountId(), newChar.GetName(), newChar.m_playerData.NativeSex, (byte)newChar.GetRace(), (byte)newChar.GetClass(), (byte)newChar.GetLevel(), false); newChar.CleanupsBeforeDelete(); } @@ -710,9 +710,9 @@ namespace Game pCurrChar.SendInitialPacketsBeforeAddToMap(); //Show cinematic at the first time that player login - if (pCurrChar.getCinematic() == 0) + if (pCurrChar.GetCinematic() == 0) { - pCurrChar.setCinematic(1); + pCurrChar.SetCinematic(1); ChrClassesRecord cEntry = CliDB.ChrClassesStorage.LookupByKey(pCurrChar.GetClass()); if (cEntry != null) { @@ -776,7 +776,7 @@ namespace Game pCurrChar.LoadCorpse(holder.GetResult(PlayerLoginQueryLoad.CorpseLocation)); // setting Ghost+speed if dead - if (pCurrChar.getDeathState() != DeathState.Alive) + if (pCurrChar.GetDeathState() != DeathState.Alive) { // not blizz like, we must correctly save and load player instead... if (pCurrChar.GetRace() == Race.NightElf && !pCurrChar.HasAura(20584)) @@ -850,7 +850,7 @@ namespace Game string IP_str = GetRemoteAddress(); Log.outDebug(LogFilter.Network, "Account: {0} (IP: {1}) Login Character:[{2}] ({3}) Level: {4}", - GetAccountId(), IP_str, pCurrChar.GetName(), pCurrChar.GetGUID().ToString(), pCurrChar.getLevel()); + GetAccountId(), IP_str, pCurrChar.GetName(), pCurrChar.GetGUID().ToString(), pCurrChar.GetLevel()); if (!pCurrChar.IsStandState() && !pCurrChar.HasUnitState(UnitState.Stunned)) pCurrChar.SetStandState(UnitStandStateType.Stand); @@ -2159,7 +2159,7 @@ namespace Game // creatures can kill players // so if the server is lagging enough the player can // release spirit after he's killed but before he is updated - if (GetPlayer().getDeathState() == DeathState.JustDied) + if (GetPlayer().GetDeathState() == DeathState.JustDied) { Log.outDebug(LogFilter.Network, "HandleRepopRequestOpcode: got request after player {0} ({1}) was killed and before he was updated", GetPlayer().GetName(), GetPlayer().GetGUID().ToString()); @@ -2284,7 +2284,7 @@ namespace Game GetPlayer().SetStandState(packet.StandState); } - void SendCharCreate(ResponseCodes result, ObjectGuid guid = default(ObjectGuid)) + void SendCharCreate(ResponseCodes result, ObjectGuid guid = default) { CreateChar response = new CreateChar(); response.Code = result; diff --git a/Source/Game/Handlers/ChatHandler.cs b/Source/Game/Handlers/ChatHandler.cs index 7cc5168f0..164d7ec31 100644 --- a/Source/Game/Handlers/ChatHandler.cs +++ b/Source/Game/Handlers/ChatHandler.cs @@ -192,7 +192,7 @@ namespace Game if (!sender.IsAlive()) return; - if (sender.getLevel() < WorldConfig.GetIntValue(WorldCfg.ChatSayLevelReq)) + if (sender.GetLevel() < WorldConfig.GetIntValue(WorldCfg.ChatSayLevelReq)) { SendNotification(Global.ObjectMgr.GetCypherString(CypherStrings.SayReq), WorldConfig.GetIntValue(WorldCfg.ChatSayLevelReq)); return; @@ -205,7 +205,7 @@ namespace Game if (!sender.IsAlive()) return; - if (sender.getLevel() < WorldConfig.GetIntValue(WorldCfg.ChatEmoteLevelReq)) + if (sender.GetLevel() < WorldConfig.GetIntValue(WorldCfg.ChatEmoteLevelReq)) { SendNotification(Global.ObjectMgr.GetCypherString(CypherStrings.SayReq), WorldConfig.GetIntValue(WorldCfg.ChatEmoteLevelReq)); return; @@ -218,7 +218,7 @@ namespace Game if (!sender.IsAlive()) return; - if (sender.getLevel() < WorldConfig.GetIntValue(WorldCfg.ChatYellLevelReq)) + if (sender.GetLevel() < WorldConfig.GetIntValue(WorldCfg.ChatYellLevelReq)) { SendNotification(Global.ObjectMgr.GetCypherString(CypherStrings.SayReq), WorldConfig.GetIntValue(WorldCfg.ChatYellLevelReq)); return; @@ -237,12 +237,12 @@ namespace Game } Player receiver = Global.ObjAccessor.FindPlayerByName(extName.Name); - if (!receiver || (lang != Language.Addon && !receiver.isAcceptWhispers() && receiver.GetSession().HasPermission(RBACPermissions.CanFilterWhispers) && !receiver.IsInWhisperWhiteList(sender.GetGUID()))) + if (!receiver || (lang != Language.Addon && !receiver.IsAcceptWhispers() && receiver.GetSession().HasPermission(RBACPermissions.CanFilterWhispers) && !receiver.IsInWhisperWhiteList(sender.GetGUID()))) { SendChatPlayerNotfoundNotice(target); return; } - if (!sender.IsGameMaster() && sender.getLevel() < WorldConfig.GetIntValue(WorldCfg.ChatWhisperLevelReq) && !receiver.IsInWhisperWhiteList(sender.GetGUID())) + if (!sender.IsGameMaster() && sender.GetLevel() < WorldConfig.GetIntValue(WorldCfg.ChatWhisperLevelReq) && !receiver.IsInWhisperWhiteList(sender.GetGUID())) { SendNotification(Global.ObjectMgr.GetCypherString(CypherStrings.WhisperReq), WorldConfig.GetIntValue(WorldCfg.ChatWhisperLevelReq)); return; @@ -260,8 +260,8 @@ namespace Game return; } - if (receiver.getLevel() < WorldConfig.GetIntValue(WorldCfg.ChatWhisperLevelReq) || - (HasPermission(RBACPermissions.CanFilterWhispers) && !sender.isAcceptWhispers() && !sender.IsInWhisperWhiteList(receiver.GetGUID()))) + if (receiver.GetLevel() < WorldConfig.GetIntValue(WorldCfg.ChatWhisperLevelReq) || + (HasPermission(RBACPermissions.CanFilterWhispers) && !sender.IsAcceptWhispers() && !sender.IsInWhisperWhiteList(receiver.GetGUID()))) sender.AddWhisperWhiteList(receiver.GetGUID()); GetPlayer().Whisper(msg, lang, receiver); @@ -344,7 +344,7 @@ namespace Game case ChatMsg.Channel: if (!HasPermission(RBACPermissions.SkipCheckChatChannelReq)) { - if (GetPlayer().getLevel() < WorldConfig.GetIntValue(WorldCfg.ChatChannelLevelReq)) + if (GetPlayer().GetLevel() < WorldConfig.GetIntValue(WorldCfg.ChatChannelLevelReq)) { SendNotification(Global.ObjectMgr.GetCypherString(CypherStrings.ChannelReq), WorldConfig.GetIntValue(WorldCfg.ChatChannelLevelReq)); return; @@ -477,7 +477,7 @@ namespace Game return; } - if (sender.isAFK()) // Already AFK + if (sender.IsAFK()) // Already AFK { if (string.IsNullOrEmpty(packet.Text)) sender.ToggleAFK(); // Remove AFK @@ -488,7 +488,7 @@ namespace Game { sender.autoReplyMsg = string.IsNullOrEmpty(packet.Text) ? Global.ObjectMgr.GetCypherString(CypherStrings.PlayerAfkDefault) : packet.Text; - if (sender.isDND()) + if (sender.IsDND()) sender.ToggleDND(); sender.ToggleAFK(); @@ -511,7 +511,7 @@ namespace Game return; } - if (sender.isDND()) // Already DND + if (sender.IsDND()) // Already DND { if (string.IsNullOrEmpty(packet.Text)) sender.ToggleDND(); // Remove DND @@ -522,7 +522,7 @@ namespace Game { sender.autoReplyMsg = string.IsNullOrEmpty(packet.Text) ? Global.ObjectMgr.GetCypherString(CypherStrings.PlayerDndDefault) : packet.Text; - if (sender.isAFK()) + if (sender.IsAFK()) sender.ToggleAFK(); sender.ToggleDND(); diff --git a/Source/Game/Handlers/GroupHandler.cs b/Source/Game/Handlers/GroupHandler.cs index f340fa34e..d2999c2c8 100644 --- a/Source/Game/Handlers/GroupHandler.cs +++ b/Source/Game/Handlers/GroupHandler.cs @@ -88,7 +88,7 @@ namespace Game return; } - if (!player.GetSocial().HasFriend(GetPlayer().GetGUID()) && GetPlayer().getLevel() < WorldConfig.GetIntValue(WorldCfg.PartyLevelReq)) + if (!player.GetSocial().HasFriend(GetPlayer().GetGUID()) && GetPlayer().GetLevel() < WorldConfig.GetIntValue(WorldCfg.PartyLevelReq)) { SendPartyResult(PartyOperation.Invite, player.GetName(), PartyResult.InviteRestricted); return; diff --git a/Source/Game/Handlers/GuildHandler.cs b/Source/Game/Handlers/GuildHandler.cs index f197574b7..cd8b3116f 100644 --- a/Source/Game/Handlers/GuildHandler.cs +++ b/Source/Game/Handlers/GuildHandler.cs @@ -20,7 +20,6 @@ using Game.Entities; using Game.Guilds; using Game.Network; using Game.Network.Packets; -using System.Collections.Generic; namespace Game { diff --git a/Source/Game/Handlers/ItemHandler.cs b/Source/Game/Handlers/ItemHandler.cs index 3587559ff..d9a58c1fb 100644 --- a/Source/Game/Handlers/ItemHandler.cs +++ b/Source/Game/Handlers/ItemHandler.cs @@ -934,7 +934,7 @@ namespace Game { if (gems[i]) { - uint gemScalingLevel = _player.getLevel(); + uint gemScalingLevel = _player.GetLevel(); uint fixedLevel = gems[i].GetModifier(ItemModifier.ScalingStatDistributionFixedLevel); if (fixedLevel != 0) gemScalingLevel = fixedLevel; @@ -1027,7 +1027,7 @@ namespace Game GetPlayer().RefundItem(item); } - bool CanUseBank(ObjectGuid bankerGUID = default(ObjectGuid)) + bool CanUseBank(ObjectGuid bankerGUID = default) { // bankerGUID parameter is optional, set to 0 by default. if (bankerGUID.IsEmpty()) diff --git a/Source/Game/Handlers/LFGHandler.cs b/Source/Game/Handlers/LFGHandler.cs index b6d01526d..b30a6ba3d 100644 --- a/Source/Game/Handlers/LFGHandler.cs +++ b/Source/Game/Handlers/LFGHandler.cs @@ -120,7 +120,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.DfGetJoinStatus, Processing = PacketProcessing.ThreadSafe)] void HandleDfGetJoinStatus(DFGetJoinStatus packet) { - if (!GetPlayer().isUsingLfg()) + if (!GetPlayer().IsUsingLfg()) return; ObjectGuid guid = GetPlayer().GetGUID(); @@ -143,7 +143,7 @@ namespace Game public void SendLfgPlayerLockInfo() { // Get Random dungeons that can be done at a certain level and expansion - uint level = GetPlayer().getLevel(); + uint level = GetPlayer().GetLevel(); List randomDungeons = Global.LFGMgr.GetRandomAndSeasonalDungeons(level, (uint)GetExpansion()); LfgPlayerInfo lfgPlayerInfo = new LfgPlayerInfo(); diff --git a/Source/Game/Handlers/LootHandler.cs b/Source/Game/Handlers/LootHandler.cs index 9399c1026..277c2d823 100644 --- a/Source/Game/Handlers/LootHandler.cs +++ b/Source/Game/Handlers/LootHandler.cs @@ -19,7 +19,6 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; using Game.Groups; -using Game.Guilds; using Game.Loots; using Game.Maps; using Game.Network; @@ -259,7 +258,7 @@ namespace Game if (!_looter.IsWithinDist(creature, LootDistance)) return false; - return _looter.isAllowedToLoot(creature); + return _looter.IsAllowedToLoot(creature); } Player _looter; diff --git a/Source/Game/Handlers/MailHandler.cs b/Source/Game/Handlers/MailHandler.cs index c5b7b1bd6..de6c01f89 100644 --- a/Source/Game/Handlers/MailHandler.cs +++ b/Source/Game/Handlers/MailHandler.cs @@ -74,7 +74,7 @@ namespace Game return; Player player = GetPlayer(); - if (player.getLevel() < WorldConfig.GetIntValue(WorldCfg.MailLevelReq)) + if (player.GetLevel() < WorldConfig.GetIntValue(WorldCfg.MailLevelReq)) { SendNotification(CypherStrings.MailSenderReq, WorldConfig.GetIntValue(WorldCfg.MailLevelReq)); return; @@ -150,7 +150,7 @@ namespace Game { receiverTeam = receiver.GetTeam(); mailsCount = (byte)receiver.GetMails().Count; - receiverLevel = (byte)receiver.getLevel(); + receiverLevel = (byte)receiver.GetLevel(); receiverAccountId = receiver.GetSession().GetAccountId(); receiverBnetAccountId = receiver.GetSession().GetBattlenetAccountId(); } diff --git a/Source/Game/Handlers/MiscHandler.cs b/Source/Game/Handlers/MiscHandler.cs index 92aad9873..b7e8a11b9 100644 --- a/Source/Game/Handlers/MiscHandler.cs +++ b/Source/Game/Handlers/MiscHandler.cs @@ -190,7 +190,7 @@ namespace Game return; } - if (player.isDebugAreaTriggers) + if (player.IsDebugAreaTriggers) player.SendSysMessage(packet.Entered ? CypherStrings.DebugAreatriggerEntered : CypherStrings.DebugAreatriggerLeft, packet.AreaTriggerID); if (Global.ScriptMgr.OnAreaTrigger(player, atEntry, packet.Entered)) diff --git a/Source/Game/Handlers/NPCHandler.cs b/Source/Game/Handlers/NPCHandler.cs index 466ac81ea..56d9bf43a 100644 --- a/Source/Game/Handlers/NPCHandler.cs +++ b/Source/Game/Handlers/NPCHandler.cs @@ -366,14 +366,14 @@ namespace Game uint petSlot = 0; // not let move dead pet in slot - if (pet && pet.IsAlive() && pet.getPetType() == PetType.Hunter) + if (pet && pet.IsAlive() && pet.GetPetType() == PetType.Hunter) { PetStableInfo stableEntry;// = new PetStableInfo(); stableEntry.PetSlot = petSlot; stableEntry.PetNumber = pet.GetCharmInfo().GetPetNumber(); stableEntry.CreatureID = pet.GetEntry(); stableEntry.DisplayID = pet.GetDisplayId(); - stableEntry.ExperienceLevel = pet.getLevel(); + stableEntry.ExperienceLevel = pet.GetLevel(); stableEntry.PetFlags = PetStableinfo.Active; stableEntry.PetName = pet.GetName(); ++petSlot; @@ -498,7 +498,7 @@ namespace Game int leftInStock = vendorItem.maxcount == 0 ? -1 : (int)vendor.GetVendorItemCurrentCount(vendorItem); if (!GetPlayer().IsGameMaster()) { - if (!Convert.ToBoolean(itemTemplate.GetAllowableClass() & GetPlayer().getClassMask()) && itemTemplate.GetBonding() == ItemBondingType.OnAcquire) + if (!Convert.ToBoolean(itemTemplate.GetAllowableClass() & GetPlayer().GetClassMask()) && itemTemplate.GetBonding() == ItemBondingType.OnAcquire) continue; if ((itemTemplate.GetFlags2().HasAnyFlag(ItemFlags2.FactionHorde) && GetPlayer().GetTeam() == Team.Alliance) || diff --git a/Source/Game/Handlers/PetHandler.cs b/Source/Game/Handlers/PetHandler.cs index dbe4a689f..269c41565 100644 --- a/Source/Game/Handlers/PetHandler.cs +++ b/Source/Game/Handlers/PetHandler.cs @@ -202,7 +202,7 @@ namespace Game pet.ToCreature().GetAI().AttackStart(TargetUnit); //10% chance to play special pet attack talk, else growl - if (pet.IsPet() && pet.ToPet().getPetType() == PetType.Summon && pet != TargetUnit && RandomHelper.IRand(0, 100) < 10) + if (pet.IsPet() && pet.ToPet().GetPetType() == PetType.Summon && pet != TargetUnit && RandomHelper.IRand(0, 100) < 10) pet.SendPetTalk(PetTalk.Attack); else { @@ -232,11 +232,11 @@ namespace Game Cypher.Assert(pet.IsTypeId(TypeId.Unit)); if (pet.IsPet()) { - if (pet.ToPet().getPetType() == PetType.Hunter) + if (pet.ToPet().GetPetType() == PetType.Hunter) GetPlayer().RemovePet(pet.ToPet(), PetSaveMode.AsDeleted); else //dismissing a summoned pet is like killing them (this prevents returning a soulshard...) - pet.setDeathState(DeathState.Corpse); + pet.SetDeathState(DeathState.Corpse); } else if (pet.HasUnitTypeMask(UnitTypeMask.Minion)) { @@ -317,7 +317,7 @@ namespace Game SpellCastResult result = spell.CheckPetCast(unit_target); //auto turn to target unless possessed - if (result == SpellCastResult.UnitNotInfront && !pet.isPossessed() && !pet.IsVehicle()) + if (result == SpellCastResult.UnitNotInfront && !pet.IsPossessed() && !pet.IsVehicle()) { Unit unit_target2 = spell.m_targets.GetUnitTarget(); if (unit_target) @@ -351,14 +351,14 @@ namespace Game //10% chance to play special pet attack talk, else growl //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell - if (pet.IsPet() && (pet.ToPet().getPetType() == PetType.Summon) && (pet != unit_target) && (RandomHelper.IRand(0, 100) < 10)) + if (pet.IsPet() && (pet.ToPet().GetPetType() == PetType.Summon) && (pet != unit_target) && (RandomHelper.IRand(0, 100) < 10)) pet.SendPetTalk(PetTalk.SpecialSpell); else { pet.SendPetAIReaction(guid1); } - if (unit_target && !GetPlayer().IsFriendlyTo(unit_target) && !pet.isPossessed() && !pet.IsVehicle()) + if (unit_target && !GetPlayer().IsFriendlyTo(unit_target) && !pet.IsPossessed() && !pet.IsVehicle()) { // This is true if pet has no target or has target but targets differs. if (pet.GetVictim() != unit_target) @@ -373,7 +373,7 @@ namespace Game } else { - if (pet.isPossessed() || pet.IsVehicle()) // @todo: confirm this check + if (pet.IsPossessed() || pet.IsVehicle()) // @todo: confirm this check Spell.SendCastResult(GetPlayer(), spellInfo, spell.m_SpellVisual, spell.m_castId, result); else spell.SendPetCastResult(result); @@ -524,7 +524,7 @@ namespace Game Pet pet = ObjectAccessor.GetPet(GetPlayer(), petguid); // check it! - if (!pet || !pet.IsPet() || pet.ToPet().getPetType() != PetType.Hunter || !pet.HasPetFlag(UnitPetFlags.CanBeRenamed) || + if (!pet || !pet.IsPet() || pet.ToPet().GetPetType() != PetType.Hunter || !pet.HasPetFlag(UnitPetFlags.CanBeRenamed) || pet.GetOwnerGUID() != GetPlayer().GetGUID() || pet.GetCharmInfo() == null) return; @@ -582,7 +582,7 @@ namespace Game // pet/charmed Creature pet = ObjectAccessor.GetCreatureOrPetOrVehicle(GetPlayer(), packet.Pet); - if (pet && pet.ToPet() && pet.ToPet().getPetType() == PetType.Hunter) + if (pet && pet.ToPet() && pet.ToPet().GetPetType() == PetType.Hunter) { _player.RemovePet((Pet)pet, PetSaveMode.AsDeleted); } @@ -680,7 +680,7 @@ namespace Game { // 10% chance to play special pet attack talk, else growl // actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell - if (pet.getPetType() == PetType.Summon && (RandomHelper.IRand(0, 100) < 10)) + if (pet.GetPetType() == PetType.Summon && (RandomHelper.IRand(0, 100) < 10)) pet.SendPetTalk(PetTalk.SpecialSpell); else pet.SendPetAIReaction(petCastSpell.PetGUID); diff --git a/Source/Game/Handlers/QueryHandler.cs b/Source/Game/Handlers/QueryHandler.cs index 8ed6822a0..1b8401e90 100644 --- a/Source/Game/Handlers/QueryHandler.cs +++ b/Source/Game/Handlers/QueryHandler.cs @@ -23,7 +23,6 @@ using Game.Maps; using Game.Misc; using Game.Network; using Game.Network.Packets; -using System; using System.Collections.Generic; namespace Game diff --git a/Source/Game/Handlers/QuestHandler.cs b/Source/Game/Handlers/QuestHandler.cs index 1d5c49a13..d0f557b57 100644 --- a/Source/Game/Handlers/QuestHandler.cs +++ b/Source/Game/Handlers/QuestHandler.cs @@ -23,7 +23,6 @@ using Game.Network; using Game.Network.Packets; using Game.DataStorage; using System.Collections.Generic; -using System; namespace Game { @@ -122,7 +121,7 @@ namespace Game } else { - if (!obj.hasQuest(packet.QuestID)) + if (!obj.HasQuest(packet.QuestID)) { CLOSE_GOSSIP_CLEAR_DIVIDER(); return; @@ -199,7 +198,7 @@ namespace Game { // Verify that the guid is valid and is a questgiver or involved in the requested quest var obj = Global.ObjAccessor.GetObjectByTypeMask(GetPlayer(), packet.QuestGiverGUID, (TypeMask.Unit | TypeMask.GameObject | TypeMask.Item)); - if (!obj || (!obj.hasQuest(packet.QuestID) && !obj.hasInvolvedQuest(packet.QuestID))) + if (!obj || (!obj.HasQuest(packet.QuestID) && !obj.HasInvolvedQuest(packet.QuestID))) { GetPlayer().PlayerTalkClass.SendCloseGossip(); return; @@ -308,7 +307,7 @@ namespace Game if (!quest.HasFlag(QuestFlags.AutoComplete)) { obj = Global.ObjAccessor.GetObjectByTypeMask(GetPlayer(), packet.QuestGiverGUID, TypeMask.Unit | TypeMask.GameObject); - if (!obj || !obj.hasInvolvedQuest(packet.QuestID)) + if (!obj || !obj.HasInvolvedQuest(packet.QuestID)) return; // some kind of WPE protection @@ -389,7 +388,7 @@ namespace Game void HandleQuestgiverRequestReward(QuestGiverRequestReward packet) { WorldObject obj = Global.ObjAccessor.GetObjectByTypeMask(GetPlayer(), packet.QuestGiverGUID, TypeMask.Unit | TypeMask.GameObject); - if (obj == null || !obj.hasInvolvedQuest(packet.QuestID)) + if (obj == null || !obj.HasInvolvedQuest(packet.QuestID)) return; // some kind of WPE protection @@ -509,7 +508,7 @@ namespace Game if (!autoCompleteMode) { - if (!obj.hasInvolvedQuest(packet.QuestID)) + if (!obj.HasInvolvedQuest(packet.QuestID)) return; // some kind of WPE protection diff --git a/Source/Game/Handlers/RAFHandler.cs b/Source/Game/Handlers/RAFHandler.cs index 3f5a607e1..11b8b4fda 100644 --- a/Source/Game/Handlers/RAFHandler.cs +++ b/Source/Game/Handlers/RAFHandler.cs @@ -40,13 +40,13 @@ namespace Game error = ReferAFriendError.NotReferredBy; else if (target.GetTeamId() != GetPlayer().GetTeamId()) error = ReferAFriendError.DifferentFaction; - else if (target.getLevel() >= GetPlayer().getLevel()) + else if (target.GetLevel() >= GetPlayer().GetLevel()) error = ReferAFriendError.TargetTooHigh; - else if (target.getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel)) + else if (target.GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel)) error = ReferAFriendError.GrantLevelMaxI; else if (target.GetGroup() != GetPlayer().GetGroup()) error = ReferAFriendError.NotInGroup; - else if (target.getLevel() >= Global.ObjectMgr.GetMaxLevelForExpansion(target.GetSession().GetExpansion())) + else if (target.GetLevel() >= Global.ObjectMgr.GetMaxLevelForExpansion(target.GetSession().GetExpansion())) error = ReferAFriendError.InsufExpanLvl; if (error != 0) @@ -80,7 +80,7 @@ namespace Game else return; - GetPlayer().GiveLevel(GetPlayer().getLevel() + 1); + GetPlayer().GiveLevel(GetPlayer().GetLevel() + 1); } } } diff --git a/Source/Game/Handlers/SpellHandler.cs b/Source/Game/Handlers/SpellHandler.cs index 43fa4ebea..0e83edfdf 100644 --- a/Source/Game/Handlers/SpellHandler.cs +++ b/Source/Game/Handlers/SpellHandler.cs @@ -308,7 +308,7 @@ namespace Game return; // can't use our own spells when we're in possession of another unit, - if (GetPlayer().isPossessing()) + if (GetPlayer().IsPossessing()) return; // client provided targets diff --git a/Source/Game/Handlers/TaxiHandler.cs b/Source/Game/Handlers/TaxiHandler.cs index 59a5805e5..0bd1ad551 100644 --- a/Source/Game/Handlers/TaxiHandler.cs +++ b/Source/Game/Handlers/TaxiHandler.cs @@ -97,7 +97,7 @@ namespace Game if (curloc == 0) return; - bool lastTaxiCheaterState = GetPlayer().isTaxiCheater(); + bool lastTaxiCheaterState = GetPlayer().IsTaxiCheater(); if (unit.GetEntry() == 29480) GetPlayer().SetTaxiCheater(true); // Grimwing in Ebon Hold, special case. NOTE: Not perfect, Zul'Aman should not be included according to WoWhead, and I think taxicheat includes it. @@ -186,7 +186,7 @@ namespace Game if (to == null) return; - if (!GetPlayer().isTaxiCheater()) + if (!GetPlayer().IsTaxiCheater()) { if (!GetPlayer().m_taxi.IsTaximaskNodeKnown(curloc) || !GetPlayer().m_taxi.IsTaximaskNodeKnown(activateTaxi.Node)) { diff --git a/Source/Game/Handlers/ToyHandler.cs b/Source/Game/Handlers/ToyHandler.cs index c93176e3e..d9f0657ff 100644 --- a/Source/Game/Handlers/ToyHandler.cs +++ b/Source/Game/Handlers/ToyHandler.cs @@ -74,7 +74,7 @@ namespace Game return; } - if (_player.isPossessing()) + if (_player.IsPossessing()) return; SpellCastTargets targets = new SpellCastTargets(_player, packet.Cast); diff --git a/Source/Game/Handlers/TradeHandler.cs b/Source/Game/Handlers/TradeHandler.cs index 10a8f184e..6f3f401dc 100644 --- a/Source/Game/Handlers/TradeHandler.cs +++ b/Source/Game/Handlers/TradeHandler.cs @@ -592,7 +592,7 @@ namespace Game return; } - if (GetPlayer().getLevel() < WorldConfig.GetIntValue(WorldCfg.TradeLevelReq)) + if (GetPlayer().GetLevel() < WorldConfig.GetIntValue(WorldCfg.TradeLevelReq)) { SendNotification(Global.ObjectMgr.GetCypherString(CypherStrings.TradeReq), WorldConfig.GetIntValue(WorldCfg.TradeLevelReq)); return; @@ -667,7 +667,7 @@ namespace Game return; } - if (pOther.getLevel() < WorldConfig.GetIntValue(WorldCfg.TradeLevelReq)) + if (pOther.GetLevel() < WorldConfig.GetIntValue(WorldCfg.TradeLevelReq)) { SendNotification(Global.ObjectMgr.GetCypherString(CypherStrings.TradeOtherReq), WorldConfig.GetIntValue(WorldCfg.TradeLevelReq)); return; diff --git a/Source/Game/Maps/Grid.cs b/Source/Game/Maps/Grid.cs index f930a23d0..c1a0be2be 100644 --- a/Source/Game/Maps/Grid.cs +++ b/Source/Game/Maps/Grid.cs @@ -18,7 +18,6 @@ using Framework.Constants; using Game.Entities; using System.Collections.Generic; -using System.Linq; namespace Game.Maps { diff --git a/Source/Game/Maps/GridMap.cs b/Source/Game/Maps/GridMap.cs index 5a3587c7d..b64bb2bab 100644 --- a/Source/Game/Maps/GridMap.cs +++ b/Source/Game/Maps/GridMap.cs @@ -21,7 +21,6 @@ using Game.DataStorage; using System; using System.Collections.Generic; using System.IO; -using System.Runtime.InteropServices; namespace Game.Maps { diff --git a/Source/Game/Maps/GridNotifiers.cs b/Source/Game/Maps/GridNotifiers.cs index a1b839244..621f16f63 100644 --- a/Source/Game/Maps/GridNotifiers.cs +++ b/Source/Game/Maps/GridNotifiers.cs @@ -24,7 +24,6 @@ using Game.Spells; using System; using System.Collections.Generic; using System.Linq; -using System.Collections.Concurrent; namespace Game.Maps { @@ -119,7 +118,7 @@ namespace Game.Maps break; case TypeId.Player: i_player.UpdateVisibilityOf(obj.ToPlayer(), i_data, i_visibleNow); - if (!obj.isNeedNotify(NotifyFlags.VisibilityChanged)) + if (!obj.IsNeedNotify(NotifyFlags.VisibilityChanged)) obj.ToPlayer().UpdateVisibilityOf(i_player); break; case TypeId.Unit: @@ -143,7 +142,7 @@ namespace Game.Maps if (guid.IsPlayer()) { Player pl = Global.ObjAccessor.FindPlayer(guid); - if (pl != null && pl.IsInWorld && !pl.isNeedNotify(NotifyFlags.VisibilityChanged)) + if (pl != null && pl.IsInWorld && !pl.IsNeedNotify(NotifyFlags.VisibilityChanged)) pl.UpdateVisibilityOf(i_player); } } @@ -236,7 +235,7 @@ namespace Game.Maps i_player.UpdateVisibilityOf(player, i_data, i_visibleNow); - if (player.seerView.isNeedNotify(NotifyFlags.VisibilityChanged)) + if (player.seerView.IsNeedNotify(NotifyFlags.VisibilityChanged)) continue; player.UpdateVisibilityOf(i_player); @@ -255,7 +254,7 @@ namespace Game.Maps i_player.UpdateVisibilityOf(creature, i_data, i_visibleNow); - if (relocated_for_ai && !creature.isNeedNotify(NotifyFlags.VisibilityChanged)) + if (relocated_for_ai && !creature.IsNeedNotify(NotifyFlags.VisibilityChanged)) CreatureUnitRelocationWorker(creature, i_player); } } @@ -272,7 +271,7 @@ namespace Game.Maps { foreach (var player in objs) { - if (!player.seerView.isNeedNotify(NotifyFlags.VisibilityChanged)) + if (!player.seerView.IsNeedNotify(NotifyFlags.VisibilityChanged)) player.UpdateVisibilityOf(i_creature); CreatureUnitRelocationWorker(i_creature, player); @@ -288,7 +287,7 @@ namespace Game.Maps { CreatureUnitRelocationWorker(i_creature, creature); - if (!creature.isNeedNotify(NotifyFlags.VisibilityChanged)) + if (!creature.IsNeedNotify(NotifyFlags.VisibilityChanged)) CreatureUnitRelocationWorker(creature, i_creature); } } @@ -312,7 +311,7 @@ namespace Game.Maps { WorldObject viewPoint = player.seerView; - if (!viewPoint.isNeedNotify(NotifyFlags.VisibilityChanged)) + if (!viewPoint.IsNeedNotify(NotifyFlags.VisibilityChanged)) continue; if (player != viewPoint && !viewPoint.IsPositionValid()) @@ -329,7 +328,7 @@ namespace Game.Maps { foreach (var creature in objs) { - if (!creature.isNeedNotify(NotifyFlags.VisibilityChanged)) + if (!creature.IsNeedNotify(NotifyFlags.VisibilityChanged)) continue; CreatureRelocationNotifier relocate = new CreatureRelocationNotifier(creature); @@ -1519,7 +1518,7 @@ namespace Game.Maps public bool Invoke(Creature u) { if (u.IsAlive() && u.IsInCombat() && !i_obj.IsHostileTo(u) && i_obj.IsWithinDistInMap(u, i_range) && - (u.isFeared() || u.IsCharmed() || u.isFrozen() || u.HasUnitState(UnitState.Stunned) || u.HasUnitState(UnitState.Confused))) + (u.IsFeared() || u.IsCharmed() || u.IsFrozen() || u.HasUnitState(UnitState.Stunned) || u.HasUnitState(UnitState.Confused))) return true; return false; } @@ -1594,7 +1593,7 @@ namespace Game.Maps if (u.IsTypeId(TypeId.Unit) && u.IsTotem()) return false; - if (!u.isTargetableForAttack(false)) + if (!u.IsTargetableForAttack(false)) return false; if (!i_obj.IsWithinDistInMap(u, i_range) || i_funit._IsValidAttackTarget(u, null, i_obj)) @@ -1701,7 +1700,7 @@ namespace Game.Maps public bool Invoke(Unit u) { - if (u.isTargetableForAttack() && i_obj.IsWithinDistInMap(u, i_range) && + if (u.IsTargetableForAttack() && i_obj.IsWithinDistInMap(u, i_range) && (i_funit.IsInCombatWith(u) || i_funit.IsHostileTo(u)) && i_obj.CanSeeOrDetect(u)) { i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check @@ -1927,7 +1926,7 @@ namespace Game.Maps public bool Invoke(Creature u) { - if (u.getDeathState() != DeathState.Dead && u.GetEntry() == i_entry && u.IsAlive() == i_alive && i_obj.IsWithinDistInMap(u, i_range)) + if (u.GetDeathState() != DeathState.Dead && u.GetEntry() == i_entry && u.IsAlive() == i_alive && i_obj.IsWithinDistInMap(u, i_range)) { i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check return true; @@ -2171,7 +2170,7 @@ namespace Game.Maps public class UnitAuraCheck : ICheck where T : WorldObject { - public UnitAuraCheck(bool present, uint spellId, ObjectGuid casterGUID = default(ObjectGuid)) + public UnitAuraCheck(bool present, uint spellId, ObjectGuid casterGUID = default) { _present = present; _spellId = spellId; @@ -2209,7 +2208,7 @@ namespace Game.Maps if (go.GetGoInfo().SpellFocus.spellFocusType != i_focusId) return false; - if (!go.isSpawned()) + if (!go.IsSpawned()) return false; float dist = go.GetGoInfo().SpellFocus.radius / 2.0f; @@ -2232,7 +2231,7 @@ namespace Game.Maps public bool Invoke(GameObject go) { - if (go.GetGoInfo().type == GameObjectTypes.FishingHole && go.isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, go.GetGoInfo().FishingHole.radius)) + if (go.GetGoInfo().type == GameObjectTypes.FishingHole && go.IsSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, go.GetGoInfo().FishingHole.radius)) { i_range = i_obj.GetDistance(go); return true; diff --git a/Source/Game/Maps/Instances/InstanceScript.cs b/Source/Game/Maps/Instances/InstanceScript.cs index d40482561..7c452ba15 100644 --- a/Source/Game/Maps/Instances/InstanceScript.cs +++ b/Source/Game/Maps/Instances/InstanceScript.cs @@ -305,7 +305,7 @@ namespace Game.Maps { Creature minion = instance.GetCreature(guid); if (minion) - if (minion.isWorldBoss() && minion.IsAlive()) + if (minion.IsWorldBoss() && minion.IsAlive()) return false; } } @@ -460,9 +460,9 @@ namespace Game.Maps { if (go.GetGoType() == GameObjectTypes.Door || go.GetGoType() == GameObjectTypes.Button) { - if (go.getLootState() == LootState.Ready) + if (go.GetLootState() == LootState.Ready) go.UseDoorOrButton(withRestoreTime, useAlternativeState); - else if (go.getLootState() == LootState.Activated) + else if (go.GetLootState() == LootState.Activated) go.ResetDoorOrButton(); } else @@ -482,7 +482,7 @@ namespace Game.Maps { if (go.GetGoType() == GameObjectTypes.Door || go.GetGoType() == GameObjectTypes.Button) { - if (go.getLootState() == LootState.Activated) + if (go.GetLootState() == LootState.Activated) go.ResetDoorOrButton(); } else @@ -510,7 +510,7 @@ namespace Game.Maps break; } - if (go.isSpawned()) + if (go.IsSpawned()) return; go.SetRespawnTime((int)timeToDespawn); diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 8e113c901..64e6287cd 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -518,7 +518,7 @@ namespace Game.Maps } var cell = new Cell(cellCoord); - if (obj.isActiveObject()) + if (obj.IsActiveObject()) EnsureGridLoadedForActiveObject(cell, obj); else EnsureGridCreated(new GridCoord(cell.GetGridX(), cell.GetGridY())); @@ -529,7 +529,7 @@ namespace Game.Maps InitializeObject(obj); - if (obj.isActiveObject()) + if (obj.IsActiveObject()) AddToActive(obj); //something, such as vehicle, needs to be update immediately @@ -656,7 +656,7 @@ namespace Game.Maps if (player.IsInCombat()) { List updateList = new List(); - HostileReference refe = player.getHostileRefManager().getFirst(); + HostileReference refe = player.GetHostileRefManager().getFirst(); while (refe != null) { @@ -818,7 +818,7 @@ namespace Game.Maps { Global.ScriptMgr.OnPlayerLeaveMap(this, player); - player.getHostileRefManager().deleteReferences(); // multithreading crashfix + player.GetHostileRefManager().deleteReferences(); // multithreading crashfix bool inWorld = player.IsInWorld; player.RemoveFromWorld(); @@ -840,7 +840,7 @@ namespace Game.Maps { bool inWorld = obj.IsInWorld && obj.GetTypeId() >= TypeId.Unit && obj.GetTypeId() <= TypeId.GameObject; obj.RemoveFromWorld(); - if (obj.isActiveObject()) + if (obj.IsActiveObject()) RemoveFromActive(obj); if (!inWorld) // if was in world, RemoveFromWorld() called DestroyForNearbyPlayers() @@ -1323,7 +1323,7 @@ namespace Game.Maps } // in diff. grids but active creature - if (c.isActiveObject()) + if (c.IsActiveObject()) { EnsureGridLoadedForActiveObject(new_cell, c); @@ -1367,7 +1367,7 @@ namespace Game.Maps } // in diff. grids but active GameObject - if (go.isActiveObject()) + if (go.IsActiveObject()) { EnsureGridLoadedForActiveObject(new_cell, go); @@ -1424,7 +1424,7 @@ namespace Game.Maps } // in diff. grids but active GameObject - if (go.isActiveObject()) + if (go.IsActiveObject()) { EnsureGridLoadedForActiveObject(new_cell, go); @@ -1476,7 +1476,7 @@ namespace Game.Maps } // in diff. grids but active AreaTrigger - if (at.isActiveObject()) + if (at.IsActiveObject()) { EnsureGridLoadedForActiveObject(new_cell, at); @@ -3549,7 +3549,7 @@ namespace Game.Maps if (obj == null) Log.outError(LogFilter.Scripts, "{0} {1} object is NULL.", scriptInfo.GetDebugInfo(), isSource ? "source" : "target"); - else if (!obj.isTypeMask(TypeMask.Unit)) + else if (!obj.IsTypeMask(TypeMask.Unit)) Log.outError(LogFilter.Scripts, "{0} {1} object is not unit (TypeId: {2}, Entry: {3}, GUID: {4}), skipping.", scriptInfo.GetDebugInfo(), isSource ? "source" : "target", obj.GetTypeId(), obj.GetEntry(), obj.GetGUID().ToString()); else @@ -3627,7 +3627,7 @@ namespace Game.Maps Log.outError(LogFilter.Scripts, "{0} door guid is not specified.", scriptInfo.GetDebugInfo()); else if (source == null) Log.outError(LogFilter.Scripts, "{0} source object is NULL.", scriptInfo.GetDebugInfo()); - else if (!source.isTypeMask(TypeMask.Unit)) + else if (!source.IsTypeMask(TypeMask.Unit)) Log.outError(LogFilter.Scripts, "{0} source object is not unit (TypeId: {1}, Entry: {2}, GUID: {3}), skipping.", scriptInfo.GetDebugInfo(), source.GetTypeId(), source.GetEntry(), source.GetGUID().ToString()); else @@ -3646,7 +3646,7 @@ namespace Game.Maps { pDoor.UseDoorOrButton((uint)nTimeToToggle); - if (target != null && target.isTypeMask(TypeMask.GameObject)) + if (target != null && target.IsTypeMask(TypeMask.GameObject)) { GameObject goTarget = target.ToGameObject(); if (goTarget != null && goTarget.GetGoType() == GameObjectTypes.Button) @@ -3947,7 +3947,7 @@ namespace Game.Maps } // Check that GO is not spawned - if (!pGO.isSpawned()) + if (!pGO.IsSpawned()) { int nTimeToDespawn = Math.Max(5, (int)step.script.RespawnGameObject.DespawnDelay); pGO.SetLootState(LootState.Ready); @@ -4055,13 +4055,13 @@ namespace Game.Maps break; } - if (uSource == null || !uSource.isTypeMask(TypeMask.Unit)) + if (uSource == null || !uSource.IsTypeMask(TypeMask.Unit)) { Log.outError(LogFilter.Scripts, "{0} no source unit found for spell {1}", step.script.GetDebugInfo(), step.script.CastSpell.SpellID); break; } - if (uTarget == null || !uTarget.isTypeMask(TypeMask.Unit)) + if (uTarget == null || !uTarget.IsTypeMask(TypeMask.Unit)) { Log.outError(LogFilter.Scripts, "{0} no target unit found for spell {1}", step.script.GetDebugInfo(), step.script.CastSpell.SpellID); break; @@ -4180,7 +4180,7 @@ namespace Game.Maps Log.outError(LogFilter.Scripts, "{0} creature is already dead (Entry: {1}, GUID: {2})", step.script.GetDebugInfo(), cSource.GetEntry(), cSource.GetGUID().ToString()); else { - cSource.setDeathState(DeathState.JustDied); + cSource.SetDeathState(DeathState.JustDied); if (step.script.Kill.RemoveCorpse == 1) cSource.RemoveCorpse(); } diff --git a/Source/Game/Maps/ObjectGridLoader.cs b/Source/Game/Maps/ObjectGridLoader.cs index 3bdc637b1..c7311a273 100644 --- a/Source/Game/Maps/ObjectGridLoader.cs +++ b/Source/Game/Maps/ObjectGridLoader.cs @@ -18,8 +18,6 @@ using Framework.Constants; using Game.Entities; using System.Collections.Generic; -using System.Linq; -using System.Collections.Concurrent; namespace Game.Maps { @@ -101,7 +99,7 @@ namespace Game.Maps { map.AddToGrid(obj, new Cell(cellCoord)); obj.AddToWorld(); - if (obj.isActiveObject()) + if (obj.IsActiveObject()) map.AddToActive(obj); ++count; diff --git a/Source/Game/Miscellaneous/Formulas.cs b/Source/Game/Miscellaneous/Formulas.cs index 0e822d7ed..a1bf6a089 100644 --- a/Source/Game/Miscellaneous/Formulas.cs +++ b/Source/Game/Miscellaneous/Formulas.cs @@ -149,15 +149,15 @@ namespace Game { float xpMod = 1.0f; - gain = BaseGain(player.getLevel(), u.GetLevelForTarget(player)); + gain = BaseGain(player.GetLevel(), u.GetLevelForTarget(player)); if (gain != 0 && creature) { // Players get only 10% xp for killing creatures of lower expansion levels than himself - if ((creature.GetCreatureTemplate().HealthScalingExpansion < (int)GetExpansionForLevel(player.getLevel()))) + if ((creature.GetCreatureTemplate().HealthScalingExpansion < (int)GetExpansionForLevel(player.GetLevel()))) gain = (uint)Math.Round(gain / 10.0f); - if (creature.isElite()) + if (creature.IsElite()) { // Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus. if (u.GetMap().IsDungeon()) diff --git a/Source/Game/Movement/Generators/ConfusedGenerator.cs b/Source/Game/Movement/Generators/ConfusedGenerator.cs index f298b6a11..abee38951 100644 --- a/Source/Game/Movement/Generators/ConfusedGenerator.cs +++ b/Source/Game/Movement/Generators/ConfusedGenerator.cs @@ -79,7 +79,7 @@ namespace Game.Movement // currently moving, update location owner.AddUnitState(UnitState.ConfusedMove); - if (owner.moveSpline.Finalized()) + if (owner.MoveSpline.Finalized()) i_nextMoveTime.Reset(RandomHelper.IRand(800, 1500)); } else diff --git a/Source/Game/Movement/Generators/FleeingGenerator.cs b/Source/Game/Movement/Generators/FleeingGenerator.cs index 4aa1238a5..6b6c0eae1 100644 --- a/Source/Game/Movement/Generators/FleeingGenerator.cs +++ b/Source/Game/Movement/Generators/FleeingGenerator.cs @@ -161,7 +161,7 @@ namespace Game.Movement } i_nextCheckTime.Update(time_diff); - if (i_nextCheckTime.Passed() && owner.moveSpline.Finalized()) + if (i_nextCheckTime.Passed() && owner.MoveSpline.Finalized()) _setTargetLocation(owner); return true; diff --git a/Source/Game/Movement/Generators/HomeMovement.cs b/Source/Game/Movement/Generators/HomeMovement.cs index fbf20aae5..61fb9704f 100644 --- a/Source/Game/Movement/Generators/HomeMovement.cs +++ b/Source/Game/Movement/Generators/HomeMovement.cs @@ -44,7 +44,7 @@ namespace Game.AI public override bool DoUpdate(T owner, uint time_diff) { - arrived = skipToHome || owner.moveSpline.Finalized(); + arrived = skipToHome || owner.MoveSpline.Finalized(); return !arrived; } diff --git a/Source/Game/Movement/Generators/IdleMovement.cs b/Source/Game/Movement/Generators/IdleMovement.cs index fe96a93a0..43b395162 100644 --- a/Source/Game/Movement/Generators/IdleMovement.cs +++ b/Source/Game/Movement/Generators/IdleMovement.cs @@ -31,7 +31,7 @@ namespace Game.Movement public override void Reset(Unit owner) { - if (!owner.isStopped()) + if (!owner.IsStopped()) owner.StopMoving(); } public override void Initialize(Unit owner) diff --git a/Source/Game/Movement/Generators/MovementGenerators.cs b/Source/Game/Movement/Generators/MovementGenerators.cs index afe29b6e2..8061b9b81 100644 --- a/Source/Game/Movement/Generators/MovementGenerators.cs +++ b/Source/Game/Movement/Generators/MovementGenerators.cs @@ -75,12 +75,12 @@ namespace Game.Movement { public override void targetObjectBuildLink() { - getTarget().addFollower(this); + getTarget().AddFollower(this); } public override void targetObjectDestroyLink() { - getTarget().removeFollower(this); + getTarget().RemoveFollower(this); } public override void sourceObjectDestroyLink() diff --git a/Source/Game/Movement/Generators/PathGenerator.cs b/Source/Game/Movement/Generators/PathGenerator.cs index 92fbcefaa..24daad403 100644 --- a/Source/Game/Movement/Generators/PathGenerator.cs +++ b/Source/Game/Movement/Generators/PathGenerator.cs @@ -20,7 +20,6 @@ using Framework.GameMath; using Game.Entities; using Game.Maps; using System; -using System.Linq; namespace Game.Movement { diff --git a/Source/Game/Movement/Generators/PointMovement.cs b/Source/Game/Movement/Generators/PointMovement.cs index 9b73ff179..bb94e2d91 100644 --- a/Source/Game/Movement/Generators/PointMovement.cs +++ b/Source/Game/Movement/Generators/PointMovement.cs @@ -61,7 +61,7 @@ namespace Game.Movement // Call for creature group update Creature creature = owner.ToCreature(); if (creature != null) - if (creature.GetFormation() != null && creature.GetFormation().getLeader() == creature) + if (creature.GetFormation() != null && creature.GetFormation().GetLeader() == creature) creature.GetFormation().LeaderMoveTo(i_x, i_y, i_z); } @@ -78,7 +78,7 @@ namespace Game.Movement owner.AddUnitState(UnitState.RoamingMove); - if (id != EventId.ChargePrepath && i_recalculateSpeed && !owner.moveSpline.Finalized()) + if (id != EventId.ChargePrepath && i_recalculateSpeed && !owner.MoveSpline.Finalized()) { i_recalculateSpeed = false; MoveSplineInit init = new MoveSplineInit(owner); @@ -90,11 +90,11 @@ namespace Game.Movement // Call for creature group update Creature creature = owner.ToCreature(); if (creature != null) - if (creature.GetFormation() != null && creature.GetFormation().getLeader() == creature) + if (creature.GetFormation() != null && creature.GetFormation().GetLeader() == creature) creature.GetFormation().LeaderMoveTo(i_x, i_y, i_z); } - return !owner.moveSpline.Finalized(); + return !owner.MoveSpline.Finalized(); } public override void DoFinalize(T owner) @@ -102,7 +102,7 @@ namespace Game.Movement if (!owner.HasUnitState(UnitState.Charging)) owner.ClearUnitState(UnitState.Roaming | UnitState.RoamingMove); - if (owner.moveSpline.Finalized()) + if (owner.MoveSpline.Finalized()) MovementInform(owner); } @@ -160,7 +160,7 @@ namespace Game.Movement // Does almost nothing - just doesn't allows previous movegen interrupt current effect. public class EffectMovementGenerator : IMovementGenerator { - public EffectMovementGenerator(uint Id, uint arrivalSpellId = 0, ObjectGuid arrivalSpellTargetGuid = default(ObjectGuid)) + public EffectMovementGenerator(uint Id, uint arrivalSpellId = 0, ObjectGuid arrivalSpellTargetGuid = default) { _Id = Id; _arrivalSpellId = arrivalSpellId; @@ -191,7 +191,7 @@ namespace Game.Movement public override bool Update(Unit owner, uint time_diff) { - return !owner.moveSpline.Finalized(); + return !owner.MoveSpline.Finalized(); } public override void Initialize(Unit owner) { } diff --git a/Source/Game/Movement/Generators/RandomMovement.cs b/Source/Game/Movement/Generators/RandomMovement.cs index 5e5406b1a..7473080be 100644 --- a/Source/Game/Movement/Generators/RandomMovement.cs +++ b/Source/Game/Movement/Generators/RandomMovement.cs @@ -75,7 +75,7 @@ namespace Game.Movement return true; } - if (creature.moveSpline.Finalized()) + if (creature.MoveSpline.Finalized()) { i_nextMoveTime.Update((int)diff); if (i_nextMoveTime.Passed()) @@ -167,7 +167,7 @@ namespace Game.Movement init.Launch(); //Call for creature group update - if (creature.GetFormation() != null && creature.GetFormation().getLeader() == creature) + if (creature.GetFormation() != null && creature.GetFormation().GetLeader() == creature) creature.GetFormation().LeaderMoveTo(destX, destY, destZ); } diff --git a/Source/Game/Movement/Generators/SplineChainMovementGenerator.cs b/Source/Game/Movement/Generators/SplineChainMovementGenerator.cs index e57ae0ee9..cd9aaf892 100644 --- a/Source/Game/Movement/Generators/SplineChainMovementGenerator.cs +++ b/Source/Game/Movement/Generators/SplineChainMovementGenerator.cs @@ -20,7 +20,6 @@ using Framework.GameMath; using Game.Entities; using System; using System.Collections.Generic; -using System.Linq; namespace Game.Movement { @@ -131,7 +130,7 @@ namespace Game.Movement // _msToNext being zero here means we're on the final spline if (_msToNext == 0) { - finished = me.moveSpline.Finalized(); + finished = me.MoveSpline.Finalized(); return !finished; } @@ -158,14 +157,14 @@ namespace Game.Movement { if (_nextIndex == 0) return new SplineChainResumeInfo(_id, _chain, _walk, 0, 0, _msToNext); - if (me.moveSpline.Finalized()) + if (me.MoveSpline.Finalized()) { if (_nextIndex < _chainSize) return new SplineChainResumeInfo(_id, _chain, _walk, _nextIndex, 0, 1u); else return new SplineChainResumeInfo(); } - return new SplineChainResumeInfo(_id, _chain, _walk, (byte)(_nextIndex - 1), (byte)(me.moveSpline._currentSplineIdx()), _msToNext); + return new SplineChainResumeInfo(_id, _chain, _walk, (byte)(_nextIndex - 1), (byte)(me.MoveSpline._currentSplineIdx()), _msToNext); } public override void Reset(Unit owner) { } diff --git a/Source/Game/Movement/Generators/TargetMovement.cs b/Source/Game/Movement/Generators/TargetMovement.cs index 1f6545bdc..a22015422 100644 --- a/Source/Game/Movement/Generators/TargetMovement.cs +++ b/Source/Game/Movement/Generators/TargetMovement.cs @@ -66,7 +66,7 @@ namespace Game.Movement // prevent movement while casting spells with cast time or channel time if (owner.IsMovementPreventedByCasting()) { - if (!owner.isStopped()) + if (!owner.IsStopped()) owner.StopMoving(); return true; } @@ -91,8 +91,8 @@ namespace Game.Movement else allowed_dist = owner.GetCombatReach() + WorldConfig.GetFloatValue(WorldCfg.RateTargetPosRecalculationRange); - Vector3 dest = owner.moveSpline.FinalDestination(); - if (owner.moveSpline.onTransport) + Vector3 dest = owner.MoveSpline.FinalDestination(); + if (owner.MoveSpline.onTransport) { float o = 0; ITransport transport = owner.GetDirectTransport(); @@ -115,7 +115,7 @@ namespace Game.Movement if (recalculateTravel || targetMoved) _setTargetLocation(owner, targetMoved); - if (owner.moveSpline.Finalized()) + if (owner.MoveSpline.Finalized()) { MovementInform(owner); if (angle == 0.0f && !owner.HasInArc(0.01f, target)) @@ -147,7 +147,7 @@ namespace Game.Movement if (owner.IsMovementPreventedByCasting()) return; - if (owner.IsTypeId(TypeId.Unit) && !target.isInAccessiblePlaceFor(owner.ToCreature())) + if (owner.IsTypeId(TypeId.Unit) && !target.IsInAccessiblePlaceFor(owner.ToCreature())) { owner.ToCreature().SetCannotReachTarget(true); return; diff --git a/Source/Game/Movement/Generators/WaypointMovement.cs b/Source/Game/Movement/Generators/WaypointMovement.cs index 561f2b4d3..339a65dec 100644 --- a/Source/Game/Movement/Generators/WaypointMovement.cs +++ b/Source/Game/Movement/Generators/WaypointMovement.cs @@ -84,7 +84,7 @@ namespace Game.Movement if (creature.IsStopped()) Stop(WorldConfig.GetIntValue(WorldCfg.CreatureStopForPlayer)); - else if (creature.moveSpline.Finalized()) + else if (creature.MoveSpline.Finalized()) { OnArrived(creature); return StartMove(creature); @@ -226,7 +226,7 @@ namespace Game.Movement init.Launch(); //Call for creature group update - if (creature.GetFormation() != null && creature.GetFormation().getLeader() == creature) + if (creature.GetFormation() != null && creature.GetFormation().GetLeader() == creature) { creature.SetWalk(node.moveType != WaypointMoveType.Run); creature.GetFormation().LeaderMoveTo(formationDest.posX, formationDest.posY, formationDest.posZ); @@ -358,9 +358,9 @@ namespace Game.Movement owner.Dismount(); owner.RemoveUnitFlag(UnitFlags.RemoveClientControl | UnitFlags.TaxiFlight); - if (owner.m_taxi.empty()) + if (owner.m_taxi.Empty()) { - owner.getHostileRefManager().setOnlineOfflineState(true); + owner.GetHostileRefManager().setOnlineOfflineState(true); // update z position to ground and orientation for landing point // this prevent cheating with landing point at lags // when client side flight end early in comparison server side @@ -374,7 +374,7 @@ namespace Game.Movement public override void DoReset(Player owner) { - owner.getHostileRefManager().setOnlineOfflineState(false); + owner.GetHostileRefManager().setOnlineOfflineState(false); owner.AddUnitState(UnitState.InFlight); owner.AddUnitFlag(UnitFlags.RemoveClientControl | UnitFlags.TaxiFlight); @@ -397,7 +397,7 @@ namespace Game.Movement public override bool DoUpdate(Player player, uint time_diff) { - uint pointId = (uint)player.moveSpline.currentPathIdx(); + uint pointId = (uint)player.MoveSpline.currentPathIdx(); if (pointId > i_currentNode) { bool departureEvent = true; diff --git a/Source/Game/Movement/MotionMaster.cs b/Source/Game/Movement/MotionMaster.cs index 7eecc45c1..cdc4996ff 100644 --- a/Source/Game/Movement/MotionMaster.cs +++ b/Source/Game/Movement/MotionMaster.cs @@ -174,10 +174,10 @@ namespace Game.Movement x = 0f; y = 0f; z = 0f; - if (_owner.moveSpline.Finalized()) + if (_owner.MoveSpline.Finalized()) return false; - Vector3 dest = _owner.moveSpline.FinalDestination(); + Vector3 dest = _owner.MoveSpline.FinalDestination(); x = dest.X; y = dest.Y; z = dest.Z; diff --git a/Source/Game/Movement/MoveSplineInit.cs b/Source/Game/Movement/MoveSplineInit.cs index 5f5db5020..33d676c15 100644 --- a/Source/Game/Movement/MoveSplineInit.cs +++ b/Source/Game/Movement/MoveSplineInit.cs @@ -70,7 +70,7 @@ namespace Game.Movement public int Launch() { - MoveSpline move_spline = unit.moveSpline; + MoveSpline move_spline = unit.MoveSpline; bool transport = !unit.GetTransGUID().IsEmpty(); Vector4 real_position = new Vector4(); @@ -146,7 +146,7 @@ namespace Game.Movement public void Stop() { - MoveSpline move_spline = unit.moveSpline; + MoveSpline move_spline = unit.MoveSpline; // No need to stop if we are not moving if (move_spline.Finalized()) diff --git a/Source/Game/Movement/Spline.cs b/Source/Game/Movement/Spline.cs index e5d8f7b6e..fd57b6622 100644 --- a/Source/Game/Movement/Spline.cs +++ b/Source/Game/Movement/Spline.cs @@ -20,7 +20,6 @@ using Framework.GameMath; using Game.Entities; using Game.Maps; using System; -using System.Linq; namespace Game.Movement { diff --git a/Source/Game/Network/Packets/AchievementPackets.cs b/Source/Game/Network/Packets/AchievementPackets.cs index 58b5caf30..68cc6c3e1 100644 --- a/Source/Game/Network/Packets/AchievementPackets.cs +++ b/Source/Game/Network/Packets/AchievementPackets.cs @@ -19,7 +19,6 @@ using Framework.Constants; using Game.Entities; using System; using System.Collections.Generic; -using System.Linq; namespace Game.Network.Packets { diff --git a/Source/Game/Network/Packets/AuthenticationPackets.cs b/Source/Game/Network/Packets/AuthenticationPackets.cs index 2fa1a0391..3e01b2c63 100644 --- a/Source/Game/Network/Packets/AuthenticationPackets.cs +++ b/Source/Game/Network/Packets/AuthenticationPackets.cs @@ -22,7 +22,6 @@ using Framework.IO; using Game.DataStorage; using System; using System.Collections.Generic; -using System.Net; using System.Security.Cryptography; using System.Linq; diff --git a/Source/Game/Network/Packets/MovementPackets.cs b/Source/Game/Network/Packets/MovementPackets.cs index 09e85e41c..6089b22a0 100644 --- a/Source/Game/Network/Packets/MovementPackets.cs +++ b/Source/Game/Network/Packets/MovementPackets.cs @@ -21,7 +21,6 @@ using Framework.GameMath; using Game.Entities; using Game.Movement; using System.Collections.Generic; -using System.Linq; using System; namespace Game.Network.Packets diff --git a/Source/Game/Network/Packets/PartyPackets.cs b/Source/Game/Network/Packets/PartyPackets.cs index d39afe1de..b6f61739e 100644 --- a/Source/Game/Network/Packets/PartyPackets.cs +++ b/Source/Game/Network/Packets/PartyPackets.cs @@ -258,17 +258,17 @@ namespace Game.Network.Packets if (player.IsFFAPvP()) MemberStats.Status |= GroupMemberOnlineStatus.PVPFFA; - if (player.isAFK()) + if (player.IsAFK()) MemberStats.Status |= GroupMemberOnlineStatus.AFK; - if (player.isDND()) + if (player.IsDND()) MemberStats.Status |= GroupMemberOnlineStatus.DND; if (player.GetVehicle()) MemberStats.Status |= GroupMemberOnlineStatus.Vehicle; // Level - MemberStats.Level = (ushort)player.getLevel(); + MemberStats.Level = (ushort)player.GetLevel(); // Health MemberStats.CurrentHealth = (int)player.GetHealth(); diff --git a/Source/Game/Network/Packets/QueryPackets.cs b/Source/Game/Network/Packets/QueryPackets.cs index 814b3d83f..d67113ec1 100644 --- a/Source/Game/Network/Packets/QueryPackets.cs +++ b/Source/Game/Network/Packets/QueryPackets.cs @@ -617,7 +617,7 @@ namespace Game.Network.Packets RaceID = player.GetRace(); Sex = (Gender)(byte)player.m_playerData.NativeSex; ClassID = player.GetClass(); - Level = (byte)player.getLevel(); + Level = (byte)player.GetLevel(); DeclinedName names = player.GetDeclinedNames(); if (names != null) diff --git a/Source/Game/Network/Packets/SpellPackets.cs b/Source/Game/Network/Packets/SpellPackets.cs index c573aa6b7..57d4d1ae9 100644 --- a/Source/Game/Network/Packets/SpellPackets.cs +++ b/Source/Game/Network/Packets/SpellPackets.cs @@ -1191,7 +1191,7 @@ namespace Game.Network.Packets PlayerLevelDelta = (short)target.m_activePlayerData.ScalingPlayerLevelDelta; PlayerItemLevel = (ushort)target.GetAverageItemLevel(); ScalingHealthItemLevelCurveID = (ushort)target.m_unitData.ScalingHealthItemLevelCurveID; - TargetLevel = (byte)target.getLevel(); + TargetLevel = (byte)target.GetLevel(); Expansion = (byte)creatureTemplate.RequiredExpansion; TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel; TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel; @@ -1207,7 +1207,7 @@ namespace Game.Network.Packets PlayerLevelDelta = (short)attacker.m_activePlayerData.ScalingPlayerLevelDelta; PlayerItemLevel = (ushort)attacker.GetAverageItemLevel(); ScalingHealthItemLevelCurveID = (ushort)target.m_unitData.ScalingHealthItemLevelCurveID; - TargetLevel = (byte)target.getLevel(); + TargetLevel = (byte)target.GetLevel(); Expansion = (byte)creatureTemplate.RequiredExpansion; TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel; TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel; @@ -1223,7 +1223,7 @@ namespace Game.Network.Packets TuningType = ContentTuningType.CreatureToCreatureDamage; PlayerLevelDelta = 0; PlayerItemLevel = 0; - TargetLevel = (byte)target.getLevel(); + TargetLevel = (byte)target.GetLevel(); Expansion = (byte)creatureTemplate.RequiredExpansion; TargetMinScalingLevel = (byte)creatureTemplate.levelScaling.Value.MinLevel; TargetMaxScalingLevel = (byte)creatureTemplate.levelScaling.Value.MaxLevel; diff --git a/Source/Game/Network/Packets/TalentPackets.cs b/Source/Game/Network/Packets/TalentPackets.cs index f7976cbb8..fd4f57668 100644 --- a/Source/Game/Network/Packets/TalentPackets.cs +++ b/Source/Game/Network/Packets/TalentPackets.cs @@ -18,8 +18,6 @@ using Framework.Constants; using Game.Entities; using System.Collections.Generic; -using Framework.Collections; -using Framework.Dynamic; namespace Game.Network.Packets { diff --git a/Source/Game/Phasing/PhaseShift.cs b/Source/Game/Phasing/PhaseShift.cs index 63f8c05b3..7056f3b59 100644 --- a/Source/Game/Phasing/PhaseShift.cs +++ b/Source/Game/Phasing/PhaseShift.cs @@ -17,10 +17,8 @@ using System; using System.Collections.Generic; -using System.Text; using Game.Conditions; using Game.Entities; -using System.Collections.Concurrent; using System.Linq; namespace Game diff --git a/Source/Game/Pools/PoolManager.cs b/Source/Game/Pools/PoolManager.cs index 7ac3fed37..14329d475 100644 --- a/Source/Game/Pools/PoolManager.cs +++ b/Source/Game/Pools/PoolManager.cs @@ -883,7 +883,7 @@ namespace Game GameObject go = GameObject.CreateGameObjectFromDB(obj.guid, map, false); if (go) { - if (go.isSpawnedByDefault()) + if (go.IsSpawnedByDefault()) map.AddToMap(go); } } diff --git a/Source/Game/Quest/Quest.cs b/Source/Game/Quest/Quest.cs index 28183d6cf..f3ef10b77 100644 --- a/Source/Game/Quest/Quest.cs +++ b/Source/Game/Quest/Quest.cs @@ -23,7 +23,6 @@ using Game.Entities; using Game.Network.Packets; using System; using System.Collections.Generic; -using Game.Network; namespace Game { @@ -263,10 +262,10 @@ namespace Game return 0; float multiplier = 1.0f; - if (questLevel != player.getLevel()) - multiplier = CliDB.XpGameTable.GetRow(Math.Min(player.getLevel(), questLevel)).Divisor / CliDB.XpGameTable.GetRow(player.getLevel()).Divisor; + if (questLevel != player.GetLevel()) + multiplier = CliDB.XpGameTable.GetRow(Math.Min(player.GetLevel(), questLevel)).Divisor / CliDB.XpGameTable.GetRow(player.GetLevel()).Divisor; - int diffFactor = (int)(2 * (questLevel + (Level == -1 ? 0 : 5) - player.getLevel()) + 10); + int diffFactor = (int)(2 * (questLevel + (Level == -1 ? 0 : 5) - player.GetLevel()) + 10); if (diffFactor < 1) diffFactor = 1; else if (diffFactor > 10) diff --git a/Source/Game/Reputation/ReputationManager.cs b/Source/Game/Reputation/ReputationManager.cs index 2701f84b2..0dbe64327 100644 --- a/Source/Game/Reputation/ReputationManager.cs +++ b/Source/Game/Reputation/ReputationManager.cs @@ -91,8 +91,8 @@ namespace Game if (factionEntry == null) return 0; - ulong raceMask = _player.getRaceMask(); - uint classMask = _player.getClassMask(); + ulong raceMask = _player.GetRaceMask(); + uint classMask = _player.GetClassMask(); for (var i = 0; i < 4; i++) { if ((Convert.ToBoolean(factionEntry.ReputationRaceMask[i] & raceMask) || @@ -149,8 +149,8 @@ namespace Game if (factionEntry == null) return 0; - ulong raceMask = _player.getRaceMask(); - uint classMask = _player.getClassMask(); + ulong raceMask = _player.GetRaceMask(); + uint classMask = _player.GetClassMask(); for (int i = 0; i < 4; i++) { if ((Convert.ToBoolean(factionEntry.ReputationRaceMask[i] & raceMask) || @@ -399,7 +399,7 @@ namespace Game var factionEntry = CliDB.FactionStorage.LookupByKey(factionTemplateEntry.Faction); if (factionEntry.Id != 0) // Never show factions of the opposing team - if (!Convert.ToBoolean(factionEntry.ReputationRaceMask[1] & _player.getRaceMask()) && factionEntry.ReputationBase[1] == Reputation_Bottom) + if (!Convert.ToBoolean(factionEntry.ReputationRaceMask[1] & _player.GetRaceMask()) && factionEntry.ReputationBase[1] == Reputation_Bottom) SetVisible(factionEntry); } diff --git a/Source/Game/Scripting/ScriptManager.cs b/Source/Game/Scripting/ScriptManager.cs index 0c5d416c4..619be2e6b 100644 --- a/Source/Game/Scripting/ScriptManager.cs +++ b/Source/Game/Scripting/ScriptManager.cs @@ -1415,7 +1415,7 @@ namespace Game.Scripting { return RunScriptRet(func, id, ret); } - public U RunScriptRet(Func func, uint id, U ret = default(U)) where T : ScriptObject + public U RunScriptRet(Func func, uint id, U ret = default) where T : ScriptObject { var reg = GetScriptRegistry(); if (reg == null || reg.Empty()) diff --git a/Source/Game/Server/WorldSession.cs b/Source/Game/Server/WorldSession.cs index c0407a081..2e2becdd8 100644 --- a/Source/Game/Server/WorldSession.cs +++ b/Source/Game/Server/WorldSession.cs @@ -101,7 +101,7 @@ namespace Game //FIXME: logout must be delayed in case lost connection with client in time of combat if (GetPlayer().GetDeathTimer() != 0) { - _player.getHostileRefManager().deleteReferences(); + _player.GetHostileRefManager().deleteReferences(); _player.BuildPlayerRepop(); _player.RepopAtGraveyard(); } @@ -202,7 +202,7 @@ namespace Game // calls to GetMap in this case may cause crashes GetPlayer().CleanupsBeforeDelete(); Log.outInfo(LogFilter.Player, "Account: {0} (IP: {1}) Logout Character:[{2}] (GUID: {3}) Level: {4}", - GetAccountId(), GetRemoteAddress(), _player.GetName(), _player.GetGUID().ToString(), _player.getLevel()); + GetAccountId(), GetRemoteAddress(), _player.GetName(), _player.GetGUID().ToString(), _player.GetLevel()); Map map = GetPlayer().GetMap(); if (map != null) diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index 90288aeb5..b6fa880a4 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -294,7 +294,7 @@ namespace Game.Spells m_owner = owner; m_timeCla = 0; m_updateTargetMapInterval = 0; - m_casterLevel = caster != null ? caster.getLevel() : m_spellInfo.SpellLevel; + m_casterLevel = caster != null ? caster.GetLevel() : m_spellInfo.SpellLevel; m_procCharges = 0; m_stackAmount = 1; m_isRemoved = false; @@ -1800,8 +1800,8 @@ namespace Game.Spells } // proc chance is reduced by an additional 3.333% per level past 60 - if (procEntry.AttributesMask.HasAnyFlag(ProcAttributes.ReduceProc60) && eventInfo.GetActor().getLevel() > 60) - chance = Math.Max(0.0f, (1.0f - ((eventInfo.GetActor().getLevel() - 60) * 1.0f / 30.0f)) * chance); + if (procEntry.AttributesMask.HasAnyFlag(ProcAttributes.ReduceProc60) && eventInfo.GetActor().GetLevel() > 60) + chance = Math.Max(0.0f, (1.0f - ((eventInfo.GetActor().GetLevel() - 60) * 1.0f / 30.0f)) * chance); return chance; } @@ -2388,12 +2388,12 @@ namespace Game.Spells } return (effMask & availableEffectMask); } - public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1) + public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, int castItemLevel = -1) { bool throwway; return TryRefreshStackOrCreate(spellproto, castId, tryEffMask, owner, caster, out throwway, baseAmount, castItem, casterGUID, resetPeriodicTimer, castItemGuid, castItemLevel); } - public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, out bool refresh, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1) + public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, out bool refresh, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, int castItemLevel = -1) { Cypher.Assert(spellproto != null); Cypher.Assert(owner != null); @@ -2418,7 +2418,7 @@ namespace Game.Spells else return Create(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemLevel); } - public static Aura TryCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1) + public static Aura TryCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default, ObjectGuid castItemGuid = default, int castItemLevel = -1) { Cypher.Assert(spellproto != null); Cypher.Assert(owner != null); @@ -2448,7 +2448,7 @@ namespace Game.Spells casterGUID = caster.GetGUID(); // check if aura can be owned by owner - if (owner.isTypeMask(TypeMask.Unit)) + if (owner.IsTypeMask(TypeMask.Unit)) if (!owner.IsInWorld || owner.ToUnit().IsDuringRemoveFromWorld()) // owner not in world so don't allow to own not self casted single target auras if (casterGUID != owner.GetGUID() && spellproto.IsSingleTarget()) diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index c03cc2778..9521e2ff2 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -690,7 +690,7 @@ namespace Game.Spells uint triggerSpellId = GetSpellEffectInfo().TriggerSpell; SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId); if (triggeredSpellInfo != null) - if (aurApp.GetTarget().m_extraAttacks != 0 && triggeredSpellInfo.HasEffect(SpellEffectName.AddExtraAttacks)) + if (aurApp.GetTarget().ExtraAttacks != 0 && triggeredSpellInfo.HasEffect(SpellEffectName.AddExtraAttacks)) return false; break; } @@ -1216,7 +1216,7 @@ namespace Game.Spells // die at aura end else if (target.IsAlive()) // call functions which may have additional effects after chainging state of unit - target.setDeathState(DeathState.JustDied); + target.SetDeathState(DeathState.JustDied); } [AuraEffectHandler(AuraType.Ghost)] @@ -1443,10 +1443,10 @@ namespace Game.Spells if (apply) { // update active transform spell only when transform not set or not overwriting negative by positive case - SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.getTransForm()); + SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransForm()); if (transformSpellInfo == null || !GetSpellInfo().IsPositive() || transformSpellInfo.IsPositive()) { - target.setTransForm(GetId()); + target.SetTransForm(GetId()); // special case (spell specific functionality) if (GetMiscValue() == 0) { @@ -1615,7 +1615,7 @@ namespace Game.Spells // for players, start regeneration after 1s (in polymorph fast regeneration case) // only if caster is Player (after patch 2.4.2) if (GetCasterGUID().IsPlayer()) - target.ToPlayer().setRegenTimerCount(1 * Time.InMilliseconds); + target.ToPlayer().SetRegenTimerCount(1 * Time.InMilliseconds); //dismount polymorphed target (after patch 2.4.2) if (target.IsMounted()) @@ -1625,7 +1625,7 @@ namespace Game.Spells else { if (target.GetTransForm() == GetId()) - target.setTransForm(0); + target.SetTransForm(0); target.RestoreDisplayId(target.IsMounted()); @@ -1727,7 +1727,7 @@ namespace Game.Spells if (GetCasterGUID() == target.GetGUID() && target.GetCurrentSpell(CurrentSpellTypes.Generic) != null) target.FinishSpell(CurrentSpellTypes.Generic, false); target.InterruptNonMeleeSpells(true); - target.getHostileRefManager().deleteReferences(); + target.GetHostileRefManager().deleteReferences(); // stop handling the effect if it was removed by linked event if (aurApp.HasRemoveMode()) @@ -2375,7 +2375,7 @@ namespace Game.Spells Unit caster = GetCaster(); if (caster != null && caster.IsAlive()) - target.getHostileRefManager().addTempThreat(GetAmount(), apply); + target.GetHostileRefManager().addTempThreat(GetAmount(), apply); } [AuraEffectHandler(AuraType.ModTaunt)] @@ -3162,7 +3162,7 @@ namespace Game.Spells // players in corpse state may mean two different states: /// 1. player just died but did not release (in this case health == 0) /// 2. player is corpse running (ie ghost) (in this case health == 1) - if (target.getDeathState() == DeathState.Corpse) + if (target.GetDeathState() == DeathState.Corpse) zeroHealth = target.GetHealth() == 0; for (int i = (int)Stats.Strength; i < (int)Stats.Max; i++) @@ -3640,8 +3640,8 @@ namespace Game.Spells } else { - target.m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount()); - target.m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount()); + target.ModMeleeHitChance += (apply) ? GetAmount() : (-GetAmount()); + target.ModRangedHitChance += (apply) ? GetAmount() : (-GetAmount()); } } @@ -3656,7 +3656,7 @@ namespace Game.Spells if (target.IsTypeId(TypeId.Player)) target.ToPlayer().UpdateSpellHitChances(); else - target.m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount()); + target.ModSpellHitChance += (apply) ? GetAmount() : (-GetAmount()); } [AuraEffectHandler(AuraType.ModSpellCritChance)] @@ -3670,7 +3670,7 @@ namespace Game.Spells if (target.IsTypeId(TypeId.Player)) target.ToPlayer().UpdateSpellCritChance(); else - target.m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount(); + target.BaseSpellCritChance += (apply) ? GetAmount() : -GetAmount(); } [AuraEffectHandler(AuraType.ModCritPct)] @@ -3683,7 +3683,7 @@ namespace Game.Spells if (!target.IsTypeId(TypeId.Player)) { - target.m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount(); + target.BaseSpellCritChance += (apply) ? GetAmount() : -GetAmount(); return; } @@ -3874,7 +3874,7 @@ namespace Game.Spells Unit target = aurApp.GetTarget(); - if ((target.getClassMask() & (uint)Class.ClassMaskWandUsers) != 0) + if ((target.GetClassMask() & (uint)Class.ClassMaskWandUsers) != 0) return; target.HandleStatModifier(UnitMods.AttackPowerRanged, UnitModifierType.TotalValue, GetAmount(), apply); @@ -3900,7 +3900,7 @@ namespace Game.Spells Unit target = aurApp.GetTarget(); - if ((target.getClassMask() & (uint)Class.ClassMaskWandUsers) != 0) + if ((target.GetClassMask() & (uint)Class.ClassMaskWandUsers) != 0) return; //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1 @@ -4485,8 +4485,8 @@ namespace Game.Spells if (GetSpellEffectInfo().ItemType == 6265) { // Soul Shard only from units that grant XP or honor - if (!plCaster.isHonorOrXPTarget(target) || - (target.IsTypeId(TypeId.Unit) && !target.ToCreature().isTappedBy(plCaster))) + if (!plCaster.IsHonorOrXPTarget(target) || + (target.IsTypeId(TypeId.Unit) && !target.ToCreature().IsTappedBy(plCaster))) return; } @@ -5338,7 +5338,7 @@ namespace Game.Spells // There is a Chance to make a Soul Shard when Drain soul does damage if (GetSpellInfo().SpellFamilyName == SpellFamilyNames.Warlock && GetSpellInfo().SpellFamilyFlags[0].HasAnyFlag(0x00004000u)) { - if (caster.IsTypeId(TypeId.Player) && caster.ToPlayer().isHonorOrXPTarget(target)) + if (caster.IsTypeId(TypeId.Player) && caster.ToPlayer().IsHonorOrXPTarget(target)) caster.CastSpell(caster, 95810, true, null, this); } if (GetSpellInfo().SpellFamilyName == SpellFamilyNames.Generic) @@ -5511,7 +5511,7 @@ namespace Game.Spells HealInfo healInfo = new HealInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo().GetSchoolMask()); caster.HealBySpell(healInfo); - caster.getHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo()); + caster.GetHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo()); caster.ProcSkillsAndAuras(caster, ProcFlags.DonePeriodic, ProcFlags.TakenPeriodic, ProcFlagsSpellType.Heal, ProcFlagsSpellPhase.None, hitMask, null, null, healInfo); } @@ -5634,7 +5634,7 @@ namespace Game.Spells SpellPeriodicAuraLogInfo pInfo = new SpellPeriodicAuraLogInfo(this, heal, (uint)damage, heal - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit); target.SendPeriodicAuraLog(pInfo); - target.getHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo()); + target.GetHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo()); // %-based heal - does not proc auras if (GetAuraType() == AuraType.ObsModHealth) @@ -5728,7 +5728,7 @@ namespace Game.Spells int gain = target.ModifyPower(powerType, amount); if (caster != null) - target.getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo()); + target.GetHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo()); target.SendPeriodicAuraLog(pInfo); } @@ -5756,7 +5756,7 @@ namespace Game.Spells int gain = target.ModifyPower(powerType, amount); if (caster != null) - target.getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo()); + target.GetHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo()); target.SendPeriodicAuraLog(pInfo); } @@ -5792,7 +5792,7 @@ namespace Game.Spells // Set trigger flag ProcFlags procAttacker = ProcFlags.DonePeriodic; ProcFlags procVictim = ProcFlags.TakenPeriodic; - ProcFlagsHit hitMask = Unit.createProcHitMask(damageInfo, SpellMissInfo.None); + ProcFlagsHit hitMask = Unit.CreateProcHitMask(damageInfo, SpellMissInfo.None); ProcFlagsSpellType spellTypeMask = ProcFlagsSpellType.NoDmgHeal; if (damageInfo.damage != 0) { diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 85dc0f299..d8e744352 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -31,13 +31,12 @@ using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; -using Game.AI; namespace Game.Spells { public partial class Spell : IDisposable { - public Spell(Unit caster, SpellInfo info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID = default(ObjectGuid), bool skipcheck = false) + public Spell(Unit caster, SpellInfo info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID = default, bool skipcheck = false) { m_spellInfo = info; m_caster = (info.HasAttribute(SpellAttr6.CastByCharmer) && caster.GetCharmerOrOwner() != null ? caster.GetCharmerOrOwner() : caster); @@ -60,7 +59,7 @@ namespace Game.Spells if (m_attackType == WeaponAttackType.RangedAttack) { - if ((m_caster.getClassMask() & (uint)Class.ClassMaskWandUsers) != 0 && m_caster.IsTypeId(TypeId.Player)) + if ((m_caster.GetClassMask() & (uint)Class.ClassMaskWandUsers) != 0 && m_caster.IsTypeId(TypeId.Player)) { Item pItem = m_caster.ToPlayer().GetWeaponForAttack(WeaponAttackType.RangedAttack); if (pItem != null) @@ -1734,7 +1733,7 @@ namespace Game.Spells if (unit.IsAlive() != target.alive) return; - if (getState() == SpellState.Delayed && !m_spellInfo.IsPositive() && (GameTime.GetGameTimeMS() - target.timeDelay) <= unit.m_lastSanctuaryTime) + if (getState() == SpellState.Delayed && !m_spellInfo.IsPositive() && (GameTime.GetGameTimeMS() - target.timeDelay) <= unit.LastSanctuaryTime) return; // No missinfo in that case // Get original caster (if exist) and calculate damage/healing from him data @@ -1870,7 +1869,7 @@ namespace Game.Spells HealInfo healInfo = new HealInfo(caster, unitTarget, addhealth, m_spellInfo, m_spellInfo.GetSchoolMask()); caster.HealBySpell(healInfo, crit); - unitTarget.getHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, m_spellInfo); + unitTarget.GetHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, m_spellInfo); m_healing = (int)healInfo.GetEffectiveHeal(); // Do triggers for unit @@ -1896,7 +1895,7 @@ namespace Game.Spells caster.CalculateSpellDamageTaken(damageInfo, m_damage, m_spellInfo, m_attackType, target.crit); caster.DealDamageMods(damageInfo.target, ref damageInfo.damage, ref damageInfo.absorb); - hitMask |= Unit.createProcHitMask(damageInfo, missInfo); + hitMask |= Unit.CreateProcHitMask(damageInfo, missInfo); procVictim |= ProcFlags.TakenDamage; m_damage = (int)damageInfo.damage; @@ -1923,7 +1922,7 @@ namespace Game.Spells { // Fill base damage struct (unitTarget - is real spell target) SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, unitTarget, m_spellInfo.Id, m_SpellVisual, m_spellSchoolMask); - hitMask |= Unit.createProcHitMask(damageInfo, missInfo); + hitMask |= Unit.CreateProcHitMask(damageInfo, missInfo); // Do triggers for unit if (canEffectTrigger) { @@ -2041,7 +2040,7 @@ namespace Game.Spells if (unit.IsInCombat() && m_spellInfo.HasInitialAggro()) { m_caster.SetInCombatState(unit.GetCombatTimer() > 0, unit); - unit.getHostileRefManager().threatAssist(m_caster, 0.0f); + unit.GetHostileRefManager().threatAssist(m_caster, 0.0f); } } } @@ -2417,13 +2416,13 @@ namespace Game.Spells if (!m_caster.ToPlayer().GetCommandStatus(PlayerCommandStates.Casttime)) { // calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail) - m_casttime = m_spellInfo.CalcCastTime(m_caster.getLevel(), this); + m_casttime = m_spellInfo.CalcCastTime(m_caster.GetLevel(), this); } else m_casttime = 0; } else - m_casttime = m_spellInfo.CalcCastTime(m_caster.getLevel(), this); + m_casttime = m_spellInfo.CalcCastTime(m_caster.GetLevel(), this); if (m_caster.IsTypeId(TypeId.Unit) && !m_caster.HasUnitFlag(UnitFlags.PlayerControlled)) // _UNIT actually means creature. for some reason. { @@ -2440,7 +2439,7 @@ namespace Game.Spells // exception are only channeled spells that have no casttime and SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING // (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in) // don't cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect - if (((m_spellInfo.IsChanneled() || m_casttime != 0) && m_caster.IsTypeId(TypeId.Player) && !(m_caster.IsCharmed() && m_caster.GetCharmerGUID().IsCreature()) && m_caster.isMoving() && + if (((m_spellInfo.IsChanneled() || m_casttime != 0) && m_caster.IsTypeId(TypeId.Player) && !(m_caster.IsCharmed() && m_caster.GetCharmerGUID().IsCreature()) && m_caster.IsMoving() && m_spellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Movement) && !m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo))) { // 1. Has casttime, 2. Or doesn't have flag to allow movement during channel @@ -2598,7 +2597,7 @@ namespace Game.Spells { Pet playerPet = playerCaster.GetPet(); if (playerPet != null) - if (playerPet.IsAlive() && playerPet.isControlled() && Convert.ToBoolean(m_targets.GetTargetMask() & SpellCastTargetFlags.Unit)) + if (playerPet.IsAlive() && playerPet.IsControlled() && Convert.ToBoolean(m_targets.GetTargetMask() & SpellCastTargetFlags.Unit)) playerPet.GetAI().OwnerAttacked(m_targets.GetUnitTarget()); } } @@ -3017,13 +3016,13 @@ namespace Game.Spells m_caster.m_playerMovingMe.GainSpellComboPoints(m_comboPointGain); } - if (m_caster.m_extraAttacks != 0 && m_spellInfo.HasEffect(SpellEffectName.AddExtraAttacks)) + if (m_caster.ExtraAttacks != 0 && m_spellInfo.HasEffect(SpellEffectName.AddExtraAttacks)) { Unit victim = Global.ObjAccessor.GetUnit(m_caster, m_targets.GetOrigUnitTargetGUID()); if (victim) m_caster.HandleProcExtraAttackFor(victim); else - m_caster.m_extraAttacks = 0; + m_caster.ExtraAttacks = 0; } // Handle procs on finish @@ -3070,7 +3069,7 @@ namespace Game.Spells // with the exception of spells affected with SPELL_AURA_CAST_WHILE_WALKING effect SpellEffectInfo effect = GetEffect(0); if ((m_caster.IsTypeId(TypeId.Player) && m_timer != 0) && - m_caster.isMoving() && m_spellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Movement) && + m_caster.IsMoving() && m_spellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Movement) && ((effect != null && effect.Effect != SpellEffectName.Stuck) || !m_caster.HasUnitMovementFlag(MovementFlag.FallingFar)) && !m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo)) { @@ -3181,7 +3180,7 @@ namespace Game.Spells if (spellInfo != null && spellInfo.IconFileDataId == 134230) { Log.outDebug(LogFilter.Spells, "Statue {0} is unsummoned in spell {1} finish", m_caster.GetGUID().ToString(), m_spellInfo.Id); - m_caster.setDeathState(DeathState.JustDied); + m_caster.SetDeathState(DeathState.JustDied); return; } } @@ -3200,10 +3199,10 @@ namespace Game.Spells } if (!found && !m_spellInfo.HasAttribute(SpellAttr2.NotResetAutoActions)) { - m_caster.resetAttackTimer(WeaponAttackType.BaseAttack); - if (m_caster.haveOffhandWeapon()) - m_caster.resetAttackTimer(WeaponAttackType.OffAttack); - m_caster.resetAttackTimer(WeaponAttackType.RangedAttack); + m_caster.ResetAttackTimer(WeaponAttackType.BaseAttack); + if (m_caster.HaveOffhandWeapon()) + m_caster.ResetAttackTimer(WeaponAttackType.OffAttack); + m_caster.ResetAttackTimer(WeaponAttackType.RangedAttack); } } @@ -4259,7 +4258,7 @@ namespace Game.Spells // positive spells distribute threat among all units that are in combat with target, like healing if (m_spellInfo.IsPositive()) - target.getHostileRefManager().threatAssist(m_caster, threatToAdd, m_spellInfo); + target.GetHostileRefManager().threatAssist(m_caster, threatToAdd, m_spellInfo); // for negative spells threat gets distributed among affected targets else { @@ -4432,7 +4431,7 @@ namespace Game.Spells // cancel autorepeat spells if cast start when moving // (not wand currently autorepeat cast delayed to moving stop anyway in spell update code) // Do not cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect - if (m_caster.IsTypeId(TypeId.Player) && m_caster.ToPlayer().isMoving() && (!m_caster.IsCharmed() || !m_caster.GetCharmerGUID().IsCreature()) && !m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo)) + if (m_caster.IsTypeId(TypeId.Player) && m_caster.ToPlayer().IsMoving() && (!m_caster.IsCharmed() || !m_caster.GetCharmerGUID().IsCreature()) && !m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo)) { // skip stuck spell to allow use it in falling case and apply spell limitations at movement SpellEffectInfo effect = GetEffect(0); @@ -4670,7 +4669,7 @@ namespace Game.Spells return SpellCastResult.DontReport; Unit target = m_targets.GetUnitTarget(); - if (target == null || !target.IsFriendlyTo(m_caster) || target.getAttackers().Empty()) + if (target == null || !target.IsFriendlyTo(m_caster) || target.GetAttackers().Empty()) return SpellCastResult.BadTargets; } @@ -4694,7 +4693,7 @@ namespace Game.Spells if (learn_spellproto == null) return SpellCastResult.NotKnown; - if (m_spellInfo.SpellLevel > pet.getLevel()) + if (m_spellInfo.SpellLevel > pet.GetLevel()) return SpellCastResult.Lowlevel; break; @@ -4726,7 +4725,7 @@ namespace Game.Spells if (learn_spellproto == null) return SpellCastResult.NotKnown; - if (m_spellInfo.SpellLevel > pet.getLevel()) + if (m_spellInfo.SpellLevel > pet.GetLevel()) return SpellCastResult.Lowlevel; } break; @@ -5136,7 +5135,7 @@ namespace Game.Spells if (spec.IsPetSpecialization()) { Pet pet = player.GetPet(); - if (!pet || pet.getPetType() != PetType.Hunter || pet.GetCharmInfo() == null) + if (!pet || pet.GetPetType() != PetType.Hunter || pet.GetCharmInfo() == null) return SpellCastResult.NoPet; } @@ -5734,7 +5733,7 @@ namespace Game.Spells } } - if (target && m_caster.isMoving() && target.isMoving() && !m_caster.IsWalking() && !target.IsWalking() && + if (target && m_caster.IsMoving() && target.IsMoving() && !m_caster.IsWalking() && !target.IsWalking() && (m_spellInfo.RangeEntry.Flags.HasAnyFlag(SpellRangeFlag.Melee) || target.IsTypeId(TypeId.Player))) rangeMod += 8.0f / 3.0f; } @@ -6715,7 +6714,7 @@ namespace Game.Spells if (!m_CastItem && m_caster.IsTypeId(TypeId.Player)) skillValue = m_caster.ToPlayer().GetSkillValue(skillId); else if (lockInfo.Index[j] == (uint)LockType.Lockpicking) - skillValue = (int)m_caster.getLevel() * 5; + skillValue = (int)m_caster.GetLevel() * 5; // skill bonus provided by casting spell (mostly item spells) // add the effect base points modifier from the spell cast (cheat lock / skeleton key etc.) @@ -7745,7 +7744,7 @@ namespace Game.Spells { if (_spellInfo.HasAttribute(SpellCustomAttributes.ConeBack)) { - if (!_caster.isInBack(target, _coneAngle)) + if (!_caster.IsInBack(target, _coneAngle)) return false; } else if (_spellInfo.HasAttribute(SpellCustomAttributes.ConeLine)) diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index b4b3daba1..8cb41af1d 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -193,7 +193,7 @@ namespace Game.Spells case 51963: { // about +4 base spell dmg per level - damage = (int)(m_caster.getLevel() - 60) * 4 + 60; + damage = (int)(m_caster.GetLevel() - 60) * 4 + 60; break; } } @@ -282,7 +282,7 @@ namespace Game.Spells hit.effectMask &= ~Convert.ToUInt32(1 << 1); // not empty (checked), copy - var attackers = unitTarget.getAttackers(); + var attackers = unitTarget.GetAttackers(); // remove invalid attackers foreach (var att in attackers) @@ -1281,11 +1281,11 @@ namespace Game.Spells { case 24571: // Blood Fury // Instantly increases your rage by ${(300-10*$max(0,$PL-60))/10}. - damage -= 10 * (int)Math.Max(0, Math.Min(30, m_caster.getLevel() - 60)); + damage -= 10 * (int)Math.Max(0, Math.Min(30, m_caster.GetLevel() - 60)); break; case 24532: // Burst of Energy // Instantly increases your energy by ${60-4*$max(0,$min(15,$PL-60))}. - damage -= 4 * (int)Math.Max(0, Math.Min(15, m_caster.getLevel() - 60)); + damage -= 4 * (int)Math.Max(0, Math.Min(15, m_caster.GetLevel() - 60)); break; case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change) { @@ -1334,7 +1334,7 @@ namespace Game.Spells if (gameObjTarget != null) { // Players shouldn't be able to loot gameobjects that are currently despawned - if (!gameObjTarget.isSpawned() && !player.IsGameMaster()) + if (!gameObjTarget.IsSpawned() && !player.IsGameMaster()) { Log.outError(LogFilter.Spells, "Possible hacking attempt: Player {0} [{1}] tried to loot a gameobject [{2}] which is on respawn time without being in GM mode!", player.GetName(), player.GetGUID().ToString(), gameObjTarget.GetGUID().ToString()); @@ -2408,14 +2408,14 @@ namespace Game.Spells OldSummon.NearTeleportTo(px, py, pz, OldSummon.GetOrientation()); - if (owner.IsTypeId(TypeId.Player) && OldSummon.isControlled()) + if (owner.IsTypeId(TypeId.Player) && OldSummon.IsControlled()) owner.ToPlayer().PetSpellInitialize(); return; } if (owner.IsTypeId(TypeId.Player)) - owner.ToPlayer().RemovePet(OldSummon, (OldSummon.getPetType() == PetType.Hunter ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot), false); + owner.ToPlayer().RemovePet(OldSummon, (OldSummon.GetPetType() == PetType.Hunter ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot), false); else return; } @@ -2466,7 +2466,7 @@ namespace Game.Spells if (learn_spellproto == null) return; - pet.learnSpell(learn_spellproto.Id); + pet.LearnSpell(learn_spellproto.Id); pet.SavePetToDB(PetSaveMode.AsCurrent); pet.GetOwner().PetSpellInitialize(); } @@ -3391,16 +3391,16 @@ namespace Game.Spells if (unitTarget == null) return; - unitTarget.getHostileRefManager().UpdateVisibility(); + unitTarget.GetHostileRefManager().UpdateVisibility(); - var attackers = unitTarget.getAttackers(); + var attackers = unitTarget.GetAttackers(); foreach (var unit in attackers) { if (!unit.CanSeeOrDetect(unitTarget)) unit.AttackStop(); } - unitTarget.m_lastSanctuaryTime = GameTime.GetGameTimeMS(); + unitTarget.LastSanctuaryTime = GameTime.GetGameTimeMS(); // Vanish allows to remove all threat and cast regular stealth so other spells can be used if (m_caster.IsTypeId(TypeId.Player) @@ -3481,7 +3481,7 @@ namespace Game.Spells PhasingHandler.InheritPhaseShift(go, m_caster); go.SetFaction(m_caster.GetFaction()); - go.SetLevel(m_caster.getLevel() + 1); + go.SetLevel(m_caster.GetLevel() + 1); int duration = m_spellInfo.CalcDuration(m_caster); go.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0); go.SetSpellId(m_spellInfo.Id); @@ -3867,10 +3867,10 @@ namespace Game.Spells if (!unitTarget || !unitTarget.IsAlive()) return; - if (unitTarget.m_extraAttacks != 0) + if (unitTarget.ExtraAttacks != 0) return; - unitTarget.m_extraAttacks = (uint)damage; + unitTarget.ExtraAttacks = (uint)damage; ExecuteLogEffectExtraAttacks(effIndex, unitTarget, (uint)damage); } @@ -3983,7 +3983,7 @@ namespace Game.Spells // we should also force pets to remove us from current target List attackerSet = new List(); - foreach (var unit in m_caster.getAttackers()) + foreach (var unit in m_caster.GetAttackers()) if (unit.GetTypeId() == TypeId.Unit && !unit.CanHaveThreatList()) attackerSet.Add(unit); @@ -4086,7 +4086,7 @@ namespace Game.Spells // tied to one of existing expansion fields in creature_template? // Double chances for elites - m_caster.ToPlayer().UpdateGatherSkill(skill, (uint)damage, (uint)reqValue, (uint)(creature.isElite() ? 2 : 1)); + m_caster.ToPlayer().UpdateGatherSkill(skill, (uint)damage, (uint)reqValue, (uint)(creature.IsElite() ? 2 : 1)); } } @@ -4176,7 +4176,7 @@ namespace Game.Spells Creature creatureTarget = unitTarget.ToCreature(); if (creatureTarget) - if (creatureTarget.isWorldBoss() || creatureTarget.IsDungeonBoss()) + if (creatureTarget.IsWorldBoss() || creatureTarget.IsDungeonBoss()) return; // Spells with SPELL_EFFECT_KNOCK_BACK (like Thunderstorm) can't knockback target if target has ROOT/STUN @@ -4401,7 +4401,7 @@ namespace Game.Spells pet.SetDynamicFlags(UnitDynFlags.HideModel); pet.RemoveUnitFlag(UnitFlags.Skinnable); - pet.setDeathState(DeathState.Alive); + pet.SetDeathState(DeathState.Alive); pet.ClearUnitState(UnitState.AllState); pet.SetHealth(pet.CountPctFromMaxHealth(damage)); @@ -5061,7 +5061,7 @@ namespace Game.Spells caster = caster.ToTotem().GetOwner(); // in another case summon new - uint level = caster.getLevel(); + uint level = caster.GetLevel(); // level of pet summoned using engineering item based at engineering skill level if (m_CastItem != null && caster.IsTypeId(TypeId.Player)) @@ -5128,7 +5128,7 @@ namespace Game.Spells return; if (unitTarget == null || !unitTarget.IsTypeId(TypeId.Unit) || - !unitTarget.IsPet() || unitTarget.ToPet().getPetType() != PetType.Hunter) + !unitTarget.IsPet() || unitTarget.ToPet().GetPetType() != PetType.Hunter) return; unitTarget.AddPetFlag(UnitPetFlags.CanBeRenamed); diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index 66eff86d6..207d55d56 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -1083,7 +1083,7 @@ namespace Game.Spells { Creature targetCreature = unitTarget.ToCreature(); if (targetCreature != null) - if (targetCreature.hasLootRecipient() && !targetCreature.isTappedBy(caster.ToPlayer())) + if (targetCreature.HasLootRecipient() && !targetCreature.IsTappedBy(caster.ToPlayer())) return SpellCastResult.CantCastOnTapped; } @@ -2681,7 +2681,7 @@ namespace Game.Spells int castTime = 0; if (CastTimeEntry != null) { - int calcLevel = spell != null ? (int)spell.GetCaster().getLevel() : 0; + int calcLevel = spell != null ? (int)spell.GetCaster().GetLevel() : 0; if (MaxLevel != 0 && calcLevel > MaxLevel) calcLevel = (int)MaxLevel; @@ -2873,7 +2873,7 @@ namespace Game.Spells if (HasAttribute(SpellAttr0.LevelDamageCalculation)) { GtNpcManaCostScalerRecord spellScaler = CliDB.NpcManaCostScalerGameTable.GetRow(SpellLevel); - GtNpcManaCostScalerRecord casterScaler = CliDB.NpcManaCostScalerGameTable.GetRow(caster.getLevel()); + GtNpcManaCostScalerRecord casterScaler = CliDB.NpcManaCostScalerGameTable.GetRow(caster.GetLevel()); if (spellScaler != null && casterScaler != null) powerCost *= (int)(casterScaler.Scaler / spellScaler.Scaler); } @@ -3023,7 +3023,7 @@ namespace Game.Spells } case SpellProcsPerMinuteModType.Class: { - if (caster.getClassMask().HasAnyFlag(mod.Param)) + if (caster.GetClassMask().HasAnyFlag(mod.Param)) ppm *= 1.0f + mod.Coeff; break; } @@ -3037,7 +3037,7 @@ namespace Game.Spells } case SpellProcsPerMinuteModType.Race: { - if (caster.getRaceMask().HasAnyFlag(mod.Param)) + if (caster.GetRaceMask().HasAnyFlag(mod.Param)) ppm *= 1.0f + mod.Coeff; break; } @@ -3938,7 +3938,7 @@ namespace Game.Spells { if (GetScalingExpectedStat() == ExpectedStatType.None) { - int level = caster ? (int)caster.getLevel() : 0; + int level = caster ? (int)caster.GetLevel() : 0; if (level > (int)_spellInfo.MaxLevel && _spellInfo.MaxLevel > 0) level = (int)_spellInfo.MaxLevel; level -= (int)_spellInfo.BaseLevel; @@ -3970,9 +3970,9 @@ namespace Game.Spells { uint level = _spellInfo.SpellLevel; if (target && _spellInfo.IsPositiveEffect(EffectIndex) && (Effect == SpellEffectName.ApplyAura)) - level = target.getLevel(); + level = target.GetLevel(); else if (caster) - level = caster.getLevel(); + level = caster.GetLevel(); if (_spellInfo.BaseLevel != 0 && !_spellInfo.HasAttribute(SpellAttr11.ScalesWithItemLevel) && _spellInfo.HasAttribute(SpellAttr10.UseSpellBaseLevelForScaling)) level = _spellInfo.BaseLevel; @@ -4040,7 +4040,7 @@ namespace Game.Spells if (contentTuning != null) expansion = contentTuning.ExpansionID; - uint level = caster ? caster.getLevel() : 1; + uint level = caster ? caster.GetLevel() : 1; tempValue = Global.DB2Mgr.EvaluateExpectedStat(stat, level, expansion, 0, Class.None) * BasePoints / 100.0f; } @@ -4093,7 +4093,7 @@ namespace Game.Spells if (caster != null) { - radius += entry.RadiusPerLevel * caster.getLevel(); + radius += entry.RadiusPerLevel * caster.GetLevel(); radius = Math.Min(radius, entry.RadiusMax); Player modOwner = caster.GetSpellModOwner(); if (modOwner != null) diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 4c8e7930b..2cf2d0c62 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -460,7 +460,7 @@ namespace Game.Entities { Player actor = eventInfo.GetActor().ToPlayer(); if (actor) - if (eventInfo.GetActionTarget() && !actor.isHonorOrXPTarget(eventInfo.GetActionTarget())) + if (eventInfo.GetActionTarget() && !actor.IsHonorOrXPTarget(eventInfo.GetActionTarget())) return false; } @@ -3485,7 +3485,7 @@ namespace Game.Entities return false; if (raceMask != 0) // not in expected race - if (player == null || !Convert.ToBoolean(raceMask & player.getRaceMask())) + if (player == null || !Convert.ToBoolean(raceMask & player.GetRaceMask())) return false; if (areaId != 0) // not in expected zone diff --git a/Source/Game/SupportSystem/SupportManager.cs b/Source/Game/SupportSystem/SupportManager.cs index 0f3c663a6..b2d8c9f1d 100644 --- a/Source/Game/SupportSystem/SupportManager.cs +++ b/Source/Game/SupportSystem/SupportManager.cs @@ -49,7 +49,7 @@ namespace Game.SupportSystem return _suggestionTicketList.LookupByKey(Id) as T; } - return default(T); + return default; } public uint GetOpenTicketCount() where T : Ticket diff --git a/Source/Game/Time/GameTime.cs b/Source/Game/Time/GameTime.cs index fd9715718..dede4261a 100644 --- a/Source/Game/Time/GameTime.cs +++ b/Source/Game/Time/GameTime.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; public class GameTime { diff --git a/Source/Game/Time/Updatetime.cs b/Source/Game/Time/Updatetime.cs index 40ba9f5d3..be8f629da 100644 --- a/Source/Game/Time/Updatetime.cs +++ b/Source/Game/Time/Updatetime.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; -using Framework; namespace Game { diff --git a/Source/Game/Warden/WardenKeyGeneration.cs b/Source/Game/Warden/WardenKeyGeneration.cs index cf7b635f5..6c3f130ae 100644 --- a/Source/Game/Warden/WardenKeyGeneration.cs +++ b/Source/Game/Warden/WardenKeyGeneration.cs @@ -15,7 +15,6 @@ * along with this program. If not, see . */ -using System.Linq; using System.Security.Cryptography; using System; diff --git a/Source/Scripts/EasternKingdoms/Karazhan/InstanceKarazhan.cs b/Source/Scripts/EasternKingdoms/Karazhan/InstanceKarazhan.cs index 6f233f8df..de39e66c3 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/InstanceKarazhan.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/InstanceKarazhan.cs @@ -16,11 +16,9 @@ */ using Framework.Constants; -using Framework.IO; using Game.Entities; using Game.Maps; using Game.Scripting; -using Game.AI; namespace Scripts.EasternKingdoms.Karazhan { diff --git a/Source/Scripts/EasternKingdoms/Karazhan/OperaEvent.cs b/Source/Scripts/EasternKingdoms/Karazhan/OperaEvent.cs index 3f05b6922..e1dc915e2 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/OperaEvent.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/OperaEvent.cs @@ -1020,7 +1020,7 @@ namespace Scripts.EasternKingdoms.Karazhan.OperaEvent { Romulo.RemoveUnitFlag(UnitFlags.NotSelectable); Romulo.GetMotionMaster().Clear(); - Romulo.setDeathState(DeathState.JustDied); + Romulo.SetDeathState(DeathState.JustDied); Romulo.CombatStop(true); Romulo.DeleteThreatList(); Romulo.SetDynamicFlags(UnitDynFlags.Lootable); @@ -1258,7 +1258,7 @@ namespace Scripts.EasternKingdoms.Karazhan.OperaEvent { Julianne.RemoveUnitFlag(UnitFlags.NotSelectable); Julianne.GetMotionMaster().Clear(); - Julianne.setDeathState(DeathState.JustDied); + Julianne.SetDeathState(DeathState.JustDied); Julianne.CombatStop(true); Julianne.DeleteThreatList(); Julianne.SetDynamicFlags(UnitDynFlags.Lootable); diff --git a/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs b/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs index 86ebe25d1..ce6adc2bb 100644 --- a/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs +++ b/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs @@ -16,7 +16,6 @@ */ using Framework.Constants; -using Game; using Game.AI; using Game.Entities; using Game.Scripting; @@ -839,8 +838,8 @@ namespace Scripts.EasternKingdoms foreach (TempSummon summon in MinionList) if (summon.GetOwnerGUID() == me.GetOwnerGUID()) - if (summon.IsInCombat() && summon.getAttackerForHelper()) - AttackStart(summon.getAttackerForHelper()); + if (summon.IsInCombat() && summon.GetAttackerForHelper()) + AttackStart(summon.GetAttackerForHelper()); } public override void UpdateAI(uint diff) @@ -853,8 +852,8 @@ namespace Scripts.EasternKingdoms Player plrOwner = owner.ToPlayer(); if (plrOwner && plrOwner.IsInCombat()) { - if (plrOwner.getAttackerForHelper() && plrOwner.getAttackerForHelper().GetEntry() == CreatureIds.Ghosts) - AttackStart(plrOwner.getAttackerForHelper()); + if (plrOwner.GetAttackerForHelper() && plrOwner.GetAttackerForHelper().GetEntry() == CreatureIds.Ghosts) + AttackStart(plrOwner.GetAttackerForHelper()); else FindMinions(owner); } @@ -868,13 +867,13 @@ namespace Scripts.EasternKingdoms //Check if we have a current target if (me.GetVictim().GetEntry() == CreatureIds.Ghosts) { - if (me.isAttackReady()) + if (me.IsAttackReady()) { //If we are within range melee the target if (me.IsWithinMeleeRange(me.GetVictim())) { me.AttackerStateUpdate(me.GetVictim()); - me.resetAttackTimer(); + me.ResetAttackTimer(); } } } diff --git a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossAnubarak.cs b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossAnubarak.cs index 060b44dba..78db5b5f0 100644 --- a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossAnubarak.cs +++ b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossAnubarak.cs @@ -511,7 +511,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Anubarak if (diff >= _backstabTimer) { - if (me.GetVictim() && me.GetVictim().isInBack(me)) + if (me.GetVictim() && me.GetVictim().IsInBack(me)) DoCastVictim(SpellIds.Backstab); _backstabTimer = 6 * Time.InMilliseconds; } diff --git a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossKrikthirTheGatewatcher.cs b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossKrikthirTheGatewatcher.cs index 03db106d5..e9bfac075 100644 --- a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossKrikthirTheGatewatcher.cs +++ b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossKrikthirTheGatewatcher.cs @@ -23,7 +23,6 @@ using Game.Scripting; using Game.Spells; using System; using System.Collections.Generic; -using System.Linq; namespace Scripts.Northrend.AzjolNerub.AzjolNerub.KrikthirTheGatewatcher { @@ -624,7 +623,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.KrikthirTheGatewatcher _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(9), task => { - if (me.GetVictim() && me.GetVictim().isInBack(me)) + if (me.GetVictim() && me.GetVictim().IsInBack(me)) DoCastVictim(SpellIds.Backstab); task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(13)); }); @@ -704,7 +703,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.KrikthirTheGatewatcher Creature gatewatcher = me.GetInstanceScript().GetCreature(ANDataTypes.KrikthirTheGatewatcher); if (gatewatcher) { - Unit target = gatewatcher.getAttackerForHelper(); + Unit target = gatewatcher.GetAttackerForHelper(); if (target) AttackStart(target); gatewatcher.GetAI().JustSummoned(me); @@ -723,7 +722,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.KrikthirTheGatewatcher Creature gatewatcher = me.GetInstanceScript().GetCreature(ANDataTypes.KrikthirTheGatewatcher); if (gatewatcher) { - Unit target = gatewatcher.getAttackerForHelper(); + Unit target = gatewatcher.GetAttackerForHelper(); if (target) AttackStart(target); gatewatcher.GetAI().JustSummoned(me); diff --git a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossNadronox.cs b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossNadronox.cs index 7d632fc91..6267a2234 100644 --- a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossNadronox.cs +++ b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossNadronox.cs @@ -305,7 +305,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Nadronox task.Repeat(TimeSpan.FromSeconds(1)); }); - me.setActive(true); + me.SetActive(true); } public override void DoAction(int action) diff --git a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/InstanceTrialOfTheChampion.cs b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/InstanceTrialOfTheChampion.cs index ef40cfbe7..46b4f7615 100644 --- a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/InstanceTrialOfTheChampion.cs +++ b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/InstanceTrialOfTheChampion.cs @@ -24,7 +24,6 @@ using Game.Scripting; using System; using System.Collections.Generic; using System.Linq; -using Game.AI; namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion { diff --git a/Source/Scripts/Northrend/Dalaran.cs b/Source/Scripts/Northrend/Dalaran.cs index 4a4afdce6..f7fc9aba1 100644 --- a/Source/Scripts/Northrend/Dalaran.cs +++ b/Source/Scripts/Northrend/Dalaran.cs @@ -93,7 +93,7 @@ namespace Scripts.Northrend { if (GetClosestCreatureWithEntry(me, DalaranConst.NpcAplleboughA, 32.0f)) { - if (me.isInBackInMap(who, 12.0f)) // In my line of sight, "outdoors", and behind me + if (me.IsInBackInMap(who, 12.0f)) // In my line of sight, "outdoors", and behind me DoCast(who, DalaranConst.SpellTrespasserA); // Teleport the Horde unit out } else // In my line of sight, and "indoors" @@ -105,7 +105,7 @@ namespace Scripts.Northrend { if (GetClosestCreatureWithEntry(me, DalaranConst.NpcSweetberryH, 32.0f)) { - if (me.isInBackInMap(who, 12.0f)) // In my line of sight, "outdoors", and behind me + if (me.IsInBackInMap(who, 12.0f)) // In my line of sight, "outdoors", and behind me DoCast(who, DalaranConst.SpellTrespasserH); // Teleport the Alliance unit out } else // In my line of sight, and "indoors" @@ -125,7 +125,7 @@ namespace Scripts.Northrend { public npc_minigob_manabonk(Creature creature) : base(creature) { - me.setActive(true); + me.SetActive(true); } public override void Reset() diff --git a/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs b/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs index 20a024b15..9d48658bc 100644 --- a/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs +++ b/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs @@ -554,7 +554,7 @@ namespace Scripts.Northrend.IcecrownCitadel Index = 0xFFFFFFFF; BurningPitchId = Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipSpells.BurningPitchA : GunshipSpells.BurningPitchH; - me.setRegeneratingHealth(false); + me.SetRegeneratingHealth(false); } public override void SetData(uint type, uint data) @@ -680,7 +680,7 @@ namespace Scripts.Northrend.IcecrownCitadel _summonedFirstMage = false; _died = false; - me.setRegeneratingHealth(false); + me.SetRegeneratingHealth(false); } public override void DamageTaken(Unit source, ref uint damage) @@ -845,7 +845,7 @@ namespace Scripts.Northrend.IcecrownCitadel _controller.ResetSlots(Team.Horde); _controller.SetTransport(creature.GetTransport()); - me.setRegeneratingHealth(false); + me.SetRegeneratingHealth(false); me.m_CombatDistance = 70.0f; } @@ -1075,10 +1075,10 @@ namespace Scripts.Northrend.IcecrownCitadel if (me.IsWithinMeleeRange(me.GetVictim())) DoMeleeAttackIfReady(); - else if (me.isAttackReady()) + else if (me.IsAttackReady()) { DoCastVictim(GunshipSpells.RendingThrow); - me.resetAttackTimer(); + me.ResetAttackTimer(); } } @@ -1104,7 +1104,7 @@ namespace Scripts.Northrend.IcecrownCitadel _controller.ResetSlots(Team.Alliance); _controller.SetTransport(creature.GetTransport()); - me.setRegeneratingHealth(false); + me.SetRegeneratingHealth(false); me.m_CombatDistance = 70.0f; } @@ -1325,10 +1325,10 @@ namespace Scripts.Northrend.IcecrownCitadel if (me.IsWithinMeleeRange(me.GetVictim())) DoMeleeAttackIfReady(); - else if (me.isAttackReady()) + else if (me.IsAttackReady()) { DoCastVictim(GunshipSpells.RendingThrow); - me.resetAttackTimer(); + me.ResetAttackTimer(); } } @@ -1710,7 +1710,7 @@ Fall Time: 824 void HandlePeriodic(AuraEffect aurEff) { - if (GetTarget().moveSpline.Finalized()) + if (GetTarget().MoveSpline.Finalized()) Remove(AuraRemoveMode.Expire); } diff --git a/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadel.cs b/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadel.cs index 35687600a..9520c7408 100644 --- a/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadel.cs +++ b/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadel.cs @@ -24,7 +24,6 @@ using Game.Maps; using Game.Scripting; using Game.Spells; using System.Collections.Generic; -using System.Linq; namespace Scripts.Northrend.IcecrownCitadel { @@ -157,13 +156,13 @@ namespace Scripts.Northrend.IcecrownCitadel Creature factionNPC = me.FindNearestCreature(_instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? CreatureIds.SeHighOverlordSaurfang : CreatureIds.SeMuradinBronzebeard, 50.0f); if (factionNPC) { - me.setActive(true); + me.SetActive(true); _theLichKing = theLichKing.GetGUID(); - theLichKing.setActive(true); + theLichKing.SetActive(true); _bolvarFordragon = bolvarFordragon.GetGUID(); - bolvarFordragon.setActive(true); + bolvarFordragon.SetActive(true); _factionNPC = factionNPC.GetGUID(); - factionNPC.setActive(true); + factionNPC.SetActive(true); } } } @@ -261,7 +260,7 @@ namespace Scripts.Northrend.IcecrownCitadel if (temp) { temp.GetAI().Talk(Texts.SayBolvarIntro1); - temp.setActive(false); + temp.SetActive(false); } break; case EventTypes.LkIntro5: @@ -269,7 +268,7 @@ namespace Scripts.Northrend.IcecrownCitadel if (temp) { temp.GetAI().Talk(Texts.SayLkIntro5); - temp.setActive(false); + temp.SetActive(false); } break; case EventTypes.SaurfangIntro1: @@ -300,7 +299,7 @@ namespace Scripts.Northrend.IcecrownCitadel Creature factionNPC = ObjectAccessor.GetCreature(me, _factionNPC); if (factionNPC) factionNPC.GetMotionMaster().MovePath((uint)(factionNPC.GetSpawnId() * 10), false); - me.setActive(false); + me.SetActive(false); _damnedKills = 3; break; case EventTypes.MuradinIntro1: @@ -549,7 +548,7 @@ namespace Scripts.Northrend.IcecrownCitadel me.CastCustomSpell(InstanceSpells.CaressOfDeath, SpellValueMod.MaxTargets, 1, me, true); break; case Actions.StartGauntlet: - me.setActive(true); + me.SetActive(true); _isEventInProgress = true; me.AddUnitFlag(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc); _events.ScheduleEvent(EventTypes.SvalnaStart, 25000); @@ -561,7 +560,7 @@ namespace Scripts.Northrend.IcecrownCitadel Talk(Texts.SaySvalnaCaptainDeath); break; case Actions.ResetEvent: - me.setActive(false); + me.SetActive(false); Reset(); break; default: @@ -584,7 +583,7 @@ namespace Scripts.Northrend.IcecrownCitadel return; _isEventInProgress = false; - me.setActive(false); + me.SetActive(false); me.RemoveUnitFlag(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc); me.SetDisableGravity(false); me.SetHover(false); @@ -700,7 +699,7 @@ namespace Scripts.Northrend.IcecrownCitadel _events.ScheduleEvent(EventTypes.ArnathIntro2, 7000); _events.ScheduleEvent(EventTypes.CrokIntro3, 14000); _events.ScheduleEvent(EventTypes.StartPathing, 37000); - me.setActive(true); + me.SetActive(true); for (uint i = 0; i < 4; ++i) { Creature crusader = ObjectAccessor.GetCreature(me, _instance.GetGuidData(DataTypes.CaptainArnath + i)); @@ -712,7 +711,7 @@ namespace Scripts.Northrend.IcecrownCitadel { _isEventActive = false; _isEventDone = _instance.GetBossState(Bosses.SisterSvalna) == EncounterState.Done; - me.setActive(false); + me.SetActive(false); _aliveTrash.Clear(); _currentWPid = 0; } @@ -729,7 +728,7 @@ namespace Scripts.Northrend.IcecrownCitadel if (_currentWPid == 4 && _isEventActive) { _isEventActive = false; - me.setActive(false); + me.SetActive(false); Talk(Texts.SayCrokFinalWp); Creature svalna = ObjectAccessor.GetCreature(me, _instance.GetGuidData(Bosses.SisterSvalna)); if (svalna) @@ -759,7 +758,7 @@ namespace Scripts.Northrend.IcecrownCitadel if (_aliveTrash.Empty() && _isEventActive) { _isEventActive = false; - me.setActive(false); + me.SetActive(false); Talk(Texts.SayCrokFinalWp); Creature svalna = ObjectAccessor.GetCreature(me, _instance.GetGuidData(Bosses.SisterSvalna)); if (svalna) @@ -980,7 +979,7 @@ namespace Scripts.Northrend.IcecrownCitadel me.GetMotionMaster().MoveFollow(crok, FollowDist, FollowAngle, MovementSlot.Idle); } - me.setActive(true); + me.SetActive(true); } else if (action == Actions.ResetEvent) { @@ -1029,7 +1028,7 @@ namespace Scripts.Northrend.IcecrownCitadel if (spell.Id == InstanceSpells.ReviveChampion && !IsUndead) { IsUndead = true; - me.setDeathState(DeathState.JustRespawned); + me.SetDeathState(DeathState.JustRespawned); uint newEntry = 0; switch (me.GetEntry()) { diff --git a/Source/Scripts/Northrend/IcecrownCitadel/InstanceIcecrownCitadel.cs b/Source/Scripts/Northrend/IcecrownCitadel/InstanceIcecrownCitadel.cs index 5e06d4f42..d2cc1992b 100644 --- a/Source/Scripts/Northrend/IcecrownCitadel/InstanceIcecrownCitadel.cs +++ b/Source/Scripts/Northrend/IcecrownCitadel/InstanceIcecrownCitadel.cs @@ -18,7 +18,6 @@ using Framework.Constants; using Framework.IO; using Game; -using Game.AI; using Game.Entities; using Game.Maps; using Game.Network.Packets; @@ -1009,11 +1008,11 @@ namespace Scripts.Northrend.IcecrownCitadel // note: "active" gameobjects do not block grid unloading GameObject precipice = instance.GetGameObject(ArthasPrecipiceGUID); if (precipice) - precipice.setActive(state == EncounterState.InProgress); + precipice.SetActive(state == EncounterState.InProgress); GameObject platform = instance.GetGameObject(ArthasPlatformGUID); if (platform) - platform.setActive(state == EncounterState.InProgress); + platform.SetActive(state == EncounterState.InProgress); if (instance.IsHeroic()) { diff --git a/Source/Scripts/Northrend/IcecrownCitadel/LadyDeathwhisper.cs b/Source/Scripts/Northrend/IcecrownCitadel/LadyDeathwhisper.cs index 6fccd74ba..879b619cb 100644 --- a/Source/Scripts/Northrend/IcecrownCitadel/LadyDeathwhisper.cs +++ b/Source/Scripts/Northrend/IcecrownCitadel/LadyDeathwhisper.cs @@ -288,7 +288,7 @@ namespace Scripts.Northrend.IcecrownCitadel } me.SetCombatPulseDelay(5); - me.setActive(true); + me.SetActive(true); DoZoneInCombat(); _phase = Phases.One; _scheduler.CancelGroup(GroupIds.Intro); diff --git a/Source/Scripts/Northrend/IcecrownCitadel/LordMarrowgar.cs b/Source/Scripts/Northrend/IcecrownCitadel/LordMarrowgar.cs index 7ae10ccd4..65c84e264 100644 --- a/Source/Scripts/Northrend/IcecrownCitadel/LordMarrowgar.cs +++ b/Source/Scripts/Northrend/IcecrownCitadel/LordMarrowgar.cs @@ -152,7 +152,7 @@ namespace Scripts.Northrend.IcecrownCitadel { Talk(Texts.SayAggro); - me.setActive(true); + me.SetActive(true); DoZoneInCombat(); instance.SetBossState(Bosses.LordMarrowgar, EncounterState.InProgress); } diff --git a/Source/Scripts/Northrend/Ulduar/FlameLeviathan.cs b/Source/Scripts/Northrend/Ulduar/FlameLeviathan.cs index f4015b78b..948e97f5e 100644 --- a/Source/Scripts/Northrend/Ulduar/FlameLeviathan.cs +++ b/Source/Scripts/Northrend/Ulduar/FlameLeviathan.cs @@ -526,13 +526,13 @@ namespace Scripts.Northrend.Ulduar.FlameLeviathan //! I also removed the spellInfo check void DoBatteringRamIfReady() { - if (me.isAttackReady()) + if (me.IsAttackReady()) { Unit target = Global.ObjAccessor.GetUnit(me, _pursueTarget); if (me.IsWithinCombatRange(target, 30.0f)) { DoCast(target, Spells.BatteringRam); - me.resetAttackTimer(); + me.ResetAttackTimer(); } } } diff --git a/Source/Scripts/Northrend/Ulduar/UlduarInstance.cs b/Source/Scripts/Northrend/Ulduar/UlduarInstance.cs index 4fafc4d99..aacf7521e 100644 --- a/Source/Scripts/Northrend/Ulduar/UlduarInstance.cs +++ b/Source/Scripts/Northrend/Ulduar/UlduarInstance.cs @@ -17,7 +17,6 @@ using Framework.Constants; using Framework.IO; -using Game.AI; using Game.Entities; using Game.Maps; using Game.Network.Packets; diff --git a/Source/Scripts/Outlands/HellfirePeninsula.cs b/Source/Scripts/Outlands/HellfirePeninsula.cs index 40f4915e3..1aa693e3f 100644 --- a/Source/Scripts/Outlands/HellfirePeninsula.cs +++ b/Source/Scripts/Outlands/HellfirePeninsula.cs @@ -20,7 +20,6 @@ using Game; using Game.AI; using Game.Entities; using Game.Scripting; -using Game.PvP; namespace Scripts.Outlands { diff --git a/Source/Scripts/Pets/Hunter.cs b/Source/Scripts/Pets/Hunter.cs index 8a966c799..137367cd9 100644 --- a/Source/Scripts/Pets/Hunter.cs +++ b/Source/Scripts/Pets/Hunter.cs @@ -37,7 +37,7 @@ namespace Scripts.Pets _isViper = Info.Entry == NpcViper ? true : false; - me.SetMaxHealth((uint)(107 * (me.getLevel() - 40) * 0.025f)); + me.SetMaxHealth((uint)(107 * (me.GetLevel() - 40) * 0.025f)); // Add delta to make them not all hit the same time uint delta = (RandomHelper.Rand32() % 7) * 100; me.SetBaseAttackTime(WeaponAttackType.BaseAttack, Info.BaseAttackTime + delta); @@ -48,8 +48,8 @@ namespace Scripts.Pets { Unit owner = me.ToTempSummon().GetSummoner(); if (owner) - if (owner.getAttackerForHelper()) - AttackStart(owner.getAttackerForHelper()); + if (owner.GetAttackerForHelper()) + AttackStart(owner.GetAttackerForHelper()); } if (!_isViper) @@ -69,7 +69,7 @@ namespace Scripts.Pets { if ((RandomHelper.Rand32() % 5) == 0) { - me.setAttackTimer(WeaponAttackType.BaseAttack, (RandomHelper.Rand32() % 10) * 100); + me.SetAttackTimer(WeaponAttackType.BaseAttack, (RandomHelper.Rand32() % 10) * 100); _spellTimer = (RandomHelper.Rand32() % 10) * 100; AttackStart(who); } diff --git a/Source/Scripts/Pets/Mage.cs b/Source/Scripts/Pets/Mage.cs index 771cae7d6..546c6469c 100644 --- a/Source/Scripts/Pets/Mage.cs +++ b/Source/Scripts/Pets/Mage.cs @@ -169,7 +169,7 @@ namespace Scripts.Pets if (!owner) return; - Unit target = owner.getAttackerForHelper(); + Unit target = owner.GetAttackerForHelper(); _events.Update(diff); diff --git a/Source/Scripts/Spells/DemonHunter.cs b/Source/Scripts/Spells/DemonHunter.cs index 521d0146e..62882de72 100644 --- a/Source/Scripts/Spells/DemonHunter.cs +++ b/Source/Scripts/Spells/DemonHunter.cs @@ -19,7 +19,6 @@ using Framework.Constants; using Game.Entities; using Game.Scripting; using Game.Spells; -using System.Collections.Generic; namespace Scripts.Spells.DemonHunter { diff --git a/Source/Scripts/Spells/Druid.cs b/Source/Scripts/Spells/Druid.cs index 86a1c1b4c..c5ebfd227 100644 --- a/Source/Scripts/Spells/Druid.cs +++ b/Source/Scripts/Spells/Druid.cs @@ -732,7 +732,7 @@ namespace Scripts.Spells.Druid if (player.IsInWater()) // Aquatic form triggeredSpellId = SpellIds.FormAquatic; else if (player.GetSkillValue(SkillType.Riding) >= 225 && CheckLocationForForm(SpellIds.FormFlight) == SpellCastResult.SpellCastOk) // Flight form - triggeredSpellId = player.getLevel() >= 71 ? SpellIds.FormSwiftFlight : SpellIds.FormFlight; + triggeredSpellId = player.GetLevel() >= 71 ? SpellIds.FormSwiftFlight : SpellIds.FormFlight; else // Stag form (riding skill already checked in CheckCast) triggeredSpellId = SpellIds.FormStag; diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index 5c357b10c..f83b9e76d 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -2067,8 +2067,8 @@ namespace Scripts.Spells.Generic if (newPet.LoadPetFromDB(player, 0, player.GetLastPetNumber(), true)) { // revive the pet if it is dead - if (newPet.getDeathState() == DeathState.Dead) - newPet.setDeathState(DeathState.Alive); + if (newPet.GetDeathState() == DeathState.Dead) + newPet.SetDeathState(DeathState.Alive); newPet.SetFullHealth(); newPet.SetFullPower(newPet.GetPowerType()); @@ -2897,7 +2897,7 @@ namespace Scripts.Spells.Generic if (player) { // Reset player faction + allow combat + allow duels - player.setFactionForRace(player.GetRace()); + player.SetFactionForRace(player.GetRace()); player.RemoveUnitFlag(UnitFlags.NonAttackable); // save player player.SaveToDB(); diff --git a/Source/Scripts/Spells/Hunter.cs b/Source/Scripts/Spells/Hunter.cs index ad962eba4..f09a184bf 100644 --- a/Source/Scripts/Spells/Hunter.cs +++ b/Source/Scripts/Spells/Hunter.cs @@ -569,7 +569,7 @@ namespace Scripts.Spells.Hunter if (playerTarget) { int baseAmount = aurEff.GetBaseAmount(); - int amount = playerTarget.isMoving() ? + int amount = playerTarget.IsMoving() ? playerTarget.CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff.GetEffIndex(), baseAmount) : aurEff.GetAmount() - 1; aurEff.SetAmount(amount); @@ -624,7 +624,7 @@ namespace Scripts.Spells.Hunter Creature target = GetExplTargetUnit().ToCreature(); if (target) { - if (target.getLevel() > caster.getLevel()) + if (target.GetLevel() > caster.GetLevel()) return SpellCastResult.Highlevel; // use SMSG_PET_TAME_FAILURE? diff --git a/Source/Scripts/Spells/Items.cs b/Source/Scripts/Spells/Items.cs index 24bb98c09..4e2d5bfcd 100644 --- a/Source/Scripts/Spells/Items.cs +++ b/Source/Scripts/Spells/Items.cs @@ -626,7 +626,7 @@ namespace Scripts.Spells.Items { void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated) { - int diff = (int)GetUnitOwner().getLevel() - 60; + int diff = (int)GetUnitOwner().GetLevel() - 60; if (diff > 0) amount += 2 * diff; } @@ -1619,7 +1619,7 @@ namespace Scripts.Spells.Items break; } - if (caster.getLevel() > maxSafeLevel) + if (caster.GetLevel() > maxSafeLevel) { caster.CastSpell(caster, SpellIds.Lost, true); @@ -1840,7 +1840,7 @@ namespace Scripts.Spells.Items { void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated) { - int diff = (int)GetUnitOwner().getLevel() - 60; + int diff = (int)GetUnitOwner().GetLevel() - 60; if (diff > 0) amount += diff; } @@ -2165,7 +2165,7 @@ namespace Scripts.Spells.Items { Creature target = GetHitCreature(); if (target) - target.setDeathState(DeathState.JustRespawned); + target.SetDeathState(DeathState.JustRespawned); } public override void Register() diff --git a/Source/Scripts/Spells/Paladin.cs b/Source/Scripts/Spells/Paladin.cs index 4f200e7e3..b051e4a9f 100644 --- a/Source/Scripts/Spells/Paladin.cs +++ b/Source/Scripts/Spells/Paladin.cs @@ -496,7 +496,7 @@ namespace Scripts.Spells.Paladin if (!caster.IsValidAttackTarget(target)) return SpellCastResult.BadTargets; - if (!caster.isInFront(target)) + if (!caster.IsInFront(target)) return SpellCastResult.NotInfront; } } @@ -715,7 +715,7 @@ namespace Scripts.Spells.Paladin Unit target = GetExplTargetUnit(); if (target) { - if (!target.IsFriendlyTo(caster) || target.getAttackers().Empty()) + if (!target.IsFriendlyTo(caster) || target.GetAttackers().Empty()) return SpellCastResult.BadTargets; } else diff --git a/Source/Scripts/Spells/Priest.cs b/Source/Scripts/Spells/Priest.cs index aeaecde03..1b3961fc1 100644 --- a/Source/Scripts/Spells/Priest.cs +++ b/Source/Scripts/Spells/Priest.cs @@ -350,7 +350,7 @@ namespace Scripts.Spells.Priest if (aegis != null) absorb += aegis.GetAmount(); - absorb = (int)Math.Min(absorb, eventInfo.GetProcTarget().getLevel() * 125); + absorb = (int)Math.Min(absorb, eventInfo.GetProcTarget().GetLevel() * 125); GetTarget().CastCustomSpell(SpellIds.DivineAegis, SpellValueMod.BasePoint0, absorb, eventInfo.GetProcTarget(), true, null, aurEff); } @@ -748,7 +748,7 @@ namespace Scripts.Spells.Priest if (!caster.IsValidAttackTarget(target)) return SpellCastResult.BadTargets; - if (!caster.isInFront(target)) + if (!caster.IsInFront(target)) return SpellCastResult.NotInfront; } else @@ -757,7 +757,7 @@ namespace Scripts.Spells.Priest if (!caster.HasAura(SpellIds.ThePenitentAura)) return SpellCastResult.BadTargets; - if (!caster.isInFront(target)) + if (!caster.IsInFront(target)) return SpellCastResult.UnitNotInfront; } } diff --git a/Source/Scripts/Spells/Warlock.cs b/Source/Scripts/Spells/Warlock.cs index 58c884492..c6b1c11df 100644 --- a/Source/Scripts/Spells/Warlock.cs +++ b/Source/Scripts/Spells/Warlock.cs @@ -195,7 +195,7 @@ namespace Scripts.Spells.Warlock if (removeMode != AuraRemoveMode.Death || !IsExpired()) return; - if (GetCaster().ToPlayer().isHonorOrXPTarget(GetTarget())) + if (GetCaster().ToPlayer().IsHonorOrXPTarget(GetTarget())) GetCaster().CastSpell(GetTarget(), SpellIds.BaneOfDoomEffect, true, null, aurEff); } diff --git a/Source/Scripts/Spells/Warrior.cs b/Source/Scripts/Spells/Warrior.cs index 9cb418df0..7b5928f89 100644 --- a/Source/Scripts/Spells/Warrior.cs +++ b/Source/Scripts/Spells/Warrior.cs @@ -135,7 +135,7 @@ namespace Scripts.Spells.Warrior for (uint i = 0; i < 5; ++i) { int timeOffset = (int)(6 * i * aurEff.GetPeriod() / 25); - Vector4 loc = GetTarget().moveSpline.ComputePosition(timeOffset); + Vector4 loc = GetTarget().MoveSpline.ComputePosition(timeOffset); GetTarget().SendPlaySpellVisual(new Vector3(loc.X, loc.Y, loc.Z), 0.0f, Misc.SpellVisualBlazingCharge, 0, 0, 1.0f, true); } } @@ -550,7 +550,7 @@ namespace Scripts.Spells.Warrior bool CheckProc(ProcEventInfo eventInfo) { // check attack comes not from behind and warrior is not stunned - return GetTarget().isInFront(eventInfo.GetProcTarget(), MathFunctions.PI) && !GetTarget().HasUnitState(UnitState.Stunned); + return GetTarget().IsInFront(eventInfo.GetProcTarget(), MathFunctions.PI) && !GetTarget().HasUnitState(UnitState.Stunned); } void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo) diff --git a/Source/Scripts/World/Achievements.cs b/Source/Scripts/World/Achievements.cs index 28ca6376b..2fa7ff0c9 100644 --- a/Source/Scripts/World/Achievements.cs +++ b/Source/Scripts/World/Achievements.cs @@ -301,7 +301,7 @@ namespace Scripts.World public override bool OnCheck(Player player, Unit target) { - return target && player.isHonorOrXPTarget(target); + return target && player.IsHonorOrXPTarget(target); } } } \ No newline at end of file diff --git a/Source/Scripts/World/AreaTrigger.cs b/Source/Scripts/World/AreaTrigger.cs index 11ed84763..189b840fd 100644 --- a/Source/Scripts/World/AreaTrigger.cs +++ b/Source/Scripts/World/AreaTrigger.cs @@ -106,7 +106,7 @@ namespace Scripts.World { GameObject go = player.FindNearestGameObject(AreaTriggerConst.GoCoilfangWaterfall, 35.0f); if (go) - if (go.getLootState() == LootState.Ready) + if (go.GetLootState() == LootState.Ready) go.UseDoorOrButton(); return false; diff --git a/Source/Scripts/World/Guards.cs b/Source/Scripts/World/Guards.cs index cbce9965d..439ca4c2f 100644 --- a/Source/Scripts/World/Guards.cs +++ b/Source/Scripts/World/Guards.cs @@ -61,7 +61,7 @@ namespace Scripts.World { if (me.GetEntry() == CreatureIds.CenarionHoldIndantry) Talk(GuardsConst.SaySilAggro, who); - SpellInfo spell = me.reachWithSpellAttack(who); + SpellInfo spell = me.ReachWithSpellAttack(who); if (spell != null) DoCast(who, spell.Id); } @@ -103,7 +103,7 @@ namespace Scripts.World return; // Make sure our attack is ready and we arn't currently casting - if (me.isAttackReady() && !me.IsNonMeleeSpellCast(false)) + if (me.IsAttackReady() && !me.IsNonMeleeSpellCast(false)) { //If we are within range melee the target if (me.IsWithinMeleeRange(me.GetVictim())) @@ -136,7 +136,7 @@ namespace Scripts.World else me.AttackerStateUpdate(me.GetVictim()); - me.resetAttackTimer(); + me.ResetAttackTimer(); } } else diff --git a/Source/Scripts/World/ItemScripts.cs b/Source/Scripts/World/ItemScripts.cs index ec0b3eea3..0cd3644a2 100644 --- a/Source/Scripts/World/ItemScripts.cs +++ b/Source/Scripts/World/ItemScripts.cs @@ -370,7 +370,7 @@ namespace Scripts.World public override bool OnCastItemCombatSpell(Player player, Unit victim, SpellInfo spellInfo, Item item) { // spell proc chance gets severely reduced on victims > 60 (formula unknown) - if (victim.getLevel() > 60) + if (victim.GetLevel() > 60) { // gives ~0.1% proc chance at lvl 70 float lvlPenaltyFactor = 9.93f; diff --git a/Source/Scripts/World/NpcSpecial.cs b/Source/Scripts/World/NpcSpecial.cs index 1af76cd09..7ca38f648 100644 --- a/Source/Scripts/World/NpcSpecial.cs +++ b/Source/Scripts/World/NpcSpecial.cs @@ -950,7 +950,7 @@ namespace Scripts.World.NpcSpecial { Creature patient = ObjectAccessor.GetCreature(me, guid); if (patient) - patient.setDeathState(DeathState.JustDied); + patient.SetDeathState(DeathState.JustDied); } } @@ -1156,7 +1156,7 @@ namespace Scripts.World.NpcSpecial { me.RemoveUnitFlag(UnitFlags.InCombat); me.AddUnitFlag(UnitFlags.NotSelectable); - me.setDeathState(DeathState.JustDied); + me.SetDeathState(DeathState.JustDied); me.AddDynamicFlag(UnitDynFlags.Dead); if (!DoctorGUID.IsEmpty()) @@ -1320,10 +1320,10 @@ namespace Scripts.World.NpcSpecial if (!UpdateVictim()) return; - if (me.isAttackReady()) + if (me.IsAttackReady()) { DoCastVictim(Spells.Deathtouch, true); - me.resetAttackTimer(); + me.ResetAttackTimer(); } } } @@ -1501,7 +1501,7 @@ namespace Scripts.World.NpcSpecial if (ExplosionTimer <= diff) { DoCast(me, Spells.TonkMineDetonate, true); - me.setDeathState(DeathState.Dead); // unsummon it + me.SetDeathState(DeathState.Dead); // unsummon it } else ExplosionTimer -= diff; @@ -1582,7 +1582,7 @@ namespace Scripts.World.NpcSpecial { Unit unit = Global.ObjAccessor.GetUnit(me, pair.Key); if (unit) - unit.getHostileRefManager().deleteReference(me); + unit.GetHostileRefManager().deleteReference(me); _damageTimes.Remove(pair.Key); }