aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorkaelima <kaelima@live.se>2012-12-21 00:00:16 +0100
committerkaelima <kaelima@live.se>2012-12-21 00:00:16 +0100
commit0a88787dfc747437b6278a044a425b6483e61b37 (patch)
tree65942c84524890446a79ef67fd1ea2ce622a8544 /src/server/game
parent8f27dfda627903997b67cab9ebb4c5b365da201e (diff)
parent4116ba75e3bef999c3111943c3b389ffc195b686 (diff)
Merge git://github.com/TrinityCore/TrinityCore into mmaps
Conflicts: src/server/game/Entities/Vehicle/Vehicle.cpp src/server/game/Movement/MovementGenerator.h src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp src/server/game/Movement/MovementGenerators/PointMovementGenerator.h src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h src/server/game/Movement/Spline/MoveSpline.h
Diffstat (limited to 'src/server/game')
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/CombatAI.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/CombatAI.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/GuardAI.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/GuardAI.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/PassiveAI.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/PassiveAI.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/PetAI.cpp239
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/PetAI.h14
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/ReactorAI.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/ReactorAI.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/TotemAI.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/TotemAI.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/UnitAI.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/UnitAI.h11
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAI.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAI.h4
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAIFactory.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAIImpl.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAIRegistry.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAIRegistry.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAISelector.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAISelector.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/EventAI/CreatureEventAI.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/EventAI/CreatureEventAI.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/EventAI/CreatureEventAIMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/EventAI/CreatureEventAIMgr.h0
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/game/Accounts/AccountMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Accounts/AccountMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Achievements/AchievementMgr.cpp62
-rw-r--r--[-rwxr-xr-x]src/server/game/Achievements/AchievementMgr.h45
-rw-r--r--[-rwxr-xr-x]src/server/game/Addons/AddonMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Addons/AddonMgr.h0
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp53
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.h16
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp142
-rw-r--r--src/server/game/Battlefield/Battlefield.h41
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp165
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.h266
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/ArenaTeam.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/ArenaTeam.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Battleground.cpp9
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Battleground.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/BattlegroundMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/BattlegroundMgr.h4
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/BattlegroundQueue.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/BattlegroundQueue.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundAB.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundAV.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundBE.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundDS.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundEY.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundIC.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundNA.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundRL.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundRV.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundSA.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundWS.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Channels/Channel.cpp8
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Channels/Channel.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Channels/ChannelMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Channels/ChannelMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Chat.cpp3
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Chat.h0
-rw-r--r--src/server/game/Chat/ChatLink.cpp25
-rw-r--r--[-rwxr-xr-x]src/server/game/Combat/HostileRefManager.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Combat/HostileRefManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Combat/ThreatManager.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Combat/ThreatManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Combat/UnitEvents.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Conditions/ConditionMgr.cpp110
-rw-r--r--[-rwxr-xr-x]src/server/game/Conditions/ConditionMgr.h10
-rw-r--r--[-rwxr-xr-x]src/server/game/Conditions/DisableMgr.cpp3
-rw-r--r--[-rwxr-xr-x]src/server/game/Conditions/DisableMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/DataStores/DBCEnums.h13
-rw-r--r--[-rwxr-xr-x]src/server/game/DataStores/DBCStores.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/game/DataStores/DBCStores.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/DataStores/DBCStructure.h6
-rw-r--r--[-rwxr-xr-x]src/server/game/DataStores/DBCfmt.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/DungeonFinding/LFG.h0
-rw-r--r--src/server/game/DungeonFinding/LFGGroupData.cpp6
-rw-r--r--[-rwxr-xr-x]src/server/game/DungeonFinding/LFGMgr.cpp125
-rw-r--r--[-rwxr-xr-x]src/server/game/DungeonFinding/LFGMgr.h2
-rw-r--r--src/server/game/DungeonFinding/LFGPlayerData.cpp18
-rw-r--r--src/server/game/DungeonFinding/LFGPlayerData.h4
-rw-r--r--src/server/game/DungeonFinding/LFGQueue.cpp7
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.cpp1
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Corpse/Corpse.cpp40
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Corpse/Corpse.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/Creature.cpp76
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/Creature.h8
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/CreatureGroups.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/CreatureGroups.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/GossipDef.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/GossipDef.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/TemporarySummon.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/TemporarySummon.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/DynamicObject/DynamicObject.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/DynamicObject/DynamicObject.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/GameObject/GameObject.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/GameObject/GameObject.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/Container/Bag.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/Container/Bag.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/Item.cpp198
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/Item.h9
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/ItemEnchantmentMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/ItemEnchantmentMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/ItemPrototype.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Object.cpp7
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Object.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/ObjectDefines.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/ObjectPosSelector.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/ObjectPosSelector.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Updates/UpdateData.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Updates/UpdateData.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Updates/UpdateFields.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Updates/UpdateMask.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Pet/Pet.cpp9
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Pet/Pet.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Player/Player.cpp610
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Player/Player.h89
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Player/SocialMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Player/SocialMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Totem/Totem.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Totem/Totem.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Transport/Transport.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Transport/Transport.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Unit/StatSystem.cpp6
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Unit/Unit.cpp503
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Unit/Unit.h44
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp8
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Vehicle/Vehicle.h7
-rw-r--r--[-rwxr-xr-x]src/server/game/Events/GameEventMgr.cpp10
-rw-r--r--[-rwxr-xr-x]src/server/game/Events/GameEventMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Globals/ObjectAccessor.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Globals/ObjectAccessor.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Globals/ObjectMgr.cpp86
-rw-r--r--[-rwxr-xr-x]src/server/game/Globals/ObjectMgr.h12
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/Cells/Cell.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/Grid.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/GridLoader.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/GridRefManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/GridReference.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/GridStates.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/GridStates.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/NGrid.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/Notifiers/GridNotifiers.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/Notifiers/GridNotifiers.h29
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/Notifiers/GridNotifiersImpl.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/ObjectGridLoader.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/ObjectGridLoader.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Groups/Group.cpp27
-rw-r--r--[-rwxr-xr-x]src/server/game/Groups/Group.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Groups/GroupRefManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Groups/GroupReference.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Groups/GroupReference.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Guilds/Guild.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/game/Guilds/Guild.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/AddonHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/AddonHandler.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/ArenaTeamHandler.cpp16
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/AuctionHouseHandler.cpp78
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/AuthHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/BattleGroundHandler.cpp8
-rw-r--r--src/server/game/Handlers/BattlefieldHandler.cpp (renamed from src/server/game/Battlefield/BattlefieldHandler.cpp)6
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/CalendarHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/ChannelHandler.cpp0
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp122
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/ChatHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/CombatHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/DuelHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/GroupHandler.cpp24
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/GuildHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/ItemHandler.cpp45
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/LFGHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/LootHandler.cpp22
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/MailHandler.cpp18
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/MiscHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/MovementHandler.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/NPCHandler.cpp44
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/NPCHandler.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/PetHandler.cpp16
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/PetitionsHandler.cpp16
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/QueryHandler.cpp10
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/QuestHandler.cpp20
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/SkillHandler.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/SpellHandler.cpp17
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/TaxiHandler.cpp8
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/TicketHandler.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/TradeHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/VoiceChatHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Instances/InstanceSaveMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Instances/InstanceSaveMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Instances/InstanceScript.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Instances/InstanceScript.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Loot/LootMgr.cpp41
-rw-r--r--[-rwxr-xr-x]src/server/game/Loot/LootMgr.h16
-rw-r--r--[-rwxr-xr-x]src/server/game/Mails/Mail.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Mails/Mail.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/Map.cpp6
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/Map.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapInstanced.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapInstanced.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapManager.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapRefManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapReference.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/ZoneScript.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Miscellaneous/Formulas.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Miscellaneous/Language.h3
-rw-r--r--[-rwxr-xr-x]src/server/game/Miscellaneous/SharedDefines.h184
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/FollowerRefManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/FollowerReference.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/FollowerReference.h0
-rw-r--r--src/server/game/Movement/MotionMaster.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MotionMaster.h4
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerator.cpp0
-rwxr-xr-xsrc/server/game/Movement/MovementGenerator.h4
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGeneratorImpl.h0
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp6
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h2
-rw-r--r--src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp10
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h4
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h0
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp4
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/IdleMovementGenerator.h6
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp8
-rw-r--r--src/server/game/Movement/MovementGenerators/PointMovementGenerator.h4
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h0
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp10
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h3
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp4
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h4
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.cpp6
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.h29
-rw-r--r--src/server/game/Movement/Spline/MoveSplineFlag.h75
-rw-r--r--src/server/game/Movement/Spline/MovementTypedefs.h6
-rw-r--r--src/server/game/Movement/Spline/MovementUtil.cpp79
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/Waypoints/Path.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/Waypoints/WaypointManager.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/Waypoints/WaypointManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/OutdoorPvP/OutdoorPvP.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/OutdoorPvP/OutdoorPvP.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/OutdoorPvP/OutdoorPvPMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Pools/PoolMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Pools/PoolMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Quests/QuestDef.cpp5
-rw-r--r--[-rwxr-xr-x]src/server/game/Quests/QuestDef.h8
-rw-r--r--[-rwxr-xr-x]src/server/game/Reputation/ReputationMgr.cpp21
-rw-r--r--[-rwxr-xr-x]src/server/game/Reputation/ReputationMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Scripting/MapScripts.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Scripting/ScriptLoader.cpp14
-rw-r--r--src/server/game/Scripting/ScriptLoader.h1
-rw-r--r--[-rwxr-xr-x]src/server/game/Scripting/ScriptMgr.cpp107
-rw-r--r--[-rwxr-xr-x]src/server/game/Scripting/ScriptMgr.h29
-rw-r--r--[-rwxr-xr-x]src/server/game/Scripting/ScriptSystem.cpp122
-rw-r--r--src/server/game/Scripting/ScriptSystem.h24
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/Protocol/Opcodes.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/Protocol/Opcodes.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSession.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSession.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSocket.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSocket.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSocketMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSocketMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Skills/SkillDiscovery.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Skills/SkillDiscovery.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Skills/SkillExtraItems.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Skills/SkillExtraItems.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Auras/SpellAuraDefines.h632
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Auras/SpellAuraEffects.cpp121
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Auras/SpellAuras.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Auras/SpellAuras.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Spell.cpp25
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Spell.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/SpellEffects.cpp76
-rw-r--r--src/server/game/Spells/SpellInfo.cpp11
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/SpellMgr.cpp11
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/SpellMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/SpellScript.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/SpellScript.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Texts/CreatureTextMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Texts/CreatureTextMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Tickets/TicketMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Tickets/TicketMgr.h0
-rw-r--r--src/server/game/Tools/CharacterDatabaseCleaner.cpp8
-rw-r--r--src/server/game/Tools/PlayerDump.cpp1
-rw-r--r--[-rwxr-xr-x]src/server/game/Tools/PlayerDump.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Weather/Weather.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Weather/Weather.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Weather/WeatherMgr.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Weather/WeatherMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/World/World.cpp69
-rw-r--r--src/server/game/World/World.h11
306 files changed, 3105 insertions, 2433 deletions
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index d9d19c2f009..d9d19c2f009 100755..100644
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h
index fa31e57d780..fa31e57d780 100755..100644
--- a/src/server/game/AI/CoreAI/CombatAI.h
+++ b/src/server/game/AI/CoreAI/CombatAI.h
diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp
index 90ca7009098..90ca7009098 100755..100644
--- a/src/server/game/AI/CoreAI/GuardAI.cpp
+++ b/src/server/game/AI/CoreAI/GuardAI.cpp
diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h
index c8dd9d54921..c8dd9d54921 100755..100644
--- a/src/server/game/AI/CoreAI/GuardAI.h
+++ b/src/server/game/AI/CoreAI/GuardAI.h
diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp
index 3738d5bab6c..3738d5bab6c 100755..100644
--- a/src/server/game/AI/CoreAI/PassiveAI.cpp
+++ b/src/server/game/AI/CoreAI/PassiveAI.cpp
diff --git a/src/server/game/AI/CoreAI/PassiveAI.h b/src/server/game/AI/CoreAI/PassiveAI.h
index b4fd579d693..b4fd579d693 100755..100644
--- a/src/server/game/AI/CoreAI/PassiveAI.h
+++ b/src/server/game/AI/CoreAI/PassiveAI.h
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 1de5417b820..78c22e74f44 100755..100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -44,10 +44,6 @@ PetAI::PetAI(Creature* c) : CreatureAI(c), i_tracker(TIME_INTERVAL_LOOK)
UpdateAllies();
}
-void PetAI::EnterEvadeMode()
-{
-}
-
bool PetAI::_needToStop()
{
// This is needed for charmed creatures, as once their target was reset other effects can trigger threat
@@ -74,12 +70,13 @@ void PetAI::_stopAttack()
me->InterruptNonMeleeSpells(false);
me->SendMeleeAttackStop(); // Should stop pet's attack button from flashing
me->GetCharmInfo()->SetIsCommandAttack(false);
+ ClearCharmInfoFlags();
HandleReturnMovement();
}
void PetAI::UpdateAI(const uint32 diff)
{
- if (!me->isAlive())
+ if (!me->isAlive() || !me->GetCharmInfo())
return;
Unit* owner = me->GetCharmerOrOwner();
@@ -107,39 +104,34 @@ void PetAI::UpdateAI(const uint32 diff)
}
// Check before attacking to prevent pets from leaving stay position
- if (CanAttack(me->getVictim()))
+ if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
+ {
+ if (me->GetCharmInfo()->IsCommandAttack() || (me->GetCharmInfo()->IsAtStay() && me->IsWithinMeleeRange(me->getVictim())))
+ DoMeleeAttackIfReady();
+ }
+ else
DoMeleeAttackIfReady();
}
- else if (owner && me->GetCharmInfo()) //no victim
+ else
{
- // Only aggressive pets do target search every update.
- // Defensive pets do target search only in these cases:
- // * Owner attacks something - handled by OwnerAttacked()
- // * Owner receives damage - handled by OwnerDamagedBy()
- // * Pet is in combat and current target dies - handled by KilledUnit()
- if (me->HasReactState(REACT_AGGRESSIVE))
+ if (me->HasReactState(REACT_AGGRESSIVE) || me->GetCharmInfo()->IsAtStay())
{
- Unit* nextTarget = SelectNextTarget();
+ // Every update we need to check targets only in certain cases
+ // Aggressive - Allow auto select if owner or pet don't have a target
+ // Stay - Only pick from pet or owner targets / attackers so targets won't run by
+ // while chasing our owner. Don't do auto select.
+ // All other cases (ie: defensive) - Targets are assigned by AttackedBy(), OwnerAttackedBy(), OwnerAttacked(), etc.
+ Unit* nextTarget = SelectNextTarget(me->HasReactState(REACT_AGGRESSIVE));
if (nextTarget)
AttackStart(nextTarget);
else
- {
- me->GetCharmInfo()->SetIsCommandAttack(false);
HandleReturnMovement();
- }
}
else
- {
- me->GetCharmInfo()->SetIsCommandAttack(false);
HandleReturnMovement();
- }
- }
- else if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW)) // no charm info and no victim
- HandleReturnMovement();
- if (!me->GetCharmInfo())
- return;
+ }
// Autocast (casted only in combat or persistent spells in any state)
if (!me->HasUnitState(UNIT_STATE_CASTING))
@@ -191,6 +183,9 @@ void PetAI::UpdateAI(const uint32 diff)
}
}
+ if (spellInfo->HasEffect(SPELL_EFFECT_JUMP_DEST))
+ continue; // Pets must only jump to target
+
// No enemy, check friendly
if (!spellUsed)
{
@@ -274,6 +269,7 @@ void PetAI::UpdateAllies()
//only pet and owner/not in group->ok
if (m_AllySet.size() == 2 && !group)
return;
+
//owner is in group; group members filled in already (no raid -> subgroupcount = whole count)
if (group && !group->isRaidGroup() && m_AllySet.size() == (group->GetMembersCount() + 2))
return;
@@ -313,15 +309,11 @@ void PetAI::KilledUnit(Unit* victim)
me->InterruptNonMeleeSpells(false);
me->SendMeleeAttackStop(); // Stops the pet's 'Attack' button from flashing
- Unit* nextTarget = SelectNextTarget();
-
- if (nextTarget)
+ // Before returning to owner, see if there are more things to attack
+ if (Unit* nextTarget = SelectNextTarget(false))
AttackStart(nextTarget);
else
- {
- me->GetCharmInfo()->SetIsCommandAttack(false);
HandleReturnMovement(); // Return
- }
}
void PetAI::AttackStart(Unit* target)
@@ -332,17 +324,14 @@ void PetAI::AttackStart(Unit* target)
if (!CanAttack(target))
return;
- if (Unit* owner = me->GetOwner())
- owner->SetInCombatWith(target);
-
// Only chase if not commanded to stay or if stay but commanded to attack
DoAttack(target, (!me->GetCharmInfo()->HasCommandState(COMMAND_STAY) || me->GetCharmInfo()->IsCommandAttack()));
}
-void PetAI::OwnerDamagedBy(Unit* attacker)
+void PetAI::OwnerAttackedBy(Unit* attacker)
{
- // Called when owner takes damage. Allows defensive pets to know
- // that their owner might need help
+ // Called when owner takes damage. This function helps keep pets from running off
+ // simply due to owner gaining aggro.
if (!attacker)
return;
@@ -380,10 +369,12 @@ void PetAI::OwnerAttacked(Unit* target)
AttackStart(target);
}
-Unit* PetAI::SelectNextTarget()
+Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const
{
- // Provides next target selection after current target death
- // Targets are not evaluated here for being valid attack targets
+ // Provides next target selection after current target death.
+ // This function should only be called internally by the AI
+ // Targets are not evaluated here for being valid targets, that is done in _CanAttack()
+ // The parameter: allowAutoSelect lets us disable aggressive pet auto targeting for certain situations
// Passive pets don't do next target selection
if (me->HasReactState(REACT_PASSIVE))
@@ -406,17 +397,17 @@ Unit* PetAI::SelectNextTarget()
// Check owner victim
// 3.0.2 - Pets now start attacking their owners victim in defensive mode as soon as the hunter does
if (Unit* ownerVictim = me->GetCharmerOrOwner()->getVictim())
- if (!ownerVictim->HasBreakableByDamageCrowdControlAura())
return ownerVictim;
// Neither pet or owner had a target and aggressive pets can pick any target
- // Note: Creature::SelectNearestTarget() If no distance is supplied it uses MAX_VISIBILITY_DISTANCE
- // We also want to lock this to LOS so pet doesn't go running through walls and stuff
- if (me->HasReactState(REACT_AGGRESSIVE))
- if (Unit* nearTarget = me->ToCreature()->SelectNearestTarget())
- if (nearTarget->IsHostileTo(me) && !nearTarget->HasBreakableByDamageCrowdControlAura())
- if (nearTarget->IsWithinLOS(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()))
- return nearTarget;
+ // To prevent aggressive pets from chain selecting targets and running off, we
+ // only select a random target if certain conditions are met.
+ if (me->HasReactState(REACT_AGGRESSIVE) && allowAutoSelect)
+ {
+ if (!me->GetCharmInfo()->IsReturning() || me->GetCharmInfo()->IsFollowing() || me->GetCharmInfo()->IsAtStay())
+ if (Unit* nearTarget = me->ToCreature()->SelectNearestHostileUnitInAggroRange(true))
+ return nearTarget;
+ }
// Default - no valid targets
return NULL;
@@ -426,6 +417,11 @@ void PetAI::HandleReturnMovement()
{
// Handles moving the pet back to stay or owner
+ // Prevent activating movement when under control of spells
+ // such as "Eyes of the Beast"
+ if (me->isCharmed())
+ return;
+
if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
{
if (!me->GetCharmInfo()->IsAtStay() && !me->GetCharmInfo()->IsReturning())
@@ -436,6 +432,7 @@ void PetAI::HandleReturnMovement()
float x, y, z;
me->GetCharmInfo()->GetStayPosition(x, y, z);
+ ClearCharmInfoFlags();
me->GetCharmInfo()->SetIsReturning(true);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(me->GetGUIDLow(), x, y, z);
@@ -448,6 +445,7 @@ void PetAI::HandleReturnMovement()
{
if (!me->GetCharmInfo()->IsCommandAttack())
{
+ ClearCharmInfoFlags();
me->GetCharmInfo()->SetIsReturning(true);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveFollow(me->GetCharmerOrOwner(), PET_FOLLOW_DIST, me->GetFollowAngle());
@@ -458,33 +456,33 @@ void PetAI::HandleReturnMovement()
void PetAI::DoAttack(Unit* target, bool chase)
{
- // Handles attack with or without chase and also resets all
- // PetAI flags for next update / creature kill
+ // Handles attack with or without chase and also resets flags
+ // for next update / creature kill
- // me->GetCharmInfo()->SetIsCommandAttack(false);
+ if (me->Attack(target, true))
+ {
+ if (Unit* owner = me->GetOwner())
+ owner->SetInCombatWith(target);
- // The following conditions are true if chase == true
- // (Follow && (Aggressive || Defensive))
- // ((Stay || Follow) && (Passive && player clicked attack))
+ // Play sound to let the player know the pet is attacking something it picked on its own
+ if (me->HasReactState(REACT_AGGRESSIVE) && !me->GetCharmInfo()->IsCommandAttack())
+ me->SendPetAIReaction(me->GetGUID());
- if (chase)
- {
- if (me->Attack(target, true))
+
+ if (chase)
+ {
+ ClearCharmInfoFlags();
+ me->GetMotionMaster()->Clear();
+ me->GetMotionMaster()->MoveChase(target);
+ }
+ else // (Stay && ((Aggressive || Defensive) && In Melee Range)))
{
- me->GetCharmInfo()->SetIsAtStay(false);
- me->GetCharmInfo()->SetIsFollowing(false);
- me->GetCharmInfo()->SetIsReturning(false);
+ ClearCharmInfoFlags();
+ me->GetCharmInfo()->SetIsAtStay(true);
me->GetMotionMaster()->Clear();
- me->GetMotionMaster()->MoveChase(target);
+ me->GetMotionMaster()->MoveIdle();
}
}
- else // (Stay && ((Aggressive || Defensive) && In Melee Range)))
- {
- me->GetCharmInfo()->SetIsAtStay(true);
- me->GetCharmInfo()->SetIsFollowing(false);
- me->GetCharmInfo()->SetIsReturning(false);
- me->Attack(target, true);
- }
}
void PetAI::MovementInform(uint32 moveType, uint32 data)
@@ -498,10 +496,8 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
// pet's GUIDLow since we set that as the waypoint ID
if (data == me->GetGUIDLow() && me->GetCharmInfo()->IsReturning())
{
+ ClearCharmInfoFlags();
me->GetCharmInfo()->SetIsAtStay(true);
- me->GetCharmInfo()->SetIsReturning(false);
- me->GetCharmInfo()->SetIsFollowing(false);
- me->GetCharmInfo()->SetIsCommandAttack(false);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
}
@@ -513,10 +509,8 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
// otherwise we're probably chasing a creature
if (me->GetCharmerOrOwner() && me->GetCharmInfo() && data == me->GetCharmerOrOwner()->GetGUIDLow() && me->GetCharmInfo()->IsReturning())
{
- me->GetCharmInfo()->SetIsAtStay(false);
- me->GetCharmInfo()->SetIsReturning(false);
+ ClearCharmInfoFlags();
me->GetCharmInfo()->SetIsFollowing(true);
- me->GetCharmInfo()->SetIsCommandAttack(false);
}
break;
}
@@ -527,32 +521,55 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
bool PetAI::CanAttack(Unit* target)
{
- // Evaluates wether a pet can attack a specific
- // target based on CommandState, ReactState and other flags
+ // Evaluates wether a pet can attack a specific target based on CommandState, ReactState and other flags
+ // IMPORTANT: The order in which things are checked is important, be careful if you add or remove checks
- // Can't attack dead targets...
- if (!target->isAlive())
+ // Hmmm...
+ if (!target)
return false;
- // Returning - check first since pets returning ignore attacks
- if (me->GetCharmInfo()->IsReturning())
+ if (!target->isAlive())
+ {
+ // Clear target to prevent getting stuck on dead targets
+ me->AttackStop();
+ me->InterruptNonMeleeSpells(false);
+ me->SendMeleeAttackStop();
return false;
+ }
- // Passive - check now so we don't have to worry about passive in later checks
+ // Passive - passive pets can attack if told to
if (me->HasReactState(REACT_PASSIVE))
return me->GetCharmInfo()->IsCommandAttack();
- // Follow
- if (me->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW))
- return true;
+ // CC - mobs under crowd control can be attacked if owner commanded
+ if (target->HasBreakableByDamageCrowdControlAura())
+ return me->GetCharmInfo()->IsCommandAttack();
+
+ // Returning - pets ignore attacks only if owner clicked follow
+ if (me->GetCharmInfo()->IsReturning())
+ return !me->GetCharmInfo()->IsCommandFollow();
// Stay - can attack if target is within range or commanded to
if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
return (me->IsWithinMeleeRange(target) || me->GetCharmInfo()->IsCommandAttack());
- // Pets commanded to attack should not stop their approach if attacked by another creature
- if (me->getVictim() && (me->getVictim() != target))
- return !me->GetCharmInfo()->IsCommandAttack();
+ // Pets attacking something (or chasing) should only switch targets if owner tells them to
+ if (me->getVictim() && me->getVictim() != target)
+ {
+ // Check if our owner selected this target and clicked "attack"
+ Unit* ownerTarget = NULL;
+ if (Player* owner = me->GetCharmerOrOwner()->ToPlayer())
+ ownerTarget = owner->GetSelectedUnit();
+ else
+ ownerTarget = me->GetCharmerOrOwner()->getVictim();
+
+ if (ownerTarget && me->GetCharmInfo()->IsCommandAttack())
+ return (target->GetGUID() == ownerTarget->GetGUID());
+ }
+
+ // Follow
+ if (me->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW))
+ return !me->GetCharmInfo()->IsReturning();
// default, though we shouldn't ever get here
return false;
@@ -565,11 +582,55 @@ void PetAI::ReceiveEmote(Player* player, uint32 emote)
{
case TEXT_EMOTE_COWER:
if (me->isPet() && me->ToPet()->IsPetGhoul())
- me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
+ me->HandleEmoteCommand(/*EMOTE_ONESHOT_ROAR*/EMOTE_ONESHOT_OMNICAST_GHOUL);
break;
case TEXT_EMOTE_ANGRY:
if (me->isPet() && me->ToPet()->IsPetGhoul())
- me->HandleEmoteCommand(EMOTE_ONESHOT_COWER);
+ me->HandleEmoteCommand(/*EMOTE_ONESHOT_COWER*/EMOTE_STATE_STUN);
+ break;
+ case TEXT_EMOTE_GLARE:
+ if (me->isPet() && me->ToPet()->IsPetGhoul())
+ me->HandleEmoteCommand(EMOTE_STATE_STUN);
+ break;
+ case TEXT_EMOTE_SOOTHE:
+ if (me->isPet() && me->ToPet()->IsPetGhoul())
+ me->HandleEmoteCommand(EMOTE_ONESHOT_OMNICAST_GHOUL);
break;
}
}
+
+void PetAI::ClearCharmInfoFlags()
+{
+ // Quick access to set all flags to FALSE
+
+ CharmInfo* ci = me->GetCharmInfo();
+
+ if (ci)
+ {
+ ci->SetIsAtStay(false);
+ ci->SetIsCommandAttack(false);
+ ci->SetIsCommandFollow(false);
+ ci->SetIsFollowing(false);
+ ci->SetIsReturning(false);
+ }
+}
+
+void PetAI::AttackedBy(Unit* attacker)
+{
+ // Called when pet takes damage. This function helps keep pets from running off
+ // simply due to gaining aggro.
+
+ if (!attacker)
+ return;
+
+ // Passive pets don't do anything
+ if (me->HasReactState(REACT_PASSIVE))
+ return;
+
+ // Prevent pet from disengaging from current target
+ if (me->getVictim() && me->getVictim()->isAlive())
+ return;
+
+ // Continue to evaluate and attack if necessary
+ AttackStart(attacker);
+}
diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h
index d7f1dca3fbf..8a8853b19b5 100755..100644
--- a/src/server/game/AI/CoreAI/PetAI.h
+++ b/src/server/game/AI/CoreAI/PetAI.h
@@ -31,17 +31,24 @@ class PetAI : public CreatureAI
explicit PetAI(Creature* c);
- void EnterEvadeMode();
void UpdateAI(const uint32);
static int Permissible(const Creature*);
void KilledUnit(Unit* /*victim*/);
void AttackStart(Unit* target);
void MovementInform(uint32 moveType, uint32 data);
- void OwnerDamagedBy(Unit* attacker);
+ void OwnerAttackedBy(Unit* attacker);
void OwnerAttacked(Unit* target);
+ void AttackedBy(Unit* attacker);
void ReceiveEmote(Player* player, uint32 textEmote);
+ // The following aren't used by the PetAI but need to be defined to override
+ // default CreatureAI functions which interfere with the PetAI
+ //
+ void MoveInLineOfSight(Unit* /*who*/) {} // CreatureAI interferes with returning pets
+ void MoveInLineOfSight_Safe(Unit* /*who*/) {} // CreatureAI interferes with returning pets
+ void EnterEvadeMode() {} // For fleeing, pets don't use this type of Evade mechanic
+
private:
bool _isVisible(Unit*) const;
bool _needToStop(void);
@@ -54,10 +61,11 @@ class PetAI : public CreatureAI
std::set<uint64> m_AllySet;
uint32 m_updateAlliesTimer;
- Unit* SelectNextTarget();
+ Unit* SelectNextTarget(bool allowAutoSelect) const;
void HandleReturnMovement();
void DoAttack(Unit* target, bool chase);
bool CanAttack(Unit* target);
+ void ClearCharmInfoFlags();
};
#endif
diff --git a/src/server/game/AI/CoreAI/ReactorAI.cpp b/src/server/game/AI/CoreAI/ReactorAI.cpp
index 4683a75a44e..4683a75a44e 100755..100644
--- a/src/server/game/AI/CoreAI/ReactorAI.cpp
+++ b/src/server/game/AI/CoreAI/ReactorAI.cpp
diff --git a/src/server/game/AI/CoreAI/ReactorAI.h b/src/server/game/AI/CoreAI/ReactorAI.h
index 4a95dcf04e8..4a95dcf04e8 100755..100644
--- a/src/server/game/AI/CoreAI/ReactorAI.h
+++ b/src/server/game/AI/CoreAI/ReactorAI.h
diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp
index d12d3c098e8..d12d3c098e8 100755..100644
--- a/src/server/game/AI/CoreAI/TotemAI.cpp
+++ b/src/server/game/AI/CoreAI/TotemAI.cpp
diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h
index f0d705345ef..f0d705345ef 100755..100644
--- a/src/server/game/AI/CoreAI/TotemAI.h
+++ b/src/server/game/AI/CoreAI/TotemAI.h
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp
index 9f2c9a86094..9f2c9a86094 100755..100644
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index 2eab0e89fcd..8b31bb5c54d 100755..100644
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -29,17 +29,6 @@ class Quest;
class Unit;
struct AISpellInfoType;
-// Default script texts
-enum GeneralScriptTexts
-{
- DEFAULT_TEXT = -1000000,
- EMOTE_GENERIC_FRENZY_KILL = -1000001,
- EMOTE_GENERIC_FRENZY = -1000002,
- EMOTE_GENERIC_ENRAGED = -1000003,
- EMOTE_GENERIC_BERSERK = -1000004,
- EMOTE_GENERIC_BERSERK_RAID = -1000005 // RaidBossEmote version of the previous one
-};
-
//Selection method used by SelectTarget
enum SelectAggroTarget
{
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index e5868117da8..e5868117da8 100755..100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index d3ad27935ca..4f61e168a87 100755..100644
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -117,7 +117,7 @@ class CreatureAI : public UnitAI
virtual void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spell*/) {}
// Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc)
- //virtual void AttackedBy(Unit* attacker);
+ virtual void AttackedBy(Unit* /*attacker*/) {}
virtual bool IsEscorted() { return false; }
// Called when creature is spawned or respawned (for reseting variables)
@@ -137,7 +137,7 @@ class CreatureAI : public UnitAI
virtual void ReceiveEmote(Player* /*player*/, uint32 /*emoteId*/) {}
// Called when owner takes damage
- virtual void OwnerDamagedBy(Unit* /*attacker*/) {}
+ virtual void OwnerAttackedBy(Unit* /*attacker*/) {}
// Called when owner attacks something
virtual void OwnerAttacked(Unit* /*target*/) {}
diff --git a/src/server/game/AI/CreatureAIFactory.h b/src/server/game/AI/CreatureAIFactory.h
index f4147826811..f4147826811 100755..100644
--- a/src/server/game/AI/CreatureAIFactory.h
+++ b/src/server/game/AI/CreatureAIFactory.h
diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h
index 981ac1f5f16..981ac1f5f16 100755..100644
--- a/src/server/game/AI/CreatureAIImpl.h
+++ b/src/server/game/AI/CreatureAIImpl.h
diff --git a/src/server/game/AI/CreatureAIRegistry.cpp b/src/server/game/AI/CreatureAIRegistry.cpp
index e5c689da339..e5c689da339 100755..100644
--- a/src/server/game/AI/CreatureAIRegistry.cpp
+++ b/src/server/game/AI/CreatureAIRegistry.cpp
diff --git a/src/server/game/AI/CreatureAIRegistry.h b/src/server/game/AI/CreatureAIRegistry.h
index 39d792a0d77..39d792a0d77 100755..100644
--- a/src/server/game/AI/CreatureAIRegistry.h
+++ b/src/server/game/AI/CreatureAIRegistry.h
diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp
index 4ccaa174e67..4ccaa174e67 100755..100644
--- a/src/server/game/AI/CreatureAISelector.cpp
+++ b/src/server/game/AI/CreatureAISelector.cpp
diff --git a/src/server/game/AI/CreatureAISelector.h b/src/server/game/AI/CreatureAISelector.h
index 933ec16f75c..933ec16f75c 100755..100644
--- a/src/server/game/AI/CreatureAISelector.h
+++ b/src/server/game/AI/CreatureAISelector.h
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index 84e44109e58..84e44109e58 100755..100644
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h
index da5f0b084cf..da5f0b084cf 100755..100644
--- a/src/server/game/AI/EventAI/CreatureEventAI.h
+++ b/src/server/game/AI/EventAI/CreatureEventAI.h
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
index f3df332c1e9..f3df332c1e9 100755..100644
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.h b/src/server/game/AI/EventAI/CreatureEventAIMgr.h
index 75e24266fb5..75e24266fb5 100755..100644
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.h
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.h
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 6aebcbb2d8a..bd528edc432 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -677,7 +677,7 @@ void SmartAI::CorpseRemoved(uint32& respawnDelay)
void SmartAI::PassengerBoarded(Unit* who, int8 seatId, bool apply)
{
- GetScript()->ProcessEventsFor(SMART_EVENT_PASSENGER_BOARDED, who, (uint32)seatId, 0, apply);
+ GetScript()->ProcessEventsFor(apply ? SMART_EVENT_PASSENGER_BOARDED : SMART_EVENT_PASSENGER_REMOVED, who, uint32(seatId), 0, apply);
}
void SmartAI::InitializeAI()
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index a82de501ea6..a82de501ea6 100755..100644
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h
index c14bcc48bdc..c14bcc48bdc 100755..100644
--- a/src/server/game/Accounts/AccountMgr.h
+++ b/src/server/game/Accounts/AccountMgr.h
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 91437ae3bb5..09e1de0a2bf 100755..100644
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -42,7 +42,6 @@
#include "World.h"
#include "WorldPacket.h"
-
namespace Trinity
{
class AchievementChatBuilder
@@ -472,7 +471,7 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uin
{
AchievementCriteriaEntry const* achievementCriteria = (*i);
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(achievementCriteria->referredAchievement);
if (!achievement)
continue;
@@ -620,7 +619,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
uint32 achievementid = fields[0].GetUInt16();
// must not happen: cleanup at server startup in sAchievementMgr->LoadCompletedAchievements()
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(achievementid);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(achievementid);
if (!achievement)
continue;
@@ -646,7 +645,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
uint32 counter = fields[1].GetUInt32();
time_t date = time_t(fields[2].GetUInt32());
- AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(id);
+ AchievementCriteriaEntry const* criteria = sAchievementMgr->GetAchievementCriteria(id);
if (!criteria)
{
// we will remove not existed criteria for all characters
@@ -781,7 +780,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i)
{
AchievementCriteriaEntry const* achievementCriteria = (*i);
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(achievementCriteria->referredAchievement);
if (!achievement)
continue;
@@ -1490,7 +1489,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
{
uint32 points = 0;
for (CompletedAchievementMap::iterator itr = m_completedAchievements.begin(); itr != m_completedAchievements.end(); ++itr)
- if (AchievementEntry const* pAchievement = sAchievementStore.LookupEntry(itr->first))
+ if (AchievementEntry const* pAchievement = sAchievementMgr->GetAchievement(itr->first))
points += pAchievement->points;
SetCriteriaProgress(achievementCriteria, points, PROGRESS_SET);
}
@@ -1940,7 +1939,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
if (entry->timeLimit)
{
// has to exist else we wouldn't be here
- timedCompleted = IsCompletedCriteria(entry, sAchievementStore.LookupEntry(entry->referredAchievement));
+ timedCompleted = IsCompletedCriteria(entry, sAchievementMgr->GetAchievement(entry->referredAchievement));
// Client expects this in packet
timeElapsed = entry->timeLimit - (timedIter->second/IN_MILLISECONDS);
@@ -1974,7 +1973,7 @@ void AchievementMgr::UpdateTimedAchievements(uint32 timeDiff)
// Time is up, remove timer and reset progress
if (itr->second <= timeDiff)
{
- AchievementCriteriaEntry const* entry = sAchievementCriteriaStore.LookupEntry(itr->first);
+ AchievementCriteriaEntry const* entry = sAchievementMgr->GetAchievementCriteria(itr->first);
RemoveCriteriaProgress(entry);
m_timedAchievements.erase(itr++);
}
@@ -1995,7 +1994,7 @@ void AchievementMgr::StartTimedAchievement(AchievementCriteriaTimedTypes type, u
if ((*i)->timerStartEvent != entry)
continue;
- AchievementEntry const* achievement = sAchievementStore.LookupEntry((*i)->referredAchievement);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement((*i)->referredAchievement);
if (m_timedAchievements.find((*i)->ID) == m_timedAchievements.end() && !IsCompletedCriteria(*i, achievement))
{
// Start the timer
@@ -2131,7 +2130,7 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket* data) const
for (CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter != m_completedAchievements.end(); ++iter)
{
// Skip hidden achievements
- achievement = sAchievementStore.LookupEntry(iter->first);
+ achievement = sAchievementMgr->GetAchievement(iter->first);
if (achievement->flags & ACHIEVEMENT_FLAG_HIDDEN)
continue;
@@ -2211,7 +2210,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId)
{
- AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId);
+ AchievementCriteriaEntry const* criteria = sAchievementMgr->GetAchievementCriteria(entryId);
if (!criteria)
continue;
@@ -2239,7 +2238,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
for (uint32 entryId = 0; entryId < sAchievementStore.GetNumRows(); ++entryId)
{
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(entryId);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(entryId);
if (!achievement || !achievement->refAchievement)
continue;
@@ -2248,7 +2247,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
}
// Once Bitten, Twice Shy (10 player) - Icecrown Citadel
- if (AchievementEntry const* achievement = sAchievementStore.LookupEntry(4539))
+ if (AchievementEntry const* achievement = sAchievementMgr->GetAchievement(4539))
const_cast<AchievementEntry*>(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -2275,7 +2274,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
Field* fields = result->Fetch();
uint32 criteria_id = fields[0].GetUInt32();
- AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(criteria_id);
+ AchievementCriteriaEntry const* criteria = sAchievementMgr->GetAchievementCriteria(criteria_id);
if (!criteria)
{
@@ -2315,7 +2314,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
// post loading checks
for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId)
{
- AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId);
+ AchievementCriteriaEntry const* criteria = sAchievementMgr->GetAchievementCriteria(entryId);
if (!criteria)
continue;
@@ -2327,7 +2326,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
break; // any cases
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST:
{
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(criteria->referredAchievement);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(criteria->referredAchievement);
if (!achievement)
continue;
@@ -2378,7 +2377,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST:
case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: // only Children's Week achievements
{
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(criteria->referredAchievement);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(criteria->referredAchievement);
if (!achievement)
continue;
if (achievement->categoryId != CATEGORY_CHILDRENS_WEEK)
@@ -2415,23 +2414,22 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
Field* fields = result->Fetch();
uint16 achievementId = fields[0].GetUInt16();
- const AchievementEntry* achievement = sAchievementStore.LookupEntry(achievementId);
+ const AchievementEntry* achievement = sAchievementMgr->GetAchievement(achievementId);
if (!achievement)
{
// Remove non existent achievements from all characters
sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Non-existing achievement %u data removed from table `character_achievement`.", achievementId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEVMENT);
-
stmt->setUInt16(0, uint16(achievementId));
-
CharacterDatabase.Execute(stmt);
continue;
}
else if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
m_allCompletedAchievements.insert(achievementId);
- } while (result->NextRow());
+ }
+ while (result->NextRow());
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu realm first completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
}
@@ -2442,7 +2440,7 @@ void AchievementGlobalMgr::LoadRewards()
m_achievementRewards.clear(); // need for reload case
- // 0 1 2 3 4 5 6
+ // 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT entry, title_A, title_H, item, sender, subject, text FROM achievement_reward");
if (!result)
@@ -2457,10 +2455,10 @@ void AchievementGlobalMgr::LoadRewards()
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
- const AchievementEntry* pAchievement = sAchievementStore.LookupEntry(entry);
+ const AchievementEntry* pAchievement = GetAchievement(entry);
if (!pAchievement)
{
- sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` has wrong achievement (Entry: %u), ignored.", entry);
continue;
}
@@ -2475,7 +2473,7 @@ void AchievementGlobalMgr::LoadRewards()
// must be title or mail at least
if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender)
{
- sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have title or item reward data, ignored.", entry);
continue;
}
@@ -2534,7 +2532,6 @@ void AchievementGlobalMgr::LoadRewards()
m_achievementRewards[entry] = reward;
++count;
-
}
while (result->NextRow());
@@ -2577,7 +2574,18 @@ void AchievementGlobalMgr::LoadRewardLocales()
ObjectMgr::AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.subject);
ObjectMgr::AddLocaleString(fields[1 + 2 * (i - 1) + 1].GetString(), locale, data.text);
}
- } while (result->NextRow());
+ }
+ while (result->NextRow());
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
}
+
+AchievementEntry const* AchievementGlobalMgr::GetAchievement(uint32 achievementId) const
+{
+ return sAchievementStore.LookupEntry(achievementId);
+}
+
+AchievementCriteriaEntry const* AchievementGlobalMgr::GetAchievementCriteria(uint32 criteriaId) const
+{
+ return sAchievementCriteriaStore.LookupEntry(criteriaId);
+}
diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h
index 3215b4196f7..0f3d63cd60f 100755..100644
--- a/src/server/game/Achievements/AchievementMgr.h
+++ b/src/server/game/Achievements/AchievementMgr.h
@@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef __TRINITY_ACHIEVEMENTMGR_H
#define __TRINITY_ACHIEVEMENTMGR_H
@@ -27,11 +28,15 @@
#include "DBCEnums.h"
#include "DBCStores.h"
-typedef std::list<AchievementCriteriaEntry const*> AchievementCriteriaEntryList;
-typedef std::list<AchievementEntry const*> AchievementEntryList;
+class Unit;
+class Player;
+class WorldPacket;
+
+typedef std::vector<AchievementCriteriaEntry const*> AchievementCriteriaEntryList;
+typedef std::vector<AchievementEntry const*> AchievementEntryList;
-typedef std::map<uint32, AchievementCriteriaEntryList> AchievementCriteriaListByAchievement;
-typedef std::map<uint32, AchievementEntryList> AchievementListByReferencedId;
+typedef UNORDERED_MAP<uint32, AchievementCriteriaEntryList> AchievementCriteriaListByAchievement;
+typedef UNORDERED_MAP<uint32, AchievementEntryList> AchievementListByReferencedId;
struct CriteriaProgress
{
@@ -68,9 +73,6 @@ enum AchievementCriteriaDataType
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 22 // maximum value in AchievementCriteriaDataType enum
-class Player;
-class Unit;
-
struct AchievementCriteriaData
{
AchievementCriteriaDataType dataType;
@@ -194,7 +196,7 @@ struct AchievementCriteriaData
}
bool IsValid(AchievementCriteriaEntry const* criteria);
- bool Meets(uint32 criteria_id, Player const* source, Unit const* target, uint32 miscvalue1 = 0) const;
+ bool Meets(uint32 criteria_id, Player const* source, Unit const* target, uint32 miscValue1 = 0) const;
};
struct AchievementCriteriaDataSet
@@ -202,7 +204,7 @@ struct AchievementCriteriaDataSet
AchievementCriteriaDataSet() : criteria_id(0) {}
typedef std::vector<AchievementCriteriaData> Storage;
void Add(AchievementCriteriaData const& data) { storage.push_back(data); }
- bool Meets(Player const* source, Unit const* target, uint32 miscvalue = 0) const;
+ bool Meets(Player const* source, Unit const* target, uint32 miscValue = 0) const;
void SetCriteriaId(uint32 id) {criteria_id = id;}
private:
uint32 criteria_id;
@@ -220,15 +222,15 @@ struct AchievementReward
std::string text;
};
-typedef std::map<uint32, AchievementReward> AchievementRewards;
+typedef UNORDERED_MAP<uint32, AchievementReward> AchievementRewards;
struct AchievementRewardLocale
{
- StringVector subject;
- StringVector text;
+ std::vector<std::string> subject;
+ std::vector<std::string> text;
};
-typedef std::map<uint32, AchievementRewardLocale> AchievementRewardLocales;
+typedef UNORDERED_MAP<uint32, AchievementRewardLocale> AchievementRewardLocales;
struct CompletedAchievementData
{
@@ -239,9 +241,12 @@ struct CompletedAchievementData
typedef UNORDERED_MAP<uint32, CriteriaProgress> CriteriaProgressMap;
typedef UNORDERED_MAP<uint32, CompletedAchievementData> CompletedAchievementMap;
-class Unit;
-class Player;
-class WorldPacket;
+enum ProgressType
+{
+ PROGRESS_SET,
+ PROGRESS_ACCUMULATE,
+ PROGRESS_HIGHEST
+};
class AchievementMgr
{
@@ -253,7 +258,7 @@ class AchievementMgr
static void DeleteFromDB(uint32 lowguid);
void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult);
void SaveToDB(SQLTransaction& trans);
- void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1 = 0, uint32 miscvalue2 = 0, bool evenIfCriteriaComplete = false);
+ void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, bool evenIfCriteriaComplete = false);
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = NULL);
void CompletedAchievement(AchievementEntry const* entry);
void CheckAllAchievementCriteria();
@@ -266,7 +271,6 @@ class AchievementMgr
void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); // used for quest and scripted timed achievements
private:
- enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST };
void SendAchievementEarned(AchievementEntry const* achievement) const;
void SendCriteriaUpdate(AchievementCriteriaEntry const* entry, CriteriaProgress const* progress, uint32 timeElapsed, bool timedCompleted) const;
CriteriaProgress* GetCriteriaProgress(AchievementCriteriaEntry const* entry);
@@ -348,14 +352,19 @@ class AchievementGlobalMgr
void LoadCompletedAchievements();
void LoadRewards();
void LoadRewardLocales();
+ AchievementEntry const* GetAchievement(uint32 achievementId) const;
+ AchievementCriteriaEntry const* GetAchievementCriteria(uint32 achievementId) const;
private:
AchievementCriteriaDataMap m_criteriaDataMap;
// store achievement criterias by type to speed up lookup
AchievementCriteriaEntryList m_AchievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];
+
AchievementCriteriaEntryList m_AchievementCriteriasByTimedType[ACHIEVEMENT_TIMED_TYPE_MAX];
+
// store achievement criterias by achievement to speed up lookup
AchievementCriteriaListByAchievement m_AchievementCriteriaListByAchievement;
+
// store achievements by referenced achievement id to speed up lookup
AchievementListByReferencedId m_AchievementListByReferencedId;
diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp
index a595c73c7c0..a595c73c7c0 100755..100644
--- a/src/server/game/Addons/AddonMgr.cpp
+++ b/src/server/game/Addons/AddonMgr.cpp
diff --git a/src/server/game/Addons/AddonMgr.h b/src/server/game/Addons/AddonMgr.h
index 9efbabc8b9f..9efbabc8b9f 100755..100644
--- a/src/server/game/Addons/AddonMgr.h
+++ b/src/server/game/Addons/AddonMgr.h
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index d580df63700..161c4a578ce 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -29,7 +29,7 @@
#include "AuctionHouseMgr.h"
#include "Item.h"
#include "Language.h"
-#include "Logging/Log.h"
+#include "Log.h"
#include <vector>
enum eAuctionHouse
@@ -89,7 +89,7 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
//does not clear ram
void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& trans)
{
- Item* pItem = GetAItem(auction->item_guidlow);
+ Item* pItem = GetAItem(auction->itemGUIDLow);
if (!pItem)
return;
@@ -143,7 +143,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
if (bidder)
{
- bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->item_template);
+ bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->itemEntry);
// FIXME: for offline player need also
bidder->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS, 1);
}
@@ -195,7 +195,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransaction& trans)
{
//return an item in auction to its owner by mail
- Item* pItem = GetAItem(auction->item_guidlow);
+ Item* pItem = GetAItem(auction->itemGUIDLow);
if (!pItem)
return;
@@ -228,7 +228,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
if (oldBidder || oldBidder_accId)
{
if (oldBidder && newBidder)
- oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template);
+ oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->itemEntry);
MailDraft(auction->BuildAuctionMailSubject(AUCTION_OUTBIDDED), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
.AddMoney(auction->bid)
@@ -275,17 +275,17 @@ void AuctionHouseMgr::LoadAuctionItems()
Field* fields = result->Fetch();
uint32 item_guid = fields[11].GetUInt32();
- uint32 item_template = fields[12].GetUInt32();
+ uint32 itemEntry = fields[12].GetUInt32();
- ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item_template);
+ ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
if (!proto)
{
- sLog->outError(LOG_FILTER_GENERAL, "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, item_template);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, itemEntry);
continue;
}
Item* item = NewItemOrBag(proto);
- if (!item->LoadFromDB(item_guid, 0, fields, item_template))
+ if (!item->LoadFromDB(item_guid, 0, fields, itemEntry))
{
delete item;
continue;
@@ -411,7 +411,7 @@ void AuctionHouseObject::AddAuction(AuctionEntry* auction)
sScriptMgr->OnAuctionAdd(this, auction);
}
-bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*item_template*/)
+bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*itemEntry*/)
{
bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false;
@@ -419,6 +419,8 @@ bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*item_temp
// we need to delete the entry, it is not referenced any more
delete auction;
+ auction = NULL;
+
return wasInMap;
}
@@ -465,14 +467,14 @@ void AuctionHouseObject::Update()
sScriptMgr->OnAuctionSuccessful(this, auction);
}
- uint32 item_template = auction->item_template;
+ uint32 itemEntry = auction->itemEntry;
///- In any case clear the auction
auction->DeleteFromDB(trans);
CharacterDatabase.CommitTransaction(trans);
- RemoveAuction(auction, item_template);
- sAuctionMgr->RemoveAItem(auction->item_guidlow);
+ sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
+ RemoveAuction(auction, itemEntry);
}
while (result->NextRow());
}
@@ -518,7 +520,7 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
{
AuctionEntry* Aentry = itr->second;
- Item* item = sAuctionMgr->GetAItem(Aentry->item_guidlow);
+ Item* item = sAuctionMgr->GetAItem(Aentry->itemGUIDLow);
if (!item)
continue;
@@ -570,7 +572,6 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
if (itemRandProp)
{
char* const* temp = itemRandProp->nameSuffix;
- //char* temp = itemRandProp->nameSuffix;
// dbc local name
if (temp)
@@ -601,10 +602,10 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
//this function inserts to WorldPacket auction's data
bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
{
- Item* item = sAuctionMgr->GetAItem(item_guidlow);
+ Item* item = sAuctionMgr->GetAItem(itemGUIDLow);
if (!item)
{
- sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, item_guidlow);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, itemGUIDLow);
return false;
}
data << uint32(Id);
@@ -658,7 +659,7 @@ void AuctionEntry::SaveToDB(SQLTransaction& trans) const
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AUCTION);
stmt->setUInt32(0, Id);
stmt->setUInt32(1, auctioneer);
- stmt->setUInt32(2, item_guidlow);
+ stmt->setUInt32(2, itemGUIDLow);
stmt->setUInt32(3, owner);
stmt->setInt32 (4, int32(buyout));
stmt->setUInt64(5, uint64(expire_time));
@@ -673,8 +674,8 @@ bool AuctionEntry::LoadFromDB(Field* fields)
{
Id = fields[0].GetUInt32();
auctioneer = fields[1].GetUInt32();
- item_guidlow = fields[2].GetUInt32();
- item_template = fields[3].GetUInt32();
+ itemGUIDLow = fields[2].GetUInt32();
+ itemEntry = fields[3].GetUInt32();
itemCount = fields[4].GetUInt32();
owner = fields[5].GetUInt32();
buyout = fields[6].GetUInt32();
@@ -707,10 +708,10 @@ bool AuctionEntry::LoadFromDB(Field* fields)
}
// check if sold item exists for guid
- // and item_template in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems)
- if (!sAuctionMgr->GetAItem(item_guidlow))
+ // and itemEntry in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems)
+ if (!sAuctionMgr->GetAItem(itemGUIDLow))
{
- sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing item : %u", Id, item_guidlow);
+ sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing item : %u", Id, itemGUIDLow);
return false;
}
return true;
@@ -795,8 +796,8 @@ bool AuctionEntry::LoadFromFieldList(Field* fields)
Id = fields[0].GetUInt32();
auctioneer = fields[1].GetUInt32();
- item_guidlow = fields[2].GetUInt32();
- item_template = fields[3].GetUInt32();
+ itemGUIDLow = fields[2].GetUInt32();
+ itemEntry = fields[3].GetUInt32();
itemCount = fields[4].GetUInt32();
owner = fields[5].GetUInt32();
buyout = fields[6].GetUInt32();
@@ -835,7 +836,7 @@ bool AuctionEntry::LoadFromFieldList(Field* fields)
std::string AuctionEntry::BuildAuctionMailSubject(MailAuctionAnswers response) const
{
std::ostringstream strm;
- strm << item_template << ":0:" << response << ':' << Id << ':' << itemCount;
+ strm << itemEntry << ":0:" << response << ':' << Id << ':' << itemCount;
return strm.str();
}
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h
index 049440f99d0..e13b4665b7b 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.h
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h
@@ -34,11 +34,11 @@ class WorldPacket;
enum AuctionError
{
- AUCTION_OK = 0,
- AUCTION_INTERNAL_ERROR = 2,
- AUCTION_NOT_ENOUGHT_MONEY = 3,
- AUCTION_ITEM_NOT_FOUND = 4,
- CANNOT_BID_YOUR_AUCTION_ERROR = 10
+ ERR_AUCTION_OK = 0,
+ ERR_AUCTION_DATABASE_ERROR = 2,
+ ERR_AUCTION_NOT_ENOUGHT_MONEY = 3,
+ ERR_AUCTION_ITEM_NOT_FOUND = 4,
+ ERR_AUCTION_BID_OWN = 10
};
enum AuctionAction
@@ -63,8 +63,8 @@ struct AuctionEntry
{
uint32 Id;
uint32 auctioneer; // creature low guid
- uint32 item_guidlow;
- uint32 item_template;
+ uint32 itemGUIDLow;
+ uint32 itemEntry;
uint32 itemCount;
uint32 owner;
uint32 startbid; //maybe useless
@@ -118,7 +118,7 @@ class AuctionHouseObject
void AddAuction(AuctionEntry* auction);
- bool RemoveAuction(AuctionEntry* auction, uint32 item_template);
+ bool RemoveAuction(AuctionEntry* auction, uint32 itemEntry);
void Update();
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 7e3b3cc0f1a..55f38f748f2 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -407,13 +407,17 @@ void Battlefield::PlayerAcceptInviteToWar(Player* player)
void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
{
if (spellId > 0)
+ {
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
if (Player* player = sObjectAccessor->FindPlayer(*itr))
player->CastSpell(player, uint32(spellId), true);
+ }
else
+ {
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
if (Player* player = sObjectAccessor->FindPlayer(*itr))
player->RemoveAuraFromStack(uint32(-spellId));
+ }
}
void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
@@ -460,10 +464,9 @@ WorldPacket Battlefield::BuildWarningAnnPacket(std::string const& msg)
void Battlefield::SendWarningToAllInZone(uint32 entry)
{
- if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid))
- if (Creature* stalker = unit->ToCreature())
- // FIXME: replaced CHAT_TYPE_END with CHAT_MSG_BG_SYSTEM_NEUTRAL to fix compile, it's a guessed change :/
- sCreatureTextMgr->SendChat(stalker, (uint8) entry, 0, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_ADDON, TEXT_RANGE_ZONE);
+ if (Creature* stalker = GetCreature(StalkerGuid))
+ // FIXME: replaced CHAT_TYPE_END with CHAT_MSG_BG_SYSTEM_NEUTRAL to fix compile, it's a guessed change :/
+ sCreatureTextMgr->SendChat(stalker, (uint8) entry, 0, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_ADDON, TEXT_RANGE_ZONE);
}
/*void Battlefield::SendWarningToAllInWar(int32 entry,...)
@@ -483,9 +486,8 @@ void Battlefield::SendWarningToAllInZone(uint32 entry)
void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
{
if (player)
- if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid))
- if (Creature* stalker = unit->ToCreature())
- sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID());
+ if (Creature* stalker = GetCreature(StalkerGuid))
+ sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID());
}
void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
@@ -658,7 +660,7 @@ void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
}
}
-void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 &guid)
+void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid)
{
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
@@ -738,7 +740,7 @@ void BfGraveyard::Resurrect()
// Check if the player is in world and on the good graveyard
if (player->IsInWorld())
- if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam]))
+ if (Creature* spirit = m_Bf->GetCreature(m_SpiritGuide[m_ControlTeam]))
spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
// Resurect player
@@ -788,6 +790,18 @@ void BfGraveyard::RelocateDeadPlayers()
}
}
+bool BfGraveyard::HasNpc(uint64 guid)
+{
+ if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
+ return false;
+
+ if (!m_Bf->GetCreature(m_SpiritGuide[0]) ||
+ !m_Bf->GetCreature(m_SpiritGuide[1]))
+ return false;
+
+ return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
+}
+
// *******************************************************
// *************** End Spirit Guide system ***************
// *******************************************************
@@ -861,11 +875,25 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
return go;
}
+Creature* Battlefield::GetCreature(uint64 GUID)
+{
+ if (!m_Map)
+ return NULL;
+ return m_Map->GetCreature(GUID);
+}
+
+GameObject* Battlefield::GetGameObject(uint64 GUID)
+{
+ if (!m_Map)
+ return NULL;
+ return m_Map->GetGameObject(GUID);
+}
+
// *******************************************************
// ******************* CapturePoint **********************
// *******************************************************
-BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePoint(NULL)
+BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePointGUID(0)
{
m_team = TEAM_NEUTRAL;
m_value = 0;
@@ -880,19 +908,24 @@ BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_
bool BfCapturePoint::HandlePlayerEnter(Player* player)
{
- if (m_capturePoint)
+ if (m_capturePointGUID)
{
- player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
- player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, uint32(ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)));
- player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+ if (GameObject* capturePoint = m_Bf->GetGameObject(m_capturePointGUID))
+ {
+ player->SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
+ player->SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate2, uint32(ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)));
+ player->SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+ }
}
+
return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
}
GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
{
- if (m_capturePoint)
- player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
+ if (m_capturePointGUID)
+ if (GameObject* capturePoint = m_Bf->GetGameObject(m_capturePointGUID))
+ player->SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
@@ -905,15 +938,18 @@ GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
void BfCapturePoint::SendChangePhase()
{
- if (!m_capturePoint)
+ if (!m_capturePointGUID)
return;
- // send this too, sometimes the slider disappears, dunno why :(
- SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
- // send these updates to only the ones in this objective
- SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
- // send this too, sometimes it resets :S
- SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+ if (GameObject* capturePoint = m_Bf->GetGameObject(m_capturePointGUID))
+ {
+ // send this too, sometimes the slider disappears, dunno why :(
+ SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
+ // send these updates to only the ones in this objective
+ SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
+ // send this too, sometimes it resets :S
+ SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+ }
}
bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint)
@@ -922,7 +958,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint)
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", capturePoint->GetEntry());
- m_capturePoint = capturePoint;
+ m_capturePointGUID = MAKE_NEW_GUID(capturePoint->GetGUIDLow(), capturePoint->GetEntry(), HIGHGUID_GAMEOBJECT);
// check info existence
GameObjectTemplate const* goinfo = capturePoint->GetGOInfo();
@@ -952,13 +988,22 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint)
return true;
}
+GameObject* BfCapturePoint::GetCapturePointGo()
+{
+ return m_Bf->GetGameObject(m_capturePointGUID);
+}
+
bool BfCapturePoint::DelCapturePoint()
{
- if (m_capturePoint)
+ if (m_capturePointGUID)
{
- m_capturePoint->SetRespawnTime(0); // not save respawn time
- m_capturePoint->Delete();
- m_capturePoint = NULL;
+ if (GameObject* capturePoint = m_Bf->GetGameObject(m_capturePointGUID))
+ {
+ capturePoint->SetRespawnTime(0); // not save respawn time
+ capturePoint->Delete();
+ capturePoint = NULL;
+ }
+ m_capturePointGUID = 0;
}
return true;
@@ -966,36 +1011,39 @@ bool BfCapturePoint::DelCapturePoint()
bool BfCapturePoint::Update(uint32 diff)
{
- if (!m_capturePoint)
+ if (!m_capturePointGUID)
return false;
- float radius = m_capturePoint->GetGOInfo()->capturePoint.radius;
-
- for (uint8 team = 0; team < 2; ++team)
+ if (GameObject* capturePoint = m_Bf->GetGameObject(m_capturePointGUID))
{
- for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
+ float radius = capturePoint->GetGOInfo()->capturePoint.radius;
+
+ for (uint8 team = 0; team < 2; ++team)
{
- if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
{
- if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
- itr = HandlePlayerLeave(player);
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (!capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
+ itr = HandlePlayerLeave(player);
+ else
+ ++itr;
+ }
else
++itr;
}
- else
- ++itr;
}
- }
- std::list<Player*> players;
- Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius);
- Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(m_capturePoint, players, checker);
- m_capturePoint->VisitNearbyWorldObject(radius, searcher);
+ std::list<Player*> players;
+ Trinity::AnyPlayerInObjectRangeCheck checker(capturePoint, radius);
+ Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(capturePoint, players, checker);
+ capturePoint->VisitNearbyWorldObject(radius, searcher);
- for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
- if ((*itr)->IsOutdoorPvPActive())
- if (m_activePlayers[(*itr)->GetTeamId()].insert((*itr)->GetGUID()).second)
- HandlePlayerEnter(*itr);
+ for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
+ if ((*itr)->IsOutdoorPvPActive())
+ if (m_activePlayers[(*itr)->GetTeamId()].insert((*itr)->GetGUID()).second)
+ HandlePlayerEnter(*itr);
+ }
// get the difference of numbers
float fact_diff = ((float) m_activePlayers[0].size() - (float) m_activePlayers[1].size()) * diff / BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL;
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
index 4533c666869..28216a43758 100644
--- a/src/server/game/Battlefield/Battlefield.h
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -103,7 +103,8 @@ class BfCapturePoint
virtual void SendChangePhase();
bool SetCapturePointData(GameObject* capturePoint);
- GameObject* GetCapturePointGo() { return m_capturePoint; }
+ GameObject* GetCapturePointGo();
+ uint32 GetCapturePointEntry(){ return m_capturePointEntry; }
TeamId GetTeamId() { return m_team; }
protected:
@@ -137,7 +138,7 @@ class BfCapturePoint
uint32 m_capturePointEntry;
// Gameobject related to that capture point
- GameObject* m_capturePoint;
+ uint64 m_capturePointGUID;
};
class BfGraveyard
@@ -171,17 +172,7 @@ class BfGraveyard
void RelocateDeadPlayers();
// Check if this graveyard has a spirit guide
- bool HasNpc(uint64 guid)
- {
- if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
- return false;
-
- if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) ||
- !sObjectAccessor->FindUnit(m_SpiritGuide[1]))
- return false;
-
- return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
- }
+ bool HasNpc(uint64 guid);
// Check if a player is in this graveyard's ressurect queue
bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
@@ -299,22 +290,25 @@ class Battlefield : public ZoneScript
Creature* SpawnCreature(uint32 entry, Position pos, TeamId team);
GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
+ Creature* GetCreature(uint64 GUID);
+ GameObject* GetGameObject(uint64 GUID);
+
// Script-methods
/// Called on start
- virtual void OnBattleStart() {};
+ virtual void OnBattleStart() { }
/// Called at the end of battle
- virtual void OnBattleEnd(bool /*endByTimer*/) {};
+ virtual void OnBattleEnd(bool /*endByTimer*/) { }
/// Called x minutes before battle start when player in zone are invite to join queue
- virtual void OnStartGrouping() {};
+ virtual void OnStartGrouping() { }
/// Called when a player accept to join the battle
- virtual void OnPlayerJoinWar(Player* /*player*/) {};
+ virtual void OnPlayerJoinWar(Player* /*player*/) { }
/// Called when a player leave the battle
- virtual void OnPlayerLeaveWar(Player* /*player*/) {};
+ virtual void OnPlayerLeaveWar(Player* /*player*/) { }
/// Called when a player leave battlefield zone
- virtual void OnPlayerLeaveZone(Player* /*player*/) {};
+ virtual void OnPlayerLeaveZone(Player* /*player*/) { }
/// Called when a player enter in battlefield zone
- virtual void OnPlayerEnterZone(Player* /*player*/) {};
+ virtual void OnPlayerEnterZone(Player* /*player*/) { }
WorldPacket BuildWarningAnnPacket(std::string const& msg);
void SendWarningToAllInZone(uint32 entry);
@@ -326,7 +320,7 @@ class Battlefield : public ZoneScript
uint32 GetBattleId() { return m_BattleId; }
void AskToLeaveQueue(Player* player);
- virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {};
+ virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) { }
/// Send all worldstate data to all player in zone.
virtual void SendInitWorldStatesToAll() = 0;
@@ -335,7 +329,7 @@ class Battlefield : public ZoneScript
/// Return if we can use mount in battlefield
bool CanFlyIn() { return !m_isActive; }
- void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 & guid);
+ void SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid);
void StartBattle();
void EndBattle(bool endByTimer);
@@ -377,6 +371,7 @@ class Battlefield : public ZoneScript
uint32 m_BattleId; // BattleID (for packet)
uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
uint32 m_MapId; // MapId where is Battlefield
+ Map* m_Map;
uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
uint32 m_MinPlayer; // Minimum number of player for Battlefield start
uint32 m_MinLevel; // Required level to participate at Battlefield
@@ -412,7 +407,7 @@ class Battlefield : public ZoneScript
void BroadcastPacketToWar(WorldPacket& data) const;
// CapturePoint system
- void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; }
+ void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints[cp->GetCapturePointEntry()] = cp; }
BfCapturePoint* GetCapturePoint(uint32 lowguid) const
{
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
index 0ea4266cc22..63f95e159af 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -21,6 +21,8 @@
// TODO: Add proper implement of achievement
#include "BattlefieldWG.h"
+#include "AchievementMgr.h"
+#include "MapManager.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
@@ -54,6 +56,7 @@ bool BattlefieldWG::SetupBattlefield()
m_BattleId = BATTLEFIELD_BATTLEID_WG;
m_ZoneId = BATTLEFIELD_WG_ZONEID;
m_MapId = BATTLEFIELD_WG_MAPID;
+ m_Map = sMapMgr->FindMap(m_MapId, 0);
m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX);
m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE);
@@ -141,9 +144,8 @@ bool BattlefieldWG::SetupBattlefield()
// Hide NPCs from the Attacker's team in the keep
for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- HideNpc(creature);
+ if (Creature* creature = GetCreature(*itr))
+ HideNpc(creature);
// Spawn Horde NPCs outside the keep
for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++)
@@ -157,9 +159,8 @@ bool BattlefieldWG::SetupBattlefield()
// Hide units outside the keep that are defenders
for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- HideNpc(creature);
+ if (Creature* creature = GetCreature(*itr))
+ HideNpc(creature);
// Spawn turrets and hide them per default
for (uint8 i = 0; i < WG_MAX_TURRET; i++)
@@ -176,20 +177,24 @@ bool BattlefieldWG::SetupBattlefield()
// Spawn all gameobjects
for (uint8 i = 0; i < WG_MAX_OBJ; i++)
{
- GameObject* go = SpawnGameObject(WGGameObjectBuilding[i].entry, WGGameObjectBuilding[i].x, WGGameObjectBuilding[i].y, WGGameObjectBuilding[i].z, WGGameObjectBuilding[i].o);
- BfWGGameObjectBuilding* b = new BfWGGameObjectBuilding(this);
- b->Init(go, WGGameObjectBuilding[i].type, WGGameObjectBuilding[i].WorldState, WGGameObjectBuilding[i].nameId);
- if (!IsEnabled() && go->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
- go->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
- BuildingsInZone.insert(b);
+ if (GameObject* go = SpawnGameObject(WGGameObjectBuilding[i].entry, WGGameObjectBuilding[i].x, WGGameObjectBuilding[i].y, WGGameObjectBuilding[i].z, WGGameObjectBuilding[i].o))
+ {
+ BfWGGameObjectBuilding* b = new BfWGGameObjectBuilding(this);
+ b->Init(go, WGGameObjectBuilding[i].type, WGGameObjectBuilding[i].WorldState, WGGameObjectBuilding[i].nameId);
+ if (!IsEnabled() && go->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
+ go->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
+ BuildingsInZone.insert(b);
+ }
}
// Spawning portal defender
for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++)
{
- GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o);
- DefenderPortalList.insert(go);
- go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
+ if (GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o))
+ {
+ DefenderPortalList.insert(go->GetGUID());
+ go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
+ }
}
UpdateCounterVehicle(true);
@@ -215,13 +220,13 @@ bool BattlefieldWG::Update(uint32 diff)
void BattlefieldWG::OnBattleStart()
{
// Spawn titan relic
- m_titansRelic = SpawnGameObject(GO_WINTERGRASP_TITAN_S_RELIC, 5440.0f, 2840.8f, 430.43f, 0);
- if (m_titansRelic)
+ if (GameObject* relic = SpawnGameObject(GO_WINTERGRASP_TITAN_S_RELIC, 5440.0f, 2840.8f, 430.43f, 0))
{
// Update faction of relic, only attacker can click on
- m_titansRelic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]);
+ relic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]);
// Set in use (not allow to click on before last door is broken)
- m_titansRelic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ relic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ m_titansRelicGUID = relic->GetGUID();
}
else
sLog->outError(LOG_FILTER_BATTLEFIELD, "WG: Failed to spawn titan relic.");
@@ -230,13 +235,10 @@ void BattlefieldWG::OnBattleStart()
// Update tower visibility and update faction
for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
{
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = GetCreature(*itr))
{
- if (Creature* creature = unit->ToCreature())
- {
- ShowNpc(creature, true);
- creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
- }
+ ShowNpc(creature, true);
+ creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
}
}
@@ -306,21 +308,19 @@ void BattlefieldWG::UpdateCounterVehicle(bool init)
void BattlefieldWG::OnBattleEnd(bool endByTimer)
{
// Remove relic
- if (m_titansRelic)
- m_titansRelic->RemoveFromWorld();
- m_titansRelic = NULL;
+ if (m_titansRelicGUID)
+ if (GameObject* relic = GetGameObject(m_titansRelicGUID))
+ relic->RemoveFromWorld();
+ m_titansRelicGUID = 0;
// Remove turret
for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
{
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = GetCreature(*itr))
{
- if (Creature* creature = unit->ToCreature())
- {
- if (!endByTimer)
- creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
- HideNpc(creature);
- }
+ if (!endByTimer)
+ creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
+ HideNpc(creature);
}
}
@@ -328,25 +328,21 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
{
// Change all npc in keep
for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- HideNpc(creature);
+ if (Creature* creature = GetCreature(*itr))
+ HideNpc(creature);
for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- ShowNpc(creature, true);
+ if (Creature* creature = GetCreature(*itr))
+ ShowNpc(creature, true);
// Change all npc out of keep
for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- HideNpc(creature);
+ if (Creature* creature = GetCreature(*itr))
+ HideNpc(creature);
for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- ShowNpc(creature, true);
+ if (Creature* creature = GetCreature(*itr))
+ ShowNpc(creature, true);
}
// Update all graveyard, control is to defender when no wartime
@@ -354,15 +350,18 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
if (BfGraveyard* graveyard = GetGraveyardById(i))
graveyard->GiveControlTo(GetDefenderTeam());
- for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr)
- (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ for (GuidSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr)
+ if (GameObject* object = GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_IMMEDIATELY);
- for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr)
- (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+ for (GuidSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr)
+ if (GameObject* object = GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_ONE_DAY);
// Update portal defender faction
- for (GameObjectSet::const_iterator itr = DefenderPortalList.begin(); itr != DefenderPortalList.end(); ++itr)
- (*itr)->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
+ for (GuidSet::const_iterator itr = DefenderPortalList.begin(); itr != DefenderPortalList.end(); ++itr)
+ if (GameObject* portal = GetGameObject(*itr))
+ portal->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
// Saving data
for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
@@ -397,10 +396,9 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
m_PlayersInWar[team].clear();
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- if (creature->IsVehicle())
- creature->GetVehicleKit()->Dismiss();
+ if (Creature* creature = GetCreature(*itr))
+ if (creature->IsVehicle())
+ creature->GetVehicleKit()->Dismiss();
m_vehicles[team].clear();
}
@@ -431,7 +429,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
// *******************************************************
void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 /*incrementNumber*/)
{
- AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(achievement);
+ AchievementEntry const* achievementEntry = sAchievementMgr->GetAchievement(achievement);
if (!achievementEntry)
return;
@@ -649,18 +647,15 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killerTeam)].begin();
itr != KeepCreature[GetOtherTeam(killerTeam)].end(); ++itr)
{
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = GetCreature(*itr))
{
- if (Creature* creature = unit->ToCreature())
+ if (victim->GetEntry() == creature->GetEntry() && !again)
{
- if (victim->GetEntry() == creature->GetEntry() && !again)
- {
- again = true;
- for (GuidSet::const_iterator iter = m_PlayersInWar[killerTeam].begin(); iter != m_PlayersInWar[killerTeam].end(); ++iter)
- if (Player* player = sObjectAccessor->FindPlayer(*iter))
- if (player->GetDistance2d(killer) < 40.0f)
- PromotePlayer(player);
- }
+ again = true;
+ for (GuidSet::const_iterator iter = m_PlayersInWar[killerTeam].begin(); iter != m_PlayersInWar[killerTeam].end(); ++iter)
+ if (Player* player = sObjectAccessor->FindPlayer(*iter))
+ if (player->GetDistance2d(killer) < 40.0f)
+ PromotePlayer(player);
}
}
}
@@ -937,22 +932,25 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
{
if (CanInteractWithRelic())
EndBattle(false);
- else
- GetRelic()->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ else if (GameObject* relic = GetRelic())
+ relic->SetRespawnTime(RESPAWN_IMMEDIATELY);
}
// if destroy or damage event, search the wall/tower and update worldstate/send warning message
for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
{
- if (go->GetEntry() == (*itr)->m_Build->GetEntry())
+ if (GameObject* build = GetGameObject((*itr)->m_BuildGUID))
{
- if ((*itr)->m_Build->GetGOInfo()->building.damagedEvent == eventId)
- (*itr)->Damaged();
+ if (go->GetEntry() == build->GetEntry())
+ {
+ if (build->GetGOInfo()->building.damagedEvent == eventId)
+ (*itr)->Damaged();
- if ((*itr)->m_Build->GetGOInfo()->building.destroyedEvent == eventId)
- (*itr)->Destroyed();
+ if (build->GetGOInfo()->building.destroyedEvent == eventId)
+ (*itr)->Destroyed();
- break;
+ break;
+ }
}
}
}
@@ -1008,9 +1006,8 @@ void BattlefieldWG::UpdateTenacity()
player->RemoveAurasDueToSpell(SPELL_TENACITY);
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- creature->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE);
+ if (Creature* creature = GetCreature(*itr))
+ creature->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE);
}
// Apply new buff
@@ -1036,9 +1033,8 @@ void BattlefieldWG::UpdateTenacity()
player->SetAuraStack(SPELL_TENACITY, player, newStack);
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack);
+ if (Creature* creature = GetCreature(*itr))
+ creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack);
if (buff_honor != 0)
{
@@ -1046,9 +1042,8 @@ void BattlefieldWG::UpdateTenacity()
if (Player* player = sObjectAccessor->FindPlayer(*itr))
player->CastSpell(player, buff_honor, true);
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- creature->CastSpell(creature, buff_honor, true);
+ if (Creature* creature = GetCreature(*itr))
+ creature->CastSpell(creature, buff_honor, true);
}
}
}
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h
index bd616167e8b..0ac87af94ba 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.h
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h
@@ -383,10 +383,10 @@ class BattlefieldWG : public Battlefield
bool SetupBattlefield();
/// Return pointer to relic object
- GameObject* GetRelic() { return m_titansRelic; }
+ GameObject* GetRelic() { return GetGameObject(m_titansRelicGUID); }
/// Define relic object
- void SetRelic(GameObject* relic) { m_titansRelic = relic; }
+ void SetRelic(uint64 relicGUID) { m_titansRelicGUID = relicGUID; }
/// Check if players can interact with the relic (Only if the last door has been broken)
bool CanInteractWithRelic() { return m_isRelicInteractible; }
@@ -420,8 +420,8 @@ class BattlefieldWG : public Battlefield
Workshop WorkshopsList;
- GameObjectSet DefenderPortalList;
- GameObjectSet m_KeepGameObject[2];
+ GuidSet DefenderPortalList;
+ GuidSet m_KeepGameObject[2];
GameObjectBuilding BuildingsInZone;
GuidSet m_vehicles[2];
@@ -432,7 +432,7 @@ class BattlefieldWG : public Battlefield
uint32 m_tenacityStack;
uint32 m_saveTimer;
- GameObject* m_titansRelic;
+ uint64 m_titansRelicGUID;
};
uint32 const VehNumWorldState[] = { 3680, 3490 };
@@ -1065,7 +1065,7 @@ struct BfWGGameObjectBuilding
{
m_WG = WG;
m_Team = 0;
- m_Build = NULL;
+ m_BuildGUID = 0;
m_Type = 0;
m_WorldState = 0;
m_State = 0;
@@ -1079,7 +1079,7 @@ struct BfWGGameObjectBuilding
BattlefieldWG* m_WG;
// Linked gameobject
- GameObject* m_Build;
+ uint64 m_BuildGUID;
// eWGGameObjectBuildingType
uint32 m_Type;
@@ -1094,7 +1094,7 @@ struct BfWGGameObjectBuilding
uint32 m_NameId;
// GameObject associations
- GameObjectSet m_GameObjectList[2];
+ GuidSet m_GameObjectList[2];
// Creature associations
GuidSet m_CreatureBottomList[2];
@@ -1120,20 +1120,23 @@ struct BfWGGameObjectBuilding
break;
}
- // Rebuild gameobject
- if (m_Build->IsDestructibleBuilding())
+ if (GameObject* build = m_WG->GetGameObject(m_BuildGUID))
{
- m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
- if (m_Build->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
- if (GameObject* go = m_Build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 10.0f))
- go->EnableCollision(true);
-
- // Update worldstate
- m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3);
- m_WG->SendUpdateWorldState(m_WorldState, m_State);
+ // Rebuild gameobject
+ if (build->IsDestructibleBuilding())
+ {
+ build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
+ if (build->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
+ if (GameObject* go = build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 50.0f))
+ go->EnableCollision(true);
+
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+ }
+ UpdateCreatureAndGo();
+ build->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]);
}
- UpdateCreatureAndGo();
- m_Build->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]);
}
// Called when associated gameobject is damaged
@@ -1148,14 +1151,12 @@ struct BfWGGameObjectBuilding
m_WG->SendWarningToAllInZone(m_NameId);
for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- m_WG->HideNpc(creature);
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- m_WG->HideNpc(creature);
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER)
m_WG->UpdateDamagedTowerCount(m_WG->GetDefenderTeam());
@@ -1182,8 +1183,9 @@ struct BfWGGameObjectBuilding
m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team));
break;
case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
- if (GameObject* go = m_Build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 10.0f))
- go->EnableCollision(false);
+ if (GameObject* build = m_WG->GetGameObject(m_BuildGUID))
+ if (GameObject* go = build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 10.0f))
+ go->EnableCollision(false);
m_WG->SetRelicInteractible(true);
if (m_WG->GetRelic())
m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
@@ -1197,8 +1199,11 @@ struct BfWGGameObjectBuilding
void Init(GameObject* go, uint32 type, uint32 worldstate, uint32 nameid)
{
+ if (!go)
+ return;
+
// GameObject associated to object
- m_Build = go;
+ m_BuildGUID = go->GetGUID();
// Type of building (WALL/TOWER/DOOR)
m_Type = type;
@@ -1226,23 +1231,20 @@ struct BfWGGameObjectBuilding
}
m_State = sWorld->getWorldState(m_WorldState);
- if (m_Build)
+ switch (m_State)
{
- switch (m_State)
- {
- case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT:
- case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT:
- m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
- break;
- case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY:
- case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY:
- m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
- break;
- case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE:
- case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE:
- m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
- break;
- }
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT:
+ go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
+ break;
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY:
+ go->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
+ break;
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE:
+ go->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
+ break;
}
int32 towerid = -1;
@@ -1278,9 +1280,9 @@ struct BfWGGameObjectBuilding
{
WintergraspObjectPositionData gobData = AttackTowers[towerid - 4].GameObject[i];
if (GameObject* go = m_WG->SpawnGameObject(gobData.entryHorde, gobData.x, gobData.y, gobData.z, gobData.o))
- m_GameObjectList[TEAM_HORDE].insert(go);
+ m_GameObjectList[TEAM_HORDE].insert(go->GetGUID());
if (GameObject* go = m_WG->SpawnGameObject(gobData.entryAlliance, gobData.x, gobData.y, gobData.z, gobData.o))
- m_GameObjectList[TEAM_ALLIANCE].insert(go);
+ m_GameObjectList[TEAM_ALLIANCE].insert(go->GetGUID());
}
// Spawn associate npc bottom
@@ -1364,64 +1366,59 @@ struct BfWGGameObjectBuilding
void UpdateCreatureAndGo()
{
for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureTopList[m_WG->GetDefenderTeam()].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- m_WG->HideNpc(creature);
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- m_WG->ShowNpc(creature, true);
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->ShowNpc(creature, true);
for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetDefenderTeam()].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- m_WG->HideNpc(creature);
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetAttackerTeam()].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- m_WG->ShowNpc(creature, true);
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->ShowNpc(creature, true);
- for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetDefenderTeam()].begin(); itr != m_GameObjectList[m_WG->GetDefenderTeam()].end(); ++itr)
- (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+ for (GuidSet::const_iterator itr = m_GameObjectList[m_WG->GetDefenderTeam()].begin(); itr != m_GameObjectList[m_WG->GetDefenderTeam()].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_ONE_DAY);
- for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetAttackerTeam()].begin(); itr != m_GameObjectList[m_WG->GetAttackerTeam()].end(); ++itr)
- (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ for (GuidSet::const_iterator itr = m_GameObjectList[m_WG->GetAttackerTeam()].begin(); itr != m_GameObjectList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_IMMEDIATELY);
}
void UpdateTurretAttack(bool disable)
{
for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr)
{
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = m_WG->GetCreature(*itr))
{
- if (Creature* creature = unit->ToCreature())
+ if (GameObject* build = m_WG->GetGameObject(m_BuildGUID))
{
- if (m_Build)
- {
- if (disable)
- m_WG->HideNpc(creature);
- else
- m_WG->ShowNpc(creature, true);
+ if (disable)
+ m_WG->HideNpc(creature);
+ else
+ m_WG->ShowNpc(creature, true);
- switch (m_Build->GetEntry())
+ switch (build->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
{
- case GO_WINTERGRASP_FORTRESS_TOWER_1:
- case GO_WINTERGRASP_FORTRESS_TOWER_2:
- case GO_WINTERGRASP_FORTRESS_TOWER_3:
- case GO_WINTERGRASP_FORTRESS_TOWER_4:
- {
- creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
- break;
- }
- case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
- case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
- case GO_WINTERGRASP_FLAMEWATCH_TOWER:
- {
- creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
- break;
- }
+ creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ }
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
}
}
}
@@ -1430,34 +1427,31 @@ struct BfWGGameObjectBuilding
for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
{
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = m_WG->GetCreature(*itr))
{
- if (Creature* creature = unit->ToCreature())
+ if (GameObject* build = m_WG->GetGameObject(m_BuildGUID))
{
- if (m_Build)
- {
- if (disable)
- m_WG->HideNpc(creature);
- else
- m_WG->ShowNpc(creature, true);
+ if (disable)
+ m_WG->HideNpc(creature);
+ else
+ m_WG->ShowNpc(creature, true);
- switch (m_Build->GetEntry())
+ switch (build->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
{
- case GO_WINTERGRASP_FORTRESS_TOWER_1:
- case GO_WINTERGRASP_FORTRESS_TOWER_2:
- case GO_WINTERGRASP_FORTRESS_TOWER_3:
- case GO_WINTERGRASP_FORTRESS_TOWER_4:
- {
- creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
- break;
- }
- case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
- case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
- case GO_WINTERGRASP_FLAMEWATCH_TOWER:
- {
- creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
- break;
- }
+ creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ }
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
}
}
}
@@ -1544,19 +1538,19 @@ struct WGWorkshop
struct WintergraspWorkshopData
{
BattlefieldWG* m_WG; // Pointer to wintergrasp
- GameObject* m_Build;
+ uint64 m_BuildGUID;
uint32 m_Type;
uint32 m_State; // For worldstate
uint32 m_WorldState;
uint32 m_TeamControl; // Team witch control the workshop
GuidSet m_CreatureOnPoint[2]; // Contain all Creature associate to this point
- GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point
+ GuidSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point
uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message
WintergraspWorkshopData(BattlefieldWG* WG)
{
m_WG = WG;
- m_Build = NULL;
+ m_BuildGUID = 0;
m_Type = 0;
m_State = 0;
m_WorldState = 0;
@@ -1578,9 +1572,9 @@ struct WintergraspWorkshopData
void AddGameObject(WintergraspObjectPositionData obj)
{
if (GameObject* gameobject = m_WG->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o))
- m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject);
+ m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject->GetGUID());
if (GameObject* gameobject = m_WG->SpawnGameObject(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o))
- m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject);
+ m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject->GetGUID());
}
// Init method, setup variable
@@ -1607,23 +1601,23 @@ struct WintergraspWorkshopData
{
// Show Alliance creature
for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- m_WG->ShowNpc(creature, creature->GetEntry() != 30499);
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->ShowNpc(creature, creature->GetEntry() != 30499);
// Hide Horde creature
for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- m_WG->HideNpc(creature);
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
// Show Alliance gameobject
- for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
- (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ for (GuidSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_IMMEDIATELY);
// Hide Horde gameobject
- for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
- (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+ for (GuidSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_ONE_DAY);
// Updating worldstate
@@ -1646,23 +1640,23 @@ struct WintergraspWorkshopData
{
// Show Horde creature
for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- m_WG->ShowNpc(creature, creature->GetEntry() != 30400);
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->ShowNpc(creature, creature->GetEntry() != 30400);
// Hide Alliance creature
for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr)
- if (Unit* unit = sObjectAccessor->FindUnit(*itr))
- if (Creature* creature = unit->ToCreature())
- m_WG->HideNpc(creature);
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
// Hide Alliance gameobject
- for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
- (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+ for (GuidSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_ONE_DAY);
// Show Horde gameobject
- for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
- (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ for (GuidSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_IMMEDIATELY);
// Update worlstate
m_State = BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index fd58765b056..628eb5ff3c1 100755..100644
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -48,7 +48,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamNa
return false;
// Check if arena team name is already taken
- if (sArenaTeamMgr->GetArenaTeamByName(TeamName))
+ if (sArenaTeamMgr->GetArenaTeamByName(teamName))
return false;
// Generate new arena team id
@@ -179,7 +179,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
}
- sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId());
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId(), GetName().c_str());
return true;
}
diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h
index 137ac93d3c0..137ac93d3c0 100755..100644
--- a/src/server/game/Battlegrounds/ArenaTeam.h
+++ b/src/server/game/Battlegrounds/ArenaTeam.h
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 40a74a49b69..22f960ceaef 100755..100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -411,7 +411,7 @@ uint32 Battleground::GetPrematureWinner()
winner = ALLIANCE;
else if (GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam())
winner = HORDE;
-
+
return winner;
}
@@ -1265,6 +1265,9 @@ void Battleground::EventPlayerLoggedIn(Player* player)
void Battleground::EventPlayerLoggedOut(Player* player)
{
uint64 guid = player->GetGUID();
+ if (!IsPlayerInBattleground(guid)) // Check if this player really is in battleground (might be a GM who teleported inside)
+ return;
+
// player is correct pointer, it is checked in WorldSession::LogoutPlayer()
m_OfflineQueue.push_back(player->GetGUID());
m_Players[guid].OfflineRemoveTime = sWorld->GetGameTime() + MAX_OFFLINE_TIME;
@@ -1275,8 +1278,8 @@ void Battleground::EventPlayerLoggedOut(Player* player)
// 1 player is logging out, if it is the last, then end arena!
if (isArena())
- if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
- EndBattleground(GetOtherTeam(player->GetTeam()));
+ if (GetAlivePlayersCountByTeam(player->GetBGTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetBGTeam())))
+ EndBattleground(GetOtherTeam(player->GetBGTeam()));
}
}
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 71dbd097b0a..0a837f9f3c3 100755..100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -528,7 +528,7 @@ class Battleground
virtual uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return 0; }
virtual void SetDroppedFlagGUID(uint64 /*guid*/, int32 /*team*/ = -1) {}
uint32 GetTeamScore(uint32 TeamID) const;
-
+
virtual uint32 GetPrematureWinner();
protected:
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index a0f95e1eaef..a0f95e1eaef 100755..100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h
index 67bed737588..22c42b0febc 100755..100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.h
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.h
@@ -80,8 +80,8 @@ class BattlegroundMgr
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg);
- void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame = 1);
- void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
+ void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, uint8 uiFrame = 1);
+ void BuildPlaySoundPacket(WorldPacket* data, uint32 soundId);
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid);
/* Battlegrounds */
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index c610cafa1b1..c610cafa1b1 100755..100644
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.h b/src/server/game/Battlegrounds/BattlegroundQueue.h
index 6f8c774864d..6f8c774864d 100755..100644
--- a/src/server/game/Battlegrounds/BattlegroundQueue.h
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.h
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index 47320db27cf..cb0d651ad47 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -558,12 +558,12 @@ uint32 BattlegroundAB::GetPrematureWinner()
++ally;
else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
++horde;
-
+
if (ally > horde)
return ALLIANCE;
else if (horde > ally)
return HORDE;
-
+
// If the values are equal, fall back to the original result (based on number of players on each team)
return Battleground::GetPrematureWinner();
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
index b80e216a216..6e01437b895 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
@@ -272,7 +272,7 @@ class BattlegroundAB : public Battleground
/* achievement req. */
bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
bool IsTeamScores500Disadvantage(uint32 team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; }
-
+
uint32 GetPrematureWinner();
private:
void PostUpdateImpl(uint32 diff);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index 918cef4d261..b12aec245cd 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -1701,11 +1701,11 @@ uint32 BattlegroundAV::GetPrematureWinner()
{
uint32 allianceScore = m_Team_Scores[GetTeamIndexByTeamId(ALLIANCE)];
uint32 hordeScore = m_Team_Scores[GetTeamIndexByTeamId(HORDE)];
-
+
if (allianceScore > hordeScore)
return ALLIANCE;
else if (hordeScore > allianceScore)
return HORDE;
-
+
return Battleground::GetPrematureWinner();
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
index bedd946a78c..b7fa8d6ece8 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
@@ -1572,7 +1572,7 @@ class BattlegroundAV : public Battleground
/* achievement req. */
bool IsBothMinesControlledByTeam(uint32 team) const;
bool IsAllTowersControlledAndCaptainAlive(uint32 team) const;
-
+
uint32 GetPrematureWinner();
private:
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
index 402406f7fd0..402406f7fd0 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
index 27a88fcfc33..27a88fcfc33 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
index ff4b279a2cf..ff4b279a2cf 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index 458e86729e7..ab0f94b74f6 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -944,6 +944,6 @@ uint32 BattlegroundEY::GetPrematureWinner()
return ALLIANCE;
else if (GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE))
return HORDE;
-
+
return Battleground::GetPrematureWinner();
} \ No newline at end of file
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
index 2cfd4ca7e0f..43e7fb4f933 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
@@ -369,7 +369,7 @@ class BattlegroundEY : public Battleground
/* achievement req. */
bool IsAllNodesConrolledByTeam(uint32 team) const;
-
+
uint32 GetPrematureWinner();
private:
void PostUpdateImpl(uint32 diff);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index dbffc318c78..dbffc318c78 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
index 9e58a93fd2d..9e58a93fd2d 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
index 6677d665290..6677d665290 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
index 0241cf182a7..0241cf182a7 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
index 2c715193a3b..2c715193a3b 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
index 56d089909e0..56d089909e0 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
index 130ba4f3290..130ba4f3290 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
index 115fd95d1b0..115fd95d1b0 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index ab479eeff2d..ab479eeff2d 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
index 9089f0c2818..9089f0c2818 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index 965045c5293..63204129f24 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -864,6 +864,6 @@ uint32 BattlegroundWS::GetPrematureWinner()
return ALLIANCE;
else if (GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE))
return HORDE;
-
+
return Battleground::GetPrematureWinner();
-} \ No newline at end of file
+}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
index 5b72de43b32..b0d68177072 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
@@ -211,7 +211,7 @@ class BattlegroundWS : public Battleground
void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; }
void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; }
void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; }
-
+
uint32 GetPrematureWinner();
private:
uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde
diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index cba38a3ebf1..8ce7d7d2139 100755..100644
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -297,7 +297,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
SendToOne(&data, good);
return;
}
-
+
Player* bad = sObjectAccessor->FindPlayerByName(badname);
uint64 victim = bad ? bad->GetGUID() : 0;
if (!victim || !IsOn(victim))
@@ -403,7 +403,7 @@ void Channel::Password(Player const* player, std::string const& pass)
SendToOne(&data, guid);
return;
}
-
+
if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()))
{
WorldPacket data;
@@ -497,7 +497,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
Player* newp = sObjectAccessor->FindPlayerByName(newname);
uint64 victim = newp ? newp->GetGUID() : 0;
-
+
if (!victim || !IsOn(victim) ||
(newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
{
@@ -615,7 +615,7 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
SendToOne(&data, guid);
return;
}
-
+
if (playersStore[guid].IsMuted())
{
WorldPacket data;
diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h
index c816cd91257..b9883144cbc 100755..100644
--- a/src/server/game/Chat/Channels/Channel.h
+++ b/src/server/game/Chat/Channels/Channel.h
@@ -28,6 +28,8 @@
#include "Opcodes.h"
#include "WorldPacket.h"
+class Player;
+
enum ChatNotify
{
CHAT_JOINED_NOTICE = 0x00, //+ "%s joined channel.";
diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp
index acd85f11ed8..acd85f11ed8 100755..100644
--- a/src/server/game/Chat/Channels/ChannelMgr.cpp
+++ b/src/server/game/Chat/Channels/ChannelMgr.cpp
diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h
index c1d1793c446..c1d1793c446 100755..100644
--- a/src/server/game/Chat/Channels/ChannelMgr.h
+++ b/src/server/game/Chat/Channels/ChannelMgr.h
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index c1ea96b0db1..6441bd1bcb6 100755..100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -63,7 +63,7 @@ ChatCommand* ChatHandler::getCommandTable()
// cache for commands, needed because some commands are loaded dynamically through ScriptMgr
// cache is never freed and will show as a memory leak in diagnostic tools
// can't use vector as vector storage is implementation-dependent, eg, there can be alignment gaps between elements
- static ChatCommand* commandTableCache = 0;
+ static ChatCommand* commandTableCache = NULL;
if (LoadCommandTable())
{
@@ -96,7 +96,6 @@ ChatCommand* ChatHandler::getCommandTable()
std::string name = fields[0].GetString();
SetDataForCommandInTable(commandTableCache, name.c_str(), fields[1].GetUInt8(), fields[2].GetString(), name);
-
}
while (result->NextRow());
}
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index 3b08fd9aa76..3b08fd9aa76 100755..100644
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp
index a9c72e1112e..c02df6198f8 100644
--- a/src/server/game/Chat/ChatLink.cpp
+++ b/src/server/game/Chat/ChatLink.cpp
@@ -20,6 +20,7 @@
#include "ObjectMgr.h"
#include "SpellInfo.h"
#include "DBCStores.h"
+#include "AchievementMgr.h"
// Supported shift-links (client generated and server side)
// |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r
@@ -318,17 +319,12 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
}
}
- bool res = false;
for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
if (*_spell->SpellName[i] && strcmp(_spell->SpellName[i], buffer) == 0)
- {
- res = true;
- break;
- }
+ return true;
- if (!res)
- sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id);
- return res;
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id);
+ return false;
}
// |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r
@@ -345,7 +341,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate achievement
- _achievement = sAchievementStore.LookupEntry(achievementId);
+ _achievement = sAchievementMgr->GetAchievement(achievementId);
if (!_achievement)
{
sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid achivement id %u in |achievement command", iss.str().c_str(), achievementId);
@@ -380,17 +376,12 @@ bool AchievementChatLink::ValidateName(char* buffer, const char* context)
{
ChatLink::ValidateName(buffer, context);
- bool res = false;
for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
if (*_achievement->name[i] && strcmp(_achievement->name[i], buffer) == 0)
- {
- res = true;
- break;
- }
+ return true;
- if (!res)
- sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID);
- return res;
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID);
+ return false;
}
// |color|Htrade:spell_id:cur_value:max_value:player_guid:base64_data|h[name]|h|r
diff --git a/src/server/game/Combat/HostileRefManager.cpp b/src/server/game/Combat/HostileRefManager.cpp
index 05b4fa171c7..05b4fa171c7 100755..100644
--- a/src/server/game/Combat/HostileRefManager.cpp
+++ b/src/server/game/Combat/HostileRefManager.cpp
diff --git a/src/server/game/Combat/HostileRefManager.h b/src/server/game/Combat/HostileRefManager.h
index b8991d8faf8..b8991d8faf8 100755..100644
--- a/src/server/game/Combat/HostileRefManager.h
+++ b/src/server/game/Combat/HostileRefManager.h
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index 2c45067d95a..2c45067d95a 100755..100644
--- a/src/server/game/Combat/ThreatManager.cpp
+++ b/src/server/game/Combat/ThreatManager.cpp
diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h
index 665acd6d751..665acd6d751 100755..100644
--- a/src/server/game/Combat/ThreatManager.h
+++ b/src/server/game/Combat/ThreatManager.h
diff --git a/src/server/game/Combat/UnitEvents.h b/src/server/game/Combat/UnitEvents.h
index 8d57ef6c59c..8d57ef6c59c 100755..100644
--- a/src/server/game/Combat/UnitEvents.h
+++ b/src/server/game/Combat/UnitEvents.h
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 5fe81bcf89c..37835618183 100755..100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -17,6 +17,7 @@
*/
#include "ConditionMgr.h"
+#include "AchievementMgr.h"
#include "GameEventMgr.h"
#include "InstanceScript.h"
#include "ObjectMgr.h"
@@ -105,6 +106,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
condMeets = unit->getRaceMask() & ConditionValue1;
break;
}
+ case CONDITION_GENDER:
+ {
+ if (Player* player = object->ToPlayer())
+ condMeets = player->getGender() == ConditionValue1;
+ break;
+ }
case CONDITION_SKILL:
{
if (Player* player = object->ToPlayer())
@@ -442,6 +449,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
case CONDITION_SPAWNMASK:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
+ case CONDITION_GENDER:
+ mask |= GRID_MAP_TYPE_MASK_PLAYER;
+ break;
default:
ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!");
break;
@@ -462,6 +472,7 @@ uint32 Condition::GetMaxAvailableConditionTargets()
case CONDITION_SOURCE_TYPE_GOSSIP_MENU:
case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION:
case CONDITION_SOURCE_TYPE_SMART_EVENT:
+ case CONDITION_SOURCE_TYPE_NPC_VENDOR:
return 2;
default:
return 1;
@@ -612,7 +623,8 @@ bool ConditionMgr::CanHaveSourceGroupSet(ConditionSourceType sourceType) const
sourceType == CONDITION_SOURCE_TYPE_VEHICLE_SPELL ||
sourceType == CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET ||
sourceType == CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT ||
- sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT);
+ sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT ||
+ sourceType == CONDITION_SOURCE_TYPE_NPC_VENDOR);
}
bool ConditionMgr::CanHaveSourceIdSet(ConditionSourceType sourceType) const
@@ -639,7 +651,6 @@ ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType
return spellCond;
}
-
ConditionList ConditionMgr::GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId)
{
ConditionList cond;
@@ -688,6 +699,22 @@ ConditionList ConditionMgr::GetConditionsForSmartEvent(int32 entryOrGuid, uint32
return cond;
}
+ConditionList ConditionMgr::GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId)
+{
+ ConditionList cond;
+ NpcVendorConditionContainer::const_iterator itr = NpcVendorConditionContainerStore.find(creatureId);
+ if (itr != NpcVendorConditionContainerStore.end())
+ {
+ ConditionTypeContainer::const_iterator i = (*itr).second.find(itemId);
+ if (i != (*itr).second.end())
+ {
+ cond = (*i).second;
+ sLog->outDebug(LOG_FILTER_CONDITIONSYS, "GetConditionsForNpcVendorEvent: found conditions for creature entry %u item %u", creatureId, itemId);
+ }
+ }
+ return cond;
+}
+
void ConditionMgr::LoadConditions(bool isReload)
{
uint32 oldMSTime = getMSTime();
@@ -720,12 +747,11 @@ void ConditionMgr::LoadConditions(bool isReload)
}
QueryResult result = WorldDatabase.Query("SELECT SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, "
- " ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition, ErrorTextId, ScriptName FROM conditions");
+ " ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition, ErrorType, ErrorTextId, ScriptName FROM conditions");
if (!result)
{
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 conditions. DB table `conditions` is empty!");
-
return;
}
@@ -736,19 +762,20 @@ void ConditionMgr::LoadConditions(bool isReload)
Field* fields = result->Fetch();
Condition* cond = new Condition();
- int32 iSourceTypeOrReferenceId = fields[0].GetInt32();
+ int32 iSourceTypeOrReferenceId = fields[0].GetInt32();
cond->SourceGroup = fields[1].GetUInt32();
cond->SourceEntry = fields[2].GetInt32();
cond->SourceId = fields[3].GetInt32();
cond->ElseGroup = fields[4].GetUInt32();
- int32 iConditionTypeOrReference = fields[5].GetInt32();
+ int32 iConditionTypeOrReference = fields[5].GetInt32();
cond->ConditionTarget = fields[6].GetUInt8();
cond->ConditionValue1 = fields[7].GetUInt32();
cond->ConditionValue2 = fields[8].GetUInt32();
cond->ConditionValue3 = fields[9].GetUInt32();
cond->NegativeCondition = fields[10].GetUInt8();
- cond->ErrorTextId = fields[11].GetUInt32();
- cond->ScriptId = sObjectMgr->GetScriptId(fields[12].GetCString());
+ cond->ErrorType = fields[11].GetUInt32();
+ cond->ErrorTextId = fields[12].GetUInt32();
+ cond->ScriptId = sObjectMgr->GetScriptId(fields[13].GetCString());
if (iConditionTypeOrReference >= 0)
cond->ConditionType = ConditionTypes(iConditionTypeOrReference);
@@ -825,6 +852,18 @@ void ConditionMgr::LoadConditions(bool isReload)
continue;
}
+ if (cond->ErrorType && cond->SourceType != CONDITION_SOURCE_TYPE_SPELL)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Condition type %u entry %i can't have ErrorType (%u), set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorType);
+ cond->ErrorType = 0;
+ }
+
+ if (cond->ErrorTextId && !cond->ErrorType)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Condition type %u entry %i has any ErrorType, ErrorTextId (%u) is set, set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorTextId);
+ cond->ErrorTextId = 0;
+ }
+
if (cond->SourceGroup)
{
bool valid = false;
@@ -899,6 +938,13 @@ void ConditionMgr::LoadConditions(bool isReload)
++count;
continue;
}
+ case CONDITION_SOURCE_TYPE_NPC_VENDOR:
+ {
+ NpcVendorConditionContainerStore[cond->SourceGroup][cond->SourceEntry].push_back(cond);
+ valid = true;
+ ++count;
+ continue;
+ }
default:
break;
}
@@ -1390,6 +1436,21 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
return false;
}
break;
+ case CONDITION_SOURCE_TYPE_NPC_VENDOR:
+ {
+ if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup))
+ {
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup);
+ return false;
+ }
+ ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(cond->SourceEntry);
+ if (!itemTemplate)
+ {
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceEntry);
+ return false;
+ }
+ break;
+ }
case CONDITION_SOURCE_TYPE_GOSSIP_MENU:
case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION:
case CONDITION_SOURCE_TYPE_SMART_EVENT:
@@ -1400,6 +1461,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
return true;
}
+
bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
if (cond->ConditionType == CONDITION_NONE || cond->ConditionType >= CONDITION_MAX)
@@ -1563,7 +1625,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
case CONDITION_ACHIEVEMENT:
{
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(cond->ConditionValue1);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(cond->ConditionValue1);
if (!achievement)
{
sLog->outError(LOG_FILTER_SQL, "Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1);
@@ -1604,6 +1666,20 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
sLog->outError(LOG_FILTER_SQL, "Race condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
+ case CONDITION_GENDER:
+ {
+ if (!Player::IsValidGender(uint8(cond->ConditionValue1)))
+ {
+ sLog->outError(LOG_FILTER_SQL, "Gender condition has invalid gender (%u), skipped", cond->ConditionValue1);
+ return false;
+ }
+
+ if (cond->ConditionValue2)
+ sLog->outError(LOG_FILTER_SQL, "Gender condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ if (cond->ConditionValue3)
+ sLog->outError(LOG_FILTER_SQL, "Gender condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ break;
+ }
case CONDITION_MAPID:
{
MapEntry const* me = sMapStore.LookupEntry(cond->ConditionValue1);
@@ -1863,9 +1939,6 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
break;
}
- case CONDITION_UNUSED_20:
- sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_20 in `conditions` table - ignoring");
- return false;
case CONDITION_UNUSED_21:
sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_21 in `conditions` table - ignoring");
return false;
@@ -1941,6 +2014,19 @@ void ConditionMgr::Clean()
SpellClickEventConditionStore.clear();
+ for (NpcVendorConditionContainer::iterator itr = NpcVendorConditionContainerStore.begin(); itr != NpcVendorConditionContainerStore.end(); ++itr)
+ {
+ for (ConditionTypeContainer::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
+ {
+ for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
+ delete *i;
+ it->second.clear();
+ }
+ itr->second.clear();
+ }
+
+ NpcVendorConditionContainerStore.clear();
+
// this is a BIG hack, feel free to fix it if you can figure out the ConditionMgr ;)
for (std::list<Condition*>::const_iterator itr = AllocatedMemoryStore.begin(); itr != AllocatedMemoryStore.end(); ++itr)
delete *itr;
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index 7b0dc1f20bf..807b75c4ee6 100755..100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -53,7 +53,7 @@ enum ConditionTypes
CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete
CONDITION_TITLE = 18, // title id 0 0 true if player has title
CONDITION_SPAWNMASK = 19, // spawnMask 0 0 true if in spawnMask
- CONDITION_UNUSED_20 = 20, //
+ CONDITION_GENDER = 20, // gender 0 0 true if player's gender is equal to gender
CONDITION_UNUSED_21 = 21, //
CONDITION_MAPID = 22, // map_id 0 0 true if in map_id
CONDITION_AREAID = 23, // area_id 0 0 true if in area_id
@@ -127,7 +127,8 @@ enum ConditionSourceType
CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK = 20,
CONDITION_SOURCE_TYPE_VEHICLE_SPELL = 21,
CONDITION_SOURCE_TYPE_SMART_EVENT = 22,
- CONDITION_SOURCE_TYPE_MAX = 23 //MAX
+ CONDITION_SOURCE_TYPE_NPC_VENDOR = 23,
+ CONDITION_SOURCE_TYPE_MAX = 24 // MAX
};
enum ComparisionType
@@ -180,6 +181,7 @@ struct Condition
uint32 ConditionValue1;
uint32 ConditionValue2;
uint32 ConditionValue3;
+ uint32 ErrorType;
uint32 ErrorTextId;
uint32 ReferenceId;
uint32 ScriptId;
@@ -198,6 +200,7 @@ struct Condition
ConditionValue2 = 0;
ConditionValue3 = 0;
ReferenceId = 0;
+ ErrorType = 0;
ErrorTextId = 0;
ScriptId = 0;
NegativeCondition = false;
@@ -213,6 +216,7 @@ typedef std::list<Condition*> ConditionList;
typedef std::map<uint32, ConditionList> ConditionTypeContainer;
typedef std::map<ConditionSourceType, ConditionTypeContainer> ConditionContainer;
typedef std::map<uint32, ConditionTypeContainer> CreatureSpellConditionContainer;
+typedef std::map<uint32, ConditionTypeContainer> NpcVendorConditionContainer;
typedef std::map<std::pair<int32, uint32 /*SAI source_type*/>, ConditionTypeContainer> SmartEventConditionContainer;
typedef std::map<uint32, ConditionList> ConditionReferenceContainer;//only used for references
@@ -240,6 +244,7 @@ class ConditionMgr
ConditionList GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId);
ConditionList GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType);
ConditionList GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId);
+ ConditionList GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId);
private:
bool isSourceTypeValid(Condition* cond);
@@ -256,6 +261,7 @@ class ConditionMgr
ConditionReferenceContainer ConditionReferenceStore;
CreatureSpellConditionContainer VehicleSpellConditionStore;
CreatureSpellConditionContainer SpellClickEventConditionStore;
+ NpcVendorConditionContainer NpcVendorConditionContainerStore;
SmartEventConditionContainer SmartEventConditionStore;
};
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index cc23036c534..b544e966084 100755..100644
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -17,6 +17,7 @@
*/
#include "DisableMgr.h"
+#include "AchievementMgr.h"
#include "ObjectMgr.h"
#include "OutdoorPvP.h"
#include "SpellMgr.h"
@@ -173,7 +174,7 @@ void LoadDisables()
sLog->outError(LOG_FILTER_SQL, "Disable flags specified for outdoor PvP %u, useless data.", entry);
break;
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
- if (!sAchievementCriteriaStore.LookupEntry(entry))
+ if (!sAchievementMgr->GetAchievementCriteria(entry))
{
sLog->outError(LOG_FILTER_SQL, "Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
diff --git a/src/server/game/Conditions/DisableMgr.h b/src/server/game/Conditions/DisableMgr.h
index b1bb43315bd..b1bb43315bd 100755..100644
--- a/src/server/game/Conditions/DisableMgr.h
+++ b/src/server/game/Conditions/DisableMgr.h
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index 4fa2e3e748e..fa6b5f0695f 100755..100644
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -79,12 +79,12 @@ enum AchievementCriteriaCondition
{
ACHIEVEMENT_CRITERIA_CONDITION_NONE = 0,
ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH = 1, // reset progress on death
- ACHIEVEMENT_CRITERIA_CONDITION_UNK1 = 2, // only used in "Complete a daily quest every day for five consecutive days"
+ ACHIEVEMENT_CRITERIA_CONDITION_UNK2 = 2, // only used in "Complete a daily quest every day for five consecutive days"
ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP = 3, // requires you to be on specific map, reset at change
ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE = 4, // only used in "Win 10 arenas without losing"
ACHIEVEMENT_CRITERIA_CONDITION_NO_SPELL_HIT = 9, // requires the player not to be hit by specific spell
ACHIEVEMENT_CRITERIA_CONDITION_NOT_IN_GROUP = 10, // requires the player not to be in group
- ACHIEVEMENT_CRITERIA_CONDITION_UNK3 = 13 // unk
+ ACHIEVEMENT_CRITERIA_CONDITION_UNK13 = 13 // unk
};
enum AchievementCriteriaFlags
@@ -140,7 +140,7 @@ enum AchievementCriteriaTypes
ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL = 34,
ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL = 35,
ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM = 36,
- ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA = 37, // TODO: the archievements 1162 and 1163 requires a special rating which can't be found in the dbc
+ ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA = 37,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING = 38,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_PERSONAL_RATING = 39,
ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL = 40,
@@ -213,14 +213,9 @@ enum AchievementCriteriaTypes
ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS = 114,
ACHIEVEMENT_CRITERIA_TYPE_EARN_ACHIEVEMENT_POINTS = 115,
ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS = 119,
- // 120
- // 121
- // 122
- // 123
- // 0..123 => 124 criteria types total
};
-#define ACHIEVEMENT_CRITERIA_TYPE_TOTAL 124
+#define ACHIEVEMENT_CRITERIA_TYPE_TOTAL 120
enum AchievementCategory
{
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 850c58bdf93..b74c8a4d1f5 100755..100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -17,11 +17,9 @@
*/
#include "DBCStores.h"
-
#include "Log.h"
#include "SharedDefines.h"
#include "SpellMgr.h"
-
#include "DBCfmt.h"
#include <map>
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h
index cd30ed587f8..cd30ed587f8 100755..100644
--- a/src/server/game/DataStores/DBCStores.h
+++ b/src/server/game/DataStores/DBCStores.h
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index 20eab098add..f57724fe58b 100755..100644
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -1677,9 +1677,9 @@ struct SpellFocusObjectEntry
struct SpellRadiusEntry
{
uint32 ID;
- float radiusMin;
- //uint32 Unk //always 0
- float radiusMax;
+ float RadiusMin;
+ float RadiusPerLevel;
+ float RadiusMax;
};
struct SpellRangeEntry
diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h
index 0fe82ea3311..bb671d4dd72 100755..100644
--- a/src/server/game/DataStores/DBCfmt.h
+++ b/src/server/game/DataStores/DBCfmt.h
@@ -106,7 +106,7 @@ const std::string CustomSpellEntryIndex = "Id";
char const SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
char const SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiiiii";
char const SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
-char const SpellRadiusfmt[]="nfxf";
+char const SpellRadiusfmt[]="nfff";
char const SpellRangefmt[]="nffffixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char const SpellRuneCostfmt[]="niiii";
char const SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii";
diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h
index 8477002279c..8477002279c 100755..100644
--- a/src/server/game/DungeonFinding/LFG.h
+++ b/src/server/game/DungeonFinding/LFG.h
diff --git a/src/server/game/DungeonFinding/LFGGroupData.cpp b/src/server/game/DungeonFinding/LFGGroupData.cpp
index c7cf6f23ce9..68e7ab82c32 100644
--- a/src/server/game/DungeonFinding/LFGGroupData.cpp
+++ b/src/server/game/DungeonFinding/LFGGroupData.cpp
@@ -34,10 +34,12 @@ void LfgGroupData::SetState(LfgState state)
{
switch (state)
{
- case LFG_STATE_FINISHED_DUNGEON:
case LFG_STATE_NONE:
+ m_Dungeon = 0;
+ m_KicksLeft = LFG_GROUP_MAX_KICKS;
+ case LFG_STATE_FINISHED_DUNGEON:
case LFG_STATE_DUNGEON:
- m_OldState = m_State;
+ m_OldState = state;
// No break on purpose
default:
m_State = state;
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index da279016255..668b1622738 100755..100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -370,11 +370,13 @@ void LFGMgr::Update(uint32 diff)
for (LfgRolesMap::const_iterator itRoles = roleCheck.roles.begin(); itRoles != roleCheck.roles.end(); ++itRoles)
{
uint64 guid = itRoles->first;
- ClearState(guid, "Remove Obsolete RoleCheck");
+ RestoreState(guid, "Remove Obsolete RoleCheck");
SendLfgRoleCheckUpdate(guid, roleCheck);
if (guid == roleCheck.leader)
SendLfgJoinResult(guid, LfgJoinResultData(LFG_JOIN_FAILED, LFG_ROLECHECK_MISSING_ROLE));
}
+
+ RestoreState(itRoleCheck->first, "Remove Obsolete RoleCheck");
RoleChecksStore.erase(itRoleCheck);
}
@@ -754,7 +756,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
*/
void LFGMgr::LeaveLfg(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Leave: [" UI64FMTD "]", guid);
+ sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::LeaveLfg: [" UI64FMTD "]", guid);
uint64 gguid = IS_GROUP(guid) ? guid : GetGroup(guid);
LfgState state = GetState(guid);
@@ -765,13 +767,12 @@ void LFGMgr::LeaveLfg(uint64 guid)
{
LFGQueue& queue = GetQueue(gguid);
queue.RemoveFromQueue(gguid);
- RestoreState(gguid, "Leave queue");
+ SetState(gguid, LFG_STATE_NONE);
const LfgGuidSet& players = GetPlayers(gguid);
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
{
- uint64 guid = (*it);
- ClearState(guid, "Leave queue");
- SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
+ SetState(*it, LFG_STATE_NONE);
+ SendLfgUpdateParty(*it, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
}
}
else
@@ -779,7 +780,7 @@ void LFGMgr::LeaveLfg(uint64 guid)
LFGQueue& queue = GetQueue(guid);
queue.RemoveFromQueue(guid);
SendLfgUpdatePlayer(guid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
- ClearState(guid, "Leave queue");
+ SetState(guid, LFG_STATE_NONE);
}
break;
case LFG_STATE_ROLECHECK:
@@ -808,7 +809,14 @@ void LFGMgr::LeaveLfg(uint64 guid)
RemoveProposal(it, LFG_UPDATETYPE_PROPOSAL_DECLINED);
break;
}
- default:
+ case LFG_STATE_NONE:
+ case LFG_STATE_RAIDBROWSER:
+ break;
+ case LFG_STATE_DUNGEON:
+ case LFG_STATE_FINISHED_DUNGEON:
+ case LFG_STATE_BOOT:
+ if (guid != gguid) // Player
+ SetState(guid, LFG_STATE_NONE);
break;
}
}
@@ -882,7 +890,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
if (roleCheck.leader == pguid)
SendLfgJoinResult(pguid, joinData);
SendLfgUpdateParty(pguid, LfgUpdateData(LFG_UPDATETYPE_ROLECHECK_FAILED));
- ClearState(pguid, "Role check Failed");
+ RestoreState(pguid, "Rolecheck Failed");
break;
}
}
@@ -1007,7 +1015,7 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
Makes a new group given a proposal
@param[in] proposal Proposal to get info from
*/
-void LFGMgr::MakeNewGroup(const LfgProposal& proposal)
+void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
{
LfgGuidList players;
LfgGuidList playersToTeleport;
@@ -1038,7 +1046,7 @@ void LFGMgr::MakeNewGroup(const LfgProposal& proposal)
Group* group = player->GetGroup();
if (group && group != grp)
- player->RemoveFromGroup();
+ group->RemoveMember(player->GetGUID());
if (!grp)
{
@@ -1243,10 +1251,11 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
updateData.updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE;
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: [" UI64FMTD "] in same group that someone that didn't accept. Removing from queue and compatible cache", guid);
}
- ClearState(guid, "Proposal Fail (didn't accepted or in group with someone that didn't accept");
+
+ RestoreState(guid, "Proposal Fail (didn't accepted or in group with someone that didn't accept");
if (gguid != guid)
{
- RestoreState(gguid, "Proposal Fail (someone in group didn't accepted)");
+ RestoreState(it->second.group, "Proposal Fail (someone in group didn't accepted)");
SendLfgUpdateParty(guid, updateData);
}
else
@@ -1325,7 +1334,7 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co
Update Boot info with player answer
@param[in] guid Player who has answered
- @param[in] accept player answer
+ @param[in] player answer
*/
void LFGMgr::UpdateBoot(uint64 guid, bool accept)
{
@@ -1339,7 +1348,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept)
LfgPlayerBoot& boot = itBoot->second;
- if (boot.votes[guid] != LFG_ANSWER_PENDING) // Cheat check: Player can't vote twice
+ if (boot.votes[guid] != LFG_ANSWER_PENDING) // Cheat check: Player can't vote twice
return;
boot.votes[guid] = LfgAnswer(accept);
@@ -1517,7 +1526,6 @@ void LFGMgr::RewardDungeonDoneFor(const uint32 dungeonId, Player* player)
// Clear player related lfg stuff
uint32 rDungeonId = (*GetSelectedDungeons(guid).begin());
- ClearState(guid, "Dungeon Finished");
SetState(guid, LFG_STATE_FINISHED_DUNGEON);
// Give rewards only if its a random or seasonal dungeon
@@ -1621,14 +1629,14 @@ LfgState LFGMgr::GetState(uint64 guid)
else
state = PlayersStore[guid].GetState();
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetState: [" UI64FMTD "] = %u", guid, state);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetState: [" UI64FMTD "] = %u", guid, state);
return state;
}
uint32 LFGMgr::GetDungeon(uint64 guid, bool asId /*= true */)
{
uint32 dungeon = GroupsStore[guid].GetDungeon(asId);
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetDungeon: [" UI64FMTD "] asId: %u = %u", guid, asId, dungeon);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetDungeon: [" UI64FMTD "] asId: %u = %u", guid, asId, dungeon);
return dungeon;
}
@@ -1640,20 +1648,20 @@ uint32 LFGMgr::GetDungeonMapId(uint64 guid)
if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId))
mapId = dungeon->map;
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetDungeonMapId: [" UI64FMTD "] = %u (DungeonId = %u)", guid, mapId, dungeonId);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetDungeonMapId: [" UI64FMTD "] = %u (DungeonId = %u)", guid, mapId, dungeonId);
return mapId;
}
uint8 LFGMgr::GetRoles(uint64 guid)
{
uint8 roles = PlayersStore[guid].GetRoles();
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetRoles: [" UI64FMTD "] = %u", guid, roles);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetRoles: [" UI64FMTD "] = %u", guid, roles);
return roles;
}
const std::string& LFGMgr::GetComment(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetComment: [" UI64FMTD "] = %s", guid, PlayersStore[guid].GetComment().c_str());
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetComment: [" UI64FMTD "] = %s", guid, PlayersStore[guid].GetComment().c_str());
return PlayersStore[guid].GetComment();
}
@@ -1669,48 +1677,50 @@ bool LFGMgr::IsTeleported(uint64 pguid)
const LfgDungeonSet& LFGMgr::GetSelectedDungeons(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetSelectedDungeons: [" UI64FMTD "]", guid);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetSelectedDungeons: [" UI64FMTD "]", guid);
return PlayersStore[guid].GetSelectedDungeons();
}
const LfgLockMap& LFGMgr::GetLockedDungeons(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetLockedDungeons: [" UI64FMTD "]", guid);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetLockedDungeons: [" UI64FMTD "]", guid);
return PlayersStore[guid].GetLockedDungeons();
}
uint8 LFGMgr::GetKicksLeft(uint64 guid)
{
uint8 kicks = GroupsStore[guid].GetKicksLeft();
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetKicksLeft: [" UI64FMTD "] = %u", guid, kicks);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetKicksLeft: [" UI64FMTD "] = %u", guid, kicks);
return kicks;
}
void LFGMgr::RestoreState(uint64 guid, char const *debugMsg)
{
- LfgGroupData& data = GroupsStore[guid];
- if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
+ if (IS_GROUP(guid))
{
- std::string const& ps = GetStateString(data.GetState());
- std::string const& os = GetStateString(data.GetOldState());
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RestoreState: Group: [" UI64FMTD "] (%s) State: %s, oldState: %s",
- guid, debugMsg, ps.c_str(), os.c_str());
- }
-
- data.RestoreState();
-}
+ LfgGroupData& data = GroupsStore[guid];
+ if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
+ {
+ std::string const& ps = GetStateString(data.GetState());
+ std::string const& os = GetStateString(data.GetOldState());
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RestoreState: Group: [" UI64FMTD "] (%s) State: %s, oldState: %s",
+ guid, debugMsg, ps.c_str(), os.c_str());
+ }
-void LFGMgr::ClearState(uint64 guid, char const *debugMsg)
-{
- LfgPlayerData& data = PlayersStore[guid];
- if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
+ data.RestoreState();
+ }
+ else
{
- std::string const& ps = GetStateString(data.GetState());
- std::string const& os = GetStateString(data.GetOldState());
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::ClearState: Player: [" UI64FMTD "] (%s) State: %s, oldState: %s",
- guid, debugMsg, ps.c_str(), os.c_str());
+ LfgPlayerData& data = PlayersStore[guid];
+ if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
+ {
+ std::string const& ps = GetStateString(data.GetState());
+ std::string const& os = GetStateString(data.GetOldState());
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RestoreState: Player: [" UI64FMTD "] (%s) State: %s, oldState: %s",
+ guid, debugMsg, ps.c_str(), os.c_str());
+ }
+ data.RestoreState();
}
- data.ClearState();
}
void LFGMgr::SetState(uint64 guid, LfgState state)
@@ -1723,7 +1733,7 @@ void LFGMgr::SetState(uint64 guid, LfgState state)
std::string const& ns = GetStateString(state);
std::string const& ps = GetStateString(data.GetState());
std::string const& os = GetStateString(data.GetOldState());
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetState: Group: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s",
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetState: Group: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s",
guid, ns.c_str(), ps.c_str(), os.c_str());
}
data.SetState(state);
@@ -1736,7 +1746,7 @@ void LFGMgr::SetState(uint64 guid, LfgState state)
std::string const& ns = GetStateString(state);
std::string const& ps = GetStateString(data.GetState());
std::string const& os = GetStateString(data.GetOldState());
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetState: Player: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s",
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetState: Player: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s",
guid, ns.c_str(), ps.c_str(), os.c_str());
}
data.SetState(state);
@@ -1745,43 +1755,43 @@ void LFGMgr::SetState(uint64 guid, LfgState state)
void LFGMgr::SetDungeon(uint64 guid, uint32 dungeon)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetDungeon: [" UI64FMTD "] dungeon %u", guid, dungeon);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetDungeon: [" UI64FMTD "] dungeon %u", guid, dungeon);
GroupsStore[guid].SetDungeon(dungeon);
}
void LFGMgr::SetRoles(uint64 guid, uint8 roles)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetRoles: [" UI64FMTD "] roles: %u", guid, roles);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetRoles: [" UI64FMTD "] roles: %u", guid, roles);
PlayersStore[guid].SetRoles(roles);
}
void LFGMgr::SetComment(uint64 guid, const std::string& comment)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetComment: [" UI64FMTD "] comment: %s", guid, comment.c_str());
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetComment: [" UI64FMTD "] comment: %s", guid, comment.c_str());
PlayersStore[guid].SetComment(comment);
}
void LFGMgr::SetSelectedDungeons(uint64 guid, const LfgDungeonSet& dungeons)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetSelectedDungeons: [" UI64FMTD "]", guid);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetSelectedDungeons: [" UI64FMTD "]", guid);
PlayersStore[guid].SetSelectedDungeons(dungeons);
}
void LFGMgr::SetLockedDungeons(uint64 guid, const LfgLockMap& lock)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid);
PlayersStore[guid].SetLockedDungeons(lock);
}
void LFGMgr::DecreaseKicksLeft(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::DecreaseKicksLeft: [" UI64FMTD "]", guid);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::DecreaseKicksLeft: [" UI64FMTD "]", guid);
GroupsStore[guid].DecreaseKicksLeft();
}
void LFGMgr::RemovePlayerData(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemovePlayerData: [" UI64FMTD "]", guid);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RemovePlayerData: [" UI64FMTD "]", guid);
LfgPlayerDataContainer::iterator it = PlayersStore.find(guid);
if (it != PlayersStore.end())
PlayersStore.erase(it);
@@ -1789,18 +1799,23 @@ void LFGMgr::RemovePlayerData(uint64 guid)
void LFGMgr::RemoveGroupData(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveGroupData: [" UI64FMTD "]", guid);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RemoveGroupData: [" UI64FMTD "]", guid);
LfgGroupDataContainer::iterator it = GroupsStore.find(guid);
if (it == GroupsStore.end())
return;
+ LfgState state = GetState(guid);
+ // If group is being formed after proposal success do nothing more
LfgGuidSet const& players = it->second.GetPlayers();
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
{
uint64 guid = (*it);
- ClearState(*it, "Group Disband");
SetGroup(*it, 0);
- SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
+ if (state != LFG_STATE_PROPOSAL)
+ {
+ SetState(*it, LFG_STATE_NONE);
+ SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
+ }
}
GroupsStore.erase(it);
}
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index 9c023d1daf8..14bc0becb02 100755..100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -254,7 +254,7 @@ struct LfgPlayerBoot
{
time_t cancelTime; ///< Time left to vote
bool inProgress; ///< Vote in progress
- LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
+ LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
uint64 victim; ///< Player guid to be kicked (can't vote)
std::string reason; ///< kick reason
};
diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp
index f1281875598..deee0ddae3c 100644
--- a/src/server/game/DungeonFinding/LFGPlayerData.cpp
+++ b/src/server/game/DungeonFinding/LFGPlayerData.cpp
@@ -33,23 +33,27 @@ void LfgPlayerData::SetState(LfgState state)
case LFG_STATE_FINISHED_DUNGEON:
m_Roles = 0;
m_SelectedDungeons.clear();
+ m_Comment = "";
// No break on purpose
case LFG_STATE_DUNGEON:
- m_OldState = m_State;
+ m_OldState = state;
// No break on purpose
default:
m_State = state;
}
}
-void LfgPlayerData::ClearState()
+void LfgPlayerData::RestoreState()
{
- m_SelectedDungeons.clear();
- m_Roles = 0;
+ if (m_OldState == LFG_STATE_NONE)
+ {
+ m_SelectedDungeons.clear();
+ m_Roles = 0;
+ }
m_State = m_OldState;
}
-void LfgPlayerData::SetLockedDungeons(const LfgLockMap& lockStatus)
+void LfgPlayerData::SetLockedDungeons(LfgLockMap const& lockStatus)
{
m_LockedDungeons = lockStatus;
}
@@ -69,12 +73,12 @@ void LfgPlayerData::SetRoles(uint8 roles)
m_Roles = roles;
}
-void LfgPlayerData::SetComment(const std::string& comment)
+void LfgPlayerData::SetComment(std::string const& comment)
{
m_Comment = comment;
}
-void LfgPlayerData::SetSelectedDungeons(const LfgDungeonSet& dungeons)
+void LfgPlayerData::SetSelectedDungeons(LfgDungeonSet const& dungeons)
{
m_SelectedDungeons = dungeons;
}
diff --git a/src/server/game/DungeonFinding/LFGPlayerData.h b/src/server/game/DungeonFinding/LFGPlayerData.h
index 0682ad66698..589404cf65c 100644
--- a/src/server/game/DungeonFinding/LFGPlayerData.h
+++ b/src/server/game/DungeonFinding/LFGPlayerData.h
@@ -31,7 +31,7 @@ class LfgPlayerData
// General
void SetState(LfgState state);
- void ClearState();
+ void RestoreState();
void SetLockedDungeons(LfgLockMap const& lock);
void SetTeam(uint8 team);
void SetGroup(uint64 group);
@@ -56,7 +56,7 @@ class LfgPlayerData
private:
// General
LfgState m_State; ///< State if group in LFG
- LfgState m_OldState; ///< Old State
+ LfgState m_OldState; ///< Old State - Used to restore state after failed Rolecheck/Proposal
// Player
LfgLockMap m_LockedDungeons; ///< Dungeons player can't do and reason
uint8 m_Team; ///< Player team - determines the queue to join
diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp
index 3bcd1ee5643..bfcf17dc270 100644
--- a/src/server/game/DungeonFinding/LFGQueue.cpp
+++ b/src/server/game/DungeonFinding/LFGQueue.cpp
@@ -483,12 +483,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
}
proposal.queues = check;
- if (check.size() == 1)
- {
- for (LfgGroupsMap::const_iterator it = proposalGroups.begin(); it != proposalGroups.end(); ++it)
- if (proposal.group && it->second != proposal.group)
- proposal.isNew = false;
- }
+ proposal.isNew = numLfgGroups != 1;
if (!sLFGMgr->AllQueued(check))
{
diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp
index f9e3c02fe98..32dc8319215 100644
--- a/src/server/game/DungeonFinding/LFGScripts.cpp
+++ b/src/server/game/DungeonFinding/LFGScripts.cpp
@@ -161,7 +161,6 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
}
sLFGMgr->LeaveLfg(guid);
- sLFGMgr->SetState(guid, LFG_STATE_NONE);
sLFGMgr->SetGroup(guid, 0);
uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid);
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index bbee663c955..9f3b416d0f6 100755..100644
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -103,25 +103,26 @@ void Corpse::SaveToDB()
SQLTransaction trans = CharacterDatabase.BeginTransaction();
DeleteFromDB(trans);
+ uint16 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
- stmt->setUInt32(0, GetGUIDLow()); // corpseGuid
- stmt->setUInt32(1, GUID_LOPART(GetOwnerGUID())); // guid
- stmt->setFloat (2, GetPositionX()); // posX
- stmt->setFloat (3, GetPositionY()); // posY
- stmt->setFloat (4, GetPositionZ()); // posZ
- stmt->setFloat (5, GetOrientation()); // orientation
- stmt->setUInt16(6, GetMapId()); // mapId
- stmt->setUInt32(7, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
- stmt->setString(8, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache
- stmt->setUInt32(9, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1
- stmt->setUInt32(10, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2
- stmt->setUInt32(11, GetUInt32Value(CORPSE_FIELD_GUILD)); // guildId
- stmt->setUInt8 (12, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
- stmt->setUInt8 (13, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
- stmt->setUInt32(14, uint32(m_time)); // time
- stmt->setUInt8 (15, GetType()); // corpseType
- stmt->setUInt32(16, GetInstanceId()); // instanceId
- stmt->setUInt16(17, GetPhaseMask()); // phaseMask
+ stmt->setUInt32(index++, GetGUIDLow()); // corpseGuid
+ stmt->setUInt32(index++, GUID_LOPART(GetOwnerGUID())); // guid
+ stmt->setFloat (index++, GetPositionX()); // posX
+ stmt->setFloat (index++, GetPositionY()); // posY
+ stmt->setFloat (index++, GetPositionZ()); // posZ
+ stmt->setFloat (index++, GetOrientation()); // orientation
+ stmt->setUInt16(index++, GetMapId()); // mapId
+ stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
+ stmt->setString(index++, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache
+ stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1
+ stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2
+ stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_GUILD)); // guildId
+ stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
+ stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
+ stmt->setUInt32(index++, uint32(m_time)); // time
+ stmt->setUInt8 (index++, GetType()); // corpseType
+ stmt->setUInt32(index++, GetInstanceId()); // instanceId
+ stmt->setUInt16(index++, GetPhaseMask()); // phaseMask
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
@@ -161,9 +162,10 @@ void Corpse::DeleteFromDB(SQLTransaction& trans)
bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
{
- uint32 ownerGuid = fields[17].GetUInt32();
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0
+
+ uint32 ownerGuid = fields[17].GetUInt32();
float posX = fields[0].GetFloat();
float posY = fields[1].GetFloat();
float posZ = fields[2].GetFloat();
diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h
index afac900df32..afac900df32 100755..100644
--- a/src/server/game/Entities/Corpse/Corpse.h
+++ b/src/server/game/Entities/Corpse/Corpse.h
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 911ccd25728..8d39e459187 100755..100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -411,6 +411,16 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data)
SetPvP(false);
}
+ // updates spell bars for vehicles and set player's faction - should be called here, to overwrite faction that is set from the new template
+ if (IsVehicle())
+ {
+ if (Player* owner = Creature::GetCharmerOrOwnerPlayerOrPlayerItself()) // this check comes in case we don't have a player
+ {
+ setFaction(owner->getFaction()); // vehicles should have same as owner faction
+ owner->VehicleSpellInitialize();
+ }
+ }
+
// trigger creature is always not selectable and can not be attacked
if (isTrigger())
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -2515,3 +2525,69 @@ bool Creature::SetHover(bool enable)
SendMessageToSet(&data, false);
return true;
}
+
+float Creature::GetAggroRange(Unit const* target) const
+{
+ // Determines the aggro range for creatures (usually pets), used mainly for aggressive pet target selection.
+ // Based on data from wowwiki due to lack of 3.3.5a data
+
+ if (target && this->isPet())
+ {
+ uint32 targetLevel = 0;
+
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ targetLevel = target->getLevelForTarget(this);
+ else if (target->GetTypeId() == TYPEID_UNIT)
+ targetLevel = target->ToCreature()->getLevelForTarget(this);
+
+ uint32 myLevel = getLevelForTarget(target);
+ int32 levelDiff = int32(targetLevel) - int32(myLevel);
+
+ // The maximum Aggro Radius is capped at 45 yards (25 level difference)
+ if (levelDiff < -25)
+ levelDiff = -25;
+
+ // The base aggro radius for mob of same level
+ float aggroRadius = 20;
+
+ // Aggro Radius varies with level difference at a rate of roughly 1 yard/level
+ aggroRadius -= (float)levelDiff;
+
+ // detect range auras
+ aggroRadius += GetTotalAuraModifier(SPELL_AURA_MOD_DETECT_RANGE);
+
+ // detected range auras
+ aggroRadius += target->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
+
+ // Just in case, we don't want pets running all over the map
+ if (aggroRadius > MAX_AGGRO_RADIUS)
+ aggroRadius = MAX_AGGRO_RADIUS;
+
+ // Minimum Aggro Radius for a mob seems to be combat range (5 yards)
+ // hunter pets seem to ignore minimum aggro radius so we'll default it a little higher
+ if (aggroRadius < 10)
+ aggroRadius = 10;
+
+ return (aggroRadius);
+ }
+
+ // Default
+ return 0.0f;
+}
+
+Unit* Creature::SelectNearestHostileUnitInAggroRange(bool useLOS) const
+{
+ // Selects nearest hostile target within creature's aggro range. Used primarily by
+ // pets set to aggressive. Will not return neutral or friendly targets.
+
+ Unit* target = NULL;
+
+ {
+ Trinity::NearestHostileUnitInAggroRangeCheck u_check(this, useLOS);
+ Trinity::UnitSearcher<Trinity::NearestHostileUnitInAggroRangeCheck> searcher(this, target, u_check);
+
+ VisitNearbyGridObject(MAX_AGGRO_RADIUS, searcher);
+ }
+
+ return target;
+}
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 228485d001e..8a697dd0ef0 100755..100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -323,7 +323,7 @@ struct VendorItem
: item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost) {}
uint32 item;
- uint32 maxcount; // 0 for infinity item amount
+ uint32 maxcount; // 0 for infinity item amount
uint32 incrtime; // time for restore items amount if maxcount != 0
uint32 ExtendedCost;
@@ -621,12 +621,14 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
bool canStartAttack(Unit const* u, bool force) const;
float GetAttackDistance(Unit const* player) const;
+ float GetAggroRange(Unit const* target) const;
void SendAIReaction(AiReaction reactionType);
Unit* SelectNearestTarget(float dist = 0) const;
Unit* SelectNearestTargetInAttackDistance(float dist = 0) const;
Player* SelectNearestPlayer(float distance = 0) const;
+ Unit* SelectNearestHostileUnitInAggroRange(bool useLOS = false) const;
void DoFleeToGetAssistance();
void CallForHelp(float fRadius);
@@ -682,8 +684,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); }
void SetHomePosition(const Position &pos) { m_homePosition.Relocate(pos); }
- void GetHomePosition(float &x, float &y, float &z, float &ori) { m_homePosition.GetPosition(x, y, z, ori); }
- Position GetHomePosition() { return m_homePosition; }
+ void GetHomePosition(float &x, float &y, float &z, float &ori) const { m_homePosition.GetPosition(x, y, z, ori); }
+ Position GetHomePosition() const { return m_homePosition; }
void SetTransportHomePosition(float x, float y, float z, float o) { m_transportHomePosition.Relocate(x, y, z, o); }
void SetTransportHomePosition(const Position &pos) { m_transportHomePosition.Relocate(pos); }
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index c9d1944af09..c9d1944af09 100755..100644
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
diff --git a/src/server/game/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h
index e5b8771ee40..e5b8771ee40 100755..100644
--- a/src/server/game/Entities/Creature/CreatureGroups.h
+++ b/src/server/game/Entities/Creature/CreatureGroups.h
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 17a8711379a..17a8711379a 100755..100644
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h
index 15766bbcd59..15766bbcd59 100755..100644
--- a/src/server/game/Entities/Creature/GossipDef.h
+++ b/src/server/game/Entities/Creature/GossipDef.h
diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp
index a6b51a4d395..a6b51a4d395 100755..100644
--- a/src/server/game/Entities/Creature/TemporarySummon.cpp
+++ b/src/server/game/Entities/Creature/TemporarySummon.cpp
diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
index ba7faf60ddf..b60197ff613 100755..100644
--- a/src/server/game/Entities/Creature/TemporarySummon.h
+++ b/src/server/game/Entities/Creature/TemporarySummon.h
@@ -34,7 +34,7 @@ class TempSummon : public Creature
void SetTempSummonType(TempSummonType type);
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) {}
Unit* GetSummoner() const;
- uint64 GetSummonerGUID() { return m_summonerGUID; }
+ uint64 GetSummonerGUID() const { return m_summonerGUID; }
TempSummonType const& GetSummonType() { return m_type; }
uint32 GetTimer() { return m_timer; }
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
index cd4a9443867..cd4a9443867 100755..100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h
index 68da99ac668..68da99ac668 100755..100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.h
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.h
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 214df2672cb..f72e36e2d30 100755..100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -118,7 +118,7 @@ void GameObject::RemoveFromOwner()
else if (IS_PET_GUID(ownerGUID))
ownerType = "pet";
- sLog->outFatal(LOG_FILTER_GENERAL, "Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.",
+ sLog->outFatal(LOG_FILTER_GENERAL, "Removed GameObject (GUID: %u Entry: %u SpellId: %u LinkedGO: %u) that just lost any reference to the owner (GUID: %u Type: '%s') GO list",
GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(ownerGUID), ownerType);
SetOwnerGUID(0);
}
@@ -1698,7 +1698,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
{
trigger->setFaction(owner->getFaction());
// needed for GO casts for proper target validation checks
- trigger->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner->GetGUID());
+ trigger->SetOwnerGUID(owner->GetGUID());
trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, owner->GetGUID());
}
else
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 32d73579f51..32d73579f51 100755..100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp
index 73b38c1da83..73b38c1da83 100755..100644
--- a/src/server/game/Entities/Item/Container/Bag.cpp
+++ b/src/server/game/Entities/Item/Container/Bag.cpp
diff --git a/src/server/game/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h
index 5a533d9cf57..5a533d9cf57 100755..100644
--- a/src/server/game/Entities/Item/Container/Bag.h
+++ b/src/server/game/Entities/Item/Container/Bag.h
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index a1ff6cf2ce8..5303fb8dc38 100755..100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -378,6 +378,10 @@ void Item::SaveToDB(SQLTransaction& trans)
if (!isInTransaction)
CharacterDatabase.CommitTransaction(trans);
+ // Delete the items if this is a container
+ if (!loot.isLooted())
+ ItemContainerDeleteLootMoneyAndLootItemsFromDB();
+
delete this;
return;
}
@@ -483,6 +487,10 @@ void Item::DeleteFromDB(SQLTransaction& trans, uint32 itemGuid)
void Item::DeleteFromDB(SQLTransaction& trans)
{
DeleteFromDB(trans, GetGUIDLow());
+
+ // Delete the items if this is a container
+ if (!loot.isLooted())
+ ItemContainerDeleteLootMoneyAndLootItemsFromDB();
}
/*static*/
@@ -1045,7 +1053,7 @@ Item* Item::CloneItem(uint32 count, Player const* player) const
newItem->SetUInt32Value(ITEM_FIELD_CREATOR, GetUInt32Value(ITEM_FIELD_CREATOR));
newItem->SetUInt32Value(ITEM_FIELD_GIFTCREATOR, GetUInt32Value(ITEM_FIELD_GIFTCREATOR));
- newItem->SetUInt32Value(ITEM_FIELD_FLAGS, GetUInt32Value(ITEM_FIELD_FLAGS));
+ newItem->SetUInt32Value(ITEM_FIELD_FLAGS, GetUInt32Value(ITEM_FIELD_FLAGS) & ~(ITEM_FLAG_REFUNDABLE | ITEM_FLAG_BOP_TRADEABLE));
newItem->SetUInt32Value(ITEM_FIELD_DURATION, GetUInt32Value(ITEM_FIELD_DURATION));
// player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
if (player)
@@ -1198,3 +1206,191 @@ bool Item::CheckSoulboundTradeExpire()
return false;
}
+
+void Item::ItemContainerSaveLootToDB()
+{
+ // Saves the money and item loot associated with an openable item to the DB
+
+ if (loot.isLooted()) // no money and no loot
+ return;
+
+ uint32 container_id = GetGUIDLow();
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+
+ loot.containerID = container_id; // Save this for when a LootItem is removed
+
+ // Save money
+ if (loot.gold > 0)
+ {
+ PreparedStatement* stmt_money = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY);
+ stmt_money->setUInt32(0, container_id);
+ trans->Append(stmt_money);
+
+ stmt_money = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_MONEY);
+ stmt_money->setUInt32(0, container_id);
+ stmt_money->setUInt32(1, loot.gold);
+ trans->Append(stmt_money);
+ }
+
+ // Save items
+ if (!loot.isLooted())
+ {
+
+ PreparedStatement* stmt_items = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEMS);
+ stmt_items->setUInt32(0, container_id);
+ trans->Append(stmt_items);
+
+ // Now insert the items
+ for (LootItemList::const_iterator _li = loot.items.begin(); _li != loot.items.end(); _li++)
+ {
+ // When an item is looted, it doesn't get removed from the items collection
+ // but we don't want to resave it.
+ if (!_li->canSave)
+ continue;
+
+ stmt_items = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_ITEMS);
+
+ // container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix
+ stmt_items->setUInt32(0, container_id);
+ stmt_items->setUInt32(1, _li->itemid);
+ stmt_items->setUInt32(2, _li->count);
+ stmt_items->setBool(3, _li->follow_loot_rules);
+ stmt_items->setBool(4, _li->freeforall);
+ stmt_items->setBool(5, _li->is_blocked);
+ stmt_items->setBool(6, _li->is_counted);
+ stmt_items->setBool(7, _li->is_underthreshold);
+ stmt_items->setBool(8, _li->needs_quest);
+ stmt_items->setUInt32(9, _li->randomPropertyId);
+ stmt_items->setUInt32(10, _li->randomSuffix);
+ trans->Append(stmt_items);
+ }
+ }
+
+ CharacterDatabase.CommitTransaction(trans);
+}
+
+bool Item::ItemContainerLoadLootFromDB()
+{
+ // Loads the money and item loot associated with an openable item from the DB
+
+ // Default. If there are no records for this item then it will be rolled for in Player::SendLoot()
+ m_lootGenerated = false;
+
+ uint32 container_id = GetGUIDLow();
+
+ // Save this for later use
+ loot.containerID = container_id;
+
+ // First, see if there was any money loot. This gets added directly to the container.
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEMCONTAINER_MONEY);
+ stmt->setUInt32(0, container_id);
+ PreparedQueryResult money_result = CharacterDatabase.Query(stmt);
+
+ if (money_result)
+ {
+ Field* fields = money_result->Fetch();
+ loot.gold = fields[0].GetUInt32();
+ }
+
+ // Next, load any items that were saved
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEMCONTAINER_ITEMS);
+ stmt->setUInt32(0, container_id);
+ PreparedQueryResult item_result = CharacterDatabase.Query(stmt);
+
+ if (item_result)
+ {
+ // Get a LootTemplate for the container item. This is where
+ // the saved loot was originally rolled from, we will copy conditions from it
+ LootTemplate const* lt = LootTemplates_Item.GetLootFor(GetEntry());
+
+ if (lt)
+ {
+ do
+ {
+ // Create an empty LootItem
+ LootItem loot_item = LootItem();
+
+ // Fill in the rest of the LootItem from the DB
+ Field* fields = item_result->Fetch();
+
+ // item_id, itm_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix
+ loot_item.itemid = fields[0].GetUInt32();
+ loot_item.count = fields[1].GetUInt32();
+ loot_item.follow_loot_rules = fields[2].GetBool();
+ loot_item.freeforall = fields[3].GetBool();
+ loot_item.is_blocked = fields[4].GetBool();
+ loot_item.is_counted = fields[5].GetBool();
+ loot_item.canSave = true;
+ loot_item.is_underthreshold = fields[6].GetBool();
+ loot_item.needs_quest = fields[7].GetBool();
+ loot_item.randomPropertyId = fields[8].GetUInt32();
+ loot_item.randomSuffix = fields[9].GetUInt32();
+
+ // Copy the extra loot conditions from the item in the loot template
+ lt->CopyConditions(&loot_item);
+
+ // If container item is in a bag, add that player as an allowed looter
+ if (GetBagSlot())
+ loot_item.allowedGUIDs.insert(GetOwner()->GetGUIDLow());
+
+ // Finally add the LootItem to the container
+ loot.items.push_back(loot_item);
+
+ // Increment unlooted count
+ loot.unlootedCount++;
+
+ } while (item_result->NextRow());
+ }
+ }
+
+ // Mark the item if it has loot so it won't be generated again on open
+ m_lootGenerated = !loot.isLooted();
+
+ return m_lootGenerated;
+}
+
+void Item::ItemContainerDeleteLootItemsFromDB()
+{
+ // Deletes items associated with an openable item from the DB
+
+ uint32 containerId = GetGUIDLow();
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEMS);
+ stmt->setUInt32(0, containerId);
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ trans->Append(stmt);
+ CharacterDatabase.CommitTransaction(trans);
+}
+
+void Item::ItemContainerDeleteLootItemFromDB(uint32 itemID)
+{
+ // Deletes a single item associated with an openable item from the DB
+
+ uint32 containerId = GetGUIDLow();
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEM);
+ stmt->setUInt32(0, containerId);
+ stmt->setUInt32(1, itemID);
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ trans->Append(stmt);
+ CharacterDatabase.CommitTransaction(trans);
+}
+
+void Item::ItemContainerDeleteLootMoneyFromDB()
+{
+ // Deletes the money loot associated with an openable item from the DB
+
+ uint32 containerId = GetGUIDLow();
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY);
+ stmt->setUInt32(0, containerId);
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ trans->Append(stmt);
+ CharacterDatabase.CommitTransaction(trans);
+}
+
+void Item::ItemContainerDeleteLootMoneyAndLootItemsFromDB()
+{
+ // Deletes money and items associated with an openable item from the DB
+
+ ItemContainerDeleteLootMoneyFromDB();
+ ItemContainerDeleteLootItemsFromDB();
+}
+
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index a5f9ed5c008..2e1956250f3 100755..100644
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -231,6 +231,15 @@ class Item : public Object
static void DeleteFromDB(SQLTransaction& trans, uint32 itemGuid);
virtual void DeleteFromDB(SQLTransaction& trans);
static void DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid);
+
+ // Lootable items and their contents
+ void ItemContainerSaveLootToDB();
+ bool ItemContainerLoadLootFromDB();
+ void ItemContainerDeleteLootItemsFromDB();
+ void ItemContainerDeleteLootItemFromDB(uint32 itemID);
+ void ItemContainerDeleteLootMoneyFromDB();
+ void ItemContainerDeleteLootMoneyAndLootItemsFromDB();
+
void DeleteFromInventoryDB(SQLTransaction& trans);
void SaveRefundDataToDB();
void DeleteRefundDataFromDB(SQLTransaction* trans);
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index cfb8c880479..cfb8c880479 100755..100644
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.h b/src/server/game/Entities/Item/ItemEnchantmentMgr.h
index fe4dca40d24..fe4dca40d24 100755..100644
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.h
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.h
diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h
index f2f41d6a8b9..f2f41d6a8b9 100755..100644
--- a/src/server/game/Entities/Item/ItemPrototype.h
+++ b/src/server/game/Entities/Item/ItemPrototype.h
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index ca32fd377e9..6f16618491e 100755..100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -2336,12 +2336,7 @@ void WorldObject::SetZoneScript()
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
m_zoneScript = bf;
else
- {
- if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
- m_zoneScript = bf;
- else
- m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
- }
+ m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
}
}
}
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 0bb4214de32..0bb4214de32 100755..100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h
index 03fa44da08a..03fa44da08a 100755..100644
--- a/src/server/game/Entities/Object/ObjectDefines.h
+++ b/src/server/game/Entities/Object/ObjectDefines.h
diff --git a/src/server/game/Entities/Object/ObjectPosSelector.cpp b/src/server/game/Entities/Object/ObjectPosSelector.cpp
index f5c36f5a3c9..f5c36f5a3c9 100755..100644
--- a/src/server/game/Entities/Object/ObjectPosSelector.cpp
+++ b/src/server/game/Entities/Object/ObjectPosSelector.cpp
diff --git a/src/server/game/Entities/Object/ObjectPosSelector.h b/src/server/game/Entities/Object/ObjectPosSelector.h
index b30694672df..b30694672df 100755..100644
--- a/src/server/game/Entities/Object/ObjectPosSelector.h
+++ b/src/server/game/Entities/Object/ObjectPosSelector.h
diff --git a/src/server/game/Entities/Object/Updates/UpdateData.cpp b/src/server/game/Entities/Object/Updates/UpdateData.cpp
index 45464f19083..45464f19083 100755..100644
--- a/src/server/game/Entities/Object/Updates/UpdateData.cpp
+++ b/src/server/game/Entities/Object/Updates/UpdateData.cpp
diff --git a/src/server/game/Entities/Object/Updates/UpdateData.h b/src/server/game/Entities/Object/Updates/UpdateData.h
index ff649b7cb2f..ff649b7cb2f 100755..100644
--- a/src/server/game/Entities/Object/Updates/UpdateData.h
+++ b/src/server/game/Entities/Object/Updates/UpdateData.h
diff --git a/src/server/game/Entities/Object/Updates/UpdateFields.h b/src/server/game/Entities/Object/Updates/UpdateFields.h
index 7e4aa9aaab8..7e4aa9aaab8 100755..100644
--- a/src/server/game/Entities/Object/Updates/UpdateFields.h
+++ b/src/server/game/Entities/Object/Updates/UpdateFields.h
diff --git a/src/server/game/Entities/Object/Updates/UpdateMask.h b/src/server/game/Entities/Object/Updates/UpdateMask.h
index ad70936b81d..ad70936b81d 100755..100644
--- a/src/server/game/Entities/Object/Updates/UpdateMask.h
+++ b/src/server/game/Entities/Object/Updates/UpdateMask.h
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index b6417681f4a..a6130f03c6e 100755..100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -74,6 +74,7 @@ void Pet::AddToWorld()
if (GetCharmInfo() && GetCharmInfo()->HasCommandState(COMMAND_FOLLOW))
{
GetCharmInfo()->SetIsCommandAttack(false);
+ GetCharmInfo()->SetIsCommandFollow(false);
GetCharmInfo()->SetIsAtStay(false);
GetCharmInfo()->SetIsFollowing(false);
GetCharmInfo()->SetIsReturning(false);
@@ -267,7 +268,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID);
stmt->setUInt8(0, uint8(PET_SAVE_NOT_IN_SLOT));
stmt->setUInt32(1, ownerid);
stmt->setUInt8(2, uint8(PET_SAVE_AS_CURRENT));
@@ -332,7 +333,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
if (getPetType() == HUNTER_PET)
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_DECLINED_NAME);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_DECLINED_NAME);
stmt->setUInt32(0, owner->GetGUIDLow());
stmt->setUInt32(1, GetCharmInfo()->GetPetNumber());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -428,7 +429,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
// prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT
if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT || mode > PET_SAVE_LAST_STABLE_SLOT))
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_SLOT);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_SLOT);
stmt->setUInt32(0, ownerLowGUID);
stmt->setUInt8(1, uint8(PET_SAVE_AS_CURRENT));
stmt->setUInt8(2, uint8(PET_SAVE_LAST_STABLE_SLOT));
@@ -1349,7 +1350,7 @@ void Pet::_SaveAuras(SQLTransaction& trans)
uint8 index = 0;
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_AURA);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_AURA);
stmt->setUInt32(index++, m_charmInfo->GetPetNumber());
stmt->setUInt64(index++, casterGUID);
stmt->setUInt32(index++, itr->second->GetId());
diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h
index a1dd57a26cc..a1dd57a26cc 100755..100644
--- a/src/server/game/Entities/Pet/Pet.h
+++ b/src/server/game/Entities/Pet/Pet.h
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index dd9907d8c07..af7692b87c5 100755..100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -207,12 +207,12 @@ void PlayerTaxi::AppendTaximaskTo(ByteBuffer& data, bool all)
{
if (all)
{
- for (uint8 i=0; i<TaxiMaskSize; i++)
+ for (uint8 i = 0; i < TaxiMaskSize; ++i)
data << uint32(sTaxiNodesMask[i]); // all existed nodes
}
else
{
- for (uint8 i=0; i<TaxiMaskSize; i++)
+ for (uint8 i = 0; i < TaxiMaskSize; ++i)
data << uint32(m_taximask[i]); // known nodes
}
}
@@ -221,9 +221,9 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, uint3
{
ClearTaxiDestinations();
- Tokenizer tokens(values, ' ');
+ Tokenizer Tokenizer(values, ' ');
- for (Tokenizer::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter)
+ for (Tokenizer::const_iterator iter = Tokenizer.begin(); iter != Tokenizer.end(); ++iter)
{
uint32 node = uint32(atol(*iter));
AddTaxiDestination(node);
@@ -728,7 +728,7 @@ Player::Player(WorldSession* session): Unit(true)
m_DailyQuestChanged = false;
m_lastDailyQuestTime = 0;
- for (uint8 i=0; i<MAX_TIMERS; i++)
+ for (uint8 i=0; i < MAX_TIMERS; i++)
m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;
m_MirrorTimerFlags = UNDERWATER_NONE;
@@ -743,7 +743,7 @@ Player::Player(WorldSession* session): Unit(true)
for (uint8 j = 0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; ++j)
{
- m_bgBattlegroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
+ m_bgBattlegroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
m_bgBattlegroundQueueID[j].invitedToInstance = 0;
}
@@ -990,8 +990,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // fix cast time showed in spell tooltip on client
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); // default for players in 3.0.3
- // -1 is default value
- SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1));
+ SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1)); // -1 is default value
SetUInt32Value(PLAYER_BYTES, (createInfo->Skin | (createInfo->Face << 8) | (createInfo->HairStyle << 16) | (createInfo->HairColor << 24)));
SetUInt32Value(PLAYER_BYTES_2, (createInfo->FacialHair |
@@ -4751,7 +4750,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
// We can return mail now
// So firstly delete the old one
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID);
stmt->setUInt32(0, mail_id);
trans->Append(stmt);
@@ -4760,7 +4759,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
{
if (has_items)
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
stmt->setUInt32(0, mail_id);
trans->Append(stmt);
}
@@ -4774,7 +4773,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
if (has_items)
{
// Data needs to be at first place for Item::LoadFromDB
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS);
stmt->setUInt32(0, mail_id);
PreparedQueryResult resultItems = CharacterDatabase.Query(stmt);
if (resultItems)
@@ -4989,7 +4988,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
// The character gets unlinked from the account, the name gets freed up and appears as deleted ingame
case CHAR_DELETE_UNLINK:
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_DELETE_INFO);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_DELETE_INFO);
stmt->setUInt32(0, guid);
@@ -5726,7 +5725,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa
float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const
{
- if (modGroup >= BASEMOD_END || modType > MOD_END)
+ if (modGroup >= BASEMOD_END || modType >= MOD_END)
{
sLog->outError(LOG_FILTER_SPELLS_AURAS, "trial to access non existed BaseModGroup or wrong BaseModType!");
return 0.0f;
@@ -6924,37 +6923,83 @@ ReputationRank Player::GetReputationRank(uint32 faction) const
return GetReputationMgr().GetRank(factionEntry);
}
-//Calculate total reputation percent player gain with quest/creature level
-int32 Player::CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool for_quest, bool noQuestBonus)
+// Calculate total reputation percent player gain with quest/creature level
+int32 Player::CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus)
{
float percent = 100.0f;
- // Get the generic rate first
- if (RepRewardRate const* repData = sObjectMgr->GetRepRewardRate(faction))
+ float repMod = noQuestBonus ? 0.0f : float(GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
+
+ // faction specific auras only seem to apply to kills
+ if (source == REPUTATION_SOURCE_KILL)
+ repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction);
+
+ percent += rep > 0 ? repMod : -repMod;
+
+ float rate;
+ switch (source)
{
- float repRate = for_quest ? repData->quest_rate : repData->creature_rate;
- percent *= repRate;
+ case REPUTATION_SOURCE_KILL:
+ rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_KILL);
+ break;
+ case REPUTATION_SOURCE_QUEST:
+ case REPUTATION_SOURCE_DAILY_QUEST:
+ case REPUTATION_SOURCE_WEEKLY_QUEST:
+ case REPUTATION_SOURCE_MONTHLY_QUEST:
+ rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_QUEST);
+ break;
+ case REPUTATION_SOURCE_SPELL:
+ default:
+ rate = 1.0f;
+ break;
}
- float rate = for_quest ? sWorld->getRate(RATE_REPUTATION_LOWLEVEL_QUEST) : sWorld->getRate(RATE_REPUTATION_LOWLEVEL_KILL);
-
if (rate != 1.0f && creatureOrQuestLevel <= Trinity::XP::GetGrayLevel(getLevel()))
percent *= rate;
- float repMod = noQuestBonus ? 0.0f : (float)GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN);
+ if (percent <= 0.0f)
+ return 0;
- if (!for_quest)
- repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction);
+ // Multiply result with the faction specific rate
+ if (RepRewardRate const* repData = sObjectMgr->GetRepRewardRate(faction))
+ {
+ float repRate = 0.0f;
+ switch (source)
+ {
+ case REPUTATION_SOURCE_KILL:
+ repRate = repData->creatureRate;
+ break;
+ case REPUTATION_SOURCE_QUEST:
+ repRate = repData->questRate;
+ break;
+ case REPUTATION_SOURCE_DAILY_QUEST:
+ repRate = repData->questDailyRate;
+ break;
+ case REPUTATION_SOURCE_WEEKLY_QUEST:
+ repRate = repData->questWeeklyRate;
+ break;
+ case REPUTATION_SOURCE_MONTHLY_QUEST:
+ repRate = repData->questMonthlyRate;
+ break;
+ case REPUTATION_SOURCE_SPELL:
+ repRate = repData->spellRate;
+ break;
+ }
- percent += rep > 0 ? repMod : -repMod;
+ // for custom, a rate of 0.0 will totally disable reputation gain for this faction/type
+ if (repRate <= 0.0f)
+ return 0;
- if (percent <= 0.0f)
- return 0;
+ percent *= repRate;
+ }
+
+ if (source != REPUTATION_SOURCE_SPELL && GetsRecruitAFriendBonus(false))
+ percent *= 1.0f + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS);
- return int32(rep*percent/100);
+ return CalculatePct(rep, percent);
}
-//Calculates how many reputation points player gains in victim's enemy factions
+// Calculates how many reputation points player gains in victim's enemy factions
void Player::RewardReputation(Unit* victim, float rate)
{
if (!victim || victim->GetTypeId() == TYPEID_PLAYER)
@@ -6964,7 +7009,6 @@ void Player::RewardReputation(Unit* victim, float rate)
return;
ReputationOnKillEntry const* Rep = sObjectMgr->GetReputationOnKilEntry(victim->ToCreature()->GetCreatureTemplate()->Entry);
-
if (!Rep)
return;
@@ -6975,41 +7019,20 @@ void Player::RewardReputation(Unit* victim, float rate)
// support for: Championing - http://www.wowwiki.com/Championing
Map const* map = GetMap();
- if (map && map->IsDungeon())
+ if (map && map->IsNonRaidDungeon())
{
- InstanceTemplate const* instance = sObjectMgr->GetInstanceTemplate(map->GetId());
- if (instance)
- {
- AccessRequirement const* pAccessRequirement = sObjectMgr->GetAccessRequirement(map->GetId(), ((InstanceMap*)map)->GetDifficulty());
- if (pAccessRequirement)
- {
- if (!map->IsRaid() && pAccessRequirement->levelMin == 80)
- ChampioningFaction = GetChampioningFaction();
- }
- }
+ if (AccessRequirement const* accessRequirement = sObjectMgr->GetAccessRequirement(map->GetId(), map->GetDifficulty()))
+ if (accessRequirement->levelMin == 80)
+ ChampioningFaction = GetChampioningFaction();
}
}
- // Favored reputation increase START
- uint32 zone = GetZoneId();
uint32 team = GetTeam();
- float favored_rep_mult = 0;
-
- if ((HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714)) favored_rep_mult = 0.25; // Thrallmar's Favor and Honor Hold's Favor
- else if (HasAura(30754) && (Rep->RepFaction1 == 609 || Rep->RepFaction2 == 609) && !ChampioningFaction) favored_rep_mult = 0.25; // Cenarion Favor
-
- if (favored_rep_mult > 0) favored_rep_mult *= 2; // Multiplied by 2 because the reputation is divided by 2 for some reason (See "donerep1 / 2" and "donerep2 / 2") -- if you know why this is done, please update/explain :)
- // Favored reputation increase END
-
- bool recruitAFriend = GetsRecruitAFriendBonus(false);
if (Rep->RepFaction1 && (!Rep->TeamDependent || team == ALLIANCE))
{
- int32 donerep1 = CalculateReputationGain(victim->getLevel(), Rep->RepValue1, ChampioningFaction ? ChampioningFaction : Rep->RepFaction1, false);
- donerep1 = int32(donerep1*(rate + favored_rep_mult));
-
- if (recruitAFriend)
- donerep1 = int32(donerep1 * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS)));
+ int32 donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), Rep->RepValue1, ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
+ donerep1 = int32(donerep1 * rate);
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1);
@@ -7019,11 +7042,8 @@ void Player::RewardReputation(Unit* victim, float rate)
if (Rep->RepFaction2 && (!Rep->TeamDependent || team == HORDE))
{
- int32 donerep2 = CalculateReputationGain(victim->getLevel(), Rep->RepValue2, ChampioningFaction ? ChampioningFaction : Rep->RepFaction2, false);
- donerep2 = int32(donerep2*(rate + favored_rep_mult));
-
- if (recruitAFriend)
- donerep2 = int32(donerep2 * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS)));
+ int32 donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), Rep->RepValue2, ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
+ donerep2 = int32(donerep2 * rate);
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2);
@@ -7032,47 +7052,46 @@ void Player::RewardReputation(Unit* victim, float rate)
}
}
-//Calculate how many reputation points player gain with the quest
+// Calculate how many reputation points player gain with the quest
void Player::RewardReputation(Quest const* quest)
{
- bool recruitAFriend = GetsRecruitAFriendBonus(false);
-
- // quest reputation reward/loss
for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
{
if (!quest->RewardFactionId[i])
continue;
- if (quest->RewardFactionValueIdOverride[i])
- {
- int32 rep = CalculateReputationGain(GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true, true);
- if (recruitAFriend)
- rep = int32(rep * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS)));
+ int32 rep = 0;
+ bool noQuestBonus = false;
- if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
- GetReputationMgr().ModifyReputation(factionEntry, rep);
+ if (quest->RewardFactionValueIdOverride[i])
+ {
+ rep = quest->RewardFactionValueIdOverride[i] / 100;
+ noQuestBonus = true;
}
else
{
uint32 row = ((quest->RewardFactionValueId[i] < 0) ? 1 : 0) + 1;
- uint32 field = abs(quest->RewardFactionValueId[i]);
-
- if (const QuestFactionRewEntry* pRow = sQuestFactionRewardStore.LookupEntry(row))
+ if (QuestFactionRewEntry const* questFactionRewEntry = sQuestFactionRewardStore.LookupEntry(row))
{
- int32 repPoints = pRow->QuestRewFactionValue[field];
-
- if (!repPoints)
- continue;
+ uint32 field = abs(quest->RewardFactionValueId[i]);
+ rep = questFactionRewEntry->QuestRewFactionValue[field];
+ }
+ }
- repPoints = CalculateReputationGain(GetQuestLevel(quest), repPoints, quest->RewardFactionId[i], true);
+ if (!rep)
+ continue;
- if (recruitAFriend)
- repPoints = int32(repPoints * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS)));
+ if (quest->IsDaily())
+ rep = CalculateReputationGain(REPUTATION_SOURCE_DAILY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus);
+ else if (quest->IsWeekly())
+ rep = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus);
+ else if (quest->IsMonthly())
+ rep = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus);
+ else
+ rep = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus);
- if (const FactionEntry* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
- GetReputationMgr().ModifyReputation(factionEntry, repPoints);
- }
- }
+ if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
+ GetReputationMgr().ModifyReputation(factionEntry, rep);
}
}
@@ -7373,7 +7392,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
if (!zone)
{
// stored zone is zero, use generic and slow zone detection
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION_XYZ);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION_XYZ);
stmt->setUInt32(0, guidLow);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -7389,7 +7408,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
if (zone > 0)
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ZONE);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ZONE);
stmt->setUInt16(0, uint16(zone));
stmt->setUInt32(1, guidLow);
@@ -8336,25 +8355,11 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
if (spellData.SpellPPMRate)
{
- if (spellData.SpellId == 52781) // Persuasive Strike
- {
- switch (target->GetEntry())
- {
- default:
- return;
- case 28939:
- case 28940:
- case 28610:
- break;
- }
- }
uint32 WeaponSpeed = GetAttackTime(attType);
chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo);
}
else if (chance > 100.0f)
- {
chance = GetWeaponProcChance();
- }
if (roll_chance_f(chance))
CastSpell(target, spellInfo->Id, true, item);
@@ -8845,7 +8850,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
loot = &item->loot;
- if (!item->m_lootGenerated)
+ // If item doesn't already have loot, attempt to load it. If that
+ // fails then this is first time opening, generate loot
+ if (!item->m_lootGenerated && !item->ItemContainerLoadLootFromDB())
{
item->m_lootGenerated = true;
loot->clear();
@@ -8864,6 +8871,12 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
default:
loot->generateMoneyLoot(item->GetTemplate()->MinMoneyLoot, item->GetTemplate()->MaxMoneyLoot);
loot->FillLoot(item->GetEntry(), LootTemplates_Item, this, true, loot->gold != 0);
+
+ // Force save the loot and money items that were just rolled
+ // Also saves the container item ID in Loot struct (not to DB)
+ if (loot->gold > 0 || loot->unlootedCount > 0)
+ item->ItemContainerSaveLootToDB();
+
break;
}
}
@@ -9625,8 +9638,8 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
instance->FillInitialWorldStates(data);
else
{
- data << uint32(4132) << uint32(0); // 9 WORLDSTATE_SHOW_CRATES
- data << uint32(4131) << uint32(0); // 10 WORLDSTATE_CRATES_REVEALED
+ data << uint32(4132) << uint32(0); // 9 WORLDSTATE_ALGALON_TIMER_ENABLED
+ data << uint32(4131) << uint32(0); // 10 WORLDSTATE_ALGALON_DESPAWN_TIMER
}
break;
// Wintergrasp
@@ -9768,11 +9781,10 @@ void Player::SetSheath(SheathState sheathed)
SetVirtualItemSlot(2, NULL);
break;
case SHEATH_STATE_MELEE: // prepared melee weapon
- {
SetVirtualItemSlot(0, GetWeaponForAttack(BASE_ATTACK, true));
SetVirtualItemSlot(1, GetWeaponForAttack(OFF_ATTACK, true));
SetVirtualItemSlot(2, NULL);
- }; break;
+ break;
case SHEATH_STATE_RANGED: // prepared ranged weapon
SetVirtualItemSlot(0, NULL);
SetVirtualItemSlot(1, NULL);
@@ -11910,7 +11922,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje
Map const* map = lootedObject->GetMap();
if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true))
if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId))
- if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty()))
+ if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty())
lootedObjectInDungeon = true;
if (!lootedObjectInDungeon)
@@ -12308,12 +12320,12 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
switch (slot)
{
- case EQUIPMENT_SLOT_MAINHAND:
- case EQUIPMENT_SLOT_OFFHAND:
- case EQUIPMENT_SLOT_RANGED:
- RecalculateRating(CR_ARMOR_PENETRATION);
- default:
- break;
+ case EQUIPMENT_SLOT_MAINHAND:
+ case EQUIPMENT_SLOT_OFFHAND:
+ case EQUIPMENT_SLOT_RANGED:
+ RecalculateRating(CR_ARMOR_PENETRATION);
+ default:
+ break;
}
}
else
@@ -12530,10 +12542,10 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool
// if this original item then it need create record in inventory
// in case trade we already have item in other player inventory
pLastItem->SetState(in_characterInventoryDB ? ITEM_CHANGED : ITEM_NEW, this);
- }
- if (pLastItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE))
- AddTradeableItem(pLastItem);
+ if (pLastItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE))
+ AddTradeableItem(pLastItem);
+ }
}
void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
@@ -12617,6 +12629,12 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
else if (Bag* pBag = GetBagByPos(bag))
pBag->RemoveItem(slot, update);
+ // Delete rolled money / loot from db.
+ // MUST be done before RemoveFromWorld() or GetTemplate() fails
+ if (ItemTemplate const* pTmp = pItem->GetTemplate())
+ if (pTmp->Flags & ITEM_PROTO_FLAG_OPENABLE)
+ pItem->ItemContainerDeleteLootMoneyAndLootItemsFromDB();
+
if (IsInWorld() && update)
{
pItem->RemoveFromWorld();
@@ -12630,22 +12648,22 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
}
}
-void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check)
+void Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, bool unequip_check)
{
- sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item = %u, count = %u", item, count);
+ sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item = %u, count = %u", itemEntry, count);
uint32 remcount = 0;
// in inventory
for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i)
{
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
- if (pItem->GetEntry() == item && !pItem->IsInTrade())
+ if (item->GetEntry() == itemEntry && !item->IsInTrade())
{
- if (pItem->GetCount() + remcount <= count)
+ if (item->GetCount() + remcount <= count)
{
// all items in inventory can unequipped
- remcount += pItem->GetCount();
+ remcount += item->GetCount();
DestroyItem(INVENTORY_SLOT_BAG_0, i, update);
if (remcount >= count)
@@ -12653,11 +12671,11 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
}
else
{
- ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
- pItem->SetCount(pItem->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
if (IsInWorld() && update)
- pItem->SendUpdateToPlayer(this);
- pItem->SetState(ITEM_CHANGED, this);
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
return;
}
}
@@ -12666,14 +12684,14 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
{
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
- if (pItem->GetEntry() == item && !pItem->IsInTrade())
+ if (item->GetEntry() == itemEntry && !item->IsInTrade())
{
- if (pItem->GetCount() + remcount <= count)
+ if (item->GetCount() + remcount <= count)
{
// all keys can be unequipped
- remcount += pItem->GetCount();
+ remcount += item->GetCount();
DestroyItem(INVENTORY_SLOT_BAG_0, i, update);
if (remcount >= count)
@@ -12681,11 +12699,11 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
}
else
{
- ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
- pItem->SetCount(pItem->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
if (IsInWorld() && update)
- pItem->SendUpdateToPlayer(this);
- pItem->SetState(ITEM_CHANGED, this);
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
return;
}
}
@@ -12695,18 +12713,18 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
// in inventory bags
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
{
- if (Bag* pBag = GetBagByPos(i))
+ if (Bag* bag = GetBagByPos(i))
{
- for (uint32 j = 0; j < pBag->GetBagSize(); j++)
+ for (uint32 j = 0; j < bag->GetBagSize(); j++)
{
- if (Item* pItem = pBag->GetItemByPos(j))
+ if (Item* item = bag->GetItemByPos(j))
{
- if (pItem->GetEntry() == item && !pItem->IsInTrade())
+ if (item->GetEntry() == itemEntry && !item->IsInTrade())
{
// all items in bags can be unequipped
- if (pItem->GetCount() + remcount <= count)
+ if (item->GetCount() + remcount <= count)
{
- remcount += pItem->GetCount();
+ remcount += item->GetCount();
DestroyItem(i, j, update);
if (remcount >= count)
@@ -12714,11 +12732,11 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
}
else
{
- ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
- pItem->SetCount(pItem->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
if (IsInWorld() && update)
- pItem->SendUpdateToPlayer(this);
- pItem->SetState(ITEM_CHANGED, this);
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
return;
}
}
@@ -12730,15 +12748,15 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
// in equipment and bag list
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++)
{
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
- if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
+ if (item && item->GetEntry() == itemEntry && !item->IsInTrade())
{
- if (pItem->GetCount() + remcount <= count)
+ if (item->GetCount() + remcount <= count)
{
if (!unequip_check || CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false) == EQUIP_ERR_OK)
{
- remcount += pItem->GetCount();
+ remcount += item->GetCount();
DestroyItem(INVENTORY_SLOT_BAG_0, i, update);
if (remcount >= count)
@@ -12747,16 +12765,78 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
}
else
{
- ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
- pItem->SetCount(pItem->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
+ if (IsInWorld() && update)
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
+ return;
+ }
+ }
+ }
+ }
+
+ // in bank
+ for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++)
+ {
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ {
+ if (item->GetEntry() == itemEntry && !item->IsInTrade())
+ {
+ if (item->GetCount() + remcount <= count)
+ {
+ remcount += item->GetCount();
+ DestroyItem(INVENTORY_SLOT_BAG_0, i, update);
+ if (remcount >= count)
+ return;
+ }
+ else
+ {
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
if (IsInWorld() && update)
- pItem->SendUpdateToPlayer(this);
- pItem->SetState(ITEM_CHANGED, this);
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
return;
}
}
}
}
+
+ // in bank bags
+ for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
+ {
+ if (Bag* bag = GetBagByPos(i))
+ {
+ for (uint32 j = 0; j < bag->GetBagSize(); j++)
+ {
+ if (Item* item = bag->GetItemByPos(j))
+ {
+ if (item->GetEntry() == itemEntry && !item->IsInTrade())
+ {
+ // all items in bags can be unequipped
+ if (item->GetCount() + remcount <= count)
+ {
+ remcount += item->GetCount();
+ DestroyItem(i, j, update);
+
+ if (remcount >= count)
+ return;
+ }
+ else
+ {
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
+ if (IsInWorld() && update)
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
}
void Player::DestroyZoneLimitedItem(bool update, uint32 new_zone)
@@ -14706,11 +14786,11 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest)
bool Player::CanSeeStartQuest(Quest const* quest)
{
- if (SatisfyQuestClass(quest, false) && SatisfyQuestRace(quest, false) && SatisfyQuestSkill(quest, false) &&
- SatisfyQuestExclusiveGroup(quest, false) && SatisfyQuestReputation(quest, false) &&
+ if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this) && SatisfyQuestClass(quest, false) && SatisfyQuestRace(quest, false) &&
+ SatisfyQuestSkill(quest, false) && SatisfyQuestExclusiveGroup(quest, false) && SatisfyQuestReputation(quest, false) &&
SatisfyQuestPreviousQuest(quest, false) && SatisfyQuestNextChain(quest, false) &&
SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
- SatisfyQuestSeasonal(quest, false) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this))
+ SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(quest, false))
{
return getLevel() + sWorld->getIntConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF) >= quest->GetMinLevel();
}
@@ -14727,7 +14807,7 @@ bool Player::CanTakeQuest(Quest const* quest, bool msg)
&& SatisfyQuestPreviousQuest(quest, msg) && SatisfyQuestTimed(quest, msg)
&& SatisfyQuestNextChain(quest, msg) && SatisfyQuestPrevChain(quest, msg)
&& SatisfyQuestDay(quest, msg) && SatisfyQuestWeek(quest, msg)
- && SatisfyQuestSeasonal(quest,msg)
+ && SatisfyQuestMonth(quest, msg) && SatisfyQuestSeasonal(quest, msg)
&& SatisfyQuestConditions(quest, msg);
}
@@ -14851,7 +14931,7 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg)
return false;
// daily quest can't be rewarded (25 daily quest already completed)
- if (!SatisfyQuestDay(quest, true) || !SatisfyQuestWeek(quest, true) || !SatisfyQuestSeasonal(quest,true))
+ if (!SatisfyQuestDay(quest, true) || !SatisfyQuestWeek(quest, true) || !SatisfyQuestMonth(quest, true) || !SatisfyQuestSeasonal(quest, true))
return false;
// rewarded and not repeatable quest (only cheating case, then ignore without message)
@@ -14984,10 +15064,6 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, quest_id);
- //starting initial quest script
- if (questGiver && quest->GetQuestStartScript() != 0)
- GetMap()->ScriptsStart(sQuestStartScripts, quest->GetQuestStartScript(), questGiver, this);
-
UpdateForQuestWorldObjects();
}
@@ -15149,6 +15225,8 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
}
else if (quest->IsWeekly())
SetWeeklyQuestStatus(quest_id);
+ else if (quest->IsMonthly())
+ SetMonthlyQuestStatus(quest_id);
else if (quest->IsSeasonal())
SetSeasonalQuestStatus(quest_id);
@@ -15602,6 +15680,15 @@ bool Player::SatisfyQuestSeasonal(Quest const* qInfo, bool /*msg*/)
return m_seasonalquests[eventId].find(qInfo->GetQuestId()) == m_seasonalquests[eventId].end();
}
+bool Player::SatisfyQuestMonth(Quest const* qInfo, bool /*msg*/)
+{
+ if (!qInfo->IsMonthly() || m_monthlyquests.empty())
+ return true;
+
+ // if not found in cooldown list
+ return m_monthlyquests.find(qInfo->GetQuestId()) == m_monthlyquests.end();
+}
+
bool Player::GiveQuestSourceItem(Quest const* quest)
{
uint32 srcitem = quest->GetSrcItemId();
@@ -16612,13 +16699,11 @@ bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, flo
return true;
}
-void Player::SetHomebind(WorldLocation const& /*loc*/, uint32 /*area_id*/)
+void Player::SetHomebind(WorldLocation const& loc, uint32 areaId)
{
- m_homebindMapId = GetMapId();
- m_homebindAreaId = GetAreaId();
- m_homebindX = GetPositionX();
- m_homebindY = GetPositionY();
- m_homebindZ = GetPositionZ();
+ loc.GetPosition(m_homebindX, m_homebindY, m_homebindZ);
+ m_homebindMapId = loc.GetMapId();
+ m_homebindAreaId = areaId;
// update sql homebind
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_HOMEBIND);
@@ -16665,8 +16750,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
//"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, "
// 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
//"health, power1, power2, power3, power4, power5, power6, power7, instance_id, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels FROM characters WHERE guid = '%u'", guid);
- PreparedQueryResult result = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADFROM);
-
+ PreparedQueryResult result = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_FROM);
if (!result)
{
sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) not found in table `characters`, can't load. ", guid);
@@ -16685,7 +16769,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
return false;
}
- if (holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBANNED))
+ if (holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BANNED))
{
sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) is banned, can't load.", guid);
return false;
@@ -16700,12 +16784,9 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
(AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && sObjectMgr->IsReservedName(m_name)))
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
-
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
stmt->setUInt32(1, guid);
-
CharacterDatabase.Execute(stmt);
-
return false;
}
@@ -16737,7 +16818,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
// load achievements before anything else to prevent multiple gains for the same achievement/criteria on every loading (as loading does call UpdateAchievementCriteria)
- m_achievementMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS));
+ m_achievementMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS));
uint32 money = fields[8].GetUInt32();
if (money > MAX_MONEY_AMOUNT)
@@ -16778,7 +16859,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
setFactionForRace(getRace());
// load home bind and check in same time class/race pair, it used later for restore broken positions
- if (!_LoadHomeBind(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADHOMEBIND)))
+ if (!_LoadHomeBind(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_HOME_BIND)))
return false;
InitPrimaryProfessions(); // to max set before any spell loaded
@@ -16802,9 +16883,9 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
#define RelocateToHomebind(){ mapId = m_homebindMapId; instanceId = 0; Relocate(m_homebindX, m_homebindY, m_homebindZ); }
- _LoadGroup(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADGROUP));
+ _LoadGroup(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GROUP));
- _LoadArenaTeamInfo(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADARENAINFO));
+ _LoadArenaTeamInfo(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ARENA_INFO));
SetArenaPoints(fields[39].GetUInt32());
@@ -16831,9 +16912,9 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[44].GetUInt16());
SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[45].GetUInt16());
- _LoadBoundInstances(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES));
- _LoadInstanceTimeRestrictions(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES));
- _LoadBGData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBGDATA));
+ _LoadBoundInstances(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BOUND_INSTANCES));
+ _LoadInstanceTimeRestrictions(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES));
+ _LoadBGData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BG_DATA));
GetSession()->SetPlayer(this);
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
@@ -16875,7 +16956,9 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
const WorldLocation& _loc = GetBattlegroundEntryPoint();
mapId = _loc.GetMapId(); instanceId = 0;
- if (mapId == MAPID_INVALID) // Battleground Entry Point not found (???)
+ // Db field type is type int16, so it can never be MAPID_INVALID
+ //if (mapId == MAPID_INVALID) -- code kept for reference
+ if (int16(mapId) == int16(-1)) // Battleground Entry Point not found (???)
{
sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", guid);
RelocateToHomebind();
@@ -17140,7 +17223,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
}
// load skills after InitStatsForLevel because it triggering aura apply also
- _LoadSkills(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADSKILLS));
+ _LoadSkills(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SKILLS));
UpdateSkillsForLevel(); //update skills after load, to make sure they are correctly update at player load
// apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods()
@@ -17158,42 +17241,43 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
sLog->outError(LOG_FILTER_PLAYER, "Player %s(GUID: %u) has SpecCount = %u and ActiveSpec = %u.", GetName().c_str(), GetGUIDLow(), m_specsCount, m_activeSpec);
}
- _LoadTalents(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADTALENTS));
- _LoadSpells(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADSPELLS));
+ _LoadTalents(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_TALENTS));
+ _LoadSpells(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SPELLS));
- _LoadGlyphs(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADGLYPHS));
- _LoadAuras(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADAURAS), time_diff);
+ _LoadGlyphs(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GLYPHS));
+ _LoadAuras(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_AURAS), time_diff);
_LoadGlyphAuras();
// add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura)
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
m_deathState = DEAD;
// after spell load, learn rewarded spell if need also
- _LoadQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS));
- _LoadQuestStatusRewarded(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUSREW));
- _LoadDailyQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS));
- _LoadWeeklyQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADWEEKLYQUESTSTATUS));
- _LoadSeasonalQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADSEASONALQUESTSTATUS));
- _LoadRandomBGStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADRANDOMBG));
+ _LoadQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS));
+ _LoadQuestStatusRewarded(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW));
+ _LoadDailyQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS));
+ _LoadWeeklyQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS));
+ _LoadSeasonalQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS));
+ _LoadMonthlyQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS));
+ _LoadRandomBGStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG));
// after spell and quest load
InitTalentForLevel();
learnDefaultSpells();
// must be before inventory (some items required reputation check)
- m_reputationMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADREPUTATION));
+ m_reputationMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_REPUTATION));
- _LoadInventory(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADINVENTORY), time_diff);
+ _LoadInventory(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_INVENTORY), time_diff);
// update items with duration and realtime
UpdateItemDuration(time_diff, true);
- _LoadActions(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACTIONS));
+ _LoadActions(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ACTIONS));
// unread mails and next delivery time, actual mails not loaded
- _LoadMailInit(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADMAILCOUNT), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADMAILDATE));
+ _LoadMailInit(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_DATE));
- m_social = sSocialMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADSOCIALLIST), GetGUIDLow());
+ m_social = sSocialMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST), GetGUIDLow());
// check PLAYER_CHOSEN_TITLE compatibility with PLAYER__FIELD_KNOWN_TITLES
// note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded
@@ -17206,7 +17290,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// has to be called after last Relocate() in Player::LoadFromDB
SetFallInformation(0, GetPositionZ());
- _LoadSpellCooldowns(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS));
+ _LoadSpellCooldowns(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS));
// Spell code allow apply any auras to dead character in load time in aura/spell/item loading
// Do now before stats re-calculation cleanup for ghost state unexpected auras
@@ -17287,11 +17371,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
if (m_grantableLevels > 0)
SetByteValue(PLAYER_FIELD_BYTES, 1, 0x01);
- _LoadDeclinedNames(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES));
+ _LoadDeclinedNames(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES));
m_achievementMgr->CheckAllAchievementCriteria();
- _LoadEquipmentSets(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS));
+ _LoadEquipmentSets(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS));
return true;
}
@@ -17662,7 +17746,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
}
else
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_REFUNDS);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_REFUNDS);
stmt->setUInt32(0, item->GetGUIDLow());
stmt->setUInt32(1, GetGUIDLow());
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
@@ -17682,7 +17766,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
}
else if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE))
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_BOP_TRADE);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_BOP_TRADE);
stmt->setUInt32(0, item->GetGUIDLow());
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
@@ -17691,8 +17775,14 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
AllowedLooterSet looters;
for (Tokenizer::const_iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr)
looters.insert(atol(*itr));
- item->SetSoulboundTradeable(looters);
- AddTradeableItem(item);
+
+ if (looters.size() > 1 && item->GetTemplate()->GetMaxStackSize() == 1 && item->IsSoulBound())
+ {
+ item->SetSoulboundTradeable(looters);
+ AddTradeableItem(item);
+ }
+ else
+ item->ClearSoulboundTradeable(this);
}
else
{
@@ -18095,6 +18185,29 @@ void Player::_LoadSeasonalQuestStatus(PreparedQueryResult result)
m_SeasonalQuestChanged = false;
}
+void Player::_LoadMonthlyQuestStatus(PreparedQueryResult result)
+{
+ m_monthlyquests.clear();
+
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 quest_id = fields[0].GetUInt32();
+ Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
+ if (!quest)
+ continue;
+
+ m_monthlyquests.insert(quest_id);
+ sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Monthly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow());
+ }
+ while (result->NextRow());
+ }
+
+ m_MonthlyQuestChanged = false;
+}
+
void Player::_LoadSpells(PreparedQueryResult result)
{
//QueryResult* result = CharacterDatabase.PQuery("SELECT spell, active, disabled FROM character_spell WHERE guid = '%u'", GetGUIDLow());
@@ -18257,11 +18370,12 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, b
if (save)
{
InstancePlayerBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
- if (bind.save)
+ if (!load)
{
- // update the save when the group kills a boss
- if (permanent != bind.perm || save != bind.save)
- if (!load)
+ if (bind.save)
+ {
+ // update the save when the group kills a boss
+ if (permanent != bind.perm || save != bind.save)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INSTANCE);
@@ -18272,9 +18386,8 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, b
CharacterDatabase.Execute(stmt);
}
- }
- else
- if (!load)
+ }
+ else
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_INSTANCE);
@@ -18284,6 +18397,7 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, b
CharacterDatabase.Execute(stmt);
}
+ }
if (bind.save != save)
{
@@ -18302,8 +18416,8 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, b
sScriptMgr->OnPlayerBindToInstance(this, save->GetDifficulty(), save->GetMapId(), permanent);
return &bind;
}
- else
- return NULL;
+
+ return NULL;
}
void Player::BindToInstance()
@@ -18835,6 +18949,7 @@ void Player::SaveToDB(bool create /*=false*/)
_SaveDailyQuestStatus(trans);
_SaveWeeklyQuestStatus(trans);
_SaveSeasonalQuestStatus(trans);
+ _SaveMonthlyQuestStatus(trans);
_SaveTalents(trans);
_SaveSpells(trans);
_SaveSpellCooldowns(trans);
@@ -18990,7 +19105,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
if (!item || item->GetState() == ITEM_NEW)
continue;
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM);
stmt->setUInt32(0, item->GetGUIDLow());
trans->Append(stmt);
@@ -19075,7 +19190,6 @@ void Player::_SaveInventory(SQLTransaction& trans)
}
}
- PreparedStatement* stmt = NULL;
switch (item->GetState())
{
case ITEM_NEW:
@@ -19112,7 +19226,7 @@ void Player::_SaveMail(SQLTransaction& trans)
Mail* m = (*itr);
if (m->state == MAIL_STATE_CHANGED)
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL);
stmt->setUInt8(0, uint8(m->HasItems() ? 1 : 0));
stmt->setUInt32(1, uint32(m->expire_time));
stmt->setUInt32(2, uint32(m->deliver_time));
@@ -19139,7 +19253,6 @@ void Player::_SaveMail(SQLTransaction& trans)
{
if (m->HasItems())
{
- PreparedStatement* stmt = NULL;
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
@@ -19337,6 +19450,28 @@ void Player::_SaveSeasonalQuestStatus(SQLTransaction& trans)
m_SeasonalQuestChanged = false;
}
+void Player::_SaveMonthlyQuestStatus(SQLTransaction& trans)
+{
+ if (!m_MonthlyQuestChanged || m_monthlyquests.empty())
+ return;
+
+ // we don't need transactions here.
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR);
+ stmt->setUInt32(0, GetGUIDLow());
+ trans->Append(stmt);
+
+ for (QuestSet::const_iterator iter = m_monthlyquests.begin(); iter != m_monthlyquests.end(); ++iter)
+ {
+ uint32 quest_id = *iter;
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_MONTHLYQUESTSTATUS);
+ stmt->setUInt32(0, GetGUIDLow());
+ stmt->setUInt32(1, quest_id);
+ trans->Append(stmt);
+ }
+
+ m_MonthlyQuestChanged = false;
+}
+
void Player::_SaveSkills(SQLTransaction& trans)
{
PreparedStatement* stmt = NULL;
@@ -20472,7 +20607,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
if (type == 10)
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_PETITION_SIGNATURES);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_PETITION_SIGNATURES);
stmt->setUInt32(0, GUID_LOPART(guid));
@@ -20480,7 +20615,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
}
else
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE);
stmt->setUInt32(0, GUID_LOPART(guid));
stmt->setUInt8(1, uint8(type));
@@ -20538,7 +20673,7 @@ void Player::LeaveAllArenaTeams(uint64 guid)
while (result->NextRow());
}
-void Player::SetRestBonus (float rest_bonus_new)
+void Player::SetRestBonus(float rest_bonus_new)
{
// Prevent resting on max level
if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
@@ -21009,7 +21144,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
if (count < 1) count = 1;
// cheating attempt
- if (slot > MAX_BAG_SIZE && slot !=NULL_SLOT)
+ if (slot > MAX_BAG_SIZE && slot != NULL_SLOT)
return false;
if (!isAlive())
@@ -22519,6 +22654,12 @@ void Player::SetSeasonalQuestStatus(uint32 quest_id)
m_SeasonalQuestChanged = true;
}
+void Player::SetMonthlyQuestStatus(uint32 quest_id)
+{
+ m_monthlyquests.insert(quest_id);
+ m_MonthlyQuestChanged = true;
+}
+
void Player::ResetDailyQuestStatus()
{
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
@@ -22551,6 +22692,16 @@ void Player::ResetSeasonalQuestStatus(uint16 event_id)
m_SeasonalQuestChanged = false;
}
+void Player::ResetMonthlyQuestStatus()
+{
+ if (m_monthlyquests.empty())
+ return;
+
+ m_monthlyquests.clear();
+ // DB data deleted in caller
+ m_MonthlyQuestChanged = false;
+}
+
Battleground* Player::GetBattleground() const
{
if (GetBattlegroundId() == 0)
@@ -23925,6 +24076,11 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item->count);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item->itemid, item->count);
+
+ // LootItem is being removed (looted) from the container, delete it from the DB.
+ if (loot->containerID > 0)
+ loot->DeleteLootItemFromContainerItemDB(item->itemid);
+
}
else
SendEquipError(msg, NULL, NULL, item->itemid);
@@ -25552,14 +25708,6 @@ bool Player::IsInWhisperWhiteList(uint64 guid)
return false;
}
-bool Player::SetHover(bool enable)
-{
- if (!Unit::SetHover(enable))
- return false;
-
- return true;
-}
-
void Player::SendMovementSetCanFly(bool apply)
{
WorldPacket data(apply ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 3e4b3e8a971..cc08e9c2e18 100755..100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -162,6 +162,16 @@ enum ActionButtonType
ACTION_BUTTON_ITEM = 0x80
};
+enum ReputationSource
+{
+ REPUTATION_SOURCE_KILL,
+ REPUTATION_SOURCE_QUEST,
+ REPUTATION_SOURCE_DAILY_QUEST,
+ REPUTATION_SOURCE_WEEKLY_QUEST,
+ REPUTATION_SOURCE_MONTHLY_QUEST,
+ REPUTATION_SOURCE_SPELL
+};
+
#define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
#define ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24)
#define MAX_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1)
@@ -763,38 +773,39 @@ enum PlayedTimeIndex
// used at player loading query list preparing, and later result selection
enum PlayerLoginQueryIndex
{
- PLAYER_LOGIN_QUERY_LOADFROM = 0,
- PLAYER_LOGIN_QUERY_LOADGROUP = 1,
- PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES = 2,
- PLAYER_LOGIN_QUERY_LOADAURAS = 3,
- PLAYER_LOGIN_QUERY_LOADSPELLS = 4,
- PLAYER_LOGIN_QUERY_LOADQUESTSTATUS = 5,
- PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS = 6,
- PLAYER_LOGIN_QUERY_LOADREPUTATION = 7,
- PLAYER_LOGIN_QUERY_LOADINVENTORY = 8,
- PLAYER_LOGIN_QUERY_LOADACTIONS = 9,
- PLAYER_LOGIN_QUERY_LOADMAILCOUNT = 10,
- PLAYER_LOGIN_QUERY_LOADMAILDATE = 11,
- PLAYER_LOGIN_QUERY_LOADSOCIALLIST = 12,
- PLAYER_LOGIN_QUERY_LOADHOMEBIND = 13,
- PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS = 14,
- PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES = 15,
- PLAYER_LOGIN_QUERY_LOADGUILD = 16,
- PLAYER_LOGIN_QUERY_LOADARENAINFO = 17,
- PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS = 18,
- PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS = 19,
- PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS = 20,
- PLAYER_LOGIN_QUERY_LOADBGDATA = 21,
- PLAYER_LOGIN_QUERY_LOADGLYPHS = 22,
- PLAYER_LOGIN_QUERY_LOADTALENTS = 23,
- PLAYER_LOGIN_QUERY_LOADACCOUNTDATA = 24,
- PLAYER_LOGIN_QUERY_LOADSKILLS = 25,
- PLAYER_LOGIN_QUERY_LOADWEEKLYQUESTSTATUS = 26,
- PLAYER_LOGIN_QUERY_LOADRANDOMBG = 27,
- PLAYER_LOGIN_QUERY_LOADBANNED = 28,
- PLAYER_LOGIN_QUERY_LOADQUESTSTATUSREW = 29,
- PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES = 30,
- PLAYER_LOGIN_QUERY_LOADSEASONALQUESTSTATUS = 31,
+ PLAYER_LOGIN_QUERY_LOAD_FROM = 0,
+ PLAYER_LOGIN_QUERY_LOAD_GROUP = 1,
+ PLAYER_LOGIN_QUERY_LOAD_BOUND_INSTANCES = 2,
+ PLAYER_LOGIN_QUERY_LOAD_AURAS = 3,
+ PLAYER_LOGIN_QUERY_LOAD_SPELLS = 4,
+ PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS = 5,
+ PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS = 6,
+ PLAYER_LOGIN_QUERY_LOAD_REPUTATION = 7,
+ PLAYER_LOGIN_QUERY_LOAD_INVENTORY = 8,
+ PLAYER_LOGIN_QUERY_LOAD_ACTIONS = 9,
+ PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT = 10,
+ PLAYER_LOGIN_QUERY_LOAD_MAIL_DATE = 11,
+ PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST = 12,
+ PLAYER_LOGIN_QUERY_LOAD_HOME_BIND = 13,
+ PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS = 14,
+ PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES = 15,
+ PLAYER_LOGIN_QUERY_LOAD_GUILD = 16,
+ PLAYER_LOGIN_QUERY_LOAD_ARENA_INFO = 17,
+ PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS = 18,
+ PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS = 19,
+ PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS = 20,
+ PLAYER_LOGIN_QUERY_LOAD_BG_DATA = 21,
+ PLAYER_LOGIN_QUERY_LOAD_GLYPHS = 22,
+ PLAYER_LOGIN_QUERY_LOAD_TALENTS = 23,
+ PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA = 24,
+ PLAYER_LOGIN_QUERY_LOAD_SKILLS = 25,
+ PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS = 26,
+ PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG = 27,
+ PLAYER_LOGIN_QUERY_LOAD_BANNED = 28,
+ PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW = 29,
+ PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES = 30,
+ PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS = 31,
+ PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS = 32,
MAX_PLAYER_LOGIN_QUERY
};
@@ -1397,6 +1408,7 @@ class Player : public Unit, public GridObject<Player>
bool SatisfyQuestPrevChain(Quest const* qInfo, bool msg);
bool SatisfyQuestDay(Quest const* qInfo, bool msg);
bool SatisfyQuestWeek(Quest const* qInfo, bool msg);
+ bool SatisfyQuestMonth(Quest const* qInfo, bool msg);
bool SatisfyQuestSeasonal(Quest const* qInfo, bool msg);
bool GiveQuestSourceItem(Quest const* quest);
bool TakeQuestSourceItem(uint32 questId, bool msg);
@@ -1408,9 +1420,11 @@ class Player : public Unit, public GridObject<Player>
void SetDailyQuestStatus(uint32 quest_id);
void SetWeeklyQuestStatus(uint32 quest_id);
+ void SetMonthlyQuestStatus(uint32 quest_id);
void SetSeasonalQuestStatus(uint32 quest_id);
void ResetDailyQuestStatus();
void ResetWeeklyQuestStatus();
+ void ResetMonthlyQuestStatus();
void ResetSeasonalQuestStatus(uint16 event_id);
uint16 FindQuestSlot(uint32 quest_id) const;
@@ -2021,6 +2035,8 @@ class Player : public Unit, public GridObject<Player>
void RewardReputation(Unit* victim, float rate);
void RewardReputation(Quest const* quest);
+ int32 CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus = false);
+
void UpdateSkillsForLevel();
void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
void ModifySkillBonus(uint32 skillid, int32 val, bool talent);
@@ -2279,8 +2295,6 @@ class Player : public Unit, public GridObject<Player>
m_mover->m_movedPlayer = this;
}
- bool SetHover(bool enable);
-
void SetSeer(WorldObject* target) { m_seer = target; }
void SetViewpoint(WorldObject* target, bool apply);
WorldObject* GetViewpoint() const;
@@ -2298,7 +2312,7 @@ class Player : public Unit, public GridObject<Player>
float m_recallO;
void SaveRecallPosition();
- void SetHomebind(WorldLocation const& loc, uint32 area_id);
+ void SetHomebind(WorldLocation const& loc, uint32 areaId);
// Homebind coordinates
uint32 m_homebindMapId;
@@ -2554,6 +2568,7 @@ class Player : public Unit, public GridObject<Player>
typedef UNORDERED_MAP<uint32,SeasonalQuestSet> SeasonalEventQuestMap;
QuestSet m_timedquests;
QuestSet m_weeklyquests;
+ QuestSet m_monthlyquests;
SeasonalEventQuestMap m_seasonalquests;
uint64 m_divider;
@@ -2575,6 +2590,7 @@ class Player : public Unit, public GridObject<Player>
void _LoadQuestStatusRewarded(PreparedQueryResult result);
void _LoadDailyQuestStatus(PreparedQueryResult result);
void _LoadWeeklyQuestStatus(PreparedQueryResult result);
+ void _LoadMonthlyQuestStatus(PreparedQueryResult result);
void _LoadSeasonalQuestStatus(PreparedQueryResult result);
void _LoadRandomBGStatus(PreparedQueryResult result);
void _LoadGroup(PreparedQueryResult result);
@@ -2601,6 +2617,7 @@ class Player : public Unit, public GridObject<Player>
void _SaveQuestStatus(SQLTransaction& trans);
void _SaveDailyQuestStatus(SQLTransaction& trans);
void _SaveWeeklyQuestStatus(SQLTransaction& trans);
+ void _SaveMonthlyQuestStatus(SQLTransaction& trans);
void _SaveSeasonalQuestStatus(SQLTransaction& trans);
void _SaveSkills(SQLTransaction& trans);
void _SaveSpells(SQLTransaction& trans);
@@ -2710,6 +2727,7 @@ class Player : public Unit, public GridObject<Player>
bool m_DailyQuestChanged;
bool m_WeeklyQuestChanged;
+ bool m_MonthlyQuestChanged;
bool m_SeasonalQuestChanged;
time_t m_lastDailyQuestTime;
@@ -2793,7 +2811,6 @@ class Player : public Unit, public GridObject<Player>
// know currencies are not removed at any point (0 displayed)
void AddKnownCurrency(uint32 itemId);
- int32 CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool for_quest, bool noQuestBonus = false);
void AdjustQuestReqItemCount(Quest const* quest, QuestStatusData& questStatusData);
bool IsCanDelayTeleport() const { return m_bCanDelayTeleport; }
diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp
index bc16a7f42a2..bc16a7f42a2 100755..100644
--- a/src/server/game/Entities/Player/SocialMgr.cpp
+++ b/src/server/game/Entities/Player/SocialMgr.cpp
diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h
index 85daf369f69..85daf369f69 100755..100644
--- a/src/server/game/Entities/Player/SocialMgr.h
+++ b/src/server/game/Entities/Player/SocialMgr.h
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index 4d726181c4f..4d726181c4f 100755..100644
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
diff --git a/src/server/game/Entities/Totem/Totem.h b/src/server/game/Entities/Totem/Totem.h
index 6271253498d..6271253498d 100755..100644
--- a/src/server/game/Entities/Totem/Totem.h
+++ b/src/server/game/Entities/Totem/Totem.h
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 6de359c67dd..6de359c67dd 100755..100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h
index 8fd12b50695..8fd12b50695 100755..100644
--- a/src/server/game/Entities/Transport/Transport.h
+++ b/src/server/game/Entities/Transport/Transport.h
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 8c0bfb8af23..2a17367e7a8 100755..100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -78,16 +78,16 @@ bool Player::UpdateStats(Stats stat)
UpdateAllCritPercentages();
UpdateDodgePercentage();
break;
- case STAT_STAMINA: UpdateMaxHealth(); break;
+ case STAT_STAMINA:
+ UpdateMaxHealth();
+ break;
case STAT_INTELLECT:
UpdateMaxPower(POWER_MANA);
UpdateAllSpellCritChances();
UpdateArmor(); //SPELL_AURA_MOD_RESISTANCE_OF_INTELLECT_PERCENT, only armor currently
break;
-
case STAT_SPIRIT:
break;
-
default:
break;
}
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 0b168a1615b..02a0ec7d5b9 100755..100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -551,18 +551,22 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
if (IsAIEnabled)
GetAI()->DamageDealt(victim, damage, damagetype);
- if (victim->GetTypeId() == TYPEID_PLAYER)
+ if (victim->GetTypeId() == TYPEID_PLAYER && this != victim)
{
- if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
- return 0;
-
// Signal to pets that their owner was attacked
Pet* pet = victim->ToPlayer()->GetPet();
if (pet && pet->isAlive())
- pet->AI()->OwnerDamagedBy(this);
+ pet->AI()->OwnerAttackedBy(this);
+
+ if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
+ return 0;
}
+ // Signal the pet it was attacked so the AI can respond if needed
+ if (victim->GetTypeId() == TYPEID_UNIT && this != victim && victim->isPet() && victim->isAlive())
+ victim->ToPet()->AI()->AttackedBy(this);
+
if (damagetype != NODAMAGE)
{
// interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
@@ -1034,6 +1038,9 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
break;
}
+ // Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations
+ sScriptMgr->ModifySpellDamageTaken(damageInfo->target, damageInfo->attacker, damage);
+
// Calculate absorb resist
if (damage > 0)
{
@@ -1130,6 +1137,9 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType);
damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType);
+ // Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
+ sScriptMgr->ModifyMeleeDamage(damageInfo->target, damageInfo->attacker, damage);
+
// Calculate armor reduction
if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask)))
{
@@ -5562,37 +5572,28 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Shadow's Fate (Shadowmourne questline)
case 71169:
{
- target = triggeredByAura->GetCaster();
- if (!target)
- return false;
- Player* player = target->ToPlayer();
- if (!player)
- return false;
- // not checking Infusion auras because its in targetAuraSpell of credit spell
- if (player->GetQuestStatus(24749) == QUEST_STATUS_INCOMPLETE) // Unholy Infusion
- {
- if (GetEntry() != 36678) // Professor Putricide
- return false;
- CastSpell(target, 71518, true); // Quest Credit
- return true;
- }
- else if (player->GetQuestStatus(24756) == QUEST_STATUS_INCOMPLETE) // Blood Infusion
- {
- if (GetEntry() != 37955) // Blood-Queen Lana'thel
- return false;
- CastSpell(target, 72934, true); // Quest Credit
- return true;
- }
- else if (player->GetQuestStatus(24757) == QUEST_STATUS_INCOMPLETE) // Frost Infusion
+ uint32 spellId = 0;
+
+ switch (GetEntry())
{
- if (GetEntry() != 36853) // Sindragosa
- return false;
- CastSpell(target, 72289, true); // Quest Credit
- return true;
+ case 36678: // NPC: Professor Putricide
+ spellId = 71518; // Spell: Unholy Infusion Credit
+ break;
+ case 37955: // NPC: Blood-Queen Lana'thel
+ spellId = 72934; // Spell: Quest Credit
+ break;
+ case 36853: // NPC: Sindragosa <Queen of the Frostbrood>
+ spellId = 72289; // Spell: Frost Infusion Quest Credit
+ break;
+ default:
+ break;
}
- else if (player->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE) // A Feast of Souls
- triggered_spell_id = 71203;
- break;
+ if (spellId)
+ CastSpell((Unit*)NULL, spellId, true);
+
+ CastSpell((Unit*)NULL, 71203, true);
+
+ return true;
}
// Essence of the Blood Queen
case 70871:
@@ -6022,9 +6023,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
// Replenishment - roll chance
if (roll_chance_i(aurEff->GetAmount()))
- {
CastSpell(this, 57669, true, castItem, triggeredByAura);
- }
}
break;
}
@@ -7545,12 +7544,18 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Unholy Blight
if (dummySpell->Id == 49194)
{
+ triggered_spell_id = 50536;
+ SpellInfo const* unholyBlight = sSpellMgr->GetSpellInfo(triggered_spell_id);
+ if (!unholyBlight)
+ return false;
+
basepoints0 = CalculatePct(int32(damage), triggerAmount);
- // Glyph of Unholy Blight
+
+ //Glyph of Unholy Blight
if (AuraEffect* glyph=GetAuraEffect(63332, 0))
AddPct(basepoints0, glyph->GetAmount());
- triggered_spell_id = 50536;
+ basepoints0 = basepoints0 / (unholyBlight->GetMaxDuration() / unholyBlight->Effects[0].Amplitude);
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
break;
}
@@ -8224,7 +8229,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
case 40336:
{
// On successful melee or ranged attack gain $29471s1 mana and if possible drain $27526s1 mana from the target.
- if (this && isAlive())
+ if (isAlive())
CastSpell(this, 29471, true, castItem, triggeredByAura);
if (victim && victim->isAlive())
CastSpell(victim, 27526, true, castItem, triggeredByAura);
@@ -8235,7 +8240,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
{
// Remove a Evasive Charge
Aura* charge = GetAura(50241);
- if (charge->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL))
+ if (charge && charge->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL))
RemoveAurasDueToSpell(50240);
}
}
@@ -9033,33 +9038,36 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Shadow's Fate (Shadowmourne questline)
case 71169:
{
- if (GetTypeId() != TYPEID_PLAYER)
+ // Victim needs more checks so bugs, rats or summons can not be affected by the proc.
+ if (GetTypeId() != TYPEID_PLAYER || victim->GetTypeId() != TYPEID_UNIT || victim->GetCreatureType() == CREATURE_TYPE_CRITTER)
return false;
Player* player = ToPlayer();
- if (player->GetQuestStatus(24749) == QUEST_STATUS_INCOMPLETE) // Unholy Infusion
+ if (player->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE)
{
- if (!player->HasAura(71516) || victim->GetEntry() != 36678) // Shadow Infusion && Professor Putricide
- return false;
- }
- else if (player->GetQuestStatus(24756) == QUEST_STATUS_INCOMPLETE) // Blood Infusion
- {
- if (!player->HasAura(72154) || victim->GetEntry() != 37955) // Thirst Quenched && Blood-Queen Lana'thel
- return false;
- }
- else if (player->GetQuestStatus(24757) == QUEST_STATUS_INCOMPLETE) // Frost Infusion
- {
- if (!player->HasAura(72290) || victim->GetEntry() != 36853) // Frost-Imbued Blade && Sindragosa
+ uint32 spellId = 0;
+ uint32 questId = 0;
+ switch (victim->GetEntry())
+ {
+ case 36678: // NPC: Professor Putricide
+ questId = 24749; // Quest: Unholy Infusion
+ spellId = 71516; // Spell: Shadow Infusion
+ break;
+ case 37955: // NPC: Blood-Queen Lana'thel
+ questId = 24756; // Quest: Blood Infusion
+ spellId = 72154; // Spell: Thirst Quenched
+ break;
+ case 36853: // NPC: Sindragosa
+ questId = 24757; // Quest: Frost Infusion
+ spellId = 72290; // Spell: Frost-Imbued Blade
+ break;
+ default:
+ return false;
+ }
+
+ if (player->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE || !player->HasAura(spellId))
return false;
}
- else if (player->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE) // A Feast of Souls
- return false;
-
- if (victim->GetTypeId() != TYPEID_UNIT)
- return false;
- // critters are not allowed
- if (victim->GetCreatureType() == CREATURE_TYPE_CRITTER)
- return false;
break;
}
}
@@ -13944,17 +13952,17 @@ void Unit::DeleteCharmInfo()
}
CharmInfo::CharmInfo(Unit* unit)
-: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_petnumber(0), m_barInit(false),
- m_isCommandAttack(false), m_isAtStay(false), m_isFollowing(false), m_isReturning(false),
- m_stayX(0.0f), m_stayY(0.0f), m_stayZ(0.0f)
+: _unit(unit), _CommandState(COMMAND_FOLLOW), _petnumber(0), _barInit(false),
+ _isCommandAttack(false), _isAtStay(false), _isFollowing(false), _isReturning(false),
+ _stayX(0.0f), _stayY(0.0f), _stayZ(0.0f)
{
for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
- m_charmspells[i].SetActionAndType(0, ACT_DISABLED);
+ _charmspells[i].SetActionAndType(0, ACT_DISABLED);
- if (m_unit->GetTypeId() == TYPEID_UNIT)
+ if (_unit->GetTypeId() == TYPEID_UNIT)
{
- m_oldReactState = m_unit->ToCreature()->GetReactState();
- m_unit->ToCreature()->SetReactState(REACT_PASSIVE);
+ _oldReactState = _unit->ToCreature()->GetReactState();
+ _unit->ToCreature()->SetReactState(REACT_PASSIVE);
}
}
@@ -13964,9 +13972,9 @@ CharmInfo::~CharmInfo()
void CharmInfo::RestoreState()
{
- if (m_unit->GetTypeId() == TYPEID_UNIT)
- if (Creature* creature = m_unit->ToCreature())
- creature->SetReactState(m_oldReactState);
+ if (_unit->GetTypeId() == TYPEID_UNIT)
+ if (Creature* creature = _unit->ToCreature())
+ creature->SetReactState(_oldReactState);
}
void CharmInfo::InitPetActionBar()
@@ -13997,16 +14005,16 @@ void CharmInfo::InitEmptyActionBar(bool withAttack)
void CharmInfo::InitPossessCreateSpells()
{
InitEmptyActionBar();
- if (m_unit->GetTypeId() == TYPEID_UNIT)
+ if (_unit->GetTypeId() == TYPEID_UNIT)
{
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
- uint32 spellId = m_unit->ToCreature()->m_spells[i];
+ uint32 spellId = _unit->ToCreature()->m_spells[i];
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo && !(spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD))
{
if (spellInfo->IsPassive())
- m_unit->CastSpell(m_unit, spellInfo, true);
+ _unit->CastSpell(_unit, spellInfo, true);
else
AddSpellToActionBar(spellInfo, ACT_PASSIVE);
}
@@ -14016,7 +14024,7 @@ void CharmInfo::InitPossessCreateSpells()
void CharmInfo::InitCharmCreateSpells()
{
- if (m_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells
+ if (_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells
{
InitEmptyActionBar();
return;
@@ -14026,23 +14034,23 @@ void CharmInfo::InitCharmCreateSpells()
for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
{
- uint32 spellId = m_unit->ToCreature()->m_spells[x];
+ uint32 spellId = _unit->ToCreature()->m_spells[x];
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo || spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD)
{
- m_charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
+ _charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
continue;
}
if (spellInfo->IsPassive())
{
- m_unit->CastSpell(m_unit, spellInfo, true);
- m_charmspells[x].SetActionAndType(spellId, ACT_PASSIVE);
+ _unit->CastSpell(_unit, spellInfo, true);
+ _charmspells[x].SetActionAndType(spellId, ACT_PASSIVE);
}
else
{
- m_charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
+ _charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
ActiveStates newstate = ACT_PASSIVE;
@@ -14119,17 +14127,17 @@ void CharmInfo::ToggleCreatureAutocast(SpellInfo const* spellInfo, bool apply)
return;
for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
- if (spellInfo->Id == m_charmspells[x].GetAction())
- m_charmspells[x].SetType(apply ? ACT_ENABLED : ACT_DISABLED);
+ if (spellInfo->Id == _charmspells[x].GetAction())
+ _charmspells[x].SetType(apply ? ACT_ENABLED : ACT_DISABLED);
}
void CharmInfo::SetPetNumber(uint32 petnumber, bool statwindow)
{
- m_petnumber = petnumber;
+ _petnumber = petnumber;
if (statwindow)
- m_unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, m_petnumber);
+ _unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, _petnumber);
else
- m_unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, 0);
+ _unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, 0);
}
void CharmInfo::LoadPetActionBar(const std::string& data)
@@ -16702,178 +16710,181 @@ uint32 Unit::GetCombatRatingDamageReduction(CombatRating cr, float rate, float c
return CalculatePct(damage, percent);
}
-uint32 Unit::GetModelForForm(ShapeshiftForm form)
+uint32 Unit::GetModelForForm(ShapeshiftForm form) const
{
- switch (form)
+ if (GetTypeId() == TYPEID_PLAYER)
{
- case FORM_CAT:
- // Based on Hair color
- if (getRace() == RACE_NIGHTELF)
- {
- uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
- switch (hairColor)
+ switch (form)
+ {
+ case FORM_CAT:
+ // Based on Hair color
+ if (getRace() == RACE_NIGHTELF)
{
- case 7: // Violet
- case 8:
- return 29405;
- case 3: // Light Blue
- return 29406;
- case 0: // Green
- case 1: // Light Green
- case 2: // Dark Green
- return 29407;
- case 4: // White
- return 29408;
- default: // original - Dark Blue
- return 892;
+ uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
+ switch (hairColor)
+ {
+ case 7: // Violet
+ case 8:
+ return 29405;
+ case 3: // Light Blue
+ return 29406;
+ case 0: // Green
+ case 1: // Light Green
+ case 2: // Dark Green
+ return 29407;
+ case 4: // White
+ return 29408;
+ default: // original - Dark Blue
+ return 892;
+ }
}
- }
- // Based on Skin color
- else if (getRace() == RACE_TAUREN)
- {
- uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
- // Male
- if (getGender() == GENDER_MALE)
+ // Based on Skin color
+ else if (getRace() == RACE_TAUREN)
{
- switch (skinColor)
+ uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
+ // Male
+ if (getGender() == GENDER_MALE)
{
- case 12: // White
- case 13:
- case 14:
- case 18: // Completly White
+ switch (skinColor)
+ {
+ case 12: // White
+ case 13:
+ case 14:
+ case 18: // Completly White
+ return 29409;
+ case 9: // Light Brown
+ case 10:
+ case 11:
+ return 29410;
+ case 6: // Brown
+ case 7:
+ case 8:
+ return 29411;
+ case 0: // Dark
+ case 1:
+ case 2:
+ case 3: // Dark Grey
+ case 4:
+ case 5:
+ return 29412;
+ default: // original - Grey
+ return 8571;
+ }
+ }
+ // Female
+ else switch (skinColor)
+ {
+ case 10: // White
return 29409;
- case 9: // Light Brown
- case 10:
- case 11:
- return 29410;
- case 6: // Brown
+ case 6: // Light Brown
case 7:
- case 8:
+ return 29410;
+ case 4: // Brown
+ case 5:
return 29411;
case 0: // Dark
case 1:
case 2:
- case 3: // Dark Grey
- case 4:
- case 5:
+ case 3:
return 29412;
default: // original - Grey
return 8571;
}
}
- // Female
- else switch (skinColor)
+ else if (Player::TeamForRace(getRace()) == ALLIANCE)
+ return 892;
+ else
+ return 8571;
+ case FORM_DIREBEAR:
+ case FORM_BEAR:
+ // Based on Hair color
+ if (getRace() == RACE_NIGHTELF)
{
- case 10: // White
- return 29409;
- case 6: // Light Brown
- case 7:
- return 29410;
- case 4: // Brown
- case 5:
- return 29411;
- case 0: // Dark
- case 1:
- case 2:
- case 3:
- return 29412;
- default: // original - Grey
- return 8571;
+ uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
+ switch (hairColor)
+ {
+ case 0: // Green
+ case 1: // Light Green
+ case 2: // Dark Green
+ return 29413; // 29415?
+ case 6: // Dark Blue
+ return 29414;
+ case 4: // White
+ return 29416;
+ case 3: // Light Blue
+ return 29417;
+ default: // original - Violet
+ return 2281;
+ }
}
- }
- else if (Player::TeamForRace(getRace()) == ALLIANCE)
- return 892;
- else
- return 8571;
- case FORM_DIREBEAR:
- case FORM_BEAR:
- // Based on Hair color
- if (getRace() == RACE_NIGHTELF)
- {
- uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
- switch (hairColor)
+ // Based on Skin color
+ else if (getRace() == RACE_TAUREN)
{
- case 0: // Green
- case 1: // Light Green
- case 2: // Dark Green
- return 29413; // 29415?
- case 6: // Dark Blue
- return 29414;
- case 4: // White
- return 29416;
- case 3: // Light Blue
- return 29417;
- default: // original - Violet
- return 2281;
- }
- }
- // Based on Skin color
- else if (getRace() == RACE_TAUREN)
- {
- uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
- // Male
- if (getGender() == GENDER_MALE)
- {
- switch (skinColor)
+ uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
+ // Male
+ if (getGender() == GENDER_MALE)
+ {
+ switch (skinColor)
+ {
+ case 0: // Dark (Black)
+ case 1:
+ case 2:
+ return 29418;
+ case 3: // White
+ case 4:
+ case 5:
+ case 12:
+ case 13:
+ case 14:
+ return 29419;
+ case 9: // Light Brown/Grey
+ case 10:
+ case 11:
+ case 15:
+ case 16:
+ case 17:
+ return 29420;
+ case 18: // Completly White
+ return 29421;
+ default: // original - Brown
+ return 2289;
+ }
+ }
+ // Female
+ else switch (skinColor)
{
case 0: // Dark (Black)
case 1:
- case 2:
return 29418;
- case 3: // White
- case 4:
- case 5:
- case 12:
- case 13:
- case 14:
+ case 2: // White
+ case 3:
return 29419;
- case 9: // Light Brown/Grey
- case 10:
- case 11:
- case 15:
- case 16:
- case 17:
+ case 6: // Light Brown/Grey
+ case 7:
+ case 8:
+ case 9:
return 29420;
- case 18: // Completly White
+ case 10: // Completly White
return 29421;
default: // original - Brown
return 2289;
}
}
- // Female
- else switch (skinColor)
- {
- case 0: // Dark (Black)
- case 1:
- return 29418;
- case 2: // White
- case 3:
- return 29419;
- case 6: // Light Brown/Grey
- case 7:
- case 8:
- case 9:
- return 29420;
- case 10: // Completly White
- return 29421;
- default: // original - Brown
- return 2289;
- }
- }
- else if (Player::TeamForRace(getRace()) == ALLIANCE)
- return 2281;
- else
- return 2289;
- case FORM_FLIGHT:
- if (Player::TeamForRace(getRace()) == ALLIANCE)
- return 20857;
- return 20872;
- case FORM_FLIGHT_EPIC:
- if (Player::TeamForRace(getRace()) == ALLIANCE)
- return 21243;
- return 21244;
- default:
- break;
+ else if (Player::TeamForRace(getRace()) == ALLIANCE)
+ return 2281;
+ else
+ return 2289;
+ case FORM_FLIGHT:
+ if (Player::TeamForRace(getRace()) == ALLIANCE)
+ return 20857;
+ return 20872;
+ case FORM_FLIGHT_EPIC:
+ if (Player::TeamForRace(getRace()) == ALLIANCE)
+ return 21243;
+ return 21244;
+ default:
+ break;
+ }
}
uint32 modelid = 0;
@@ -17572,58 +17583,68 @@ uint32 Unit::GetResistance(SpellSchoolMask mask) const
void CharmInfo::SetIsCommandAttack(bool val)
{
- m_isCommandAttack = val;
+ _isCommandAttack = val;
}
bool CharmInfo::IsCommandAttack()
{
- return m_isCommandAttack;
+ return _isCommandAttack;
+}
+
+void CharmInfo::SetIsCommandFollow(bool val)
+{
+ _isCommandFollow = val;
+}
+
+bool CharmInfo::IsCommandFollow()
+{
+ return _isCommandFollow;
}
void CharmInfo::SaveStayPosition()
{
//! At this point a new spline destination is enabled because of Unit::StopMoving()
- G3D::Vector3 const stayPos = m_unit->movespline->FinalDestination();
- m_stayX = stayPos.x;
- m_stayY = stayPos.y;
- m_stayZ = stayPos.z;
+ G3D::Vector3 const stayPos = _unit->movespline->FinalDestination();
+ _stayX = stayPos.x;
+ _stayY = stayPos.y;
+ _stayZ = stayPos.z;
}
void CharmInfo::GetStayPosition(float &x, float &y, float &z)
{
- x = m_stayX;
- y = m_stayY;
- z = m_stayZ;
+ x = _stayX;
+ y = _stayY;
+ z = _stayZ;
}
void CharmInfo::SetIsAtStay(bool val)
{
- m_isAtStay = val;
+ _isAtStay = val;
}
bool CharmInfo::IsAtStay()
{
- return m_isAtStay;
+ return _isAtStay;
}
void CharmInfo::SetIsFollowing(bool val)
{
- m_isFollowing = val;
+ _isFollowing = val;
}
bool CharmInfo::IsFollowing()
{
- return m_isFollowing;
+ return _isFollowing;
}
void CharmInfo::SetIsReturning(bool val)
{
- m_isReturning = val;
+ _isReturning = val;
}
bool CharmInfo::IsReturning()
{
- return m_isReturning;
+ return _isReturning;
}
void Unit::SetInFront(Unit const* target)
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 08fefe4c420..bba58a2f5e9 100755..100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -253,6 +253,7 @@ enum UnitRename
#define MAX_SPELL_CONTROL_BAR 10
#define MAX_AGGRO_RESET_TIME 10 // in seconds
+#define MAX_AGGRO_RADIUS 45.0f // yards
enum Swing
{
@@ -1095,12 +1096,12 @@ struct CharmInfo
explicit CharmInfo(Unit* unit);
~CharmInfo();
void RestoreState();
- uint32 GetPetNumber() const { return m_petnumber; }
+ uint32 GetPetNumber() const { return _petnumber; }
void SetPetNumber(uint32 petnumber, bool statwindow);
- void SetCommandState(CommandStates st) { m_CommandState = st; }
- CommandStates GetCommandState() const { return m_CommandState; }
- bool HasCommandState(CommandStates state) const { return (m_CommandState == state); }
+ void SetCommandState(CommandStates st) { _CommandState = st; }
+ CommandStates GetCommandState() const { return _CommandState; }
+ bool HasCommandState(CommandStates state) const { return (_CommandState == state); }
void InitPossessCreateSpells();
void InitCharmCreateSpells();
@@ -1121,12 +1122,14 @@ struct CharmInfo
void ToggleCreatureAutocast(SpellInfo const* spellInfo, bool apply);
- CharmSpellInfo* GetCharmSpell(uint8 index) { return &(m_charmspells[index]); }
+ CharmSpellInfo* GetCharmSpell(uint8 index) { return &(_charmspells[index]); }
GlobalCooldownMgr& GetGlobalCooldownMgr() { return m_GlobalCooldownMgr; }
void SetIsCommandAttack(bool val);
bool IsCommandAttack();
+ void SetIsCommandFollow(bool val);
+ bool IsCommandFollow();
void SetIsAtStay(bool val);
bool IsAtStay();
void SetIsFollowing(bool val);
@@ -1138,23 +1141,24 @@ struct CharmInfo
private:
- Unit* m_unit;
+ Unit* _unit;
UnitActionBarEntry PetActionBar[MAX_UNIT_ACTION_BAR_INDEX];
- CharmSpellInfo m_charmspells[4];
- CommandStates m_CommandState;
- uint32 m_petnumber;
- bool m_barInit;
+ CharmSpellInfo _charmspells[4];
+ CommandStates _CommandState;
+ uint32 _petnumber;
+ bool _barInit;
//for restoration after charmed
- ReactStates m_oldReactState;
+ ReactStates _oldReactState;
- bool m_isCommandAttack;
- bool m_isAtStay;
- bool m_isFollowing;
- bool m_isReturning;
- float m_stayX;
- float m_stayY;
- float m_stayZ;
+ bool _isCommandAttack;
+ bool _isCommandFollow;
+ bool _isAtStay;
+ bool _isFollowing;
+ bool _isReturning;
+ float _stayX;
+ float _stayY;
+ float _stayZ;
GlobalCooldownMgr m_GlobalCooldownMgr;
};
@@ -1619,7 +1623,7 @@ class Unit : public WorldObject
bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);}
virtual bool SetWalk(bool enable);
virtual bool SetDisableGravity(bool disable, bool packetOnly = false);
- bool SetHover(bool enable);
+ virtual bool SetHover(bool enable);
void SetInFront(Unit const* target);
void SetFacingTo(float ori);
@@ -2138,7 +2142,7 @@ class Unit : public WorldObject
void AddPetAura(PetAura const* petSpell);
void RemovePetAura(PetAura const* petSpell);
- uint32 GetModelForForm(ShapeshiftForm form);
+ uint32 GetModelForForm(ShapeshiftForm form) const;
uint32 GetModelForTotem(PlayerTotemType totemType);
void SetReducedThreatPercent(uint32 pct, uint64 guid)
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index f8f7a1a1b72..502ec0335e2 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -348,7 +348,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
unit->m_movementInfo.t_pos.m_positionX = veSeat->m_attachmentOffsetX;
unit->m_movementInfo.t_pos.m_positionY = veSeat->m_attachmentOffsetY;
unit->m_movementInfo.t_pos.m_positionZ = veSeat->m_attachmentOffsetZ;
- unit->m_movementInfo.t_pos.m_orientation = 0;
+ unit->m_movementInfo.t_pos.SetOrientation(0);
unit->m_movementInfo.t_time = 0; // 1 for player
unit->m_movementInfo.t_seat = seat->first;
unit->m_movementInfo.t_guid = _me->GetGUID();
@@ -363,9 +363,9 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
if (_me->IsInWorld())
{
- unit->SendClearTarget(); // SMSG_BREAK_TARGET
- unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
- // also adds MOVEMENTFLAG_ROOT
+ unit->SendClearTarget(); // SMSG_BREAK_TARGET
+ unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
+ // also adds MOVEMENTFLAG_ROOT
Movement::MoveSplineInit init(unit);
init.DisableTransportPathTransformations();
init.MoveTo(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ);
diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h
index 4ad8663a17a..3f1567c74ee 100755..100644
--- a/src/server/game/Entities/Vehicle/Vehicle.h
+++ b/src/server/game/Entities/Vehicle/Vehicle.h
@@ -20,9 +20,11 @@
#define __TRINITY_VEHICLE_H
#include "ObjectDefines.h"
+#include "Object.h"
#include "VehicleDefines.h"
struct VehicleEntry;
+
class Unit;
typedef std::set<uint64> GuidSet;
@@ -58,6 +60,9 @@ class Vehicle : public TransportBase
void TeleportVehicle(float x, float y, float z, float ang);
bool IsVehicleInUse() { return Seats.begin() != Seats.end(); }
+ void SetLastShootPos(Position const& pos) { m_lastShootPos.Relocate(pos); }
+ Position GetLastShootPos() { return m_lastShootPos; }
+
SeatMap Seats;
VehicleSeatEntry const* GetSeatForPassenger(Unit* passenger);
@@ -77,5 +82,7 @@ class Vehicle : public TransportBase
GuidSet vehiclePlayers;
uint32 _usableSeatNum; // Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags
uint32 _creatureEntry; // Can be different than me->GetBase()->GetEntry() in case of players
+
+ Position m_lastShootPos;
};
#endif
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index 2116738fac3..256864d6a77 100755..100644
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -795,9 +795,7 @@ void GameEventMgr::LoadFromDB()
QueryResult result = WorldDatabase.Query("SELECT eventEntry, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor ORDER BY guid, slot ASC");
if (!result)
- {
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
- }
else
{
uint32 count = 0;
@@ -1041,14 +1039,14 @@ uint32 GameEventMgr::Update() // return the next e
// changed, save to DB the gameevent state, will be updated in next update cycle
SaveWorldEventStateToDB(itr);
- //sLog->outDebug("GameEvent %u is active", itr->first);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "GameEvent %u is active", itr->first);
// queue for activation
if (!IsActiveEvent(itr))
activate.insert(itr);
}
else
{
- //sLog->outDebug("GameEvent %u is not active", itr->first);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "GameEvent %u is not active", itr->first);
if (IsActiveEvent(itr))
deactivate.insert(itr);
else
@@ -1206,7 +1204,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY))
{
Creature* creature = new Creature;
- //sLog->outDebug("Spawning creature %u", *itr);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "Spawning creature %u", *itr);
if (!creature->LoadCreatureFromDB(*itr, map))
delete creature;
}
@@ -1233,7 +1231,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY))
{
GameObject* pGameobject = new GameObject;
- //sLog->outDebug("Spawning gameobject %u", *itr);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "Spawning gameobject %u", *itr);
//TODO: find out when it is add to map
if (!pGameobject->LoadGameObjectFromDB(*itr, map, false))
delete pGameobject;
diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h
index dbc2c7ead10..dbc2c7ead10 100755..100644
--- a/src/server/game/Events/GameEventMgr.h
+++ b/src/server/game/Events/GameEventMgr.h
diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp
index cedb20eccf1..cedb20eccf1 100755..100644
--- a/src/server/game/Globals/ObjectAccessor.cpp
+++ b/src/server/game/Globals/ObjectAccessor.cpp
diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h
index d2b532c9f94..d2b532c9f94 100755..100644
--- a/src/server/game/Globals/ObjectAccessor.h
+++ b/src/server/game/Globals/ObjectAccessor.h
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index ff734efe385..70ac4aec4aa 100755..100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -50,7 +50,6 @@
#include "World.h"
ScriptMapMap sQuestEndScripts;
-ScriptMapMap sQuestStartScripts;
ScriptMapMap sSpellScripts;
ScriptMapMap sGameObjectScripts;
ScriptMapMap sEventScripts;
@@ -62,7 +61,6 @@ std::string GetScriptsTableNameByType(ScriptsType type)
switch (type)
{
case SCRIPTS_QUEST_END: res = "quest_end_scripts"; break;
- case SCRIPTS_QUEST_START: res = "quest_start_scripts";break;
case SCRIPTS_SPELL: res = "spell_scripts"; break;
case SCRIPTS_GAMEOBJECT: res = "gameobject_scripts"; break;
case SCRIPTS_EVENT: res = "event_scripts"; break;
@@ -78,7 +76,6 @@ ScriptMapMap* GetScriptsMapByType(ScriptsType type)
switch (type)
{
case SCRIPTS_QUEST_END: res = &sQuestEndScripts; break;
- case SCRIPTS_QUEST_START: res = &sQuestStartScripts; break;
case SCRIPTS_SPELL: res = &sSpellScripts; break;
case SCRIPTS_GAMEOBJECT: res = &sGameObjectScripts; break;
case SCRIPTS_EVENT: res = &sEventScripts; break;
@@ -1661,7 +1658,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
Creature* creature = new Creature;
if (!creature->LoadCreatureFromDB(guid, map))
{
- sLog->outError(LOG_FILTER_GENERAL, "AddCreature: cannot add creature entry %u to map", guid);
+ sLog->outError(LOG_FILTER_GENERAL, "MoveCreData: Cannot add creature guid %u to map", guid);
delete creature;
return false;
}
@@ -1713,7 +1710,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float
Creature* creature = new Creature;
if (!creature->LoadCreatureFromDB(guid, map))
{
- sLog->outError(LOG_FILTER_GENERAL, "AddCreature: cannot add creature entry %u to map", entry);
+ sLog->outError(LOG_FILTER_GENERAL, "AddCreature: Cannot add creature entry %u to map", entry);
delete creature;
return 0;
}
@@ -1739,7 +1736,6 @@ void ObjectMgr::LoadGameobjects()
if (!result)
{
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobjects. DB table `gameobject` is empty.");
-
return;
}
@@ -3662,8 +3658,8 @@ void ObjectMgr::LoadQuests()
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4, EmoteOnIncomplete, EmoteOnComplete, "
// 136 137 138 139 140 141 142 143
"OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4, "
- // 144 145 146
- "StartScript, CompleteScript, WDBVerified"
+ // 144 145
+ "CompleteScript, WDBVerified"
" FROM quest_template");
if (!result)
{
@@ -3730,6 +3726,15 @@ void ObjectMgr::LoadQuests()
}
}
+ if (qinfo->Flags & QUEST_TRINITY_FLAGS_MONTHLY)
+ {
+ if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE))
+ {
+ sLog->outError(LOG_FILTER_SQL, "Monthly quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
+ qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE;
+ }
+ }
+
if (qinfo->Flags & QUEST_FLAGS_AUTO_REWARDED)
{
// at auto-reward can be rewarded only RewardChoiceItemId[0]
@@ -4690,18 +4695,6 @@ void ObjectMgr::LoadQuestEndScripts()
}
}
-void ObjectMgr::LoadQuestStartScripts()
-{
- LoadScripts(SCRIPTS_QUEST_START);
-
- // check ids
- for (ScriptMapMap::const_iterator itr = sQuestStartScripts.begin(); itr != sQuestStartScripts.end(); ++itr)
- {
- if (!GetQuestTemplate(itr->first))
- sLog->outError(LOG_FILTER_SQL, "Table `quest_start_scripts` has not existing quest (Id: %u) as script id", itr->first);
- }
-}
-
void ObjectMgr::LoadSpellScripts()
{
LoadScripts(SCRIPTS_SPELL);
@@ -6016,7 +6009,7 @@ void ObjectMgr::LoadAccessRequirements()
if (ar->achievement)
{
- if (!sAchievementStore.LookupEntry(ar->achievement))
+ if (!sAchievementMgr->GetAchievement(ar->achievement))
{
sLog->outError(LOG_FILTER_SQL, "Required Achievement %u not exist for map %u difficulty %u, remove quest done requirement.", ar->achievement, mapid, difficulty);
ar->achievement = 0;
@@ -6650,13 +6643,11 @@ void ObjectMgr::LoadReputationRewardRate()
_repRewardRateStore.clear(); // for reload case
- uint32 count = 0; // 0 1 2 3
- QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, creature_rate, spell_rate FROM reputation_reward_rate");
-
+ uint32 count = 0; // 0 1 2 3 4 5 6
+ QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, quest_daily_rate, quest_weekly_rate, quest_monthly_rate, creature_rate, spell_rate FROM reputation_reward_rate");
if (!result)
{
sLog->outError(LOG_FILTER_SQL, ">> Loaded `reputation_reward_rate`, table is empty!");
-
return;
}
@@ -6664,13 +6655,16 @@ void ObjectMgr::LoadReputationRewardRate()
{
Field* fields = result->Fetch();
- uint32 factionId = fields[0].GetUInt32();
+ uint32 factionId = fields[0].GetUInt32();
RepRewardRate repRate;
- repRate.quest_rate = fields[1].GetFloat();
- repRate.creature_rate = fields[2].GetFloat();
- repRate.spell_rate = fields[3].GetFloat();
+ repRate.questRate = fields[1].GetFloat();
+ repRate.questDailyRate = fields[2].GetFloat();
+ repRate.questWeeklyRate = fields[3].GetFloat();
+ repRate.questMonthlyRate = fields[4].GetFloat();
+ repRate.creatureRate = fields[5].GetFloat();
+ repRate.spellRate = fields[6].GetFloat();
FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
if (!factionEntry)
@@ -6679,21 +6673,39 @@ void ObjectMgr::LoadReputationRewardRate()
continue;
}
- if (repRate.quest_rate < 0.0f)
+ if (repRate.questRate < 0.0f)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.questRate, factionId);
+ continue;
+ }
+
+ if (repRate.questDailyRate < 0.0f)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_daily_rate with invalid rate %f, skipping data for faction %u", repRate.questDailyRate, factionId);
+ continue;
+ }
+
+ if (repRate.questWeeklyRate < 0.0f)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_weekly_rate with invalid rate %f, skipping data for faction %u", repRate.questWeeklyRate, factionId);
+ continue;
+ }
+
+ if (repRate.questMonthlyRate < 0.0f)
{
- sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.quest_rate, factionId);
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_monthly_rate with invalid rate %f, skipping data for faction %u", repRate.questMonthlyRate, factionId);
continue;
}
- if (repRate.creature_rate < 0.0f)
+ if (repRate.creatureRate < 0.0f)
{
- sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creature_rate, factionId);
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creatureRate, factionId);
continue;
}
- if (repRate.spell_rate < 0.0f)
+ if (repRate.spellRate < 0.0f)
{
- sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spell_rate, factionId);
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spellRate, factionId);
continue;
}
@@ -8551,9 +8563,9 @@ void ObjectMgr::LoadFactionChangeAchievements()
uint32 alliance = fields[0].GetUInt32();
uint32 horde = fields[1].GetUInt32();
- if (!sAchievementStore.LookupEntry(alliance))
+ if (!sAchievementMgr->GetAchievement(alliance))
sLog->outError(LOG_FILTER_SQL, "Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance);
- else if (!sAchievementStore.LookupEntry(horde))
+ else if (!sAchievementMgr->GetAchievement(horde))
sLog->outError(LOG_FILTER_SQL, "Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde);
else
FactionChange_Achievements[alliance] = horde;
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 3dcab3df951..e1df03b97b0 100755..100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -128,7 +128,6 @@ enum ScriptsType
SCRIPTS_FIRST = 1,
SCRIPTS_QUEST_END = SCRIPTS_FIRST,
- SCRIPTS_QUEST_START,
SCRIPTS_SPELL,
SCRIPTS_GAMEOBJECT,
SCRIPTS_EVENT,
@@ -363,7 +362,6 @@ typedef std::map<uint32, ScriptMap > ScriptMapMap;
typedef std::multimap<uint32, uint32> SpellScriptsContainer;
typedef std::pair<SpellScriptsContainer::iterator, SpellScriptsContainer::iterator> SpellScriptsBounds;
extern ScriptMapMap sQuestEndScripts;
-extern ScriptMapMap sQuestStartScripts;
extern ScriptMapMap sSpellScripts;
extern ScriptMapMap sGameObjectScripts;
extern ScriptMapMap sEventScripts;
@@ -465,9 +463,12 @@ typedef UNORDERED_MAP<uint8, MailLevelRewardList> MailLevelRewardContainer;
// We assume the rate is in general the same for all three types below, but chose to keep three for scalability and customization
struct RepRewardRate
{
- float quest_rate; // We allow rate = 0.0 in database. For this case, it means that
- float creature_rate; // no reputation are given at all for this faction/rate type.
- float spell_rate;
+ float questRate; // We allow rate = 0.0 in database. For this case, it means that
+ float questDailyRate;
+ float questWeeklyRate;
+ float questMonthlyRate;
+ float creatureRate; // no reputation are given at all for this faction/rate type.
+ float spellRate;
};
struct ReputationOnKillEntry
@@ -864,7 +865,6 @@ class ObjectMgr
void LoadGameObjectScripts();
void LoadQuestEndScripts();
- void LoadQuestStartScripts();
void LoadEventScripts();
void LoadSpellScripts();
void LoadWaypointScripts();
diff --git a/src/server/game/Grids/Cells/Cell.h b/src/server/game/Grids/Cells/Cell.h
index 67b862845b9..67b862845b9 100755..100644
--- a/src/server/game/Grids/Cells/Cell.h
+++ b/src/server/game/Grids/Cells/Cell.h
diff --git a/src/server/game/Grids/Grid.h b/src/server/game/Grids/Grid.h
index d9350e9e897..d9350e9e897 100755..100644
--- a/src/server/game/Grids/Grid.h
+++ b/src/server/game/Grids/Grid.h
diff --git a/src/server/game/Grids/GridLoader.h b/src/server/game/Grids/GridLoader.h
index 85393872eb9..85393872eb9 100755..100644
--- a/src/server/game/Grids/GridLoader.h
+++ b/src/server/game/Grids/GridLoader.h
diff --git a/src/server/game/Grids/GridRefManager.h b/src/server/game/Grids/GridRefManager.h
index 66b6313c997..66b6313c997 100755..100644
--- a/src/server/game/Grids/GridRefManager.h
+++ b/src/server/game/Grids/GridRefManager.h
diff --git a/src/server/game/Grids/GridReference.h b/src/server/game/Grids/GridReference.h
index 107bddf04eb..107bddf04eb 100755..100644
--- a/src/server/game/Grids/GridReference.h
+++ b/src/server/game/Grids/GridReference.h
diff --git a/src/server/game/Grids/GridStates.cpp b/src/server/game/Grids/GridStates.cpp
index c2f66bc3e8a..c2f66bc3e8a 100755..100644
--- a/src/server/game/Grids/GridStates.cpp
+++ b/src/server/game/Grids/GridStates.cpp
diff --git a/src/server/game/Grids/GridStates.h b/src/server/game/Grids/GridStates.h
index ad888b26dd3..ad888b26dd3 100755..100644
--- a/src/server/game/Grids/GridStates.h
+++ b/src/server/game/Grids/GridStates.h
diff --git a/src/server/game/Grids/NGrid.h b/src/server/game/Grids/NGrid.h
index 0ef885703be..0ef885703be 100755..100644
--- a/src/server/game/Grids/NGrid.h
+++ b/src/server/game/Grids/NGrid.h
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
index 1cd442e48f9..1cd442e48f9 100755..100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index 752c6ec068e..24d2a45c4f2 100755..100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -1087,6 +1087,35 @@ namespace Trinity
NearestHostileUnitInAttackDistanceCheck(NearestHostileUnitInAttackDistanceCheck const&);
};
+ class NearestHostileUnitInAggroRangeCheck
+ {
+ public:
+ explicit NearestHostileUnitInAggroRangeCheck(Creature const* creature, bool useLOS = false) : _me(creature), _useLOS(useLOS)
+ {
+ }
+ bool operator()(Unit* u)
+ {
+ if (!u->IsHostileTo(_me))
+ return false;
+
+ if (!u->IsWithinDistInMap(_me, _me->GetAggroRange(u)))
+ return false;
+
+ if (!_me->IsValidAttackTarget(u))
+ return false;
+
+ if (_useLOS && !u->IsWithinLOSInMap(_me))
+ return false;
+
+ return true;
+ }
+
+ private:
+ Creature const* _me;
+ bool _useLOS;
+ NearestHostileUnitInAggroRangeCheck(NearestHostileUnitInAggroRangeCheck const&);
+ };
+
class AnyAssistCreatureInRangeCheck
{
public:
diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
index 2d60678d4ff..2d60678d4ff 100755..100644
--- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp
index 3b2d59dd998..3b2d59dd998 100755..100644
--- a/src/server/game/Grids/ObjectGridLoader.cpp
+++ b/src/server/game/Grids/ObjectGridLoader.cpp
diff --git a/src/server/game/Grids/ObjectGridLoader.h b/src/server/game/Grids/ObjectGridLoader.h
index f768bd0826b..f768bd0826b 100755..100644
--- a/src/server/game/Grids/ObjectGridLoader.h
+++ b/src/server/game/Grids/ObjectGridLoader.h
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 45473f792c4..13c656a4aa3 100755..100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -368,10 +368,13 @@ bool Group::AddMember(Player* player)
if (player)
{
player->SetGroupInvite(NULL);
- if (player->GetGroup() && (isBGGroup() || isBFGroup())) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
- player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
- else if (player->GetGroup()) //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
- player->SetOriginalGroup(this, subGroup);
+ if (player->GetGroup())
+ {
+ if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
+ player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
+ else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
+ player->SetOriginalGroup(this, subGroup);
+ }
else //if player is not in group, then call set group
player->SetGroup(this, subGroup);
@@ -770,7 +773,7 @@ void Group::Disband(bool hideDestroy /* = false */)
/*** LOOT SYSTEM ***/
/*********************************************************/
-void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
+void Group::SendLootStartRoll(uint32 countDown, uint32 mapid, const Roll &r)
{
WorldPacket data(SMSG_LOOT_START_ROLL, (8+4+4+4+4+4+4+1));
data << uint64(r.itemGUID); // guid of rolled item
@@ -780,7 +783,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
data << uint32(r.itemRandomSuffix); // randomSuffix
data << uint32(r.itemRandomPropId); // item random property ID
data << uint32(r.itemCount); // items in stack
- data << uint32(CountDown); // the countdown time to choose "need" or "greed"
+ data << uint32(countDown); // the countdown time to choose "need" or "greed"
data << uint8(r.rollVoteMask); // roll type mask
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
@@ -914,7 +917,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
item = sObjectMgr->GetItemTemplate(i->itemid);
if (!item)
{
- //sLog->outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
continue;
}
@@ -1001,7 +1004,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
item = sObjectMgr->GetItemTemplate(i->itemid);
if (!item)
{
- //sLog->outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
continue;
}
@@ -1198,12 +1201,12 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Group::MasterLoot (SMSG_LOOT_MASTER_LIST, 330)");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Group::MasterLoot (SMSG_LOOT_MASTER_LIST)");
uint32 real_count = 0;
- WorldPacket data(SMSG_LOOT_MASTER_LIST, 330);
- data << (uint8)GetMembersCount();
+ WorldPacket data(SMSG_LOOT_MASTER_LIST, 1 + GetMembersCount() * 8);
+ data << uint8(GetMembersCount());
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
@@ -1507,7 +1510,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
Player* member = ObjectAccessor::FindPlayer(citr->guid);
- uint8 onlineState = (member) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
+ uint8 onlineState = member ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
onlineState = onlineState | ((isBGGroup() || isBFGroup()) ? MEMBER_STATUS_PVP : 0);
data << citr->name;
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index b20a1bd9dd4..3421e12a9a4 100755..100644
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -267,7 +267,7 @@ class Group
void SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot = NULL);
void UpdatePlayerOutOfRange(Player* player);
// ignore: GUID of player that will be ignored
- void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group=-1, uint64 ignore=0);
+ void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group = -1, uint64 ignore = 0);
void BroadcastReadyCheck(WorldPacket* packet);
void OfflineReadyCheck();
diff --git a/src/server/game/Groups/GroupRefManager.h b/src/server/game/Groups/GroupRefManager.h
index d9fef8611de..d9fef8611de 100755..100644
--- a/src/server/game/Groups/GroupRefManager.h
+++ b/src/server/game/Groups/GroupRefManager.h
diff --git a/src/server/game/Groups/GroupReference.cpp b/src/server/game/Groups/GroupReference.cpp
index 68d85c5bce9..68d85c5bce9 100755..100644
--- a/src/server/game/Groups/GroupReference.cpp
+++ b/src/server/game/Groups/GroupReference.cpp
diff --git a/src/server/game/Groups/GroupReference.h b/src/server/game/Groups/GroupReference.h
index 7960dd21035..7960dd21035 100755..100644
--- a/src/server/game/Groups/GroupReference.h
+++ b/src/server/game/Groups/GroupReference.h
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index a03e94ff190..8609e1a7735 100755..100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -249,7 +249,7 @@ void Guild::BankEventLogEntry::WritePacket(WorldPacket& data) const
data << uint8(m_destTabId);
break;
default:
- data << uint64(m_itemOrMoney);
+ data << uint32(m_itemOrMoney);
}
data << uint32(time(NULL) - m_timestamp);
diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h
index 2f43245159b..2f43245159b 100755..100644
--- a/src/server/game/Guilds/Guild.h
+++ b/src/server/game/Guilds/Guild.h
diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp
index c3ffeace3fb..c3ffeace3fb 100755..100644
--- a/src/server/game/Handlers/AddonHandler.cpp
+++ b/src/server/game/Handlers/AddonHandler.cpp
diff --git a/src/server/game/Handlers/AddonHandler.h b/src/server/game/Handlers/AddonHandler.h
index 36cb19e5698..36cb19e5698 100755..100644
--- a/src/server/game/Handlers/AddonHandler.h
+++ b/src/server/game/Handlers/AddonHandler.h
diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp
index b8592fd846e..e3ccee35b47 100755..100644
--- a/src/server/game/Handlers/ArenaTeamHandler.cpp
+++ b/src/server/game/Handlers/ArenaTeamHandler.cpp
@@ -29,7 +29,7 @@
#include "ArenaTeamMgr.h"
#include "Opcodes.h"
-void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recvData)
+void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_INSPECT_ARENA_TEAMS");
@@ -50,7 +50,7 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_QUERY");
@@ -64,7 +64,7 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_ROSTER");
@@ -75,7 +75,7 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recvData)
arenaTeam->Roster(this);
}
-void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_INVITE");
@@ -194,7 +194,7 @@ void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recvData*/)
_player->SetArenaTeamIdInvited(0);
}
-void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEAVE");
@@ -236,7 +236,7 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recvData)
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, arenaTeam->GetName(), "", 0);
}
-void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_DISBAND");
@@ -258,7 +258,7 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_REMOVE");
@@ -304,7 +304,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recvData)
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName());
}
-void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEADER");
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index 7e23429be2f..3c38ff8460e 100755..100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -34,7 +34,7 @@
//post-incrementation is always slower than pre-incrementation !
//void called when player click on auctioneer npc
-void WorldSession::HandleAuctionHelloOpcode(WorldPacket & recvData)
+void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData)
{
uint64 guid; //NPC guid
recvData >> guid;
@@ -86,7 +86,7 @@ void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uin
}
//this function sends notification, if bidder is online
-void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template)
+void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 itemEntry)
{
WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8*4));
data << uint32(location);
@@ -94,7 +94,7 @@ void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auction
data << uint64(bidder);
data << uint32(bidSum);
data << uint32(diff);
- data << uint32(item_template);
+ data << uint32(itemEntry);
data << uint32(0);
SendPacket(&data);
}
@@ -107,14 +107,14 @@ void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction)
data << uint32(auction->bid);
data << uint32(0); //unk
data << uint64(0); //unk (bidder guid?)
- data << uint32(auction->item_template);
+ data << uint32(auction->itemEntry);
data << uint32(0); //unk
data << float(0); //unk (time?)
SendPacket(&data);
}
//this void creates new auction and adds auction to some auctionhouse
-void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
+void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
{
uint64 auctioneer;
uint32 itemsCount, etime, bid, buyout;
@@ -126,7 +126,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
if (itemsCount > MAX_AUCTION_ITEMS)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
@@ -185,7 +185,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
if (!item)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_ITEM_NOT_FOUND);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_ITEM_NOT_FOUND);
return;
}
@@ -193,7 +193,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
item->GetTemplate()->Flags & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) ||
item->GetCount() < count[i])
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
@@ -203,7 +203,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
if (!finalCount)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
@@ -213,7 +213,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
if (item->GetMaxStackCount() < finalCount)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
}
@@ -228,7 +228,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, item, finalCount);
if (!_player->HasEnoughMoney(deposit))
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_NOT_ENOUGHT_MONEY);
return;
}
@@ -251,8 +251,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount());
}
- AH->item_guidlow = item->GetGUIDLow();
- AH->item_template = item->GetEntry();
+ AH->itemGUIDLow = item->GetGUIDLow();
+ AH->itemEntry = item->GetEntry();
AH->itemCount = item->GetCount();
AH->owner = _player->GetGUIDLow();
AH->startbid = bid;
@@ -276,7 +276,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
_player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
- SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
+ SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, ERR_AUCTION_OK);
GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1);
return;
@@ -287,7 +287,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
if (!newItem)
{
sLog->outError(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry());
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
@@ -297,8 +297,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
GetPlayerName().c_str(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount());
}
- AH->item_guidlow = newItem->GetGUIDLow();
- AH->item_template = newItem->GetEntry();
+ AH->itemGUIDLow = newItem->GetGUIDLow();
+ AH->itemEntry = newItem->GetEntry();
AH->itemCount = newItem->GetCount();
AH->owner = _player->GetGUIDLow();
AH->startbid = bid;
@@ -346,7 +346,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
_player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
- SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
+ SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, ERR_AUCTION_OK);
GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1);
return;
@@ -355,7 +355,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
}
//this function is called when client bids or buys out auction
-void WorldSession::HandleAuctionPlaceBid(WorldPacket & recvData)
+void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_PLACE_BID");
@@ -387,7 +387,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recvData)
if (!auction || auction->owner == player->GetGUIDLow())
{
//you cannot bid your own auction:
- SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
+ SendAuctionCommandResult(0, AUCTION_PLACE_BID, ERR_AUCTION_BID_OWN);
return;
}
@@ -396,7 +396,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recvData)
if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == player->GetSession()->GetAccountId())
{
//you cannot bid your another character auction:
- SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
+ SendAuctionCommandResult(0, AUCTION_PLACE_BID, ERR_AUCTION_BID_OWN);
return;
}
@@ -447,7 +447,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recvData)
stmt->setUInt32(2, auction->Id);
trans->Append(stmt);
- SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK, 0);
+ SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, ERR_AUCTION_OK, 0);
}
else
{
@@ -469,20 +469,20 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recvData)
sAuctionMgr->SendAuctionSuccessfulMail(auction, trans);
sAuctionMgr->SendAuctionWonMail(auction, trans);
- SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK);
+ SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, ERR_AUCTION_OK);
auction->DeleteFromDB(trans);
- uint32 item_template = auction->item_template;
- sAuctionMgr->RemoveAItem(auction->item_guidlow);
- auctionHouse->RemoveAuction(auction, item_template);
+ uint32 itemEntry = auction->itemEntry;
+ sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
+ auctionHouse->RemoveAuction(auction, itemEntry);
}
player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
}
//this void is called when auction_owner cancels his auction
-void WorldSession::HandleAuctionRemoveItem(WorldPacket & recvData)
+void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_REMOVE_ITEM");
@@ -511,7 +511,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recvData)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
if (auction && auction->owner == player->GetGUIDLow())
{
- Item* pItem = sAuctionMgr->GetAItem(auction->item_guidlow);
+ Item* pItem = sAuctionMgr->GetAItem(auction->itemGUIDLow);
if (pItem)
{
if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
@@ -531,21 +531,21 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recvData)
}
else
{
- sLog->outError(LOG_FILTER_NETWORKIO, "Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->item_guidlow);
- SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->itemGUIDLow);
+ SendAuctionCommandResult(0, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR);
return;
}
}
else
{
- SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(0, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR);
//this code isn't possible ... maybe there should be assert
sLog->outError(LOG_FILTER_NETWORKIO, "CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId);
return;
}
//inform player, that auction is removed
- SendAuctionCommandResult(auction->Id, AUCTION_CANCEL, AUCTION_OK);
+ SendAuctionCommandResult(auction->Id, AUCTION_CANCEL, ERR_AUCTION_OK);
// Now remove the auction
@@ -553,13 +553,13 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recvData)
auction->DeleteFromDB(trans);
CharacterDatabase.CommitTransaction(trans);
- uint32 item_template = auction->item_template;
- sAuctionMgr->RemoveAItem(auction->item_guidlow);
- auctionHouse->RemoveAuction(auction, item_template);
+ uint32 itemEntry = auction->itemEntry;
+ sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
+ auctionHouse->RemoveAuction(auction, itemEntry);
}
//called when player lists his bids
-void WorldSession::HandleAuctionListBidderItems(WorldPacket & recvData)
+void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
@@ -616,7 +616,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recvData)
}
//this void sends player info about his auctions
-void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recvData)
+void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
@@ -653,7 +653,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recvData)
}
//this void is called when player clicks on search button
-void WorldSession::HandleAuctionListItems(WorldPacket & recvData)
+void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_ITEMS");
@@ -720,7 +720,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recvData)
SendPacket(&data);
}
-void WorldSession::HandleAuctionListPendingSales(WorldPacket & recvData)
+void WorldSession::HandleAuctionListPendingSales(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_PENDING_SALES");
diff --git a/src/server/game/Handlers/AuthHandler.cpp b/src/server/game/Handlers/AuthHandler.cpp
index 49027bdf497..49027bdf497 100755..100644
--- a/src/server/game/Handlers/AuthHandler.cpp
+++ b/src/server/game/Handlers/AuthHandler.cpp
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index 0a076dfaa34..12f4e6ffa82 100755..100644
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -35,7 +35,7 @@
#include "DisableMgr.h"
#include "Group.h"
-void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recvData)
+void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
{
uint64 guid;
recvData >> guid;
@@ -70,7 +70,7 @@ void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId
SendPacket(&data);
}
-void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
+void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
{
uint64 guid;
uint32 bgTypeId_;
@@ -581,7 +581,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/)
}
}
-void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData)
+void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
@@ -749,7 +749,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData)
sBattlegroundMgr->ScheduleQueueUpdate(matchmakerRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
}
-void WorldSession::HandleReportPvPAFK(WorldPacket & recvData)
+void WorldSession::HandleReportPvPAFK(WorldPacket& recvData)
{
uint64 playerGuid;
recvData >> playerGuid;
diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Handlers/BattlefieldHandler.cpp
index a2d8cec3936..c4225551311 100644
--- a/src/server/game/Battlefield/BattlefieldHandler.cpp
+++ b/src/server/game/Handlers/BattlefieldHandler.cpp
@@ -102,7 +102,7 @@ void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recvData)
uint8 Accepted;
recvData >> BattleId >> Accepted;
- sLog->outError(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
+ sLog->outDebug(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
if (!Bf)
return;
@@ -120,7 +120,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recvData)
uint8 Accepted;
recvData >> BattleId >> Accepted;
- sLog->outError(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
+ sLog->outDebug(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
if (!Bf)
return;
@@ -142,7 +142,7 @@ void WorldSession::HandleBfExitRequest(WorldPacket & recvData)
uint32 BattleId;
recvData >> BattleId;
- sLog->outError(LOG_FILTER_GENERAL, "HandleBfExitRequest: BattleID:%u ", BattleId);
+ sLog->outDebug(LOG_FILTER_GENERAL, "HandleBfExitRequest: BattleID:%u ", BattleId);
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
if (!Bf)
return;
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index 876a0fc4463..876a0fc4463 100755..100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp
index 462bc7fff0b..462bc7fff0b 100755..100644
--- a/src/server/game/Handlers/ChannelHandler.cpp
+++ b/src/server/game/Handlers/ChannelHandler.cpp
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 0b01c796511..9580e1d193a 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -71,135 +71,139 @@ bool LoginQueryHolder::Initialize()
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADFROM, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_FROM, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADGROUP, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_GROUP, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_INSTANCE);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BOUND_INSTANCES, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURAS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADAURAS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_AURAS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SPELL);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SPELLS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_QUESTSTATUS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_DAILYQUESTSTATUS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_WEEKLYQUESTSTATUS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADWEEKLYQUESTSTATUS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS, stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MONTHLYQUESTSTATUS);
+ stmt->setUInt32(0, lowGuid);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SEASONALQUESTSTATUS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSEASONALQUESTSTATUS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_REPUTATION);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_REPUTATION, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_INVENTORY);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_INVENTORY, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ACTIONS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ACTIONS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILCOUNT);
stmt->setUInt32(0, lowGuid);
stmt->setUInt64(1, uint64(time(NULL)));
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILDATE);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_DATE, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SOCIALLIST);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_HOMEBIND);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_HOME_BIND, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SPELLCOOLDOWNS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS, stmt);
if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_DECLINEDNAMES);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES, stmt);
}
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADGUILD, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_GUILD, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ARENAINFO);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ARENA_INFO, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ACHIEVEMENTS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_CRITERIAPROGRESS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_EQUIPMENTSETS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_BGDATA);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADBGDATA, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BG_DATA, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_GLYPHS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADGLYPHS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_GLYPHS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_TALENTS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_TALENTS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PLAYER_ACCOUNT_DATA);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SKILLS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SKILLS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_RANDOMBG);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADRANDOMBG, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_BANNED);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADBANNED, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BANNED, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_QUESTSTATUSREW);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUSREW, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_INSTANCELOCKTIMES);
stmt->setUInt32(0, m_accountId);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES, stmt);
return res;
}
@@ -252,7 +256,7 @@ void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recvData*/)
_charEnumCallback = CharacterDatabase.AsyncQuery(stmt);
}
-void WorldSession::HandleCharCreateOpcode(WorldPacket & recvData)
+void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
{
std::string name;
uint8 race_, class_;
@@ -673,7 +677,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
}
}
-void WorldSession::HandleCharDeleteOpcode(WorldPacket & recvData)
+void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
{
uint64 guid;
recvData >> guid;
@@ -683,6 +687,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recvData)
return;
uint32 accountId = 0;
+ uint8 level = 0;
std::string name;
// is guild leader
@@ -703,14 +708,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recvData)
return;
}
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_NAME_BY_GUID);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_DATA_BY_GUID);
stmt->setUInt32(0, GUID_LOPART(guid));
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
- accountId = fields[0].GetUInt32();
- name = fields[1].GetString();
+ accountId = fields[0].GetUInt32();
+ name = fields[1].GetString();
+ level = fields[2].GetUInt8();
}
// prevent deleting other players' characters using cheating tools
@@ -718,7 +724,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recvData)
return;
std::string IP_str = GetRemoteAddress();
- sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d, IP: %s deleted character: %s, GUID: %u, Level: %u", accountId, IP_str.c_str(), name.c_str(), GUID_LOPART(guid), level);
sScriptMgr->OnPlayerDelete(guid);
sWorld->DeleteCharaceterNameData(GUID_LOPART(guid));
@@ -726,18 +732,18 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recvData)
{
std::string dump;
if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump))
- sLog->outCharDump(dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
+ sLog->outCharDump(dump.c_str(), accountId, GUID_LOPART(guid), name.c_str());
}
sCalendarMgr->RemoveAllPlayerEventsAndInvites(guid);
- Player::DeleteFromDB(guid, GetAccountId());
+ Player::DeleteFromDB(guid, accountId);
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << uint8(CHAR_DELETE_SUCCESS);
SendPacket(&data);
}
-void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recvData)
+void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
{
if (PlayerLoading() || GetPlayer() != NULL)
{
@@ -801,7 +807,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
SendPacket(&data);
// load player specific part before send times
- LoadAccountData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA), PER_CHARACTER_CACHE_MASK);
+ LoadAccountData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA), PER_CHARACTER_CACHE_MASK);
SendAccountDataTimes(PER_CHARACTER_CACHE_MASK);
data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0
@@ -848,7 +854,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
}
//QueryResult* result = CharacterDatabase.PQuery("SELECT guildid, rank FROM guild_member WHERE guid = '%u'", pCurrChar->GetGUIDLow());
- if (PreparedQueryResult resultGuild = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADGUILD))
+ if (PreparedQueryResult resultGuild = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GUILD))
{
Field* fields = resultGuild->Fetch();
pCurrChar->SetInGuild(fields[0].GetUInt32());
@@ -1006,7 +1012,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
delete holder;
}
-void WorldSession::HandleSetFactionAtWar(WorldPacket & recvData)
+void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_ATWAR");
@@ -1026,7 +1032,7 @@ void WorldSession::HandleSetFactionCheat(WorldPacket & /*recvData*/)
GetPlayer()->GetReputationMgr().SendStates();
}
-void WorldSession::HandleTutorialFlag(WorldPacket & recvData)
+void WorldSession::HandleTutorialFlag(WorldPacket& recvData)
{
uint32 data;
recvData >> data;
@@ -1054,7 +1060,7 @@ void WorldSession::HandleTutorialReset(WorldPacket & /*recvData*/)
SetTutorialInt(i, 0x00000000);
}
-void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recvData)
+void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_WATCHED_FACTION");
uint32 fact;
@@ -1062,7 +1068,7 @@ void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recvData)
GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fact);
}
-void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recvData)
+void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_INACTIVE");
uint32 replistid;
@@ -1279,7 +1285,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
SendPacket(&data);
}
-void WorldSession::HandleAlterAppearance(WorldPacket & recvData)
+void WorldSession::HandleAlterAppearance(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ALTER_APPEARANCE");
@@ -1351,7 +1357,7 @@ void WorldSession::HandleAlterAppearance(WorldPacket & recvData)
_player->SetStandState(0); // stand up
}
-void WorldSession::HandleRemoveGlyph(WorldPacket & recvData)
+void WorldSession::HandleRemoveGlyph(WorldPacket& recvData)
{
uint32 slot;
recvData >> slot;
@@ -1800,7 +1806,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
if (recvData.GetOpcode() == CMSG_CHAR_FACTION_CHANGE)
{
// Delete all Flypaths
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXI_PATH);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXI_PATH);
stmt->setUInt32(0, lowGuid);
trans->Append(stmt);
@@ -1845,7 +1851,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
taximaskstream << '0';
std::string taximask = taximaskstream.str();
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXIMASK);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXIMASK);
stmt->setString(0, taximask);
stmt->setUInt32(1, lowGuid);
trans->Append(stmt);
@@ -1892,7 +1898,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
{
// Reset guild
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER);
stmt->setUInt32(0, lowGuid);
@@ -1905,7 +1911,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND))
{
// Delete Friend List
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID);
stmt->setUInt32(0, lowGuid);
trans->Append(stmt);
@@ -1951,7 +1957,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
uint32 achiev_alliance = it->first;
uint32 achiev_horde = it->second;
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
stmt->setUInt16(0, uint16(team == TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
stmt->setUInt32(1, lowGuid);
trans->Append(stmt);
@@ -1969,7 +1975,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
uint32 item_alliance = it->first;
uint32 item_horde = it->second;
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE);
stmt->setUInt32(0, (team == TEAM_ALLIANCE ? item_alliance : item_horde));
stmt->setUInt32(1, (team == TEAM_ALLIANCE ? item_horde : item_alliance));
stmt->setUInt32(2, guid);
@@ -1982,7 +1988,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
uint32 spell_alliance = it->first;
uint32 spell_horde = it->second;
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
stmt->setUInt32(0, (team == TEAM_ALLIANCE ? spell_alliance : spell_horde));
stmt->setUInt32(1, lowGuid);
trans->Append(stmt);
@@ -2003,7 +2009,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
uint32 oldReputation = (team == TEAM_ALLIANCE) ? reputation_horde : reputation_alliance;
// select old standing set in db
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_REP_BY_FACTION);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_REP_BY_FACTION);
stmt->setUInt32(0, oldReputation);
stmt->setUInt32(1, lowGuid);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -2095,7 +2101,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
for (uint32 index = 0; index < ktcount; ++index)
ss << knownTitles[index] << ' ';
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TITLES_FACTION_CHANGE);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TITLES_FACTION_CHANGE);
stmt->setString(0, ss.str().c_str());
stmt->setUInt32(1, lowGuid);
trans->Append(stmt);
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index e4989816998..e4989816998 100755..100644
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp
index d30164b2592..d30164b2592 100755..100644
--- a/src/server/game/Handlers/CombatHandler.cpp
+++ b/src/server/game/Handlers/CombatHandler.cpp
diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp
index bdfb2369198..bdfb2369198 100755..100644
--- a/src/server/game/Handlers/DuelHandler.cpp
+++ b/src/server/game/Handlers/DuelHandler.cpp
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index 8555b4a6a1f..5b517e1d726 100755..100644
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -57,7 +57,7 @@ void WorldSession::SendPartyResult(PartyOperation operation, const std::string&
SendPacket(&data);
}
-void WorldSession::HandleGroupInviteOpcode(WorldPacket & recvData)
+void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_INVITE");
@@ -271,7 +271,7 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recvData*/)
leader->GetSession()->SendPacket(&data);
}
-void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recvData)
+void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_UNINVITE_GUID");
@@ -320,7 +320,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recvData)
SendPartyResult(PARTY_OP_UNINVITE, "", ERR_TARGET_NOT_IN_GROUP_S);
}
-void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recvData)
+void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_UNINVITE");
@@ -365,7 +365,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recvData)
SendPartyResult(PARTY_OP_UNINVITE, membername, ERR_TARGET_NOT_IN_GROUP_S);
}
-void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket & recvData)
+void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_SET_LEADER");
@@ -409,7 +409,7 @@ void WorldSession::HandleGroupDisbandOpcode(WorldPacket & /*recvData*/)
GetPlayer()->RemoveFromGroup(GROUP_REMOVEMETHOD_LEAVE);
}
-void WorldSession::HandleLootMethodOpcode(WorldPacket & recvData)
+void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_LOOT_METHOD");
@@ -513,7 +513,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recvData)
SendPacket(&data);
}
-void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket & recvData)
+void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RAID_TARGET_UPDATE");
@@ -564,7 +564,7 @@ void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket & /*recvData*/)
group->ConvertToRaid();
}
-void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recvData)
+void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_CHANGE_SUB_GROUP");
@@ -603,7 +603,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recvData)
group->ChangeMembersGroup(guid, groupNr);
}
-void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket & recvData)
+void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_ASSISTANT_LEADER");
@@ -624,7 +624,7 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket & recvData)
group->SendUpdate();
}
-void WorldSession::HandlePartyAssignmentOpcode(WorldPacket & recvData)
+void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_PARTY_ASSIGNMENT");
@@ -658,7 +658,7 @@ void WorldSession::HandlePartyAssignmentOpcode(WorldPacket & recvData)
group->SendUpdate();
}
-void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket & recvData)
+void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RAID_READY_CHECK");
@@ -969,12 +969,12 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData)
_player->SendRaidInfo();
}
-/*void WorldSession::HandleGroupCancelOpcode(WorldPacket & recvData)
+/*void WorldSession::HandleGroupCancelOpcode(WorldPacket& recvData)
{
sLog->outDebug("WORLD: got CMSG_GROUP_CANCEL.");
}*/
-void WorldSession::HandleOptOutOfLootOpcode(WorldPacket & recvData)
+void WorldSession::HandleOptOutOfLootOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_OPT_OUT_OF_LOOT");
diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp
index 929a31938d2..929a31938d2 100755..100644
--- a/src/server/game/Handlers/GuildHandler.cpp
+++ b/src/server/game/Handlers/GuildHandler.cpp
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 6dc7dc427d3..2053f14e814 100755..100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -28,7 +28,7 @@
#include "ObjectAccessor.h"
#include "SpellInfo.h"
-void WorldSession::HandleSplitItemOpcode(WorldPacket & recvData)
+void WorldSession::HandleSplitItemOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SPLIT_ITEM");
uint8 srcbag, srcslot, dstbag, dstslot;
@@ -61,7 +61,7 @@ void WorldSession::HandleSplitItemOpcode(WorldPacket & recvData)
_player->SplitItem(src, dst, count);
}
-void WorldSession::HandleSwapInvItemOpcode(WorldPacket & recvData)
+void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_INV_ITEM");
uint8 srcslot, dstslot;
@@ -91,7 +91,7 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket & recvData)
_player->SwapItem(src, dst);
}
-void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket & recvData)
+void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData)
{
uint64 itemguid;
uint8 dstslot;
@@ -110,7 +110,7 @@ void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket & recvData)
_player->SwapItem(item->GetPos(), dstpos);
}
-void WorldSession::HandleSwapItem(WorldPacket & recvData)
+void WorldSession::HandleSwapItem(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_ITEM");
uint8 dstbag, dstslot, srcbag, srcslot;
@@ -140,7 +140,7 @@ void WorldSession::HandleSwapItem(WorldPacket & recvData)
_player->SwapItem(src, dst);
}
-void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recvData)
+void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_AUTOEQUIP_ITEM");
uint8 srcbag, srcslot;
@@ -234,7 +234,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleDestroyItemOpcode(WorldPacket & recvData)
+void WorldSession::HandleDestroyItemOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_DESTROYITEM");
uint8 bag, slot, count, data1, data2, data3;
@@ -278,7 +278,7 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recvData)
}
// Only _static_ data send in this packet !!!
-void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recvData)
+void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_ITEM_QUERY_SINGLE");
uint32 item;
@@ -437,7 +437,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleReadItem(WorldPacket & recvData)
+void WorldSession::HandleReadItem(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_READ_ITEM");
@@ -470,7 +470,7 @@ void WorldSession::HandleReadItem(WorldPacket & recvData)
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
}
-void WorldSession::HandlePageQuerySkippedOpcode(WorldPacket & recvData)
+void WorldSession::HandlePageQuerySkippedOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PAGE_TEXT_QUERY");
@@ -483,7 +483,7 @@ void WorldSession::HandlePageQuerySkippedOpcode(WorldPacket & recvData)
itemid, GUID_LOPART(guid), GUID_ENPART(guid), GUID_HIPART(guid));
}
-void WorldSession::HandleSellItemOpcode(WorldPacket & recvData)
+void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SELL_ITEM");
uint64 vendorguid, itemguid;
@@ -538,9 +538,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recvData)
// special case at auto sell (sell all)
if (count == 0)
- {
count = pItem->GetCount();
- }
else
{
// prevent sell more items that exist in stack (possible only not from client)
@@ -597,7 +595,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recvData)
return;
}
-void WorldSession::HandleBuybackItem(WorldPacket & recvData)
+void WorldSession::HandleBuybackItem(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUYBACK_ITEM");
uint64 vendorguid;
@@ -645,7 +643,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recvData)
_player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, 0, 0);
}
-void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recvData)
+void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUY_ITEM_IN_SLOT");
uint64 vendorguid, bagguid;
@@ -687,7 +685,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recvData)
GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, bag, bagslot);
}
-void WorldSession::HandleBuyItemOpcode(WorldPacket & recvData)
+void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUY_ITEM");
uint64 vendorguid;
@@ -705,7 +703,7 @@ void WorldSession::HandleBuyItemOpcode(WorldPacket & recvData)
GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, NULL_BAG, NULL_SLOT);
}
-void WorldSession::HandleListInventoryOpcode(WorldPacket & recvData)
+void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
{
uint64 guid;
@@ -779,6 +777,13 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
if (!_player->isGameMaster() && !leftInStock)
continue;
+ ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(vendor->GetEntry(), item->item);
+ if (!sConditionMgr->IsObjectMeetToConditions(_player, vendor, conditions))
+ {
+ sLog->outDebug(LOG_FILTER_CONDITIONSYS, "SendListInventory: conditions not met for creature entry %u item %u", vendor->GetEntry(), item->item);
+ continue;
+ }
+
++count;
// reputation discount
@@ -807,7 +812,7 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
SendPacket(&data);
}
-void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recvData)
+void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_AUTOSTORE_BAG_ITEM");
uint8 srcbag, srcslot, dstbag;
@@ -983,7 +988,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
}
}
-void WorldSession::HandleSetAmmoOpcode(WorldPacket & recvData)
+void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData)
{
if (!GetPlayer()->isAlive())
{
@@ -1024,7 +1029,7 @@ void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid,
SendPacket(&data);
}
-void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recvData)
+void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recvData)
{
uint32 itemid;
recvData >> itemid;
@@ -1415,7 +1420,7 @@ void WorldSession::HandleItemRefund(WorldPacket &recvData)
*
* This function is called when player clicks on item which has some flag set
*/
-void WorldSession::HandleItemTextQuery(WorldPacket & recvData )
+void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
{
uint64 itemGuid;
recvData >> itemGuid;
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index 3f33b60329b..3f33b60329b 100755..100644
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index 1c9719a210f..b15636e75d2 100755..100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -31,7 +31,7 @@
#include "WorldPacket.h"
#include "WorldSession.h"
-void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recvData)
+void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
Player* player = GetPlayer();
@@ -93,6 +93,10 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recvData)
}
player->StoreLootItem(lootSlot, loot);
+
+ // If player is removing the last LootItem, delete the empty container.
+ if (loot->isLooted() && IS_ITEM_GUID(lguid))
+ player->GetSession()->DoLootRelease(lguid);
}
void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/)
@@ -200,10 +204,18 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/)
}
loot->gold = 0;
+
+ // Delete the money loot record from the DB
+ if (loot->containerID > 0)
+ loot->DeleteLootMoneyFromContainerItemDB();
+
+ // Delete container if empty
+ if (loot->isLooted() && IS_ITEM_GUID(guid))
+ player->GetSession()->DoLootRelease(guid);
}
}
-void WorldSession::HandleLootOpcode(WorldPacket & recvData)
+void WorldSession::HandleLootOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT");
@@ -381,8 +393,8 @@ void WorldSession::DoLootRelease(uint64 lguid)
player->DestroyItemCount(pItem, count, true);
}
else
- // FIXME: item must not be deleted in case not fully looted state. But this pre-request implement loot saving in DB at item save. Or cheating possible.
- player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
+ if (pItem->loot.isLooted()) // Only delete item if no loot or money (unlooted loot is saved to db)
+ player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
return; // item can be looted only single player
}
else
@@ -429,7 +441,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
loot->RemoveLooter(player->GetGUID());
}
-void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recvData)
+void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
{
uint8 slotid;
uint64 lootguid, target_playerguid;
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index cb3a6d920b8..6b8c83cce73 100755..100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -29,7 +29,7 @@
#include "Item.h"
#include "AccountMgr.h"
-void WorldSession::HandleSendMail(WorldPacket & recvData)
+void WorldSession::HandleSendMail(WorldPacket& recvData)
{
uint64 mailbox, unk3;
std::string receiver, subject, body;
@@ -302,7 +302,7 @@ void WorldSession::HandleSendMail(WorldPacket & recvData)
}
//called when mail is read
-void WorldSession::HandleMailMarkAsRead(WorldPacket & recvData)
+void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
@@ -325,7 +325,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recvData)
}
//called when client deletes mail
-void WorldSession::HandleMailDelete(WorldPacket & recvData)
+void WorldSession::HandleMailDelete(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
@@ -353,7 +353,7 @@ void WorldSession::HandleMailDelete(WorldPacket & recvData)
player->SendMailResult(mailId, MAIL_DELETED, MAIL_OK);
}
-void WorldSession::HandleMailReturnToSender(WorldPacket & recvData)
+void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
@@ -417,7 +417,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recvData)
}
//called when player takes item attached in mail
-void WorldSession::HandleMailTakeItem(WorldPacket & recvData)
+void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
@@ -513,7 +513,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recvData)
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg);
}
-void WorldSession::HandleMailTakeMoney(WorldPacket & recvData)
+void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
@@ -547,7 +547,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recvData)
}
//called when player lists his received mails
-void WorldSession::HandleGetMailList(WorldPacket & recvData)
+void WorldSession::HandleGetMailList(WorldPacket& recvData)
{
uint64 mailbox;
recvData >> mailbox;
@@ -617,7 +617,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recvData)
data << uint32((*itr)->stationery); // stationery (Stationery.dbc)
data << uint32((*itr)->money); // Gold
data << uint32((*itr)->checked); // flags
- data << float(((*itr)->expire_time-time(NULL))/DAY); // Time
+ data << float(float((*itr)->expire_time-time(NULL))/DAY); // Time
data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc)
data << (*itr)->subject; // Subject string - once 00, when mail type = 3, max 256
data << (*itr)->body; // message? max 8000
@@ -667,7 +667,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recvData)
}
//used when player copies mail body to his inventory
-void WorldSession::HandleMailCreateTextItem(WorldPacket & recvData)
+void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index aa182a16d91..aa182a16d91 100755..100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 0eaf3c127b7..9ad70772476 100755..100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -239,7 +239,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
GetPlayer()->ProcessDelayedOperations();
}
-void WorldSession::HandleMovementOpcodes(WorldPacket & recvData)
+void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
{
uint16 opcode = recvData.GetOpcode();
@@ -523,7 +523,7 @@ void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvData*/)
GetPlayer()->SendMessageToSet(&data, false);
}
-void WorldSession::HandleMoveKnockBackAck(WorldPacket & recvData)
+void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_KNOCK_BACK_ACK");
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index ef0f8e130b6..a9cb7e9b806 100755..100644
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -48,7 +48,7 @@ enum StableResultCode
STABLE_ERR_EXOTIC = 0x0C // "you are unable to control exotic creatures"
};
-void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket & recvData)
+void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
{
uint64 guid;
recvData >> guid;
@@ -74,7 +74,7 @@ void WorldSession::SendTabardVendorActivate(uint64 guid)
SendPacket(&data);
}
-void WorldSession::HandleBankerActivateOpcode(WorldPacket & recvData)
+void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
{
uint64 guid;
@@ -103,7 +103,7 @@ void WorldSession::SendShowBank(uint64 guid)
SendPacket(&data);
}
-void WorldSession::HandleTrainerListOpcode(WorldPacket & recvData)
+void WorldSession::HandleTrainerListOpcode(WorldPacket& recvData)
{
uint64 guid;
@@ -235,7 +235,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
SendPacket(&data);
}
-void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recvData)
+void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
{
uint64 guid;
uint32 spellId = 0;
@@ -295,7 +295,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recvData)
SendPacket(&data);
}
-void WorldSession::HandleGossipHelloOpcode(WorldPacket & recvData)
+void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GOSSIP_HELLO");
@@ -344,7 +344,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recvData)
unit->AI()->sGossipHello(_player);
}
-/*void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recvData)
+/*void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_GOSSIP_SELECT_OPTION");
@@ -385,7 +385,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recvData)
}
}*/
-void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket & recvData)
+void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
@@ -440,7 +440,7 @@ void WorldSession::SendSpiritResurrect()
_player->UpdateObjectVisibility();
}
-void WorldSession::HandleBinderActivateOpcode(WorldPacket & recvData)
+void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData)
{
uint64 npcGUID;
recvData >> npcGUID;
@@ -470,22 +470,6 @@ void WorldSession::SendBindPoint(Creature* npc)
uint32 bindspell = 3286;
- // update sql homebind
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_HOMEBIND);
- stmt->setUInt16(0, _player->GetMapId());
- stmt->setUInt16(1, _player->GetAreaId());
- stmt->setFloat (2, _player->GetPositionX());
- stmt->setFloat (3, _player->GetPositionY());
- stmt->setFloat (4, _player->GetPositionZ());
- stmt->setUInt32(5, _player->GetGUIDLow());
- CharacterDatabase.Execute(stmt);
-
- _player->m_homebindMapId = _player->GetMapId();
- _player->m_homebindAreaId = _player->GetAreaId();
- _player->m_homebindX = _player->GetPositionX();
- _player->m_homebindY = _player->GetPositionY();
- _player->m_homebindZ = _player->GetPositionZ();
-
// send spell for homebinding (3286)
npc->CastSpell(_player, bindspell, true);
@@ -497,7 +481,7 @@ void WorldSession::SendBindPoint(Creature* npc)
_player->PlayerTalkClass->SendCloseGossip();
}
-void WorldSession::HandleListStabledPetsOpcode(WorldPacket & recvData)
+void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv MSG_LIST_STABLED_PETS");
uint64 npcGUID;
@@ -590,7 +574,7 @@ void WorldSession::SendStableResult(uint8 res)
SendPacket(&data);
}
-void WorldSession::HandleStablePet(WorldPacket & recvData)
+void WorldSession::HandleStablePet(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_PET");
uint64 npcGUID;
@@ -665,7 +649,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result)
SendStableResult(STABLE_ERR_STABLE);
}
-void WorldSession::HandleUnstablePet(WorldPacket & recvData)
+void WorldSession::HandleUnstablePet(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_UNSTABLE_PET.");
uint64 npcGUID;
@@ -746,7 +730,7 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32
SendStableResult(STABLE_SUCCESS_UNSTABLE);
}
-void WorldSession::HandleBuyStableSlot(WorldPacket & recvData)
+void WorldSession::HandleBuyStableSlot(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_BUY_STABLE_SLOT.");
uint64 npcGUID;
@@ -784,7 +768,7 @@ void WorldSession::HandleStableRevivePet(WorldPacket &/* recvData */)
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleStableRevivePet: Not implemented");
}
-void WorldSession::HandleStableSwapPet(WorldPacket & recvData)
+void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_SWAP_PET.");
uint64 npcGUID;
@@ -876,7 +860,7 @@ void WorldSession::HandleStableSwapPetCallback(PreparedQueryResult result, uint3
SendStableResult(STABLE_SUCCESS_UNSTABLE);
}
-void WorldSession::HandleRepairItemOpcode(WorldPacket & recvData)
+void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_REPAIR_ITEM");
diff --git a/src/server/game/Handlers/NPCHandler.h b/src/server/game/Handlers/NPCHandler.h
index af84b71a74f..af84b71a74f 100755..100644
--- a/src/server/game/Handlers/NPCHandler.h
+++ b/src/server/game/Handlers/NPCHandler.h
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index 97a2765b4df..6bcbcbbcfc9 100755..100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -56,7 +56,7 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData)
}
}
-void WorldSession::HandlePetAction(WorldPacket & recvData)
+void WorldSession::HandlePetAction(WorldPacket& recvData)
{
uint64 guid1;
uint32 data;
@@ -162,6 +162,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid
charmInfo->SetIsCommandAttack(false);
charmInfo->SetIsAtStay(true);
+ charmInfo->SetIsCommandFollow(false);
charmInfo->SetIsFollowing(false);
charmInfo->SetIsReturning(false);
charmInfo->SaveStayPosition();
@@ -175,6 +176,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid
charmInfo->SetIsCommandAttack(false);
charmInfo->SetIsAtStay(false);
charmInfo->SetIsReturning(true);
+ charmInfo->SetIsCommandFollow(true);
charmInfo->SetIsFollowing(false);
break;
case COMMAND_ATTACK: //spellid=1792 //ATTACK
@@ -208,6 +210,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid
charmInfo->SetIsCommandAttack(true);
charmInfo->SetIsAtStay(false);
charmInfo->SetIsFollowing(false);
+ charmInfo->SetIsCommandFollow(false);
charmInfo->SetIsReturning(false);
pet->ToCreature()->AI()->AttackStart(TargetUnit);
@@ -229,6 +232,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid
charmInfo->SetIsCommandAttack(true);
charmInfo->SetIsAtStay(false);
charmInfo->SetIsFollowing(false);
+ charmInfo->SetIsCommandFollow(false);
charmInfo->SetIsReturning(false);
pet->Attack(TargetUnit, true);
@@ -396,7 +400,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid
}
}
-void WorldSession::HandlePetNameQuery(WorldPacket & recvData)
+void WorldSession::HandlePetNameQuery(WorldPacket& recvData)
{
sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetNameQuery. CMSG_PET_NAME_QUERY");
@@ -463,7 +467,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
return true;
}
-void WorldSession::HandlePetSetAction(WorldPacket & recvData)
+void WorldSession::HandlePetSetAction(WorldPacket& recvData)
{
sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetSetAction. CMSG_PET_SET_ACTION");
@@ -580,7 +584,7 @@ void WorldSession::HandlePetSetAction(WorldPacket & recvData)
}
}
-void WorldSession::HandlePetRename(WorldPacket & recvData)
+void WorldSession::HandlePetRename(WorldPacket& recvData)
{
sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetRename. CMSG_PET_RENAME");
@@ -665,7 +669,7 @@ void WorldSession::HandlePetRename(WorldPacket & recvData)
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped
}
-void WorldSession::HandlePetAbandon(WorldPacket & recvData)
+void WorldSession::HandlePetAbandon(WorldPacket& recvData)
{
uint64 guid;
recvData >> guid; //pet guid
@@ -861,7 +865,7 @@ void WorldSession::HandlePetLearnTalent(WorldPacket& recvData)
_player->SendTalentsInfoData(true);
}
-void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket & recvData)
+void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LEARN_PREVIEW_TALENTS_PET");
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index 0da9c762ca9..1704229674e 100755..100644
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -50,7 +50,7 @@ enum CharterCosts
ARENA_TEAM_CHARTER_5v5_COST = 2000000
};
-void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recvData)
+void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_BUY");
@@ -305,7 +305,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
SendPacket(&data);
}
-void WorldSession::HandlePetitionQueryOpcode(WorldPacket & recvData)
+void WorldSession::HandlePetitionQueryOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_QUERY"); // ok
@@ -380,7 +380,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
SendPacket(&data);
}
-void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recvData)
+void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_RENAME"); // ok
@@ -453,7 +453,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recvData)
SendPacket(&data);
}
-void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData)
+void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SIGN"); // ok
@@ -590,7 +590,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData)
owner->GetSession()->SendPacket(&data);
}
-void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recvData)
+void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_DECLINE"); // ok
@@ -620,7 +620,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recvData)
+void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_OFFER_PETITION"); // ok
@@ -729,7 +729,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recvData)
player->GetSession()->SendPacket(&data);
}
-void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recvData)
+void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_TURN_IN_PETITION");
@@ -919,7 +919,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recvData)
SendPacket(&data);
}
-void WorldSession::HandlePetitionShowListOpcode(WorldPacket & recvData)
+void WorldSession::HandlePetitionShowListOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received CMSG_PETITION_SHOWLIST");
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index 534f992b594..e44fbd0d899 100755..100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -89,7 +89,7 @@ void WorldSession::SendQueryTimeResponse()
}
/// Only _static_ data is sent in this packet !!!
-void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recvData)
+void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
{
uint32 entry;
recvData >> entry;
@@ -152,7 +152,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recvData)
}
/// Only _static_ data is sent in this packet !!!
-void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recvData)
+void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
{
uint32 entry;
recvData >> entry;
@@ -258,7 +258,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/)
SendPacket(&data);
}
-void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recvData)
+void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData)
{
uint32 textID;
uint64 guid;
@@ -342,7 +342,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recvData)
}
/// Only _static_ data is sent in this packet !!!
-void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recvData)
+void WorldSession::HandlePageTextQueryOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PAGE_TEXT_QUERY");
@@ -382,7 +382,7 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleCorpseMapPositionQuery(WorldPacket & recvData)
+void WorldSession::HandleCorpseMapPositionQuery(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY");
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index 4196bc26b91..8b230ae05c9 100755..100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -33,7 +33,7 @@
#include "ScriptMgr.h"
#include "GameObjectAI.h"
-void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recvData)
+void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
{
uint64 guid;
recvData >> guid;
@@ -43,7 +43,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recvData)
Object* questgiver = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!questgiver)
{
- sLog->outInfo(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid));
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for non-existing questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid));
return;
}
@@ -79,7 +79,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recvData)
_player->PlayerTalkClass->SendQuestGiverStatus(questStatus, guid);
}
-void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recvData)
+void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
{
uint64 guid;
recvData >> guid;
@@ -109,7 +109,7 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recvData)
creature->AI()->sGossipHello(_player);
}
-void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recvData)
+void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
{
uint64 guid;
uint32 questId;
@@ -230,7 +230,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recvData)
_player->PlayerTalkClass->SendCloseGossip();
}
-void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recvData)
+void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData)
{
uint64 guid;
uint32 questId;
@@ -268,7 +268,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleQuestQueryOpcode(WorldPacket & recvData)
+void WorldSession::HandleQuestQueryOpcode(WorldPacket& recvData)
{
if (!_player)
return;
@@ -281,7 +281,7 @@ void WorldSession::HandleQuestQueryOpcode(WorldPacket & recvData)
_player->PlayerTalkClass->SendQuestQueryResponse(quest);
}
-void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recvData)
+void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
{
uint32 questId, reward;
uint64 guid;
@@ -289,7 +289,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recvData)
if (reward >= QUEST_REWARD_CHOICES_COUNT)
{
- sLog->outError(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (probably packet hacking)", _player->GetName().c_str(), _player->GetGUIDLow(), reward);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (possible packet-hacking detected)", _player->GetName().c_str(), _player->GetGUIDLow(), reward);
return;
}
@@ -308,7 +308,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recvData)
if ((!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) ||
(_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete()))
{
- sLog->outError(LOG_FILTER_NETWORKIO, "HACK ALERT: Player %s (guid: %u) is trying to complete quest (id: %u) but he has no right to do it!",
+ sLog->outError(LOG_FILTER_NETWORKIO, "Error in QUEST_STATUS_COMPLETE: player %s (guid %u) tried to complete quest %u, but is not allowed to do so (possible packet-hacking or high latency)",
_player->GetName().c_str(), _player->GetGUIDLow(), questId);
return;
}
@@ -365,7 +365,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket & recvData)
+void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData)
{
uint32 questId;
uint64 guid;
diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp
index ec389142182..f5f48b2a45b 100755..100644
--- a/src/server/game/Handlers/SkillHandler.cpp
+++ b/src/server/game/Handlers/SkillHandler.cpp
@@ -27,7 +27,7 @@
#include "WorldPacket.h"
#include "WorldSession.h"
-void WorldSession::HandleLearnTalentOpcode(WorldPacket & recvData)
+void WorldSession::HandleLearnTalentOpcode(WorldPacket& recvData)
{
uint32 talent_id, requested_rank;
recvData >> talent_id >> requested_rank;
@@ -55,7 +55,7 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket)
_player->SendTalentsInfoData(false);
}
-void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket & recvData)
+void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_TALENT_WIPE_CONFIRM");
uint64 guid;
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index 270980c8e7c..7002a55e2d1 100755..100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -51,15 +51,8 @@ void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlag
recvPacket >> hasMovementData;
if (hasMovementData)
{
- recvPacket.rfinish();
- // movement packet for caster of the spell
- /*recvPacket.read_skip<uint32>(); // MSG_MOVE_STOP - hardcoded in client
- uint64 guid;
- recvPacket.readPackGUID(guid);
-
- MovementInfo movementInfo;
- movementInfo.guid = guid;
- ReadMovementInfo(recvPacket, &movementInfo);*/
+ recvPacket.SetOpcode(recvPacket.read<uint32>());
+ HandleMovementOpcodes(recvPacket);
}
}
}
@@ -270,7 +263,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
pUser->SendLoot(item->GetGUID(), LOOT_CORPSE);
}
-void WorldSession::HandleGameObjectUseOpcode(WorldPacket & recvData)
+void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData)
{
uint64 guid;
@@ -486,7 +479,7 @@ void WorldSession::HandleCancelAutoRepeatSpellOpcode(WorldPacket& /*recvPacket*/
_player->InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
}
-void WorldSession::HandleCancelChanneling(WorldPacket & recvData)
+void WorldSession::HandleCancelChanneling(WorldPacket& recvData)
{
recvData.read_skip<uint32>(); // spellid, not used
@@ -556,7 +549,7 @@ void WorldSession::HandleSpellClick(WorldPacket& recvData)
unit->HandleSpellClick(_player);
}
-void WorldSession::HandleMirrorImageDataRequest(WorldPacket & recvData)
+void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GET_MIRRORIMAGE_DATA");
uint64 guid;
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp
index 16ffdfbc440..1df98af315d 100755..100644
--- a/src/server/game/Handlers/TaxiHandler.cpp
+++ b/src/server/game/Handlers/TaxiHandler.cpp
@@ -28,7 +28,7 @@
#include "Path.h"
#include "WaypointMovementGenerator.h"
-void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket & recvData)
+void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TAXINODE_STATUS_QUERY");
@@ -63,7 +63,7 @@ void WorldSession::SendTaxiStatus(uint64 guid)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_TAXINODE_STATUS");
}
-void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket & recvData)
+void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES");
@@ -163,7 +163,7 @@ void WorldSession::SendDiscoverNewTaxiNode(uint32 nodeid)
}
}
-void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket & recvData)
+void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXIEXPRESS");
@@ -273,7 +273,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
}
-void WorldSession::HandleActivateTaxiOpcode(WorldPacket & recvData)
+void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI");
diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp
index 1571d857f41..a632f956470 100755..100644
--- a/src/server/game/Handlers/TicketHandler.cpp
+++ b/src/server/game/Handlers/TicketHandler.cpp
@@ -97,7 +97,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
SendPacket(&data);
}
-void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recvData)
+void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket& recvData)
{
std::string message;
recvData >> message;
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index 08f2d61826e..08f2d61826e 100755..100644
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
diff --git a/src/server/game/Handlers/VoiceChatHandler.cpp b/src/server/game/Handlers/VoiceChatHandler.cpp
index 785b4f8e5cd..785b4f8e5cd 100755..100644
--- a/src/server/game/Handlers/VoiceChatHandler.cpp
+++ b/src/server/game/Handlers/VoiceChatHandler.cpp
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index 48ed7bdba1f..48ed7bdba1f 100755..100644
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h
index 83c2170255d..83c2170255d 100755..100644
--- a/src/server/game/Instances/InstanceSaveMgr.h
+++ b/src/server/game/Instances/InstanceSaveMgr.h
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index a370cf25d97..a370cf25d97 100755..100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index f1766833aee..f1766833aee 100755..100644
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index ef3d2b9fbd6..098fcc657b3 100755..100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -334,6 +334,7 @@ LootItem::LootItem(LootStoreItem const& li)
is_blocked = 0;
is_underthreshold = 0;
is_counted = 0;
+ canSave = true;
}
// Basic checks for player/item compatibility - if false no chance to see the item in the loot
@@ -654,6 +655,33 @@ void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
}
}
+void Loot::DeleteLootItemFromContainerItemDB(uint32 itemID)
+{
+ // Deletes a single item associated with an openable item from the DB
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEM);
+ stmt->setUInt32(0, containerID);
+ stmt->setUInt32(1, itemID);
+ CharacterDatabase.Execute(stmt);
+
+ // Mark the item looted to prevent resaving
+ for (LootItemList::iterator _itr = items.begin(); _itr != items.end(); _itr++)
+ {
+ if (!_itr->itemid == itemID)
+ continue;
+
+ _itr->canSave = true;
+ break;
+ }
+}
+
+void Loot::DeleteLootMoneyFromContainerItemDB()
+{
+ // Deletes money loot associated with an openable item from the DB
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY);
+ stmt->setUInt32(0, containerID);
+ CharacterDatabase.Execute(stmt);
+}
+
LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem* *qitem, QuestItem* *ffaitem, QuestItem* *conditem)
{
LootItem* item = NULL;
@@ -1239,6 +1267,19 @@ void LootTemplate::CopyConditions(ConditionList conditions)
i->CopyConditions(conditions);
}
+void LootTemplate::CopyConditions(LootItem* li) const
+{
+ // Copies the conditions list from a template item to a LootItem
+ for (LootStoreItemList::const_iterator _iter = Entries.begin(); _iter != Entries.end(); ++_iter)
+ {
+ if (!_iter->itemid == li->itemid)
+ continue;
+
+ li->conditions = _iter->conditions;
+ break;
+ }
+}
+
// Rolls for every item in the template and adds the rolled items the the loot
void LootTemplate::Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId) const
{
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index 45fc5c7983c..cfa5d370e3b 100755..100644
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -141,14 +141,17 @@ struct LootItem
bool is_counted : 1;
bool needs_quest : 1; // quest drop
bool follow_loot_rules : 1;
+ bool canSave;
// Constructor, copies most fields from LootStoreItem, generates random count and random suffixes/properties
// Should be called for non-reference LootStoreItem entries only (mincountOrRef > 0)
explicit LootItem(LootStoreItem const& li);
+ // Empty constructor for creating an empty LootItem to be filled in with DB data
+ LootItem() : canSave(true){};
+
// Basic checks for player/item compatibility - if false no chance to see the item in the loot
bool AllowedForPlayer(Player const* player) const;
-
void AddAllowedLooter(Player const* player);
const AllowedLooterSet & GetAllowedLooters() const { return allowedGUIDs; }
};
@@ -223,6 +226,7 @@ class LootTemplate
// Rolls for every item in the template and adds the rolled items the the loot
void Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId = 0) const;
void CopyConditions(ConditionList conditions);
+ void CopyConditions(LootItem* li) const;
// True if template includes at least 1 quest drop entry
bool HasQuestDrop(LootTemplateMap const& store, uint8 groupId = 0) const;
@@ -286,10 +290,18 @@ struct Loot
uint8 unlootedCount;
uint64 roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
LootType loot_type; // required for achievement system
+
+ // GUIDLow of container that holds this loot (item_instance.entry)
+ // Only set for inventory items that can be right-click looted
+ uint32 containerID;
- Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), loot_type(LOOT_CORPSE) {}
+ Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), loot_type(LOOT_CORPSE), containerID(0) {}
~Loot() { clear(); }
+ // For deleting items at loot removal since there is no backward interface to the Item()
+ void DeleteLootItemFromContainerItemDB(uint32 itemID);
+ void DeleteLootMoneyFromContainerItemDB();
+
// if loot becomes invalid this reference is used to inform the listener
void addLootValidatorRef(LootValidatorRef* pLootValidatorRef)
{
diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp
index 108856d81b6..108856d81b6 100755..100644
--- a/src/server/game/Mails/Mail.cpp
+++ b/src/server/game/Mails/Mail.cpp
diff --git a/src/server/game/Mails/Mail.h b/src/server/game/Mails/Mail.h
index c2771f4b57c..c2771f4b57c 100755..100644
--- a/src/server/game/Mails/Mail.h
+++ b/src/server/game/Mails/Mail.h
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 1bb651831c7..3ef168929c9 100755..100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -1113,7 +1113,7 @@ bool GridMap::loadData(char* filename)
return false;
}
// loadup height data
- if (header.heightMapOffset && !loadHeihgtData(in, header.heightMapOffset, header.heightMapSize))
+ if (header.heightMapOffset && !loadHeightData(in, header.heightMapOffset, header.heightMapSize))
{
sLog->outError(LOG_FILTER_MAPS, "Error loading map height data\n");
fclose(in);
@@ -1169,7 +1169,7 @@ bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/)
return true;
}
-bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/)
+bool GridMap::loadHeightData(FILE* in, uint32 offset, uint32 /*size*/)
{
map_heightHeader header;
fseek(in, offset, SEEK_SET);
@@ -2489,7 +2489,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId))
if (LFGDungeonData const* randomDungeon = sLFGMgr->GetLFGDungeon(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin())))
- if (uint32(dungeon->map) == GetId() && dungeon->difficulty == uint32(GetDifficulty()) && randomDungeon->type == uint32(LFG_TYPE_RANDOM))
+ if (uint32(dungeon->map) == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM)
player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true);
}
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index e35f430b638..4bf2544543a 100755..100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -178,7 +178,7 @@ class GridMap
bool loadAreaData(FILE* in, uint32 offset, uint32 size);
- bool loadHeihgtData(FILE* in, uint32 offset, uint32 size);
+ bool loadHeightData(FILE* in, uint32 offset, uint32 size);
bool loadLiquidData(FILE* in, uint32 offset, uint32 size);
// Get height functions and pointers
diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp
index f45105c324a..f45105c324a 100755..100644
--- a/src/server/game/Maps/MapInstanced.cpp
+++ b/src/server/game/Maps/MapInstanced.cpp
diff --git a/src/server/game/Maps/MapInstanced.h b/src/server/game/Maps/MapInstanced.h
index 0b1a404630b..0b1a404630b 100755..100644
--- a/src/server/game/Maps/MapInstanced.h
+++ b/src/server/game/Maps/MapInstanced.h
diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp
index 96a2a44655d..96a2a44655d 100755..100644
--- a/src/server/game/Maps/MapManager.cpp
+++ b/src/server/game/Maps/MapManager.cpp
diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h
index aa07eef2204..aa07eef2204 100755..100644
--- a/src/server/game/Maps/MapManager.h
+++ b/src/server/game/Maps/MapManager.h
diff --git a/src/server/game/Maps/MapRefManager.h b/src/server/game/Maps/MapRefManager.h
index 3976139a18d..3976139a18d 100755..100644
--- a/src/server/game/Maps/MapRefManager.h
+++ b/src/server/game/Maps/MapRefManager.h
diff --git a/src/server/game/Maps/MapReference.h b/src/server/game/Maps/MapReference.h
index 86709fb28ab..86709fb28ab 100755..100644
--- a/src/server/game/Maps/MapReference.h
+++ b/src/server/game/Maps/MapReference.h
diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h
index 7b20b0ee676..7b20b0ee676 100755..100644
--- a/src/server/game/Maps/ZoneScript.h
+++ b/src/server/game/Maps/ZoneScript.h
diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h
index 4f358d7a145..4f358d7a145 100755..100644
--- a/src/server/game/Miscellaneous/Formulas.h
+++ b/src/server/game/Miscellaneous/Formulas.h
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index 5321202b256..df5f45622f8 100755..100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -86,8 +86,7 @@ enum TrinityStrings
LANG_CONNECTED_PLAYERS = 60,
LANG_ACCOUNT_ADDON = 61,
LANG_IMPROPER_VALUE = 62,
- LANG_CANT_DO_NOW = 63,
- // Room for more level 0 64-99 not used
+ // Room for more level 0 63-99 not used
// level 1 chat
LANG_GLOBAL_NOTIFY = 100,
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index 7d69753b287..283025c7e0d 100755..100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -37,11 +37,11 @@ enum SpellEffIndex
// loot modes for creatures and gameobjects, bitmask!
enum LootModes
{
- LOOT_MODE_DEFAULT = 1,
- LOOT_MODE_HARD_MODE_1 = 2,
- LOOT_MODE_HARD_MODE_2 = 4,
- LOOT_MODE_HARD_MODE_3 = 8,
- LOOT_MODE_HARD_MODE_4 = 16
+ LOOT_MODE_DEFAULT = 0x1,
+ LOOT_MODE_HARD_MODE_1 = 0x2,
+ LOOT_MODE_HARD_MODE_2 = 0x4,
+ LOOT_MODE_HARD_MODE_3 = 0x8,
+ LOOT_MODE_HARD_MODE_4 = 0x10
};
enum Gender
@@ -54,28 +54,28 @@ enum Gender
// Race value is index in ChrRaces.dbc
enum Races
{
- RACE_NONE = 0,
- RACE_HUMAN = 1,
- RACE_ORC = 2,
- RACE_DWARF = 3,
- RACE_NIGHTELF = 4,
- RACE_UNDEAD_PLAYER = 5,
- RACE_TAUREN = 6,
- RACE_GNOME = 7,
- RACE_TROLL = 8,
- //RACE_GOBLIN = 9,
- RACE_BLOODELF = 10,
- RACE_DRAENEI = 11
- //RACE_FEL_ORC = 12,
- //RACE_NAGA = 13,
- //RACE_BROKEN = 14,
- //RACE_SKELETON = 15,
- //RACE_VRYKUL = 16,
- //RACE_TUSKARR = 17,
- //RACE_FOREST_TROLL = 18,
- //RACE_TAUNKA = 19,
+ RACE_NONE = 0,
+ RACE_HUMAN = 1,
+ RACE_ORC = 2,
+ RACE_DWARF = 3,
+ RACE_NIGHTELF = 4,
+ RACE_UNDEAD_PLAYER = 5,
+ RACE_TAUREN = 6,
+ RACE_GNOME = 7,
+ RACE_TROLL = 8,
+ //RACE_GOBLIN = 9,
+ RACE_BLOODELF = 10,
+ RACE_DRAENEI = 11
+ //RACE_FEL_ORC = 12,
+ //RACE_NAGA = 13,
+ //RACE_BROKEN = 14,
+ //RACE_SKELETON = 15,
+ //RACE_VRYKUL = 16,
+ //RACE_TUSKARR = 17,
+ //RACE_FOREST_TROLL = 18,
+ //RACE_TAUNKA = 19,
//RACE_NORTHREND_SKELETON = 20,
- //RACE_ICE_TROLL = 21
+ //RACE_ICE_TROLL = 21
};
// max+1 for player race
@@ -83,13 +83,13 @@ enum Races
#define RACEMASK_ALL_PLAYABLE \
((1<<(RACE_HUMAN-1)) |(1<<(RACE_ORC-1)) |(1<<(RACE_DWARF-1)) | \
- (1<<(RACE_NIGHTELF-1))|(1<<(RACE_UNDEAD_PLAYER-1))|(1<<(RACE_TAUREN-1)) | \
- (1<<(RACE_GNOME-1)) |(1<<(RACE_TROLL-1)) |(1<<(RACE_BLOODELF-1))| \
- (1<<(RACE_DRAENEI-1)))
+ (1<<(RACE_NIGHTELF-1))|(1<<(RACE_UNDEAD_PLAYER-1))|(1<<(RACE_TAUREN-1)) | \
+ (1<<(RACE_GNOME-1)) |(1<<(RACE_TROLL-1)) |(1<<(RACE_BLOODELF-1))| \
+ (1<<(RACE_DRAENEI-1)))
#define RACEMASK_ALLIANCE \
((1<<(RACE_HUMAN-1)) | (1<<(RACE_DWARF-1)) | (1<<(RACE_NIGHTELF-1)) | \
- (1<<(RACE_GNOME-1)) | (1<<(RACE_DRAENEI-1)))
+ (1<<(RACE_GNOME-1)) | (1<<(RACE_DRAENEI-1)))
#define RACEMASK_HORDE RACEMASK_ALL_PLAYABLE & ~RACEMASK_ALLIANCE
@@ -2520,47 +2520,47 @@ uint32 const CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL = (1 << (CREATURE_TYPE_ME
// CreatureFamily.dbc
enum CreatureFamily
{
- CREATURE_FAMILY_WOLF = 1,
- CREATURE_FAMILY_CAT = 2,
- CREATURE_FAMILY_SPIDER = 3,
- CREATURE_FAMILY_BEAR = 4,
- CREATURE_FAMILY_BOAR = 5,
- CREATURE_FAMILY_CROCOLISK = 6,
- CREATURE_FAMILY_CARRION_BIRD = 7,
- CREATURE_FAMILY_CRAB = 8,
- CREATURE_FAMILY_GORILLA = 9,
- CREATURE_FAMILY_HORSE_CUSTOM = 10, // not exist in DBC but used for horse like beasts in DB
- CREATURE_FAMILY_RAPTOR = 11,
- CREATURE_FAMILY_TALLSTRIDER = 12,
- CREATURE_FAMILY_FELHUNTER = 15,
- CREATURE_FAMILY_VOIDWALKER = 16,
- CREATURE_FAMILY_SUCCUBUS = 17,
- CREATURE_FAMILY_DOOMGUARD = 19,
- CREATURE_FAMILY_SCORPID = 20,
- CREATURE_FAMILY_TURTLE = 21,
- CREATURE_FAMILY_IMP = 23,
- CREATURE_FAMILY_BAT = 24,
- CREATURE_FAMILY_HYENA = 25,
- CREATURE_FAMILY_BIRD_OF_PREY = 26,
- CREATURE_FAMILY_WIND_SERPENT = 27,
- CREATURE_FAMILY_REMOTE_CONTROL = 28,
- CREATURE_FAMILY_FELGUARD = 29,
- CREATURE_FAMILY_DRAGONHAWK = 30,
- CREATURE_FAMILY_RAVAGER = 31,
- CREATURE_FAMILY_WARP_STALKER = 32,
- CREATURE_FAMILY_SPOREBAT = 33,
- CREATURE_FAMILY_NETHER_RAY = 34,
- CREATURE_FAMILY_SERPENT = 35,
- CREATURE_FAMILY_MOTH = 37,
- CREATURE_FAMILY_CHIMAERA = 38,
- CREATURE_FAMILY_DEVILSAUR = 39,
- CREATURE_FAMILY_GHOUL = 40,
- CREATURE_FAMILY_SILITHID = 41,
- CREATURE_FAMILY_WORM = 42,
- CREATURE_FAMILY_RHINO = 43,
- CREATURE_FAMILY_WASP = 44,
- CREATURE_FAMILY_CORE_HOUND = 45,
- CREATURE_FAMILY_SPIRIT_BEAST = 46
+ CREATURE_FAMILY_WOLF = 1,
+ CREATURE_FAMILY_CAT = 2,
+ CREATURE_FAMILY_SPIDER = 3,
+ CREATURE_FAMILY_BEAR = 4,
+ CREATURE_FAMILY_BOAR = 5,
+ CREATURE_FAMILY_CROCOLISK = 6,
+ CREATURE_FAMILY_CARRION_BIRD = 7,
+ CREATURE_FAMILY_CRAB = 8,
+ CREATURE_FAMILY_GORILLA = 9,
+ CREATURE_FAMILY_HORSE_CUSTOM = 10, // Does not exist in DBC but used for horse like beasts in DB
+ CREATURE_FAMILY_RAPTOR = 11,
+ CREATURE_FAMILY_TALLSTRIDER = 12,
+ CREATURE_FAMILY_FELHUNTER = 15,
+ CREATURE_FAMILY_VOIDWALKER = 16,
+ CREATURE_FAMILY_SUCCUBUS = 17,
+ CREATURE_FAMILY_DOOMGUARD = 19,
+ CREATURE_FAMILY_SCORPID = 20,
+ CREATURE_FAMILY_TURTLE = 21,
+ CREATURE_FAMILY_IMP = 23,
+ CREATURE_FAMILY_BAT = 24,
+ CREATURE_FAMILY_HYENA = 25,
+ CREATURE_FAMILY_BIRD_OF_PREY = 26,
+ CREATURE_FAMILY_WIND_SERPENT = 27,
+ CREATURE_FAMILY_REMOTE_CONTROL = 28,
+ CREATURE_FAMILY_FELGUARD = 29,
+ CREATURE_FAMILY_DRAGONHAWK = 30,
+ CREATURE_FAMILY_RAVAGER = 31,
+ CREATURE_FAMILY_WARP_STALKER = 32,
+ CREATURE_FAMILY_SPOREBAT = 33,
+ CREATURE_FAMILY_NETHER_RAY = 34,
+ CREATURE_FAMILY_SERPENT = 35,
+ CREATURE_FAMILY_MOTH = 37,
+ CREATURE_FAMILY_CHIMAERA = 38,
+ CREATURE_FAMILY_DEVILSAUR = 39,
+ CREATURE_FAMILY_GHOUL = 40,
+ CREATURE_FAMILY_SILITHID = 41,
+ CREATURE_FAMILY_WORM = 42,
+ CREATURE_FAMILY_RHINO = 43,
+ CREATURE_FAMILY_WASP = 44,
+ CREATURE_FAMILY_CORE_HOUND = 45,
+ CREATURE_FAMILY_SPIRIT_BEAST = 46
};
enum CreatureTypeFlags
@@ -2993,7 +2993,7 @@ enum WeatherType
enum ChatMsg
{
- CHAT_MSG_ADDON = 0xFFFFFFFF,
+ CHAT_MSG_ADDON = 0xFFFFFFFF, // -1
CHAT_MSG_SYSTEM = 0x00,
CHAT_MSG_SAY = 0x01,
CHAT_MSG_PARTY = 0x02,
@@ -3077,8 +3077,11 @@ enum PetDiet
#define CHAIN_SPELL_JUMP_RADIUS 8
-#define GUILD_BANKLOG_MAX_RECORDS 25
-#define GUILD_EVENTLOG_MAX_RECORDS 100
+enum GuildLogs
+{
+ GUILD_BANKLOG_MAX_RECORDS = 25,
+ GUILD_EVENTLOG_MAX_RECORDS = 100,
+};
enum AiReaction
{
@@ -3152,7 +3155,8 @@ enum SummonType
enum EventId
{
- EVENT_CHARGE = 1003
+ EVENT_CHARGE = 1003,
+ EVENT_JUMP = 1004
};
enum ResponseCodes
@@ -3231,9 +3235,7 @@ enum ResponseCodes
CHAR_CREATE_CHARACTER_DELETE_MAIL = 0x41,
CHAR_CREATE_CHARACTER_SWAP_FACTION = 0x42,
CHAR_CREATE_CHARACTER_RACE_ONLY = 0x43,
-
CHAR_CREATE_CHARACTER_GOLD_LIMIT = 0x44,
-
CHAR_CREATE_FORCE_LOGIN = 0x45,
CHAR_DELETE_IN_PROGRESS = 0x46,
@@ -3293,20 +3295,20 @@ enum BanReturn
// indexes of BattlemasterList.dbc
enum BattlegroundTypeId
{
- BATTLEGROUND_TYPE_NONE = 0, // None
- BATTLEGROUND_AV = 1, // Alterac Valley
- BATTLEGROUND_WS = 2, // Warsong Gulch
- BATTLEGROUND_AB = 3, // Arathi Basin
- BATTLEGROUND_NA = 4, // Nagrand Arena
- BATTLEGROUND_BE = 5, // Blade's Edge Arena
- BATTLEGROUND_AA = 6, // All Arenas
- BATTLEGROUND_EY = 7, // Eye of the Storm
- BATTLEGROUND_RL = 8, // Ruins of Lordaernon
- BATTLEGROUND_SA = 9, // Strand of the Ancients
- BATTLEGROUND_DS = 10, // Dalaran Sewers
- BATTLEGROUND_RV = 11, // Ring of Valor
- BATTLEGROUND_IC = 30, // Isle of Conquest
- BATTLEGROUND_RB = 32 // Random Battleground
+ BATTLEGROUND_TYPE_NONE = 0, // None
+ BATTLEGROUND_AV = 1, // Alterac Valley
+ BATTLEGROUND_WS = 2, // Warsong Gulch
+ BATTLEGROUND_AB = 3, // Arathi Basin
+ BATTLEGROUND_NA = 4, // Nagrand Arena
+ BATTLEGROUND_BE = 5, // Blade's Edge Arena
+ BATTLEGROUND_AA = 6, // All Arenas
+ BATTLEGROUND_EY = 7, // Eye of the Storm
+ BATTLEGROUND_RL = 8, // Ruins of Lordaernon
+ BATTLEGROUND_SA = 9, // Strand of the Ancients
+ BATTLEGROUND_DS = 10, // Dalaran Sewers
+ BATTLEGROUND_RV = 11, // Ring of Valor
+ BATTLEGROUND_IC = 30, // Isle of Conquest
+ BATTLEGROUND_RB = 32 // Random Battleground
};
#define MAX_BATTLEGROUND_TYPE_ID 33
diff --git a/src/server/game/Movement/FollowerRefManager.h b/src/server/game/Movement/FollowerRefManager.h
index 5066804d60f..5066804d60f 100755..100644
--- a/src/server/game/Movement/FollowerRefManager.h
+++ b/src/server/game/Movement/FollowerRefManager.h
diff --git a/src/server/game/Movement/FollowerReference.cpp b/src/server/game/Movement/FollowerReference.cpp
index 997d066a9f2..997d066a9f2 100755..100644
--- a/src/server/game/Movement/FollowerReference.cpp
+++ b/src/server/game/Movement/FollowerReference.cpp
diff --git a/src/server/game/Movement/FollowerReference.h b/src/server/game/Movement/FollowerReference.h
index 6a1a3719cb8..6a1a3719cb8 100755..100644
--- a/src/server/game/Movement/FollowerReference.h
+++ b/src/server/game/Movement/FollowerReference.h
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 48f17a0d0c6..600165f5d97 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -378,14 +378,14 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
}
-void MotionMaster::MoveFall(uint32 id/*=0*/)
+void MotionMaster::MoveFall(uint32 id /*=0*/)
{
// use larger distance for vmap height search than in most other cases
float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
if (tz <= INVALID_HEIGHT)
{
sLog->outDebug(LOG_FILTER_GENERAL, "MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).",
- _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ());
+ _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ());
return;
}
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h
index 0dd9248da7a..b0676e02f51 100755..100644
--- a/src/server/game/Movement/MotionMaster.h
+++ b/src/server/game/Movement/MotionMaster.h
@@ -165,7 +165,9 @@ class MotionMaster //: private std::stack<MovementGenerator *>
void MoveCharge(PathGenerator path, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE);
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ);
void MoveJumpTo(float angle, float speedXY, float speedZ);
- void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = 0);
+ void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = EVENT_JUMP)
+ { MoveJump(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speedXY, speedZ, id); };
+ void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = EVENT_JUMP);
void MoveFall(uint32 id = 0);
void MoveSeekAssistance(float x, float y, float z);
diff --git a/src/server/game/Movement/MovementGenerator.cpp b/src/server/game/Movement/MovementGenerator.cpp
index 73921ea86ff..73921ea86ff 100755..100644
--- a/src/server/game/Movement/MovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerator.cpp
diff --git a/src/server/game/Movement/MovementGenerator.h b/src/server/game/Movement/MovementGenerator.h
index ee8dfb51cce..43d03160a41 100755
--- a/src/server/game/Movement/MovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerator.h
@@ -38,7 +38,7 @@ class MovementGenerator
virtual void Reset(Unit*) = 0;
- virtual bool Update(Unit*, const uint32& time_diff) = 0;
+ virtual bool Update(Unit*, uint32 time_diff) = 0;
virtual MovementGeneratorType GetMovementGeneratorType() = 0;
@@ -70,7 +70,7 @@ class MovementGeneratorMedium : public MovementGenerator
(static_cast<D*>(this))->Reset(static_cast<T*>(u));
}
- bool Update(Unit* u, const uint32& time_diff)
+ bool Update(Unit* u, uint32 time_diff)
{
//u->AssertIsType<T>();
return (static_cast<D*>(this))->Update(static_cast<T*>(u), time_diff);
diff --git a/src/server/game/Movement/MovementGeneratorImpl.h b/src/server/game/Movement/MovementGeneratorImpl.h
index 725b309e3f1..725b309e3f1 100755..100644
--- a/src/server/game/Movement/MovementGeneratorImpl.h
+++ b/src/server/game/Movement/MovementGeneratorImpl.h
diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
index a8b4d68c802..9ccb13c32ee 100755
--- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
@@ -57,7 +57,7 @@ void ConfusedMovementGenerator<T>::Reset(T* unit)
}
template<class T>
-bool ConfusedMovementGenerator<T>::Update(T* unit, const uint32& diff)
+bool ConfusedMovementGenerator<T>::Update(T* unit, uint32 diff)
{
if (unit->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
return true;
@@ -125,6 +125,6 @@ template void ConfusedMovementGenerator<Player>::Initialize(Player*);
template void ConfusedMovementGenerator<Creature>::Initialize(Creature*);
template void ConfusedMovementGenerator<Player>::Reset(Player*);
template void ConfusedMovementGenerator<Creature>::Reset(Creature*);
-template bool ConfusedMovementGenerator<Player>::Update(Player*, const uint32&);
-template bool ConfusedMovementGenerator<Creature>::Update(Creature*, const uint32&);
+template bool ConfusedMovementGenerator<Player>::Update(Player*, uint32 diff);
+template bool ConfusedMovementGenerator<Creature>::Update(Creature*, uint32 diff);
diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
index 5b535e2d47d..22d9bcc1a07 100755
--- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
@@ -31,7 +31,7 @@ class ConfusedMovementGenerator : public MovementGeneratorMedium< T, ConfusedMov
void Initialize(T*);
void Finalize(T*);
void Reset(T*);
- bool Update(T*, const uint32&);
+ bool Update(T*, uint32);
MovementGeneratorType GetMovementGeneratorType() { return CONFUSED_MOTION_TYPE; }
private:
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
index 3d75e384e93..7f9c7fac7e7 100644
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
@@ -136,7 +136,7 @@ void FleeingMovementGenerator<T>::Reset(T* owner)
}
template<class T>
-bool FleeingMovementGenerator<T>::Update(T* owner, const uint32& time_diff)
+bool FleeingMovementGenerator<T>::Update(T* owner, uint32 time_diff)
{
if (!owner || !owner->isAlive())
return false;
@@ -162,8 +162,8 @@ template void FleeingMovementGenerator<Player>::_setTargetLocation(Player*);
template void FleeingMovementGenerator<Creature>::_setTargetLocation(Creature*);
template void FleeingMovementGenerator<Player>::Reset(Player*);
template void FleeingMovementGenerator<Creature>::Reset(Creature*);
-template bool FleeingMovementGenerator<Player>::Update(Player*, const uint32&);
-template bool FleeingMovementGenerator<Creature>::Update(Creature*, const uint32&);
+template bool FleeingMovementGenerator<Player>::Update(Player*, uint32);
+template bool FleeingMovementGenerator<Creature>::Update(Creature*, uint32);
void TimedFleeingMovementGenerator::Finalize(Unit* owner)
{
@@ -179,7 +179,7 @@ void TimedFleeingMovementGenerator::Finalize(Unit* owner)
}
}
-bool TimedFleeingMovementGenerator::Update(Unit* owner, const uint32& time_diff)
+bool TimedFleeingMovementGenerator::Update(Unit* owner, uint32 time_diff)
{
if (!owner->isAlive())
return false;
@@ -194,7 +194,7 @@ bool TimedFleeingMovementGenerator::Update(Unit* owner, const uint32& time_diff)
if (i_totalFleeTime.Passed())
return false;
- // This calls grant-parent Update method hiden by FleeingMovementGenerator::Update(Creature &, const uint32 &) version
+ // This calls grant-parent Update method hiden by FleeingMovementGenerator::Update(Creature &, uint32) version
// This is done instead of casting Unit& to Creature& and call parent method, then we can use Unit directly
return MovementGeneratorMedium< Creature, FleeingMovementGenerator<Creature> >::Update(owner, time_diff);
}
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
index ed1fe85a314..05c3916ea8a 100755
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
@@ -30,7 +30,7 @@ class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovem
void Initialize(T*);
void Finalize(T*);
void Reset(T*);
- bool Update(T*, const uint32&);
+ bool Update(T*, uint32);
MovementGeneratorType GetMovementGeneratorType() { return FLEEING_MOTION_TYPE; }
@@ -50,7 +50,7 @@ class TimedFleeingMovementGenerator : public FleeingMovementGenerator<Creature>
i_totalFleeTime(time) {}
MovementGeneratorType GetMovementGeneratorType() { return TIMED_FLEEING_MOTION_TYPE; }
- bool Update(Unit*, const uint32&);
+ bool Update(Unit*, uint32);
void Finalize(Unit*);
private:
diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h
index dfbea60d353..dfbea60d353 100755..100644
--- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h
diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp
index 8ef9bd7697a..b33cddc6f6d 100755
--- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp
@@ -48,7 +48,7 @@ void RotateMovementGenerator::Initialize(Unit* owner)
owner->AttackStop();
}
-bool RotateMovementGenerator::Update(Unit* owner, const uint32& diff)
+bool RotateMovementGenerator::Update(Unit* owner, uint32 diff)
{
float angle = owner->GetOrientation();
if (m_direction == ROTATE_DIRECTION_LEFT)
@@ -89,7 +89,7 @@ void DistractMovementGenerator::Finalize(Unit* owner)
owner->ClearUnitState(UNIT_STATE_DISTRACTED);
}
-bool DistractMovementGenerator::Update(Unit* /*owner*/, const uint32& time_diff)
+bool DistractMovementGenerator::Update(Unit* /*owner*/, uint32 time_diff)
{
if (time_diff > m_timer)
return false;
diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h
index 14287d871c9..4a2a5e35d22 100755
--- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h
@@ -28,7 +28,7 @@ class IdleMovementGenerator : public MovementGenerator
void Initialize(Unit*);
void Finalize(Unit*) { }
void Reset(Unit*);
- bool Update(Unit*, const uint32&) { return true; }
+ bool Update(Unit*, uint32) { return true; }
MovementGeneratorType GetMovementGeneratorType() { return IDLE_MOTION_TYPE; }
};
@@ -42,7 +42,7 @@ class RotateMovementGenerator : public MovementGenerator
void Initialize(Unit*);
void Finalize(Unit*);
void Reset(Unit* owner) { Initialize(owner); }
- bool Update(Unit*, const uint32&);
+ bool Update(Unit*, uint32);
MovementGeneratorType GetMovementGeneratorType() { return ROTATE_MOTION_TYPE; }
private:
@@ -58,7 +58,7 @@ class DistractMovementGenerator : public MovementGenerator
void Initialize(Unit*);
void Finalize(Unit*);
void Reset(Unit* owner) { Initialize(owner); }
- bool Update(Unit*, const uint32&);
+ bool Update(Unit*, uint32);
MovementGeneratorType GetMovementGeneratorType() { return DISTRACT_MOTION_TYPE; }
private:
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
index c022de31869..5d70b1aac3a 100755
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
@@ -45,7 +45,7 @@ void PointMovementGenerator<T>::Initialize(T* unit)
}
template<class T>
-bool PointMovementGenerator<T>::Update(T* unit, const uint32& /*diff*/)
+bool PointMovementGenerator<T>::Update(T* unit, uint32 /*diff*/)
{
if (!unit)
return false;
@@ -107,8 +107,8 @@ template void PointMovementGenerator<Player>::Finalize(Player*);
template void PointMovementGenerator<Creature>::Finalize(Creature*);
template void PointMovementGenerator<Player>::Reset(Player*);
template void PointMovementGenerator<Creature>::Reset(Creature*);
-template bool PointMovementGenerator<Player>::Update(Player*, const uint32&);
-template bool PointMovementGenerator<Creature>::Update(Creature*, const uint32&);
+template bool PointMovementGenerator<Player>::Update(Player*, uint32);
+template bool PointMovementGenerator<Creature>::Update(Creature*, uint32);
void AssistanceMovementGenerator::Finalize(Unit* unit)
{
@@ -118,7 +118,7 @@ void AssistanceMovementGenerator::Finalize(Unit* unit)
unit->GetMotionMaster()->MoveSeekAssistanceDistract(sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY));
}
-bool EffectMovementGenerator::Update(Unit* unit, const uint32&)
+bool EffectMovementGenerator::Update(Unit* unit, uint32)
{
return !unit->movespline->Finalized();
}
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
index e01ced758a3..c26ff94c3a4 100644
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
@@ -32,7 +32,7 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG
void Initialize(T*);
void Finalize(T*);
void Reset(T*);
- bool Update(T*, const uint32 &);
+ bool Update(T*, uint32);
void MovementInform(T*);
@@ -67,7 +67,7 @@ class EffectMovementGenerator : public MovementGenerator
void Initialize(Unit*) {}
void Finalize(Unit*);
void Reset(Unit*) {}
- bool Update(Unit*, const uint32&);
+ bool Update(Unit*, uint32);
MovementGeneratorType GetMovementGeneratorType() { return EFFECT_MOTION_TYPE; }
private:
uint32 m_Id;
diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
index a9d3c404a87..a9d3c404a87 100755..100644
--- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h
index ca370de6ac3..ca370de6ac3 100755..100644
--- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h
diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
index 45c7c7c9ab2..0cb46a11e2e 100755
--- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
@@ -104,7 +104,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool upd
}
template<class T, typename D>
-bool TargetedMovementGeneratorMedium<T,D>::Update(T* owner, const uint32& time_diff)
+bool TargetedMovementGeneratorMedium<T,D>::Update(T* owner, uint32 time_diff)
{
if (!i_target.isValid() || !i_target->IsInWorld())
return false;
@@ -293,10 +293,10 @@ template void TargetedMovementGeneratorMedium<Player,ChaseMovementGenerator<Play
template void TargetedMovementGeneratorMedium<Player,FollowMovementGenerator<Player> >::_setTargetLocation(Player*, bool);
template void TargetedMovementGeneratorMedium<Creature,ChaseMovementGenerator<Creature> >::_setTargetLocation(Creature*, bool);
template void TargetedMovementGeneratorMedium<Creature,FollowMovementGenerator<Creature> >::_setTargetLocation(Creature*, bool);
-template bool TargetedMovementGeneratorMedium<Player,ChaseMovementGenerator<Player> >::Update(Player*, const uint32&);
-template bool TargetedMovementGeneratorMedium<Player,FollowMovementGenerator<Player> >::Update(Player*, const uint32&);
-template bool TargetedMovementGeneratorMedium<Creature,ChaseMovementGenerator<Creature> >::Update(Creature*, const uint32&);
-template bool TargetedMovementGeneratorMedium<Creature,FollowMovementGenerator<Creature> >::Update(Creature*, const uint32&);
+template bool TargetedMovementGeneratorMedium<Player,ChaseMovementGenerator<Player> >::Update(Player*, uint32);
+template bool TargetedMovementGeneratorMedium<Player,FollowMovementGenerator<Player> >::Update(Player*, uint32);
+template bool TargetedMovementGeneratorMedium<Creature,ChaseMovementGenerator<Creature> >::Update(Creature*, uint32);
+template bool TargetedMovementGeneratorMedium<Creature,FollowMovementGenerator<Creature> >::Update(Creature*, uint32);
template void ChaseMovementGenerator<Player>::_reachTarget(Player*);
template void ChaseMovementGenerator<Creature>::_reachTarget(Creature*);
diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
index f293d5976af..987baa91133 100755
--- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
@@ -47,7 +47,7 @@ class TargetedMovementGeneratorMedium : public MovementGeneratorMedium< T, D >,
~TargetedMovementGeneratorMedium() { delete i_path; }
public:
- bool Update(T*, const uint32 &);
+ bool Update(T*, uint32);
Unit* GetTarget() const { return i_target.getTarget(); }
void unitSpeedChanged() { i_recalculateTravel = true; }
@@ -114,4 +114,3 @@ class FollowMovementGenerator : public TargetedMovementGeneratorMedium<T, Follow
};
#endif
-
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index 22b2a2a450b..d3b63ed6331 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -130,7 +130,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
return true;
}
-bool WaypointMovementGenerator<Creature>::Update(Creature* creature, const uint32& diff)
+bool WaypointMovementGenerator<Creature>::Update(Creature* creature, uint32 diff)
{
// Waypoint movement can be switched on/off
// This is quite handy for escort quests and other stuff
@@ -241,7 +241,7 @@ void FlightPathMovementGenerator::Reset(Player* player)
init.Launch();
}
-bool FlightPathMovementGenerator::Update(Player* player, const uint32& /*diff*/)
+bool FlightPathMovementGenerator::Update(Player* player, uint32 /*diff*/)
{
uint32 pointId = (uint32)player->movespline->currentPathIdx();
if (pointId > i_currentNode)
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
index 5230fe3b0e3..bf3f6f4cae3 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
@@ -68,7 +68,7 @@ class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Crea
void Initialize(Creature*);
void Finalize(Creature*);
void Reset(Creature*);
- bool Update(Creature*, const uint32 &diff);
+ bool Update(Creature*, uint32 diff);
void MovementInform(Creature*);
@@ -121,7 +121,7 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, Flig
void Initialize(Player*);
void Reset(Player*);
void Finalize(Player*);
- bool Update(Player*, const uint32&);
+ bool Update(Player*, uint32);
MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; }
TaxiPathNodeList const& GetPath() { return *i_path; }
diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp
index 1821a78d993..1e96cd00fd3 100644
--- a/src/server/game/Movement/Spline/MoveSpline.cpp
+++ b/src/server/game/Movement/Spline/MoveSpline.cpp
@@ -51,15 +51,15 @@ Location MoveSpline::ComputePosition() const
if (splineflags.final_angle)
c.orientation = facing.angle;
else if (splineflags.final_point)
- c.orientation = atan2(facing.f.y-c.y, facing.f.x-c.x);
+ c.orientation = atan2(facing.f.y - c.y, facing.f.x - c.x);
//nothing to do for MoveSplineFlag::Final_Target flag
}
else
{
- if (!splineflags.hasFlag(MoveSplineFlag::OrientationFixed|MoveSplineFlag::Falling))
+ if (!splineflags.hasFlag(MoveSplineFlag::OrientationFixed | MoveSplineFlag::Falling))
{
Vector3 hermite;
- spline.evaluate_derivative(point_Idx,u,hermite);
+ spline.evaluate_derivative(point_Idx, u, hermite);
c.orientation = atan2(hermite.y, hermite.x);
}
diff --git a/src/server/game/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h
index ef5e4bce08b..edeff668e0c 100644
--- a/src/server/game/Movement/Spline/MoveSpline.h
+++ b/src/server/game/Movement/Spline/MoveSpline.h
@@ -41,7 +41,8 @@ namespace Movement
{
public:
typedef Spline<int32> MySpline;
- enum UpdateResult{
+ enum UpdateResult
+ {
Result_None = 0x01,
Result_Arrived = 0x02,
Result_NextCycle = 0x04,
@@ -70,26 +71,26 @@ namespace Movement
void init_spline(const MoveSplineInitArgs& args);
protected:
- const MySpline::ControlArray& getPath() const { return spline.getPoints();}
+ const MySpline::ControlArray& getPath() const { return spline.getPoints(); }
void computeParabolicElevation(float& el) const;
void computeFallElevation(float& el) const;
UpdateResult _updateState(int32& ms_time_diff);
- int32 next_timestamp() const { return spline.length(point_Idx+1);}
- int32 segment_time_elapsed() const { return next_timestamp()-time_passed;}
- int32 timeElapsed() const { return Duration() - time_passed;}
- int32 timePassed() const { return time_passed;}
+ int32 next_timestamp() const { return spline.length(point_Idx+1); }
+ int32 segment_time_elapsed() const { return next_timestamp()-time_passed; }
+ int32 Duration() const { return spline.length(); }
+ int32 timeElapsed() const { return Duration() - time_passed; }
+ int32 timePassed() const { return time_passed; }
public:
- const MySpline& _Spline() const { return spline;}
- int32 _currentSplineIdx() const { return point_Idx;}
+ const MySpline& _Spline() const { return spline; }
+ int32 _currentSplineIdx() const { return point_Idx; }
void _Finalize();
void _Interrupt() { splineflags.done = true;}
public:
- int32 Duration() const { return spline.length();}
void Initialize(const MoveSplineInitArgs&);
- bool Initialized() const { return !spline.empty();}
+ bool Initialized() const { return !spline.empty(); }
explicit MoveSpline();
@@ -111,11 +112,11 @@ namespace Movement
Location ComputePosition() const;
- uint32 GetId() const { return m_Id;}
+ uint32 GetId() const { return m_Id; }
bool Finalized() const { return splineflags.done; }
- bool isCyclic() const { return splineflags.cyclic;}
- const Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last()) : Vector3();}
- const Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx+1) : Vector3();}
+ bool isCyclic() const { return splineflags.cyclic; }
+ const Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last()) : Vector3(); }
+ const Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx+1) : Vector3(); }
int32 currentPathIdx() const;
bool onTransport;
diff --git a/src/server/game/Movement/Spline/MoveSplineFlag.h b/src/server/game/Movement/Spline/MoveSplineFlag.h
index a7262182391..f3f436c9d00 100644
--- a/src/server/game/Movement/Spline/MoveSplineFlag.h
+++ b/src/server/game/Movement/Spline/MoveSplineFlag.h
@@ -33,7 +33,8 @@ namespace Movement
class MoveSplineFlag
{
public:
- enum eFlags{
+ enum eFlags
+ {
None = 0x00000000,
// x00-xFF(first byte) used as animation Ids storage in pair with Animation flag
Done = 0x00000100,
@@ -73,8 +74,8 @@ namespace Movement
Mask_Unused = No_Spline|Enter_Cycle|Frozen|Unknown7|Unknown8|Unknown10|Unknown11|Unknown12|Unknown13
};
- inline uint32& raw() { return (uint32&)*this;}
- inline const uint32& raw() const { return (const uint32&)*this;}
+ inline uint32& raw() { return (uint32&)*this; }
+ inline const uint32& raw() const { return (const uint32&)*this; }
MoveSplineFlag() { raw() = 0; }
MoveSplineFlag(uint32 f) { raw() = f; }
@@ -82,21 +83,21 @@ namespace Movement
// Constant interface
- bool isSmooth() const { return raw() & Mask_CatmullRom;}
- bool isLinear() const { return !isSmooth();}
- bool isFacing() const { return raw() & Mask_Final_Facing;}
+ bool isSmooth() const { return raw() & Mask_CatmullRom; }
+ bool isLinear() const { return !isSmooth(); }
+ bool isFacing() const { return raw() & Mask_Final_Facing; }
- uint8 getAnimationId() const { return animId;}
- bool hasAllFlags(uint32 f) const { return (raw() & f) == f;}
- bool hasFlag(uint32 f) const { return (raw() & f) != 0;}
- uint32 operator & (uint32 f) const { return (raw() & f);}
- uint32 operator | (uint32 f) const { return (raw() | f);}
+ uint8 getAnimationId() const { return animId; }
+ bool hasAllFlags(uint32 f) const { return (raw() & f) == f; }
+ bool hasFlag(uint32 f) const { return (raw() & f) != 0; }
+ uint32 operator & (uint32 f) const { return (raw() & f); }
+ uint32 operator | (uint32 f) const { return (raw() | f); }
std::string ToString() const;
// Not constant interface
- void operator &= (uint32 f) { raw() &= f;}
- void operator |= (uint32 f) { raw() |= f;}
+ void operator &= (uint32 f) { raw() &= f; }
+ void operator |= (uint32 f) { raw() |= f; }
void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations | Falling | Parabolic)) | Animation | anim; }
void EnableParabolic() { raw() = (raw() & ~(Mask_Animations | Falling | Animation)) | Parabolic; }
@@ -109,31 +110,31 @@ namespace Movement
void EnableTransportEnter() { raw() = (raw() & ~TransportExit) | TransportEnter; }
void EnableTransportExit() { raw() = (raw() & ~TransportEnter) | TransportExit; }
- uint8 animId : 8;
- bool done : 1;
- bool falling : 1;
- bool no_spline : 1;
- bool parabolic : 1;
- bool walkmode : 1;
- bool flying : 1;
- bool orientationFixed : 1;
- bool final_point : 1;
- bool final_target : 1;
- bool final_angle : 1;
- bool catmullrom : 1;
- bool cyclic : 1;
- bool enter_cycle : 1;
- bool animation : 1;
- bool frozen : 1;
- bool transportEnter: 1;
- bool transportExit : 1;
- bool unknown7 : 1;
- bool unknown8 : 1;
+ uint8 animId : 8;
+ bool done : 1;
+ bool falling : 1;
+ bool no_spline : 1;
+ bool parabolic : 1;
+ bool walkmode : 1;
+ bool flying : 1;
+ bool orientationFixed : 1;
+ bool final_point : 1;
+ bool final_target : 1;
+ bool final_angle : 1;
+ bool catmullrom : 1;
+ bool cyclic : 1;
+ bool enter_cycle : 1;
+ bool animation : 1;
+ bool frozen : 1;
+ bool transportEnter : 1;
+ bool transportExit : 1;
+ bool unknown7 : 1;
+ bool unknown8 : 1;
bool orientationInversed : 1;
- bool unknown10 : 1;
- bool unknown11 : 1;
- bool unknown12 : 1;
- bool unknown13 : 1;
+ bool unknown10 : 1;
+ bool unknown11 : 1;
+ bool unknown12 : 1;
+ bool unknown13 : 1;
};
#if defined( __GNUC__ )
#pragma pack()
diff --git a/src/server/game/Movement/Spline/MovementTypedefs.h b/src/server/game/Movement/Spline/MovementTypedefs.h
index 01c8a5b7e7b..d8fe21ad4e6 100644
--- a/src/server/game/Movement/Spline/MovementTypedefs.h
+++ b/src/server/game/Movement/Spline/MovementTypedefs.h
@@ -54,7 +54,7 @@ namespace Movement
class counter
{
public:
- counter() { init();}
+ counter() { init(); }
void Increase()
{
@@ -64,8 +64,8 @@ namespace Movement
++m_counter;
}
- T NewId() { Increase(); return m_counter;}
- T getCurrent() const { return m_counter;}
+ T NewId() { Increase(); return m_counter; }
+ T getCurrent() const { return m_counter; }
private:
void init() { m_counter = 0; }
diff --git a/src/server/game/Movement/Spline/MovementUtil.cpp b/src/server/game/Movement/Spline/MovementUtil.cpp
index f0ed01c4676..b69d4b39e19 100644
--- a/src/server/game/Movement/Spline/MovementUtil.cpp
+++ b/src/server/game/Movement/Spline/MovementUtil.cpp
@@ -26,31 +26,31 @@ namespace Movement
/// Velocity bounds that makes fall speed limited
float terminalVelocity = 60.148003f;
- float terminalSavefallVelocity = 7.f;
+ float terminalSafefallVelocity = 7.0f;
- const float terminal_length = float(terminalVelocity * terminalVelocity) / (2.f * gravity);
- const float terminal_savefall_length = (terminalSavefallVelocity * terminalSavefallVelocity) / (2.f * gravity);
- const float terminalFallTime = float(terminalVelocity/gravity); // the time that needed to reach terminalVelocity
+ const float terminal_length = float(terminalVelocity * terminalVelocity) / (2.0f * gravity);
+ const float terminal_safefall_length = (terminalSafefallVelocity * terminalSafefallVelocity) / (2.0f * gravity);
+ const float terminalFallTime = float(terminalVelocity / gravity); // the time that needed to reach terminalVelocity
float computeFallTime(float path_length, bool isSafeFall)
{
- if (path_length < 0.f)
- return 0.f;
+ if (path_length < 0.0f)
+ return 0.0f;
float time;
- if ( isSafeFall )
+ if (isSafeFall)
{
- if (path_length >= terminal_savefall_length)
- time = (path_length - terminal_savefall_length)/terminalSavefallVelocity + terminalSavefallVelocity/gravity;
+ if (path_length >= terminal_safefall_length)
+ time = (path_length - terminal_safefall_length) / terminalSafefallVelocity + terminalSafefallVelocity / gravity;
else
- time = sqrtf(2.f * path_length/gravity);
+ time = sqrtf(2.0f * path_length / gravity);
}
else
{
if (path_length >= terminal_length)
- time = (path_length - terminal_length)/terminalVelocity + terminalFallTime;
+ time = (path_length - terminal_length) / terminalVelocity + terminalFallTime;
else
- time = sqrtf(2.f * path_length/gravity);
+ time = sqrtf(2.0f * path_length / gravity);
}
return time;
@@ -61,20 +61,21 @@ namespace Movement
float termVel;
float result;
- if ( isSafeFall )
- termVel = terminalSavefallVelocity;
+ if (isSafeFall)
+ termVel = terminalSafefallVelocity;
else
termVel = terminalVelocity;
- if ( start_velocity > termVel )
+ if (start_velocity > termVel)
start_velocity = termVel;
float terminal_time = terminalFallTime - start_velocity / gravity; // the time that needed to reach terminalVelocity
- if ( t_passed > terminal_time )
+ if (t_passed > terminal_time)
{
- result = terminalVelocity*(t_passed - terminal_time) +
- start_velocity*terminal_time + gravity*terminal_time*terminal_time*0.5f;
+ result = terminalVelocity * (t_passed - terminal_time) +
+ start_velocity * terminal_time +
+ gravity * terminal_time * terminal_time*0.5f;
}
else
result = t_passed * (start_velocity + t_passed * gravity * 0.5f);
@@ -100,7 +101,7 @@ namespace Movement
#define STR(x) #x
- const char * g_MovementFlag_names[]=
+ char const* g_MovementFlag_names[] =
{
STR(Forward ),// 0x00000001,
STR(Backward ),// 0x00000002,
@@ -135,25 +136,25 @@ namespace Movement
STR(Safe_Fall ),// 0x20000000, // Active Rogue Safe Fall Spell (Passive)
STR(Hover ),// 0x40000000
STR(Unknown13 ),// 0x80000000
- STR(Unk1 ),
- STR(Unk2 ),
- STR(Unk3 ),
- STR(Fullspeedturning ),
- STR(Fullspeedpitching ),
- STR(Allow_Pitching ),
- STR(Unk4 ),
- STR(Unk5 ),
- STR(Unk6 ),
- STR(Unk7 ),
- STR(Interp_Move ),
- STR(Interp_Turning ),
- STR(Interp_Pitching ),
- STR(Unk8 ),
- STR(Unk9 ),
- STR(Unk10 ),
+ STR(Unk1 ),
+ STR(Unk2 ),
+ STR(Unk3 ),
+ STR(Fullspeedturning ),
+ STR(Fullspeedpitching ),
+ STR(Allow_Pitching ),
+ STR(Unk4 ),
+ STR(Unk5 ),
+ STR(Unk6 ),
+ STR(Unk7 ),
+ STR(Interp_Move ),
+ STR(Interp_Turning ),
+ STR(Interp_Pitching ),
+ STR(Unk8 ),
+ STR(Unk9 ),
+ STR(Unk10 ),
};
- const char * g_SplineFlag_names[32]=
+ char const* g_SplineFlag_names[32] =
{
STR(AnimBit1 ),// 0x00000001,
STR(AnimBit2 ),// 0x00000002,
@@ -190,11 +191,11 @@ namespace Movement
};
template<class Flags, int N>
- void print_flags(Flags t, const char* (&names)[N], std::string& str)
+ void print_flags(Flags t, char const* (&names)[N], std::string& str)
{
for (int i = 0; i < N; ++i)
{
- if ((t & (Flags)(1 << i)) && names[i] != NULL)
+ if ((t & Flags(1 << i)) && names[i] != NULL)
str.append(" ").append(names[i]);
}
}
@@ -202,7 +203,7 @@ namespace Movement
std::string MoveSplineFlag::ToString() const
{
std::string str;
- print_flags(raw(),g_SplineFlag_names,str);
+ print_flags(raw(), g_SplineFlag_names, str);
return str;
}
}
diff --git a/src/server/game/Movement/Waypoints/Path.h b/src/server/game/Movement/Waypoints/Path.h
index 038958593fb..038958593fb 100755..100644
--- a/src/server/game/Movement/Waypoints/Path.h
+++ b/src/server/game/Movement/Waypoints/Path.h
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp
index a01e18347f6..a01e18347f6 100755..100644
--- a/src/server/game/Movement/Waypoints/WaypointManager.cpp
+++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.h b/src/server/game/Movement/Waypoints/WaypointManager.h
index df20c513c90..df20c513c90 100755..100644
--- a/src/server/game/Movement/Waypoints/WaypointManager.h
+++ b/src/server/game/Movement/Waypoints/WaypointManager.h
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index 5e3d37acb71..5e3d37acb71 100755..100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h
index e9d5ff9dfdc..e9d5ff9dfdc 100755..100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.h
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
index ce987e25eed..ce987e25eed 100755..100644
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
index 1313e29bfb4..1313e29bfb4 100755..100644
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 0d3d97d3996..0d3d97d3996 100755..100644
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
diff --git a/src/server/game/Pools/PoolMgr.h b/src/server/game/Pools/PoolMgr.h
index be839bf1566..be839bf1566 100755..100644
--- a/src/server/game/Pools/PoolMgr.h
+++ b/src/server/game/Pools/PoolMgr.h
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index b58011efe42..1238afe2ee1 100755..100644
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -140,10 +140,9 @@ Quest::Quest(Field* questRecord)
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmoteDelay[i] = questRecord[140+i].GetInt32();
- StartScript = questRecord[144].GetUInt32();
- CompleteScript = questRecord[145].GetUInt32();
+ CompleteScript = questRecord[144].GetUInt32();
- // int32 WDBVerified = questRecord[146].GetInt32();
+ // int32 WDBVerified = questRecord[145].GetInt32();
Flags |= SpecialFlags << 20;
if (Flags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT)
diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h
index 58734751cea..61b3de5f327 100755..100644
--- a/src/server/game/Quests/QuestDef.h
+++ b/src/server/game/Quests/QuestDef.h
@@ -120,7 +120,7 @@ enum __QuestGiverStatus
DIALOG_STATUS_REWARD = 10 // yellow dot on minimap
};
-enum __QuestFlags
+enum QuestFlags
{
// Flags used at server and sent to client
QUEST_FLAGS_NONE = 0x00000000,
@@ -150,8 +150,9 @@ enum __QuestFlags
QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT = 0x00200000, // Set by 2 in SpecialFlags from DB (if reequired area explore, spell SPELL_EFFECT_QUEST_COMPLETE casting, table `*_script` command SCRIPT_COMMAND_QUEST_EXPLORED use, set from script)
QUEST_TRINITY_FLAGS_AUTO_ACCEPT = 0x00400000, // Set by 4 in SpecialFlags in DB if the quest is to be auto-accepted.
QUEST_TRINITY_FLAGS_DF_QUEST = 0x00800000, // Set by 8 in SpecialFlags in DB if the quest is used by Dungeon Finder.
+ QUEST_TRINITY_FLAGS_MONTHLY = 0x01000000, // Set by 16 in SpecialFlags in DB if the quest is reset at the begining of the month
- QUEST_TRINITY_FLAGS_DB_ALLOWED = 0xFFFFF | QUEST_TRINITY_FLAGS_REPEATABLE | QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT | QUEST_TRINITY_FLAGS_AUTO_ACCEPT | QUEST_TRINITY_FLAGS_DF_QUEST,
+ QUEST_TRINITY_FLAGS_DB_ALLOWED = 0xFFFFF | QUEST_TRINITY_FLAGS_REPEATABLE | QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT | QUEST_TRINITY_FLAGS_AUTO_ACCEPT | QUEST_TRINITY_FLAGS_DF_QUEST | QUEST_TRINITY_FLAGS_MONTHLY,
// Trinity flags for internal use only
QUEST_TRINITY_FLAGS_DELIVER = 0x04000000, // Internal flag computed only
@@ -243,7 +244,6 @@ class Quest
uint32 GetPointOpt() const { return PointOption; }
uint32 GetIncompleteEmote() const { return EmoteOnIncomplete; }
uint32 GetCompleteEmote() const { return EmoteOnComplete; }
- uint32 GetQuestStartScript() const { return StartScript; }
uint32 GetQuestCompleteScript() const { return CompleteScript; }
bool IsRepeatable() const { return Flags & QUEST_TRINITY_FLAGS_REPEATABLE; }
bool IsAutoAccept() const;
@@ -251,6 +251,7 @@ class Quest
uint32 GetFlags() const { return Flags; }
bool IsDaily() const { return Flags & QUEST_FLAGS_DAILY; }
bool IsWeekly() const { return Flags & QUEST_FLAGS_WEEKLY; }
+ bool IsMonthly() const { return Flags & QUEST_TRINITY_FLAGS_MONTHLY; }
bool IsSeasonal() const { return (ZoneOrSort == -QUEST_SORT_SEASONAL || ZoneOrSort == -QUEST_SORT_SPECIAL || ZoneOrSort == -QUEST_SORT_LUNAR_FESTIVAL || ZoneOrSort == -QUEST_SORT_MIDSUMMER || ZoneOrSort == -QUEST_SORT_BREWFEST || ZoneOrSort == -QUEST_SORT_LOVE_IS_IN_THE_AIR || ZoneOrSort == -QUEST_SORT_NOBLEGARDEN) && !IsRepeatable(); }
bool IsDailyOrWeekly() const { return Flags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); }
bool IsRaidQuest() const { return Type == QUEST_TYPE_RAID || Type == QUEST_TYPE_RAID_10 || Type == QUEST_TYPE_RAID_25; }
@@ -353,7 +354,6 @@ class Quest
uint32 PointOption;
uint32 EmoteOnIncomplete;
uint32 EmoteOnComplete;
- uint32 StartScript;
uint32 CompleteScript;
};
diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp
index 3a8dc7c5e63..2294ec0d6a4 100755..100644
--- a/src/server/game/Reputation/ReputationMgr.cpp
+++ b/src/server/game/Reputation/ReputationMgr.cpp
@@ -198,23 +198,24 @@ void ReputationMgr::SendState(FactionState const* faction)
void ReputationMgr::SendInitialReputations()
{
- WorldPacket data(SMSG_INITIALIZE_FACTIONS, (4+128*5));
- data << uint32 (0x00000080);
+ uint8 count = 128;
+ WorldPacket data(SMSG_INITIALIZE_FACTIONS, 4 + count * 5);
+ data << uint32(count);
RepListID a = 0;
for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
{
// fill in absent fields
- for (; a != itr->first; a++)
+ for (; a != itr->first; ++a)
{
- data << uint8 (0x00);
- data << uint32 (0x00000000);
+ data << uint8(0);
+ data << uint32(0);
}
// fill in encountered data
- data << uint8 (itr->second.Flags);
- data << uint32 (itr->second.Standing);
+ data << uint8(itr->second.Flags);
+ data << uint32(itr->second.Standing);
itr->second.needSend = false;
@@ -222,10 +223,10 @@ void ReputationMgr::SendInitialReputations()
}
// fill in absent fields
- for (; a != 128; a++)
+ for (; a != count; ++a)
{
- data << uint8 (0x00);
- data << uint32 (0x00000000);
+ data << uint8(0);
+ data << uint32(0);
}
_player->SendDirectMessage(&data);
diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h
index f950cbb82c2..f950cbb82c2 100755..100644
--- a/src/server/game/Reputation/ReputationMgr.h
+++ b/src/server/game/Reputation/ReputationMgr.h
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 069ae71b7cb..069ae71b7cb 100755..100644
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index 56a020cad88..a41ebc02808 100755..100644
--- a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -91,7 +91,6 @@ void AddSC_npc_innkeeper();
void AddSC_npcs_special();
void AddSC_npc_taxi();
void AddSC_achievement_scripts();
-void AddSC_event_scripts();
//eastern kingdoms
void AddSC_alterac_valley(); //Alterac Valley
@@ -322,6 +321,7 @@ void AddSC_boss_ayamiss();
void AddSC_boss_ossirian();
void AddSC_instance_ruins_of_ahnqiraj();
void AddSC_boss_cthun(); //Temple of ahn'qiraj
+void AddSC_boss_viscidus();
void AddSC_boss_fankriss();
void AddSC_boss_huhuran();
void AddSC_bug_trio();
@@ -603,6 +603,9 @@ void AddSC_shattrath_city();
void AddSC_terokkar_forest();
void AddSC_zangarmarsh();
+// Events
+void AddSC_event_childrens_week();
+
// battlegrounds
// outdoor pvp
@@ -716,7 +719,6 @@ void AddWorldScripts()
AddSC_npc_taxi();
AddSC_achievement_scripts();
AddSC_chat_log();
- AddSC_event_scripts();
#endif
}
@@ -955,6 +957,7 @@ void AddKalimdorScripts()
AddSC_boss_ossirian();
AddSC_instance_ruins_of_ahnqiraj();
AddSC_boss_cthun(); //Temple of ahn'qiraj
+ AddSC_boss_viscidus();
AddSC_boss_fankriss();
AddSC_boss_huhuran();
AddSC_bug_trio();
@@ -1246,6 +1249,13 @@ void AddNorthrendScripts()
#endif
}
+void AddEventScripts()
+{
+#ifdef SCRIPTS
+ AddSC_event_childrens_week();
+#endif
+}
+
void AddOutdoorPvPScripts()
{
#ifdef SCRIPTS
diff --git a/src/server/game/Scripting/ScriptLoader.h b/src/server/game/Scripting/ScriptLoader.h
index 0db6917a0d4..04ab3215551 100644
--- a/src/server/game/Scripting/ScriptLoader.h
+++ b/src/server/game/Scripting/ScriptLoader.h
@@ -27,6 +27,7 @@ void AddEasternKingdomsScripts();
void AddKalimdorScripts();
void AddOutlandScripts();
void AddNorthrendScripts();
+void AddEventScripts();
void AddBattlegroundScripts();
void AddOutdoorPvPScripts();
void AddCustomScripts();
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 6682d3c11e3..401b0e1728b 100755..100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -160,83 +160,7 @@ class ScriptRegistry
if (!V) \
return R;
-void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target)
-{
- if (!pSource)
- {
- sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i, invalid Source pointer.", iTextEntry);
- return;
- }
-
- if (iTextEntry >= 0)
- {
- sLog->outError(LOG_FILTER_TSCR, "DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
- return;
- }
-
- const StringTextData* pData = sScriptSystemMgr->GetTextData(iTextEntry);
-
- if (!pData)
- {
- sLog->outError(LOG_FILTER_TSCR, "DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
- return;
- }
-
- sLog->outDebug(LOG_FILTER_TSCR, "DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote);
-
- if (pData->uiSoundId)
- {
- if (sSoundEntriesStore.LookupEntry(pData->uiSoundId))
- pSource->SendPlaySound(pData->uiSoundId, false);
- else
- sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId);
- }
-
- if (pData->uiEmote)
- {
- if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER)
- ((Unit*)pSource)->HandleEmoteCommand(pData->uiEmote);
- else
- sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId());
- }
-
- switch (pData->uiType)
- {
- case CHAT_TYPE_SAY:
- pSource->MonsterSay(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0);
- break;
- case CHAT_TYPE_YELL:
- pSource->MonsterYell(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0);
- break;
- case CHAT_TYPE_TEXT_EMOTE:
- pSource->MonsterTextEmote(iTextEntry, target ? target->GetGUID() : 0);
- break;
- case CHAT_TYPE_BOSS_EMOTE:
- pSource->MonsterTextEmote(iTextEntry, target ? target->GetGUID() : 0, true);
- break;
- case CHAT_TYPE_WHISPER:
- {
- if (target && target->GetTypeId() == TYPEID_PLAYER)
- pSource->MonsterWhisper(iTextEntry, target->GetGUID());
- else
- sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
-
- break;
- }
- case CHAT_TYPE_BOSS_WHISPER:
- {
- if (target && target->GetTypeId() == TYPEID_PLAYER)
- pSource->MonsterWhisper(iTextEntry, target->GetGUID(), true);
- else
- sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
- break;
- }
- case CHAT_TYPE_ZONE_YELL:
- pSource->MonsterYellToZone(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0);
- break;
- }
-}
ScriptMgr::ScriptMgr()
: _scriptCount(0), _scheduledScripts(0)
@@ -293,14 +217,13 @@ void ScriptMgr::Unload()
SCR_CLEAR(PlayerScript);
SCR_CLEAR(GuildScript);
SCR_CLEAR(GroupScript);
+ SCR_CLEAR(UnitScript);
#undef SCR_CLEAR
}
void ScriptMgr::LoadDatabase()
{
- sScriptSystemMgr->LoadScriptTexts();
- sScriptSystemMgr->LoadScriptTextsCustom();
sScriptSystemMgr->LoadScriptWaypoints();
}
@@ -1416,6 +1339,22 @@ void ScriptMgr::OnGroupDisband(Group* group)
FOREACH_SCRIPT(GroupScript)->OnDisband(group);
}
+// Unit
+void ScriptMgr::ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage)
+{
+ FOREACH_SCRIPT(UnitScript)->ModifyPeriodicDamageAurasTick(target, attacker, damage);
+}
+
+void ScriptMgr::ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage)
+{
+ FOREACH_SCRIPT(UnitScript)->ModifyMeleeDamage(target, attacker, damage);
+}
+
+void ScriptMgr::ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage)
+{
+ FOREACH_SCRIPT(UnitScript)->ModifySpellDamageTaken(target, attacker, damage);
+}
+
SpellScriptLoader::SpellScriptLoader(const char* name)
: ScriptObject(name)
{
@@ -1440,6 +1379,13 @@ FormulaScript::FormulaScript(const char* name)
ScriptRegistry<FormulaScript>::AddScript(this);
}
+UnitScript::UnitScript(const char* name, bool addToScripts)
+ : ScriptObject(name)
+{
+ if (addToScripts)
+ ScriptRegistry<UnitScript>::AddScript(this);
+}
+
WorldMapScript::WorldMapScript(const char* name, uint32 mapId)
: ScriptObject(name), MapScript<Map>(mapId)
{
@@ -1474,7 +1420,7 @@ ItemScript::ItemScript(const char* name)
}
CreatureScript::CreatureScript(const char* name)
- : ScriptObject(name)
+ : UnitScript(name, false)
{
ScriptRegistry<CreatureScript>::AddScript(this);
}
@@ -1552,7 +1498,7 @@ AchievementCriteriaScript::AchievementCriteriaScript(const char* name)
}
PlayerScript::PlayerScript(const char* name)
- : ScriptObject(name)
+ : UnitScript(name, false)
{
ScriptRegistry<PlayerScript>::AddScript(this);
}
@@ -1598,6 +1544,7 @@ template class ScriptRegistry<AchievementCriteriaScript>;
template class ScriptRegistry<PlayerScript>;
template class ScriptRegistry<GuildScript>;
template class ScriptRegistry<GroupScript>;
+template class ScriptRegistry<UnitScript>;
// Undefine utility macros.
#undef GET_SCRIPT_RET
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 947be2b73fe..0f6fd5d018b 100755..100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -69,8 +69,6 @@ struct OutdoorPvPData;
#define VISIBLE_RANGE 166.0f //MAX visible range (size of grid)
-// Generic scripting text function.
-void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target = NULL);
/*
TODO: Add more script type classes.
@@ -394,7 +392,24 @@ class ItemScript : public ScriptObject
virtual bool OnExpire(Player* /*player*/, ItemTemplate const* /*proto*/) { return false; }
};
-class CreatureScript : public ScriptObject, public UpdatableScript<Creature>
+class UnitScript : public ScriptObject
+{
+ protected:
+
+ UnitScript(const char* name, bool addToScripts = true);
+
+ public:
+ // Called when DoT's Tick Damage is being Dealt
+ virtual void ModifyPeriodicDamageAurasTick(Unit* /*target*/, Unit* /*attacker*/, uint32& /*damage*/) { }
+
+ // Called when Melee Damage is being Dealt
+ virtual void ModifyMeleeDamage(Unit* /*target*/, Unit* /*attacker*/, uint32& /*damage*/) { }
+
+ // Called when Spell Damage is being Dealt
+ virtual void ModifySpellDamageTaken(Unit* /*target*/, Unit* /*attacker*/, int32& /*damage*/) { }
+};
+
+class CreatureScript : public UnitScript, public UpdatableScript<Creature>
{
protected:
@@ -656,7 +671,7 @@ class AchievementCriteriaScript : public ScriptObject
virtual bool OnCheck(Player* source, Unit* target) = 0;
};
-class PlayerScript : public ScriptObject
+class PlayerScript : public UnitScript
{
protected:
@@ -1033,6 +1048,12 @@ class ScriptMgr
void OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid);
void OnGroupDisband(Group* group);
+ public: /* UnitScript */
+
+ void ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage);
+ void ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage);
+ void ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage);
+
public: /* Scheduled scripts */
uint32 IncreaseScheduledScriptsCount() { return ++_scheduledScripts; }
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index 41b41b91808..ea1cf6b1994 100755..100644
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -23,128 +23,6 @@
ScriptPointVector const SystemMgr::_empty;
-void SystemMgr::LoadScriptTexts()
-{
- sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts...");
- LoadTrinityStrings("script_texts", TEXT_SOURCE_RANGE, 1+(TEXT_SOURCE_RANGE*2));
-
- sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts additional data...");
- uint32 oldMSTime = getMSTime();
-
- // 0 1 2 3
- QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts");
-
- if (!result)
- {
- sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");
- return;
- }
-
- uint32 uiCount = 0;
-
- do
- {
- Field* pFields = result->Fetch();
- StringTextData temp;
-
- int32 iId = pFields[0].GetInt32();
- temp.uiSoundId = pFields[1].GetUInt32();
- temp.uiType = pFields[2].GetUInt8();
- temp.uiLanguage = pFields[3].GetUInt8();
- temp.uiEmote = pFields[4].GetUInt16();
-
- if (iId >= 0)
- {
- sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` is not a negative value.", iId);
- continue;
- }
-
- if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2)
- {
- sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId);
- continue;
- }
-
- if (temp.uiSoundId)
- {
- if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId))
- sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId);
- }
-
- if (!GetLanguageDescByID(temp.uiLanguage))
- sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage);
-
- if (temp.uiType > CHAT_TYPE_ZONE_YELL)
- sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType);
-
- m_mTextDataMap[iId] = temp;
- ++uiCount;
- }
- while (result->NextRow());
-
- sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime));
-}
-
-void SystemMgr::LoadScriptTextsCustom()
-{
- sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts...");
- LoadTrinityStrings("custom_texts", TEXT_SOURCE_RANGE*2, 1+(TEXT_SOURCE_RANGE*3));
-
- sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts additional data...");
-
- QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts");
-
- if (!result)
- {
- sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");
- return;
- }
-
- uint32 uiCount = 0;
-
- do
- {
- Field* pFields = result->Fetch();
- StringTextData temp;
-
- int32 iId = pFields[0].GetInt32();
- temp.uiSoundId = pFields[1].GetUInt32();
- temp.uiType = pFields[2].GetUInt8();
- temp.uiLanguage = pFields[3].GetUInt8();
- temp.uiEmote = pFields[4].GetUInt16();
-
- if (iId >= 0)
- {
- sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` is not a negative value.", iId);
- continue;
- }
-
- if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3)
- {
- sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId);
- continue;
- }
-
- if (temp.uiSoundId)
- {
- if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId))
- sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId);
- }
-
- if (!GetLanguageDescByID(temp.uiLanguage))
- sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage);
-
- if (temp.uiType > CHAT_TYPE_ZONE_YELL)
- sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType);
-
- m_mTextDataMap[iId] = temp;
- ++uiCount;
- }
- while (result->NextRow());
-
- sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Custom Texts data.", uiCount);
-}
-
void SystemMgr::LoadScriptWaypoints()
{
uint32 oldMSTime = getMSTime();
diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h
index 4211a63b043..cc65d493f3e 100644
--- a/src/server/game/Scripting/ScriptSystem.h
+++ b/src/server/game/Scripting/ScriptSystem.h
@@ -46,14 +46,6 @@ struct ScriptPointMove
typedef std::vector<ScriptPointMove> ScriptPointVector;
-struct StringTextData
-{
- uint32 uiSoundId;
- uint8 uiType;
- uint32 uiLanguage;
- uint32 uiEmote;
-};
-
class SystemMgr
{
friend class ACE_Singleton<SystemMgr, ACE_Null_Mutex>;
@@ -61,26 +53,11 @@ class SystemMgr
~SystemMgr() {}
public:
- //Maps and lists
- typedef UNORDERED_MAP<int32, StringTextData> TextDataMap;
typedef UNORDERED_MAP<uint32, ScriptPointVector> PointMoveMap;
//Database
- void LoadScriptTexts();
- void LoadScriptTextsCustom();
void LoadScriptWaypoints();
- //Retrive from storage
- StringTextData const* GetTextData(int32 textId) const
- {
- TextDataMap::const_iterator itr = m_mTextDataMap.find(textId);
-
- if (itr == m_mTextDataMap.end())
- return NULL;
-
- return &itr->second;
- }
-
ScriptPointVector const& GetPointMoveList(uint32 creatureEntry) const
{
PointMoveMap::const_iterator itr = m_mPointMoveMap.find(creatureEntry);
@@ -92,7 +69,6 @@ class SystemMgr
}
protected:
- TextDataMap m_mTextDataMap; //additional data for text strings
PointMoveMap m_mPointMoveMap; //coordinates for waypoints
private:
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index 0821be2abb9..0821be2abb9 100755..100644
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h
index 625ee88a853..625ee88a853 100755..100644
--- a/src/server/game/Server/Protocol/Opcodes.h
+++ b/src/server/game/Server/Protocol/Opcodes.h
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 0185d4adc9f..0185d4adc9f 100755..100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index a442bb45a69..a442bb45a69 100755..100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 8b034299ad6..8b034299ad6 100755..100644
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h
index b8080b128f2..b8080b128f2 100755..100644
--- a/src/server/game/Server/WorldSocket.h
+++ b/src/server/game/Server/WorldSocket.h
diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp
index ed960258c41..ed960258c41 100755..100644
--- a/src/server/game/Server/WorldSocketMgr.cpp
+++ b/src/server/game/Server/WorldSocketMgr.cpp
diff --git a/src/server/game/Server/WorldSocketMgr.h b/src/server/game/Server/WorldSocketMgr.h
index fd7e28485cf..fd7e28485cf 100755..100644
--- a/src/server/game/Server/WorldSocketMgr.h
+++ b/src/server/game/Server/WorldSocketMgr.h
diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp
index 3eac3d34fd2..3eac3d34fd2 100755..100644
--- a/src/server/game/Skills/SkillDiscovery.cpp
+++ b/src/server/game/Skills/SkillDiscovery.cpp
diff --git a/src/server/game/Skills/SkillDiscovery.h b/src/server/game/Skills/SkillDiscovery.h
index ba5542e0189..ba5542e0189 100755..100644
--- a/src/server/game/Skills/SkillDiscovery.h
+++ b/src/server/game/Skills/SkillDiscovery.h
diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp
index 9e2648dc943..9e2648dc943 100755..100644
--- a/src/server/game/Skills/SkillExtraItems.cpp
+++ b/src/server/game/Skills/SkillExtraItems.cpp
diff --git a/src/server/game/Skills/SkillExtraItems.h b/src/server/game/Skills/SkillExtraItems.h
index 0cf49021e1c..0cf49021e1c 100755..100644
--- a/src/server/game/Skills/SkillExtraItems.h
+++ b/src/server/game/Skills/SkillExtraItems.h
diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h
index 6902dd60c80..11e4a28e084 100755..100644
--- a/src/server/game/Spells/Auras/SpellAuraDefines.h
+++ b/src/server/game/Spells/Auras/SpellAuraDefines.h
@@ -59,324 +59,324 @@ enum DAMAGE_ABSORB_TYPE
enum AuraType
{
- SPELL_AURA_NONE = 0,
- SPELL_AURA_BIND_SIGHT = 1,
- SPELL_AURA_MOD_POSSESS = 2,
- SPELL_AURA_PERIODIC_DAMAGE = 3,
- SPELL_AURA_DUMMY = 4,
- SPELL_AURA_MOD_CONFUSE = 5,
- SPELL_AURA_MOD_CHARM = 6,
- SPELL_AURA_MOD_FEAR = 7,
- SPELL_AURA_PERIODIC_HEAL = 8,
- SPELL_AURA_MOD_ATTACKSPEED = 9,
- SPELL_AURA_MOD_THREAT = 10,
- SPELL_AURA_MOD_TAUNT = 11,
- SPELL_AURA_MOD_STUN = 12,
- SPELL_AURA_MOD_DAMAGE_DONE = 13,
- SPELL_AURA_MOD_DAMAGE_TAKEN = 14,
- SPELL_AURA_DAMAGE_SHIELD = 15,
- SPELL_AURA_MOD_STEALTH = 16,
- SPELL_AURA_MOD_STEALTH_DETECT = 17,
- SPELL_AURA_MOD_INVISIBILITY = 18,
- SPELL_AURA_MOD_INVISIBILITY_DETECT = 19,
- SPELL_AURA_OBS_MOD_HEALTH = 20, //20, 21 unofficial
- SPELL_AURA_OBS_MOD_POWER = 21,
- SPELL_AURA_MOD_RESISTANCE = 22,
- SPELL_AURA_PERIODIC_TRIGGER_SPELL = 23,
- SPELL_AURA_PERIODIC_ENERGIZE = 24,
- SPELL_AURA_MOD_PACIFY = 25,
- SPELL_AURA_MOD_ROOT = 26,
- SPELL_AURA_MOD_SILENCE = 27,
- SPELL_AURA_REFLECT_SPELLS = 28,
- SPELL_AURA_MOD_STAT = 29,
- SPELL_AURA_MOD_SKILL = 30,
- SPELL_AURA_MOD_INCREASE_SPEED = 31,
- SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED = 32,
- SPELL_AURA_MOD_DECREASE_SPEED = 33,
- SPELL_AURA_MOD_INCREASE_HEALTH = 34,
- SPELL_AURA_MOD_INCREASE_ENERGY = 35,
- SPELL_AURA_MOD_SHAPESHIFT = 36,
- SPELL_AURA_EFFECT_IMMUNITY = 37,
- SPELL_AURA_STATE_IMMUNITY = 38,
- SPELL_AURA_SCHOOL_IMMUNITY = 39,
- SPELL_AURA_DAMAGE_IMMUNITY = 40,
- SPELL_AURA_DISPEL_IMMUNITY = 41,
- SPELL_AURA_PROC_TRIGGER_SPELL = 42,
- SPELL_AURA_PROC_TRIGGER_DAMAGE = 43,
- SPELL_AURA_TRACK_CREATURES = 44,
- SPELL_AURA_TRACK_RESOURCES = 45,
- SPELL_AURA_46 = 46, // Ignore all Gear test spells
- SPELL_AURA_MOD_PARRY_PERCENT = 47,
- SPELL_AURA_48 = 48, // One periodic spell
- SPELL_AURA_MOD_DODGE_PERCENT = 49,
- SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT = 50,
- SPELL_AURA_MOD_BLOCK_PERCENT = 51,
- SPELL_AURA_MOD_WEAPON_CRIT_PERCENT = 52,
- SPELL_AURA_PERIODIC_LEECH = 53,
- SPELL_AURA_MOD_HIT_CHANCE = 54,
- SPELL_AURA_MOD_SPELL_HIT_CHANCE = 55,
- SPELL_AURA_TRANSFORM = 56,
- SPELL_AURA_MOD_SPELL_CRIT_CHANCE = 57,
- SPELL_AURA_MOD_INCREASE_SWIM_SPEED = 58,
- SPELL_AURA_MOD_DAMAGE_DONE_CREATURE = 59,
- SPELL_AURA_MOD_PACIFY_SILENCE = 60,
- SPELL_AURA_MOD_SCALE = 61,
- SPELL_AURA_PERIODIC_HEALTH_FUNNEL = 62,
- SPELL_AURA_63 = 63, // old SPELL_AURA_PERIODIC_MANA_FUNNEL
- SPELL_AURA_PERIODIC_MANA_LEECH = 64,
- SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK = 65,
- SPELL_AURA_FEIGN_DEATH = 66,
- SPELL_AURA_MOD_DISARM = 67,
- SPELL_AURA_MOD_STALKED = 68,
- SPELL_AURA_SCHOOL_ABSORB = 69,
- SPELL_AURA_EXTRA_ATTACKS = 70,
- SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL = 71,
- SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT = 72,
- SPELL_AURA_MOD_POWER_COST_SCHOOL = 73,
- SPELL_AURA_REFLECT_SPELLS_SCHOOL = 74,
- SPELL_AURA_MOD_LANGUAGE = 75,
- SPELL_AURA_FAR_SIGHT = 76,
- SPELL_AURA_MECHANIC_IMMUNITY = 77,
- SPELL_AURA_MOUNTED = 78,
- SPELL_AURA_MOD_DAMAGE_PERCENT_DONE = 79,
- SPELL_AURA_MOD_PERCENT_STAT = 80,
- SPELL_AURA_SPLIT_DAMAGE_PCT = 81,
- SPELL_AURA_WATER_BREATHING = 82,
- SPELL_AURA_MOD_BASE_RESISTANCE = 83,
- SPELL_AURA_MOD_REGEN = 84,
- SPELL_AURA_MOD_POWER_REGEN = 85,
- SPELL_AURA_CHANNEL_DEATH_ITEM = 86,
- SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN = 87,
- SPELL_AURA_MOD_HEALTH_REGEN_PERCENT = 88,
- SPELL_AURA_PERIODIC_DAMAGE_PERCENT = 89,
- SPELL_AURA_90 = 90, // old SPELL_AURA_MOD_RESIST_CHANCE
- SPELL_AURA_MOD_DETECT_RANGE = 91,
- SPELL_AURA_PREVENTS_FLEEING = 92,
- SPELL_AURA_MOD_UNATTACKABLE = 93,
- SPELL_AURA_INTERRUPT_REGEN = 94,
- SPELL_AURA_GHOST = 95,
- SPELL_AURA_SPELL_MAGNET = 96,
- SPELL_AURA_MANA_SHIELD = 97,
- SPELL_AURA_MOD_SKILL_TALENT = 98,
- SPELL_AURA_MOD_ATTACK_POWER = 99,
- SPELL_AURA_AURAS_VISIBLE = 100,
- SPELL_AURA_MOD_RESISTANCE_PCT = 101,
- SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS = 102,
- SPELL_AURA_MOD_TOTAL_THREAT = 103,
- SPELL_AURA_WATER_WALK = 104,
- SPELL_AURA_FEATHER_FALL = 105,
- SPELL_AURA_HOVER = 106,
- SPELL_AURA_ADD_FLAT_MODIFIER = 107,
- SPELL_AURA_ADD_PCT_MODIFIER = 108,
- SPELL_AURA_ADD_TARGET_TRIGGER = 109,
- SPELL_AURA_MOD_POWER_REGEN_PERCENT = 110,
- SPELL_AURA_ADD_CASTER_HIT_TRIGGER = 111,
- SPELL_AURA_OVERRIDE_CLASS_SCRIPTS = 112,
- SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN = 113,
- SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT = 114,
- SPELL_AURA_MOD_HEALING = 115,
- SPELL_AURA_MOD_REGEN_DURING_COMBAT = 116,
- SPELL_AURA_MOD_MECHANIC_RESISTANCE = 117,
- SPELL_AURA_MOD_HEALING_PCT = 118,
- SPELL_AURA_119 = 119, // old SPELL_AURA_SHARE_PET_TRACKING
- SPELL_AURA_UNTRACKABLE = 120,
- SPELL_AURA_EMPATHY = 121,
- SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT = 122,
- SPELL_AURA_MOD_TARGET_RESISTANCE = 123,
- SPELL_AURA_MOD_RANGED_ATTACK_POWER = 124,
- SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN = 125,
- SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT = 126,
- SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS = 127,
- SPELL_AURA_MOD_POSSESS_PET = 128,
- SPELL_AURA_MOD_SPEED_ALWAYS = 129,
- SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS = 130,
- SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS = 131,
- SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT = 132,
- SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT = 133,
- SPELL_AURA_MOD_MANA_REGEN_INTERRUPT = 134,
- SPELL_AURA_MOD_HEALING_DONE = 135,
- SPELL_AURA_MOD_HEALING_DONE_PERCENT = 136,
- SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE = 137,
- SPELL_AURA_MOD_MELEE_HASTE = 138,
- SPELL_AURA_FORCE_REACTION = 139,
- SPELL_AURA_MOD_RANGED_HASTE = 140,
- SPELL_AURA_MOD_RANGED_AMMO_HASTE = 141,
- SPELL_AURA_MOD_BASE_RESISTANCE_PCT = 142,
- SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE = 143,
- SPELL_AURA_SAFE_FALL = 144,
- SPELL_AURA_MOD_PET_TALENT_POINTS = 145,
- SPELL_AURA_ALLOW_TAME_PET_TYPE = 146,
- SPELL_AURA_MECHANIC_IMMUNITY_MASK = 147,
- SPELL_AURA_RETAIN_COMBO_POINTS = 148,
- SPELL_AURA_REDUCE_PUSHBACK = 149, // Reduce Pushback
- SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT = 150,
- SPELL_AURA_TRACK_STEALTHED = 151, // Track Stealthed
- SPELL_AURA_MOD_DETECTED_RANGE = 152, // Mod Detected Range
- SPELL_AURA_SPLIT_DAMAGE_FLAT = 153, // Split Damage Flat
- SPELL_AURA_MOD_STEALTH_LEVEL = 154, // Stealth Level Modifier
- SPELL_AURA_MOD_WATER_BREATHING = 155, // Mod Water Breathing
- SPELL_AURA_MOD_REPUTATION_GAIN = 156, // Mod Reputation Gain
- SPELL_AURA_PET_DAMAGE_MULTI = 157, // Mod Pet Damage
- SPELL_AURA_MOD_SHIELD_BLOCKVALUE = 158,
- SPELL_AURA_NO_PVP_CREDIT = 159,
- SPELL_AURA_MOD_AOE_AVOIDANCE = 160,
- SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT = 161,
- SPELL_AURA_POWER_BURN = 162,
- SPELL_AURA_MOD_CRIT_DAMAGE_BONUS = 163,
- SPELL_AURA_164 = 164,
- SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS = 165,
- SPELL_AURA_MOD_ATTACK_POWER_PCT = 166,
- SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT = 167,
- SPELL_AURA_MOD_DAMAGE_DONE_VERSUS = 168,
- SPELL_AURA_MOD_CRIT_PERCENT_VERSUS = 169,
- SPELL_AURA_DETECT_AMORE = 170,
- SPELL_AURA_MOD_SPEED_NOT_STACK = 171,
- SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK = 172,
- SPELL_AURA_173 = 173, // old SPELL_AURA_ALLOW_CHAMPION_SPELLS
- SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT = 174, // by defeult intelect, dependent from SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
- SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT = 175,
- SPELL_AURA_SPIRIT_OF_REDEMPTION = 176,
- SPELL_AURA_AOE_CHARM = 177,
- SPELL_AURA_MOD_DEBUFF_RESISTANCE = 178,
- SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE = 179,
- SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS = 180,
- SPELL_AURA_181 = 181, // old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS - possible flat spell crit damage versus
- SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT = 182,
- SPELL_AURA_MOD_CRITICAL_THREAT = 183,
- SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE = 184,
- SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE= 185,
- SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE = 186,
- SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE = 187,
- SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE = 188,
- SPELL_AURA_MOD_RATING = 189,
- SPELL_AURA_MOD_FACTION_REPUTATION_GAIN = 190,
- SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED = 191,
- SPELL_AURA_MOD_MELEE_RANGED_HASTE = 192,
- SPELL_AURA_MELEE_SLOW = 193,
- SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL = 194,
- SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL = 195,
- SPELL_AURA_MOD_COOLDOWN = 196, // only 24818 Noxious Breath
- SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE = 197,
- SPELL_AURA_198 = 198, // old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
- SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT = 199,
- SPELL_AURA_MOD_XP_PCT = 200,
- SPELL_AURA_FLY = 201,
- SPELL_AURA_IGNORE_COMBAT_RESULT = 202,
- SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE = 203,
- SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE = 204,
- SPELL_AURA_MOD_SCHOOL_CRIT_DMG_TAKEN = 205,
- SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED = 206,
- SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED = 207,
- SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED = 208,
- SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS = 209,
- SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS = 210,
- SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK = 211,
- SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT = 212,
- SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT = 213,
- SPELL_AURA_214 = 214,
- SPELL_AURA_ARENA_PREPARATION = 215,
- SPELL_AURA_HASTE_SPELLS = 216,
- SPELL_AURA_MOD_MELEE_HASTE_2 = 217, // NYI
- SPELL_AURA_HASTE_RANGED = 218,
- SPELL_AURA_MOD_MANA_REGEN_FROM_STAT = 219,
- SPELL_AURA_MOD_RATING_FROM_STAT = 220,
- SPELL_AURA_MOD_DETAUNT = 221,
- SPELL_AURA_222 = 222,
- SPELL_AURA_RAID_PROC_FROM_CHARGE = 223,
- SPELL_AURA_224 = 224,
- SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE = 225,
- SPELL_AURA_PERIODIC_DUMMY = 226,
- SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE = 227,
- SPELL_AURA_DETECT_STEALTH = 228,
- SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE = 229,
- SPELL_AURA_230 = 230,
- SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE = 231,
- SPELL_AURA_MECHANIC_DURATION_MOD = 232,
- SPELL_AURA_CHANGE_MODEL_FOR_ALL_HUMANOIDS = 233, // client-side only
- SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK = 234,
- SPELL_AURA_MOD_DISPEL_RESIST = 235,
- SPELL_AURA_CONTROL_VEHICLE = 236,
- SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER = 237,
- SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER = 238,
- SPELL_AURA_MOD_SCALE_2 = 239,
- SPELL_AURA_MOD_EXPERTISE = 240,
- SPELL_AURA_FORCE_MOVE_FORWARD = 241,
- SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING = 242,
- SPELL_AURA_MOD_FACTION = 243,
- SPELL_AURA_COMPREHEND_LANGUAGE = 244,
- SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL = 245,
- SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK = 246,
- SPELL_AURA_CLONE_CASTER = 247,
- SPELL_AURA_MOD_COMBAT_RESULT_CHANCE = 248,
- SPELL_AURA_CONVERT_RUNE = 249,
- SPELL_AURA_MOD_INCREASE_HEALTH_2 = 250,
- SPELL_AURA_MOD_ENEMY_DODGE = 251,
- SPELL_AURA_MOD_SPEED_SLOW_ALL = 252,
- SPELL_AURA_MOD_BLOCK_CRIT_CHANCE = 253,
- SPELL_AURA_MOD_DISARM_OFFHAND = 254,
- SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT = 255,
- SPELL_AURA_NO_REAGENT_USE = 256,
- SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS = 257,
- SPELL_AURA_258 = 258,
- SPELL_AURA_MOD_HOT_PCT = 259,
- SPELL_AURA_SCREEN_EFFECT = 260,
- SPELL_AURA_PHASE = 261,
- SPELL_AURA_ABILITY_IGNORE_AURASTATE = 262,
- SPELL_AURA_ALLOW_ONLY_ABILITY = 263,
- SPELL_AURA_264 = 264,
- SPELL_AURA_265 = 265,
- SPELL_AURA_266 = 266,
- SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL = 267,
+ SPELL_AURA_NONE = 0,
+ SPELL_AURA_BIND_SIGHT = 1,
+ SPELL_AURA_MOD_POSSESS = 2,
+ SPELL_AURA_PERIODIC_DAMAGE = 3,
+ SPELL_AURA_DUMMY = 4,
+ SPELL_AURA_MOD_CONFUSE = 5,
+ SPELL_AURA_MOD_CHARM = 6,
+ SPELL_AURA_MOD_FEAR = 7,
+ SPELL_AURA_PERIODIC_HEAL = 8,
+ SPELL_AURA_MOD_ATTACKSPEED = 9,
+ SPELL_AURA_MOD_THREAT = 10,
+ SPELL_AURA_MOD_TAUNT = 11,
+ SPELL_AURA_MOD_STUN = 12,
+ SPELL_AURA_MOD_DAMAGE_DONE = 13,
+ SPELL_AURA_MOD_DAMAGE_TAKEN = 14,
+ SPELL_AURA_DAMAGE_SHIELD = 15,
+ SPELL_AURA_MOD_STEALTH = 16,
+ SPELL_AURA_MOD_STEALTH_DETECT = 17,
+ SPELL_AURA_MOD_INVISIBILITY = 18,
+ SPELL_AURA_MOD_INVISIBILITY_DETECT = 19,
+ SPELL_AURA_OBS_MOD_HEALTH = 20, // 20, 21 unofficial
+ SPELL_AURA_OBS_MOD_POWER = 21,
+ SPELL_AURA_MOD_RESISTANCE = 22,
+ SPELL_AURA_PERIODIC_TRIGGER_SPELL = 23,
+ SPELL_AURA_PERIODIC_ENERGIZE = 24,
+ SPELL_AURA_MOD_PACIFY = 25,
+ SPELL_AURA_MOD_ROOT = 26,
+ SPELL_AURA_MOD_SILENCE = 27,
+ SPELL_AURA_REFLECT_SPELLS = 28,
+ SPELL_AURA_MOD_STAT = 29,
+ SPELL_AURA_MOD_SKILL = 30,
+ SPELL_AURA_MOD_INCREASE_SPEED = 31,
+ SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED = 32,
+ SPELL_AURA_MOD_DECREASE_SPEED = 33,
+ SPELL_AURA_MOD_INCREASE_HEALTH = 34,
+ SPELL_AURA_MOD_INCREASE_ENERGY = 35,
+ SPELL_AURA_MOD_SHAPESHIFT = 36,
+ SPELL_AURA_EFFECT_IMMUNITY = 37,
+ SPELL_AURA_STATE_IMMUNITY = 38,
+ SPELL_AURA_SCHOOL_IMMUNITY = 39,
+ SPELL_AURA_DAMAGE_IMMUNITY = 40,
+ SPELL_AURA_DISPEL_IMMUNITY = 41,
+ SPELL_AURA_PROC_TRIGGER_SPELL = 42,
+ SPELL_AURA_PROC_TRIGGER_DAMAGE = 43,
+ SPELL_AURA_TRACK_CREATURES = 44,
+ SPELL_AURA_TRACK_RESOURCES = 45,
+ SPELL_AURA_46 = 46, // Ignore all Gear test spells
+ SPELL_AURA_MOD_PARRY_PERCENT = 47,
+ SPELL_AURA_48 = 48, // One periodic spell
+ SPELL_AURA_MOD_DODGE_PERCENT = 49,
+ SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT = 50,
+ SPELL_AURA_MOD_BLOCK_PERCENT = 51,
+ SPELL_AURA_MOD_WEAPON_CRIT_PERCENT = 52,
+ SPELL_AURA_PERIODIC_LEECH = 53,
+ SPELL_AURA_MOD_HIT_CHANCE = 54,
+ SPELL_AURA_MOD_SPELL_HIT_CHANCE = 55,
+ SPELL_AURA_TRANSFORM = 56,
+ SPELL_AURA_MOD_SPELL_CRIT_CHANCE = 57,
+ SPELL_AURA_MOD_INCREASE_SWIM_SPEED = 58,
+ SPELL_AURA_MOD_DAMAGE_DONE_CREATURE = 59,
+ SPELL_AURA_MOD_PACIFY_SILENCE = 60,
+ SPELL_AURA_MOD_SCALE = 61,
+ SPELL_AURA_PERIODIC_HEALTH_FUNNEL = 62,
+ SPELL_AURA_63 = 63, // old SPELL_AURA_PERIODIC_MANA_FUNNEL
+ SPELL_AURA_PERIODIC_MANA_LEECH = 64,
+ SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK = 65,
+ SPELL_AURA_FEIGN_DEATH = 66,
+ SPELL_AURA_MOD_DISARM = 67,
+ SPELL_AURA_MOD_STALKED = 68,
+ SPELL_AURA_SCHOOL_ABSORB = 69,
+ SPELL_AURA_EXTRA_ATTACKS = 70,
+ SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL = 71,
+ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT = 72,
+ SPELL_AURA_MOD_POWER_COST_SCHOOL = 73,
+ SPELL_AURA_REFLECT_SPELLS_SCHOOL = 74,
+ SPELL_AURA_MOD_LANGUAGE = 75,
+ SPELL_AURA_FAR_SIGHT = 76,
+ SPELL_AURA_MECHANIC_IMMUNITY = 77,
+ SPELL_AURA_MOUNTED = 78,
+ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE = 79,
+ SPELL_AURA_MOD_PERCENT_STAT = 80,
+ SPELL_AURA_SPLIT_DAMAGE_PCT = 81,
+ SPELL_AURA_WATER_BREATHING = 82,
+ SPELL_AURA_MOD_BASE_RESISTANCE = 83,
+ SPELL_AURA_MOD_REGEN = 84,
+ SPELL_AURA_MOD_POWER_REGEN = 85,
+ SPELL_AURA_CHANNEL_DEATH_ITEM = 86,
+ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN = 87,
+ SPELL_AURA_MOD_HEALTH_REGEN_PERCENT = 88,
+ SPELL_AURA_PERIODIC_DAMAGE_PERCENT = 89,
+ SPELL_AURA_90 = 90, // old SPELL_AURA_MOD_RESIST_CHANCE
+ SPELL_AURA_MOD_DETECT_RANGE = 91,
+ SPELL_AURA_PREVENTS_FLEEING = 92,
+ SPELL_AURA_MOD_UNATTACKABLE = 93,
+ SPELL_AURA_INTERRUPT_REGEN = 94,
+ SPELL_AURA_GHOST = 95,
+ SPELL_AURA_SPELL_MAGNET = 96,
+ SPELL_AURA_MANA_SHIELD = 97,
+ SPELL_AURA_MOD_SKILL_TALENT = 98,
+ SPELL_AURA_MOD_ATTACK_POWER = 99,
+ SPELL_AURA_AURAS_VISIBLE = 100,
+ SPELL_AURA_MOD_RESISTANCE_PCT = 101,
+ SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS = 102,
+ SPELL_AURA_MOD_TOTAL_THREAT = 103,
+ SPELL_AURA_WATER_WALK = 104,
+ SPELL_AURA_FEATHER_FALL = 105,
+ SPELL_AURA_HOVER = 106,
+ SPELL_AURA_ADD_FLAT_MODIFIER = 107,
+ SPELL_AURA_ADD_PCT_MODIFIER = 108,
+ SPELL_AURA_ADD_TARGET_TRIGGER = 109,
+ SPELL_AURA_MOD_POWER_REGEN_PERCENT = 110,
+ SPELL_AURA_ADD_CASTER_HIT_TRIGGER = 111,
+ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS = 112,
+ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN = 113,
+ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT = 114,
+ SPELL_AURA_MOD_HEALING = 115,
+ SPELL_AURA_MOD_REGEN_DURING_COMBAT = 116,
+ SPELL_AURA_MOD_MECHANIC_RESISTANCE = 117,
+ SPELL_AURA_MOD_HEALING_PCT = 118,
+ SPELL_AURA_119 = 119, // old SPELL_AURA_SHARE_PET_TRACKING
+ SPELL_AURA_UNTRACKABLE = 120,
+ SPELL_AURA_EMPATHY = 121,
+ SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT = 122,
+ SPELL_AURA_MOD_TARGET_RESISTANCE = 123,
+ SPELL_AURA_MOD_RANGED_ATTACK_POWER = 124,
+ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN = 125,
+ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT = 126,
+ SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS = 127,
+ SPELL_AURA_MOD_POSSESS_PET = 128,
+ SPELL_AURA_MOD_SPEED_ALWAYS = 129,
+ SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS = 130,
+ SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS = 131,
+ SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT = 132,
+ SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT = 133,
+ SPELL_AURA_MOD_MANA_REGEN_INTERRUPT = 134,
+ SPELL_AURA_MOD_HEALING_DONE = 135,
+ SPELL_AURA_MOD_HEALING_DONE_PERCENT = 136,
+ SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE = 137,
+ SPELL_AURA_MOD_MELEE_HASTE = 138,
+ SPELL_AURA_FORCE_REACTION = 139,
+ SPELL_AURA_MOD_RANGED_HASTE = 140,
+ SPELL_AURA_MOD_RANGED_AMMO_HASTE = 141,
+ SPELL_AURA_MOD_BASE_RESISTANCE_PCT = 142,
+ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE = 143,
+ SPELL_AURA_SAFE_FALL = 144,
+ SPELL_AURA_MOD_PET_TALENT_POINTS = 145,
+ SPELL_AURA_ALLOW_TAME_PET_TYPE = 146,
+ SPELL_AURA_MECHANIC_IMMUNITY_MASK = 147,
+ SPELL_AURA_RETAIN_COMBO_POINTS = 148,
+ SPELL_AURA_REDUCE_PUSHBACK = 149, // Reduce Pushback
+ SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT = 150,
+ SPELL_AURA_TRACK_STEALTHED = 151, // Track Stealthed
+ SPELL_AURA_MOD_DETECTED_RANGE = 152, // Mod Detected Range
+ SPELL_AURA_SPLIT_DAMAGE_FLAT = 153, // Split Damage Flat
+ SPELL_AURA_MOD_STEALTH_LEVEL = 154, // Stealth Level Modifier
+ SPELL_AURA_MOD_WATER_BREATHING = 155, // Mod Water Breathing
+ SPELL_AURA_MOD_REPUTATION_GAIN = 156, // Mod Reputation Gain
+ SPELL_AURA_PET_DAMAGE_MULTI = 157, // Mod Pet Damage
+ SPELL_AURA_MOD_SHIELD_BLOCKVALUE = 158,
+ SPELL_AURA_NO_PVP_CREDIT = 159,
+ SPELL_AURA_MOD_AOE_AVOIDANCE = 160,
+ SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT = 161,
+ SPELL_AURA_POWER_BURN = 162,
+ SPELL_AURA_MOD_CRIT_DAMAGE_BONUS = 163,
+ SPELL_AURA_164 = 164,
+ SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS = 165,
+ SPELL_AURA_MOD_ATTACK_POWER_PCT = 166,
+ SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT = 167,
+ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS = 168,
+ SPELL_AURA_MOD_CRIT_PERCENT_VERSUS = 169,
+ SPELL_AURA_DETECT_AMORE = 170,
+ SPELL_AURA_MOD_SPEED_NOT_STACK = 171,
+ SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK = 172,
+ SPELL_AURA_173 = 173, // old SPELL_AURA_ALLOW_CHAMPION_SPELLS
+ SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT = 174, // by defeult intelect, dependent from SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
+ SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT = 175,
+ SPELL_AURA_SPIRIT_OF_REDEMPTION = 176,
+ SPELL_AURA_AOE_CHARM = 177,
+ SPELL_AURA_MOD_DEBUFF_RESISTANCE = 178,
+ SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE = 179,
+ SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS = 180,
+ SPELL_AURA_181 = 181, // old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS - possible flat spell crit damage versus
+ SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT = 182,
+ SPELL_AURA_MOD_CRITICAL_THREAT = 183,
+ SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE = 184,
+ SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE = 185,
+ SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE = 186,
+ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE = 187,
+ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE = 188,
+ SPELL_AURA_MOD_RATING = 189,
+ SPELL_AURA_MOD_FACTION_REPUTATION_GAIN = 190,
+ SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED = 191,
+ SPELL_AURA_MOD_MELEE_RANGED_HASTE = 192,
+ SPELL_AURA_MELEE_SLOW = 193,
+ SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL = 194,
+ SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL = 195,
+ SPELL_AURA_MOD_COOLDOWN = 196, // only 24818 Noxious Breath
+ SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE = 197,
+ SPELL_AURA_198 = 198, // old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
+ SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT = 199,
+ SPELL_AURA_MOD_XP_PCT = 200,
+ SPELL_AURA_FLY = 201,
+ SPELL_AURA_IGNORE_COMBAT_RESULT = 202,
+ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE = 203,
+ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE = 204,
+ SPELL_AURA_MOD_SCHOOL_CRIT_DMG_TAKEN = 205,
+ SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED = 206,
+ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED = 207,
+ SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED = 208,
+ SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS = 209,
+ SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS = 210,
+ SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK = 211,
+ SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT = 212,
+ SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT = 213,
+ SPELL_AURA_214 = 214,
+ SPELL_AURA_ARENA_PREPARATION = 215,
+ SPELL_AURA_HASTE_SPELLS = 216,
+ SPELL_AURA_MOD_MELEE_HASTE_2 = 217, // NYI
+ SPELL_AURA_HASTE_RANGED = 218,
+ SPELL_AURA_MOD_MANA_REGEN_FROM_STAT = 219,
+ SPELL_AURA_MOD_RATING_FROM_STAT = 220,
+ SPELL_AURA_MOD_DETAUNT = 221,
+ SPELL_AURA_222 = 222,
+ SPELL_AURA_RAID_PROC_FROM_CHARGE = 223,
+ SPELL_AURA_224 = 224,
+ SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE = 225,
+ SPELL_AURA_PERIODIC_DUMMY = 226,
+ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE = 227,
+ SPELL_AURA_DETECT_STEALTH = 228,
+ SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE = 229,
+ SPELL_AURA_230 = 230,
+ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE = 231,
+ SPELL_AURA_MECHANIC_DURATION_MOD = 232,
+ SPELL_AURA_CHANGE_MODEL_FOR_ALL_HUMANOIDS = 233, // client-side only
+ SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK = 234,
+ SPELL_AURA_MOD_DISPEL_RESIST = 235,
+ SPELL_AURA_CONTROL_VEHICLE = 236,
+ SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER = 237,
+ SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER = 238,
+ SPELL_AURA_MOD_SCALE_2 = 239,
+ SPELL_AURA_MOD_EXPERTISE = 240,
+ SPELL_AURA_FORCE_MOVE_FORWARD = 241,
+ SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING = 242,
+ SPELL_AURA_MOD_FACTION = 243,
+ SPELL_AURA_COMPREHEND_LANGUAGE = 244,
+ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL = 245,
+ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK = 246,
+ SPELL_AURA_CLONE_CASTER = 247,
+ SPELL_AURA_MOD_COMBAT_RESULT_CHANCE = 248,
+ SPELL_AURA_CONVERT_RUNE = 249,
+ SPELL_AURA_MOD_INCREASE_HEALTH_2 = 250,
+ SPELL_AURA_MOD_ENEMY_DODGE = 251,
+ SPELL_AURA_MOD_SPEED_SLOW_ALL = 252,
+ SPELL_AURA_MOD_BLOCK_CRIT_CHANCE = 253,
+ SPELL_AURA_MOD_DISARM_OFFHAND = 254,
+ SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT = 255,
+ SPELL_AURA_NO_REAGENT_USE = 256,
+ SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS = 257,
+ SPELL_AURA_258 = 258,
+ SPELL_AURA_MOD_HOT_PCT = 259,
+ SPELL_AURA_SCREEN_EFFECT = 260,
+ SPELL_AURA_PHASE = 261,
+ SPELL_AURA_ABILITY_IGNORE_AURASTATE = 262,
+ SPELL_AURA_ALLOW_ONLY_ABILITY = 263,
+ SPELL_AURA_264 = 264,
+ SPELL_AURA_265 = 265,
+ SPELL_AURA_266 = 266,
+ SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL = 267,
SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT = 268,
- SPELL_AURA_MOD_IGNORE_TARGET_RESIST = 269,
- SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST = 270, // Possibly need swap vs 195 aura used only in 1 spell Chaos Bolt Passive
- SPELL_AURA_MOD_DAMAGE_FROM_CASTER = 271,
- SPELL_AURA_IGNORE_MELEE_RESET = 272,
- SPELL_AURA_X_RAY = 273,
- SPELL_AURA_ABILITY_CONSUME_NO_AMMO = 274,
- SPELL_AURA_MOD_IGNORE_SHAPESHIFT = 275,
- SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC = 276, // NYI
- SPELL_AURA_MOD_MAX_AFFECTED_TARGETS = 277,
- SPELL_AURA_MOD_DISARM_RANGED = 278,
- SPELL_AURA_INITIALIZE_IMAGES = 279,
+ SPELL_AURA_MOD_IGNORE_TARGET_RESIST = 269,
+ SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST = 270, // Possibly need swap vs 195 aura used only in 1 spell Chaos Bolt Passive
+ SPELL_AURA_MOD_DAMAGE_FROM_CASTER = 271,
+ SPELL_AURA_IGNORE_MELEE_RESET = 272,
+ SPELL_AURA_X_RAY = 273,
+ SPELL_AURA_ABILITY_CONSUME_NO_AMMO = 274,
+ SPELL_AURA_MOD_IGNORE_SHAPESHIFT = 275,
+ SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC = 276, // NYI
+ SPELL_AURA_MOD_MAX_AFFECTED_TARGETS = 277,
+ SPELL_AURA_MOD_DISARM_RANGED = 278,
+ SPELL_AURA_INITIALIZE_IMAGES = 279,
SPELL_AURA_MOD_ARMOR_PENETRATION_PCT = 280,
- SPELL_AURA_MOD_HONOR_GAIN_PCT = 281,
- SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
- SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells
- SPELL_AURA_LINKED = 284,
- SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR = 285,
- SPELL_AURA_ABILITY_PERIODIC_CRIT = 286,
- SPELL_AURA_DEFLECT_SPELLS = 287,
- SPELL_AURA_IGNORE_HIT_DIRECTION = 288,
- SPELL_AURA_289 = 289,
- SPELL_AURA_MOD_CRIT_PCT = 290,
- SPELL_AURA_MOD_XP_QUEST_PCT = 291,
- SPELL_AURA_OPEN_STABLE = 292,
- SPELL_AURA_OVERRIDE_SPELLS = 293,
- SPELL_AURA_PREVENT_REGENERATE_POWER = 294,
- SPELL_AURA_295 = 295,
- SPELL_AURA_SET_VEHICLE_ID = 296,
- SPELL_AURA_BLOCK_SPELL_FAMILY = 297,
- SPELL_AURA_STRANGULATE = 298,
- SPELL_AURA_299 = 299,
- SPELL_AURA_SHARE_DAMAGE_PCT = 300,
- SPELL_AURA_SCHOOL_HEAL_ABSORB = 301,
- SPELL_AURA_302 = 302,
- SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE = 303,
- SPELL_AURA_MOD_FAKE_INEBRIATE = 304,
- SPELL_AURA_MOD_MINIMUM_SPEED = 305,
- SPELL_AURA_306 = 306,
- SPELL_AURA_HEAL_ABSORB_TEST = 307,
- SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER = 308, // NYI
- SPELL_AURA_309 = 309,
- SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE = 310,
- SPELL_AURA_311 = 311,
- SPELL_AURA_312 = 312,
- SPELL_AURA_313 = 313,
- SPELL_AURA_PREVENT_RESURRECTION = 314,
- SPELL_AURA_UNDERWATER_WALKING = 315,
- SPELL_AURA_PERIODIC_HASTE = 316,
- TOTAL_AURAS = 317
+ SPELL_AURA_MOD_HONOR_GAIN_PCT = 281,
+ SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
+ SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells
+ SPELL_AURA_LINKED = 284,
+ SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR = 285,
+ SPELL_AURA_ABILITY_PERIODIC_CRIT = 286,
+ SPELL_AURA_DEFLECT_SPELLS = 287,
+ SPELL_AURA_IGNORE_HIT_DIRECTION = 288,
+ SPELL_AURA_289 = 289,
+ SPELL_AURA_MOD_CRIT_PCT = 290,
+ SPELL_AURA_MOD_XP_QUEST_PCT = 291,
+ SPELL_AURA_OPEN_STABLE = 292,
+ SPELL_AURA_OVERRIDE_SPELLS = 293,
+ SPELL_AURA_PREVENT_REGENERATE_POWER = 294,
+ SPELL_AURA_295 = 295,
+ SPELL_AURA_SET_VEHICLE_ID = 296,
+ SPELL_AURA_BLOCK_SPELL_FAMILY = 297,
+ SPELL_AURA_STRANGULATE = 298,
+ SPELL_AURA_299 = 299,
+ SPELL_AURA_SHARE_DAMAGE_PCT = 300,
+ SPELL_AURA_SCHOOL_HEAL_ABSORB = 301,
+ SPELL_AURA_302 = 302,
+ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE = 303,
+ SPELL_AURA_MOD_FAKE_INEBRIATE = 304,
+ SPELL_AURA_MOD_MINIMUM_SPEED = 305,
+ SPELL_AURA_306 = 306,
+ SPELL_AURA_HEAL_ABSORB_TEST = 307,
+ SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER = 308, // NYI
+ SPELL_AURA_309 = 309,
+ SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE = 310,
+ SPELL_AURA_311 = 311,
+ SPELL_AURA_312 = 312,
+ SPELL_AURA_313 = 313,
+ SPELL_AURA_PREVENT_RESURRECTION = 314,
+ SPELL_AURA_UNDERWATER_WALKING = 315,
+ SPELL_AURA_PERIODIC_HASTE = 316,
+ TOTAL_AURAS = 317
};
enum AuraObjectType
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index b29f1498152..260091c9ed7 100755..100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -120,7 +120,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleAuraModPacifyAndSilence, // 60 SPELL_AURA_MOD_PACIFY_SILENCE
&AuraEffect::HandleAuraModScale, // 61 SPELL_AURA_MOD_SCALE
&AuraEffect::HandleNoImmediateEffect, // 62 SPELL_AURA_PERIODIC_HEALTH_FUNNEL implemented in AuraEffect::PeriodicTick
- &AuraEffect::HandleNULL, // 63 unused (3.2.0) old SPELL_AURA_PERIODIC_MANA_FUNNEL
+ &AuraEffect::HandleUnused, // 63 unused (3.2.0) old SPELL_AURA_PERIODIC_MANA_FUNNEL
&AuraEffect::HandleNoImmediateEffect, // 64 SPELL_AURA_PERIODIC_MANA_LEECH implemented in AuraEffect::PeriodicTick
&AuraEffect::HandleModCastingSpeed, // 65 SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
&AuraEffect::HandleFeignDeath, // 66 SPELL_AURA_FEIGN_DEATH
@@ -147,7 +147,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNoImmediateEffect, // 87 SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
&AuraEffect::HandleNoImmediateEffect, // 88 SPELL_AURA_MOD_HEALTH_REGEN_PERCENT implemented in Player::RegenerateHealth
&AuraEffect::HandleNoImmediateEffect, // 89 SPELL_AURA_PERIODIC_DAMAGE_PERCENT
- &AuraEffect::HandleNULL, // 90 unused (3.0.8a) old SPELL_AURA_MOD_RESIST_CHANCE
+ &AuraEffect::HandleUnused, // 90 unused (3.0.8a) old SPELL_AURA_MOD_RESIST_CHANCE
&AuraEffect::HandleNoImmediateEffect, // 91 SPELL_AURA_MOD_DETECT_RANGE implemented in Creature::GetAttackDistance
&AuraEffect::HandlePreventFleeing, // 92 SPELL_AURA_PREVENTS_FLEEING
&AuraEffect::HandleModUnattackable, // 93 SPELL_AURA_MOD_UNATTACKABLE
@@ -176,7 +176,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNoImmediateEffect, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT
&AuraEffect::HandleNoImmediateEffect, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult
&AuraEffect::HandleNoImmediateEffect, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus
- &AuraEffect::HandleNULL, //119 unused (3.2.0) old SPELL_AURA_SHARE_PET_TRACKING
+ &AuraEffect::HandleUnused, //119 unused (3.2.0) old SPELL_AURA_SHARE_PET_TRACKING
&AuraEffect::HandleAuraUntrackable, //120 SPELL_AURA_UNTRACKABLE
&AuraEffect::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY
&AuraEffect::HandleModOffhandDamagePercent, //122 SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT
@@ -230,7 +230,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNULL, //170 SPELL_AURA_DETECT_AMORE various spells that change visual of units for aura target (clientside?)
&AuraEffect::HandleAuraModIncreaseSpeed, //171 SPELL_AURA_MOD_SPEED_NOT_STACK
&AuraEffect::HandleAuraModIncreaseMountedSpeed, //172 SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
- &AuraEffect::HandleNULL, //173 unused (3.2.0) no spells, old SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell
+ &AuraEffect::HandleUnused, //173 unused (3.2.0) no spells, old SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell
&AuraEffect::HandleModSpellDamagePercentFromStat, //174 SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT implemented in Unit::SpellBaseDamageBonus
&AuraEffect::HandleModSpellHealingPercentFromStat, //175 SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT implemented in Unit::SpellBaseHealingBonus
&AuraEffect::HandleSpiritOfRedemption, //176 SPELL_AURA_SPIRIT_OF_REDEMPTION only for Spirit of Redemption spell, die at aura end
@@ -238,7 +238,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNoImmediateEffect, //178 SPELL_AURA_MOD_DEBUFF_RESISTANCE implemented in Unit::MagicSpellHitResult
&AuraEffect::HandleNoImmediateEffect, //179 SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE implemented in Unit::SpellCriticalBonus
&AuraEffect::HandleNoImmediateEffect, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonus
- &AuraEffect::HandleNULL, //181 unused (3.2.0) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS
+ &AuraEffect::HandleUnused, //181 unused (3.2.0) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS
&AuraEffect::HandleAuraModResistenceOfStatPercent, //182 SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT
&AuraEffect::HandleNULL, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746 - miscvalue - spell school
&AuraEffect::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
@@ -255,7 +255,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNoImmediateEffect, //195 SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
&AuraEffect::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN - flat mod of spell cooldowns
&AuraEffect::HandleNoImmediateEffect, //197 SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE implemented in Unit::SpellCriticalBonus Unit::GetUnitCriticalChance
- &AuraEffect::HandleNULL, //198 unused (3.2.0) old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
+ &AuraEffect::HandleUnused, //198 unused (3.2.0) old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
&AuraEffect::HandleNoImmediateEffect, //199 SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT implemented in Unit::MagicSpellHitResult
&AuraEffect::HandleNoImmediateEffect, //200 SPELL_AURA_MOD_XP_PCT implemented in Player::RewardPlayerAndGroupAtKill
&AuraEffect::HandleAuraAllowFlight, //201 SPELL_AURA_FLY this aura enable flight mode...
@@ -352,25 +352,25 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleAuraOpenStable, //292 SPELL_AURA_OPEN_STABLE
&AuraEffect::HandleAuraOverrideSpells, //293 auras which probably add set of abilities to their target based on it's miscvalue
&AuraEffect::HandleNoImmediateEffect, //294 SPELL_AURA_PREVENT_REGENERATE_POWER implemented in Player::Regenerate(Powers power)
- &AuraEffect::HandleNULL, //295 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //295 0 spells in 3.3.5
&AuraEffect::HandleAuraSetVehicle, //296 SPELL_AURA_SET_VEHICLE_ID sets vehicle on target
&AuraEffect::HandleNULL, //297 Spirit Burst spells
&AuraEffect::HandleNULL, //298 70569 - Strangulating, maybe prevents talk or cast
- &AuraEffect::HandleNULL, //299 unused
+ &AuraEffect::HandleUnused, //299 unused
&AuraEffect::HandleNoImmediateEffect, //300 SPELL_AURA_SHARE_DAMAGE_PCT implemented in Unit::DealDamage
&AuraEffect::HandleNoImmediateEffect, //301 SPELL_AURA_SCHOOL_HEAL_ABSORB implemented in Unit::CalcHealAbsorb
- &AuraEffect::HandleNULL, //302 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //302 0 spells in 3.3.5
&AuraEffect::HandleNoImmediateEffect, //303 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
&AuraEffect::HandleAuraModFakeInebriation, //304 SPELL_AURA_MOD_DRUNK
&AuraEffect::HandleAuraModIncreaseSpeed, //305 SPELL_AURA_MOD_MINIMUM_SPEED
- &AuraEffect::HandleNULL, //306 0 spells in 3.3.5
- &AuraEffect::HandleNULL, //307 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //306 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //307 0 spells in 3.3.5
&AuraEffect::HandleNULL, //308 new aura for hunter traps
- &AuraEffect::HandleNULL, //309 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //309 0 spells in 3.3.5
&AuraEffect::HandleNoImmediateEffect, //310 SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE implemented in Spell::CalculateDamageDone
&AuraEffect::HandleNULL, //311 0 spells in 3.3.5
&AuraEffect::HandleNULL, //312 0 spells in 3.3.5
- &AuraEffect::HandleNULL, //313 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //313 0 spells in 3.3.5
&AuraEffect::HandlePreventResurrection, //314 SPELL_AURA_PREVENT_RESURRECTION todo
&AuraEffect::HandleNoImmediateEffect, //315 SPELL_AURA_UNDERWATER_WALKING todo
&AuraEffect::HandleNoImmediateEffect, //316 SPELL_AURA_PERIODIC_HASTE implemented in AuraEffect::CalculatePeriodic
@@ -417,9 +417,8 @@ void AuraEffect::GetApplicationList(std::list<AuraApplication*> & applicationLis
int32 AuraEffect::CalculateAmount(Unit* caster)
{
- int32 amount;
// default amount calculation
- amount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, NULL);
+ int32 amount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, NULL);
// check item enchant aura cast
if (!amount && caster)
@@ -658,31 +657,18 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
AddPct(amount, m_spellInfo->Effects[EFFECT_2].CalcValue(caster));
}
}
- // Unholy Blight damage over time effect
- else if (GetId() == 50536)
- {
- m_canBeRecalculated = false;
- // we're getting total damage on aura apply, change it to be damage per tick
- amount = int32((float)amount / GetTotalTicks());
- }
break;
case SPELL_AURA_PERIODIC_ENERGIZE:
switch (m_spellInfo->Id)
{
- case 57669: // Replenishment (0.2% from max)
- amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f;
- break;
- case 61782: // Infinite Replenishment
- amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f;
- break;
- case 29166: // Innervate
- ApplyPct(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
- break;
- case 48391: // Owlkin Frenzy
- ApplyPct(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
- break;
- default:
- break;
+ case 29166: // Innervate
+ ApplyPct(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
+ break;
+ case 48391: // Owlkin Frenzy
+ ApplyPct(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
+ break;
+ default:
+ break;
}
break;
case SPELL_AURA_PERIODIC_HEAL:
@@ -3109,9 +3095,10 @@ void AuraEffect::HandleModPossess(AuraApplication const* aurApp, uint8 mode, boo
target->RemoveCharmedBy(caster);
}
-// only one spell has this aura
void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode, bool apply) const
{
+ // Used by spell "Eyes of the Beast"
+
if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
@@ -3134,6 +3121,9 @@ void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode,
if (caster->ToPlayer()->GetPet() != pet)
return;
+ // Must clear current motion or pet leashes back to owner after a few yards
+ // when under spell 'Eyes of the Beast'
+ pet->GetMotionMaster()->Clear();
pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
}
else
@@ -3144,13 +3134,15 @@ void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode,
pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
else
{
- // Reinitialize the pet bar and make the pet come back to the owner
+ // Reinitialize the pet bar or it will appear greyed out
caster->ToPlayer()->PetSpellInitialize();
- if (!pet->getVictim())
+
+ // Follow owner only if not fighting or owner didn't click "stay" at new location
+ // This may be confusing because pet bar shows "stay" when under the spell but it retains
+ // the "follow" flag. Player MUST click "stay" while under the spell.
+ if (!pet->getVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
{
pet->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, pet->GetFollowAngle());
- //if (target->GetCharmInfo())
- // target->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
}
}
}
@@ -3581,6 +3573,26 @@ void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8
switch (GetId())
{
+ case 34471: // The Beast Within
+ case 19574: // Bestial Wrath
+ mechanic = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_KNOCKOUT, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_BANISH, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SHACKLE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DAZE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply);
+ break;
case 42292: // PvP trinket
case 59752: // Every Man for Himself
mechanic = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
@@ -3592,28 +3604,6 @@ void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply);
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
break;
- case 34471: // The Beast Within
- case 19574: // Bestial Wrath
- mechanic = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
- | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
- | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
- | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
- | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
- | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
-
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
- break;
default:
if (GetMiscValue() < 1)
return;
@@ -5463,7 +5453,7 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo
{
Unit* target = aurApp->GetTarget();
- uint32 triggeredSpellId = m_spellInfo->Effects[m_effIndex].TriggerSpell;
+ uint32 triggeredSpellId = sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->Effects[m_effIndex].TriggerSpell, target);
SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId);
if (!triggeredSpellInfo)
return;
@@ -6179,6 +6169,9 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
// ignore non positive values (can be result apply spellmods to aura damage
uint32 damage = std::max(GetAmount(), 0);
+ // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
+ sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
+
if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
{
damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index d0d9d417c3e..d0d9d417c3e 100755..100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h
index 85c8992c597..85c8992c597 100755..100644
--- a/src/server/game/Spells/Auras/SpellAuras.h
+++ b/src/server/game/Spells/Auras/SpellAuras.h
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 97f0f350ab0..aa0104da57e 100755..100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1393,7 +1393,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id))
{
// TODO: fix this check
- if (m_spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS))
+ if (m_spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS) || m_spellInfo->HasEffect(SPELL_EFFECT_BIND))
m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation, (int32)st->target_mapId);
else if (st->target_mapId == m_caster->GetMapId())
m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation);
@@ -4199,12 +4199,12 @@ void Spell::ExecuteLogEffectInterruptCast(uint8 effIndex, Unit* victim, uint32 s
*m_effectExecuteData[effIndex] << uint32(spellId);
}
-void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, uint32 /*itemslot*/, uint32 damage)
+void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 slot)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(victim->GetPackGUID());
- *m_effectExecuteData[effIndex] << uint32(m_spellInfo->Id);
- *m_effectExecuteData[effIndex] << uint32(damage);
+ *m_effectExecuteData[effIndex] << int32(itemId);
+ *m_effectExecuteData[effIndex] << int32(slot);
}
void Spell::ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj)
@@ -4867,17 +4867,12 @@ SpellCastResult Spell::CheckCast(bool strict)
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id);
if (!conditions.empty() && !sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
{
- // send error msg to player if condition failed and text message available
- // TODO: using WorldSession::SendNotification is not blizzlike
- if (Player* playerCaster = m_caster->ToPlayer())
+ // mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others)
+ if (condInfo.mLastFailedCondition && condInfo.mLastFailedCondition->ErrorType)
{
- // mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others)
- if (playerCaster->GetSession() && condInfo.mLastFailedCondition
- && condInfo.mLastFailedCondition->ErrorTextId)
- {
- playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextId);
- return SPELL_FAILED_DONT_REPORT;
- }
+ if (condInfo.mLastFailedCondition->ErrorType == SPELL_FAILED_CUSTOM_ERROR)
+ m_customError = SpellCustomErrors(condInfo.mLastFailedCondition->ErrorTextId);
+ return SpellCastResult(condInfo.mLastFailedCondition->ErrorType);
}
if (!condInfo.mLastFailedCondition || !condInfo.mLastFailedCondition->ConditionTarget)
return SPELL_FAILED_CASTER_AURASTATE;
@@ -5615,7 +5610,7 @@ SpellCastResult Spell::CheckCasterAuras() const
dispel_immune |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
}
// immune movement impairment and loss of control
- if (m_spellInfo->Id == 42292 || m_spellInfo->Id == 59752)
+ if (m_spellInfo->Id == 42292 || m_spellInfo->Id == 59752 || m_spellInfo->Id == 19574)
mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
}
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 1f2a468133b..c43ee401780 100755..100644
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -424,7 +424,7 @@ class Spell
void ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32 powerType, uint32 powerTaken, float gainMultiplier);
void ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit* victim, uint32 attCount);
void ExecuteLogEffectInterruptCast(uint8 effIndex, Unit* victim, uint32 spellId);
- void ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, uint32 itemslot, uint32 damage);
+ void ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 slot);
void ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj);
void ExecuteLogEffectCreateItem(uint8 effIndex, uint32 entry);
void ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry);
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 622f3e1517b..8bf164767e8 100755..100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -4983,25 +4983,17 @@ void Spell::EffectReputation(SpellEffIndex effIndex)
Player* player = unitTarget->ToPlayer();
- int32 rep_change = damage;
+ int32 repChange = damage;
- uint32 faction_id = m_spellInfo->Effects[effIndex].MiscValue;
-
- FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
+ uint32 factionId = m_spellInfo->Effects[effIndex].MiscValue;
+ FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
if (!factionEntry)
return;
- if (RepRewardRate const* repData = sObjectMgr->GetRepRewardRate(faction_id))
- {
- rep_change = int32((float)rep_change * repData->spell_rate);
- }
+ repChange = player->CalculateReputationGain(REPUTATION_SOURCE_SPELL, 0, repChange, factionId);
- // Bonus from spells that increase reputation gain
- float bonus = rep_change * player->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN) / 100.0f; // 10%
- rep_change += (int32)bonus;
-
- player->GetReputationMgr().ModifyReputation(factionEntry, rep_change);
+ player->GetReputationMgr().ModifyReputation(factionEntry, repChange);
}
void Spell::EffectQuestComplete(SpellEffIndex effIndex)
@@ -5400,11 +5392,11 @@ void Spell::EffectDurabilityDamage(SpellEffIndex effIndex)
int32 slot = m_spellInfo->Effects[effIndex].MiscValue;
- // FIXME: some spells effects have value -1/-2
- // Possibly its mean -1 all player equipped items and -2 all items
+ // -1 means all player equipped items and -2 all items
if (slot < 0)
{
unitTarget->ToPlayer()->DurabilityPointsLossAll(damage, (slot < -1));
+ ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, -1, -1);
return;
}
@@ -5413,9 +5405,10 @@ void Spell::EffectDurabilityDamage(SpellEffIndex effIndex)
return;
if (Item* item = unitTarget->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ {
unitTarget->ToPlayer()->DurabilityPointsLoss(item, damage);
-
- ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, slot, damage);
+ ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, item->GetEntry(), slot);
+ }
}
void Spell::EffectDurabilityDamagePCT(SpellEffIndex effIndex)
@@ -6271,51 +6264,38 @@ void Spell::EffectBind(SpellEffIndex effIndex)
Player* player = unitTarget->ToPlayer();
- uint32 area_id;
- WorldLocation loc;
- if (m_spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_DEST_DB || m_spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DB)
- {
- SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id);
- if (!st)
- {
- sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectBind - unknown teleport coordinates for spell ID %u", m_spellInfo->Id);
- return;
- }
+ WorldLocation homeLoc;
+ uint32 areaId = player->GetAreaId();
- loc.m_mapId = st->target_mapId;
- loc.m_positionX = st->target_X;
- loc.m_positionY = st->target_Y;
- loc.m_positionZ = st->target_Z;
- loc.m_orientation = st->target_Orientation;
- area_id = player->GetAreaId();
- }
+ if (m_spellInfo->Effects[effIndex].MiscValue)
+ areaId = m_spellInfo->Effects[effIndex].MiscValue;
+
+ if (m_targets.HasDst())
+ homeLoc.WorldRelocate(*destTarget);
else
{
- player->GetPosition(&loc);
- area_id = player->GetAreaId();
+ player->GetPosition(&homeLoc);
+ homeLoc.m_mapId = player->GetMapId();
}
- player->SetHomebind(loc, area_id);
+ player->SetHomebind(homeLoc, areaId);
// binding
WorldPacket data(SMSG_BINDPOINTUPDATE, (4+4+4+4+4));
- data << float(loc.m_positionX);
- data << float(loc.m_positionY);
- data << float(loc.m_positionZ);
- data << uint32(loc.m_mapId);
- data << uint32(area_id);
+ data << float(homeLoc.GetPositionX());
+ data << float(homeLoc.GetPositionY());
+ data << float(homeLoc.GetPositionZ());
+ data << uint32(homeLoc.GetMapId());
+ data << uint32(areaId);
player->SendDirectMessage(&data);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind X : %f", loc.m_positionX);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind Y : %f", loc.m_positionY);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind Z : %f", loc.m_positionZ);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind MapId : %u", loc.m_mapId);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind AreaId : %u", area_id);
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "EffectBind: New homebind X: %f, Y: %f, Z: %f, MapId: %u, AreaId: %u",
+ homeLoc.GetPositionX(), homeLoc.GetPositionY(), homeLoc.GetPositionZ(), homeLoc.GetMapId(), areaId);
// zone update
data.Initialize(SMSG_PLAYERBOUND, 8+4);
data << uint64(player->GetGUID());
- data << uint32(area_id);
+ data << uint32(areaId);
player->SendDirectMessage(&data);
}
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index be4c522956c..fcfa441455e 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -499,9 +499,14 @@ float SpellEffectInfo::CalcRadius(Unit* caster, Spell* spell) const
if (!HasRadius())
return 0.0f;
- float radius = RadiusEntry->radiusMax;
- if (Player* modOwner = (caster ? caster->GetSpellModOwner() : NULL))
- modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_RADIUS, radius, spell);
+ float radius = RadiusEntry->RadiusMin;
+ if (caster)
+ {
+ radius += RadiusEntry->RadiusPerLevel * caster->getLevel();
+ radius = std::min(radius, RadiusEntry->RadiusMax);
+ if (Player* modOwner = caster->GetSpellModOwner())
+ modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_RADIUS, radius, spell);
+ }
return radius;
}
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 1edb8eab103..3eefd969eed 100755..100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -2439,7 +2439,6 @@ void SpellMgr::LoadSpellAreas()
// 0 1 2 3 4 5 6 7 8 9
QueryResult result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_status, quest_end_status, quest_end, aura_spell, racemask, gender, autocast FROM spell_area");
-
if (!result)
{
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty.");
@@ -2979,6 +2978,9 @@ void SpellMgr::LoadDbcDataCorrections()
switch (spellInfo->Id)
{
+ case 53096: // Quetz'lun's Judgment
+ spellInfo->MaxAffectedTargets = 1;
+ break;
case 42730:
spellInfo->EffectTriggerSpell[EFFECT_1] = 42739;
break;
@@ -3313,6 +3315,13 @@ void SpellMgr::LoadDbcDataCorrections()
case 70650: // Death Knight T10 Tank 2P Bonus
spellInfo->EffectApplyAuraName[0] = SPELL_AURA_ADD_PCT_MODIFIER;
break;
+ case 71838: // Drain Life - Bryntroll Normal
+ case 71839: // Drain Life - Bryntroll Heroic
+ spellInfo->AttributesEx2 |= SPELL_ATTR2_CANT_CRIT;
+ break;
+ case 34471: // The Beast Within
+ spellInfo->AttributesEx5 |= SPELL_ATTR5_USABLE_WHILE_CONFUSED | SPELL_ATTR5_USABLE_WHILE_FEARED | SPELL_ATTR5_USABLE_WHILE_STUNNED;
+ break;
// ULDUAR SPELLS
//
case 62374: // Pursued (Flame Leviathan)
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index cec9d4650f5..cec9d4650f5 100755..100644
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index f7ab6e22f2e..f7ab6e22f2e 100755..100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index 26dda4d2327..26dda4d2327 100755..100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index 89b75fd1695..89b75fd1695 100755..100644
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h
index df6dd7fe4f3..df6dd7fe4f3 100755..100644
--- a/src/server/game/Texts/CreatureTextMgr.h
+++ b/src/server/game/Texts/CreatureTextMgr.h
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index 3f0e608ec14..3f0e608ec14 100755..100644
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h
index 7e6768b96b2..7e6768b96b2 100755..100644
--- a/src/server/game/Tickets/TicketMgr.h
+++ b/src/server/game/Tickets/TicketMgr.h
diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
index f87b81c8be8..0ec56dd17fd 100644
--- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp
+++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
@@ -17,6 +17,7 @@
*/
#include "Common.h"
+#include "AchievementMgr.h"
#include "CharacterDatabaseCleaner.h"
#include "World.h"
#include "Database/DatabaseEnv.h"
@@ -34,7 +35,7 @@ void CharacterDatabaseCleaner::CleanDatabase()
uint32 oldMSTime = getMSTime();
// check flags which clean ups are necessary
- QueryResult result = CharacterDatabase.Query("SELECT value FROM worldstates WHERE entry = 20004");
+ QueryResult result = CharacterDatabase.PQuery("SELECT value FROM worldstates WHERE entry = %d", WS_CLEANING_FLAGS);
if (!result)
return;
@@ -59,12 +60,11 @@ void CharacterDatabaseCleaner::CleanDatabase()
// NOTE: In order to have persistentFlags be set in worldstates for the next cleanup,
// you need to define them at least once in worldstates.
flags &= sWorld->getIntConfig(CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS);
- CharacterDatabase.DirectPExecute("UPDATE worldstates SET value = %u WHERE entry = 20004", flags);
+ CharacterDatabase.DirectPExecute("UPDATE worldstates SET value = %u WHERE entry = %d", flags, WS_CLEANING_FLAGS);
sWorld->SetCleaningFlags(flags);
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
}
void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32))
@@ -108,7 +108,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
bool CharacterDatabaseCleaner::AchievementProgressCheck(uint32 criteria)
{
- return sAchievementCriteriaStore.LookupEntry(criteria);
+ return sAchievementMgr->GetAchievementCriteria(criteria);
}
void CharacterDatabaseCleaner::CleanCharacterAchievementProgress()
diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp
index 57986243879..23114bda12a 100644
--- a/src/server/game/Tools/PlayerDump.cpp
+++ b/src/server/game/Tools/PlayerDump.cpp
@@ -406,7 +406,6 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
if (!fin)
return DUMP_FILE_OPEN_ERROR;
- QueryResult result = QueryResult(NULL);
char newguid[20], chraccount[20], newpetid[20], currpetid[20], lastpetid[20];
// make sure the same guid doesn't already exist and is safe to use
diff --git a/src/server/game/Tools/PlayerDump.h b/src/server/game/Tools/PlayerDump.h
index 321649fc485..321649fc485 100755..100644
--- a/src/server/game/Tools/PlayerDump.h
+++ b/src/server/game/Tools/PlayerDump.h
diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp
index e119ebf5f2e..e119ebf5f2e 100755..100644
--- a/src/server/game/Weather/Weather.cpp
+++ b/src/server/game/Weather/Weather.cpp
diff --git a/src/server/game/Weather/Weather.h b/src/server/game/Weather/Weather.h
index 59bff95d7ea..59bff95d7ea 100755..100644
--- a/src/server/game/Weather/Weather.h
+++ b/src/server/game/Weather/Weather.h
diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp
index c96ec1742cf..c96ec1742cf 100755..100644
--- a/src/server/game/Weather/WeatherMgr.cpp
+++ b/src/server/game/Weather/WeatherMgr.cpp
diff --git a/src/server/game/Weather/WeatherMgr.h b/src/server/game/Weather/WeatherMgr.h
index 768cd2dca17..768cd2dca17 100755..100644
--- a/src/server/game/Weather/WeatherMgr.h
+++ b/src/server/game/Weather/WeatherMgr.h
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index be5b005dc27..67693f22267 100755..100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1655,7 +1655,6 @@ void World::SetInitialWorldSettings()
LoadAutobroadcasts();
///- Load and initialize scripts
- sObjectMgr->LoadQuestStartScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
sObjectMgr->LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
sObjectMgr->LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr->LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data)
@@ -1780,6 +1779,9 @@ void World::SetInitialWorldSettings()
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next weekly quest reset time...");
InitWeeklyQuestResetTime();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next monthly quest reset time...");
+ InitMonthlyQuestResetTime();
+
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate random battleground reset time...");
InitRandomBGResetTime();
@@ -1935,9 +1937,14 @@ void World::Update(uint32 diff)
m_NextDailyQuestReset += DAY;
}
+ /// Handle weekly quests reset time
if (m_gameTime > m_NextWeeklyQuestReset)
ResetWeeklyQuests();
+ /// Handle monthly quests reset time
+ if (m_gameTime > m_NextMonthlyQuestReset)
+ ResetMonthlyQuests();
+
if (m_gameTime > m_NextRandomBGReset)
ResetRandomBG();
@@ -2727,6 +2734,13 @@ void World::InitDailyQuestResetTime()
m_NextDailyQuestReset = (curTime >= curDayResetTime) ? curDayResetTime + DAY : curDayResetTime;
}
+void World::InitMonthlyQuestResetTime()
+{
+ time_t wstime = uint64(sWorld->getWorldState(WS_MONTHLY_QUEST_RESET_TIME));
+ time_t curtime = time(NULL);
+ m_NextMonthlyQuestReset = wstime < curtime ? curtime : time_t(wstime);
+}
+
void World::InitRandomBGResetTime()
{
time_t bgtime = uint64(sWorld->getWorldState(WS_BG_DAILY_RESET_TIME));
@@ -2817,6 +2831,8 @@ void World::SetPlayerSecurityLimit(AccountTypes _sec)
void World::ResetWeeklyQuests()
{
+ sLog->outInfo(LOG_FILTER_GENERAL, "Weekly quests reset for all characters.");
+
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_WEEKLY);
CharacterDatabase.Execute(stmt);
@@ -2831,6 +2847,57 @@ void World::ResetWeeklyQuests()
sPoolMgr->ChangeWeeklyQuests();
}
+void World::ResetMonthlyQuests()
+{
+ sLog->outInfo(LOG_FILTER_GENERAL, "Monthly quests reset for all characters.");
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_MONTHLY);
+ CharacterDatabase.Execute(stmt);
+
+ for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
+ if (itr->second->GetPlayer())
+ itr->second->GetPlayer()->ResetMonthlyQuestStatus();
+
+ time_t mostRecentQuestTime = 0;
+
+ // generate time
+ time_t curTime = time(NULL);
+ tm localTm = *localtime(&curTime);
+
+ int month = localTm.tm_mon;
+ int year = localTm.tm_year;
+
+ ++month;
+
+ // month 11 is december, next is january (0)
+ if (month > 11)
+ {
+ month = 0;
+ year += 1;
+ }
+
+ // reset time for next month
+ localTm.tm_year = year;
+ localTm.tm_mon = month;
+ localTm.tm_mday = 1; // don't know if we really need config option for day / hour
+ localTm.tm_hour = 0;
+ localTm.tm_min = 0;
+ localTm.tm_sec = 0;
+
+ time_t nextMonthResetTime = mktime(&localTm);
+
+ // last reset time before current moment
+ time_t resetTime = (curTime < nextMonthResetTime) ? nextMonthResetTime - MONTH : nextMonthResetTime;
+
+ // need reset (if we have quest time before last reset time (not processed by some reason)
+ if (mostRecentQuestTime && mostRecentQuestTime <= resetTime)
+ m_NextMonthlyQuestReset = mostRecentQuestTime;
+ else // plan next reset time
+ m_NextMonthlyQuestReset = (curTime >= nextMonthResetTime) ? nextMonthResetTime + MONTH : nextMonthResetTime;
+
+ sWorld->setWorldState(WS_MONTHLY_QUEST_RESET_TIME, uint64(m_NextMonthlyQuestReset));
+}
+
void World::ResetEventSeasonalQuests(uint16 event_id)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_SEASONAL);
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index 37c35c58c29..afc2690c10b 100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -469,9 +469,11 @@ enum RealmZone
enum WorldStates
{
- WS_WEEKLY_QUEST_RESET_TIME = 20002, // Next weekly reset time
- WS_BG_DAILY_RESET_TIME = 20003, // Next daily BG reset time
- WS_GUILD_DAILY_RESET_TIME = 20006, // Next guild cap reset time
+ WS_WEEKLY_QUEST_RESET_TIME = 20002, // Next weekly reset time
+ WS_BG_DAILY_RESET_TIME = 20003, // Next daily BG reset time
+ WS_CLEANING_FLAGS = 20004, // Cleaning Flags
+ WS_GUILD_DAILY_RESET_TIME = 20006, // Next guild cap reset time
+ WS_MONTHLY_QUEST_RESET_TIME = 20007, // Next monthly reset time
};
/// Storage class for commands issued for delayed execution
@@ -742,10 +744,12 @@ class World
void InitDailyQuestResetTime();
void InitWeeklyQuestResetTime();
+ void InitMonthlyQuestResetTime();
void InitRandomBGResetTime();
void InitGuildResetTime();
void ResetDailyQuests();
void ResetWeeklyQuests();
+ void ResetMonthlyQuests();
void ResetRandomBG();
void ResetGuildCap();
private:
@@ -807,6 +811,7 @@ class World
// next daily quests and random bg reset time
time_t m_NextDailyQuestReset;
time_t m_NextWeeklyQuestReset;
+ time_t m_NextMonthlyQuestReset;
time_t m_NextRandomBGReset;
time_t m_NextGuildReset;