aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-05-18 23:52:58 +0200
committerShauren <shauren.trinity@gmail.com>2017-05-18 23:53:25 +0200
commitc5d3dd90bea3889ef5fcd33c9ef0d59d7c544f8a (patch)
treeaa7fde6f924fc39da54908bd6eeeb0be422e5fc3
parent74456703146194de72424ec98c4ea76402077be6 (diff)
Core/Game: Include cleanup
* Mostly aimed at removing Log/DatabaseEnv includes from other headers * Fix most packet headers including other packet headers - moved common structures such as ItemInstance to their own files * Moved SAI function definitions to source files (massive or requiring many different dependencies)
-rw-r--r--src/common/Common.h2
-rw-r--r--src/server/game/AI/CoreAI/GameObjectAI.cpp7
-rw-r--r--src/server/game/AI/CoreAI/GameObjectAI.h10
-rw-r--r--src/server/game/AI/CoreAI/GuardAI.cpp1
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp11
-rw-r--r--src/server/game/AI/CoreAI/ReactorAI.cpp2
-rw-r--r--src/server/game/AI/CoreAI/ReactorAI.h2
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.cpp34
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.h45
-rw-r--r--src/server/game/AI/CreatureAI.cpp14
-rw-r--r--src/server/game/AI/CreatureAI.h9
-rw-r--r--src/server/game/AI/CreatureAISelector.cpp1
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp1
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h11
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp3
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.h3
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp3
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h3
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp15
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h11
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp227
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.h228
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp206
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h218
-rw-r--r--src/server/game/Accounts/AccountMgr.cpp2
-rw-r--r--src/server/game/Accounts/BattlenetAccountMgr.cpp2
-rw-r--r--src/server/game/Accounts/RBAC.cpp2
-rw-r--r--src/server/game/Accounts/RBAC.h3
-rw-r--r--src/server/game/Achievements/AchievementMgr.cpp4
-rw-r--r--src/server/game/Achievements/CriteriaHandler.cpp2
-rw-r--r--src/server/game/Achievements/CriteriaHandler.h2
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp16
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.h21
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp5
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp7
-rw-r--r--src/server/game/BattlePets/BattlePetMgr.cpp5
-rw-r--r--src/server/game/BattlePets/BattlePetMgr.h1
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp8
-rw-r--r--src/server/game/Battlefield/Battlefield.h33
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldTB.cpp1
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp2
-rw-r--r--src/server/game/Battlegrounds/Arena.cpp2
-rw-r--r--src/server/game/Battlegrounds/ArenaScore.h1
-rw-r--r--src/server/game/Battlegrounds/ArenaTeam.cpp11
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp4
-rw-r--r--src/server/game/Battlegrounds/Battleground.h16
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp34
-rw-r--r--src/server/game/Battlegrounds/BattlegroundQueue.cpp2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp7
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp12
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp2
-rw-r--r--src/server/game/BlackMarket/BlackMarketMgr.cpp34
-rw-r--r--src/server/game/BlackMarket/BlackMarketMgr.h9
-rw-r--r--src/server/game/Calendar/CalendarMgr.cpp10
-rw-r--r--src/server/game/Calendar/CalendarMgr.h9
-rw-r--r--src/server/game/Chat/Channels/Channel.cpp7
-rw-r--r--src/server/game/Chat/Channels/Channel.h2
-rw-r--r--src/server/game/Chat/Channels/ChannelMgr.h5
-rw-r--r--src/server/game/Chat/Chat.cpp14
-rw-r--r--src/server/game/Chat/Chat.h3
-rw-r--r--src/server/game/Chat/ChatLink.cpp1
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp3
-rw-r--r--src/server/game/Conditions/ConditionMgr.h2
-rw-r--r--src/server/game/Conditions/DisableMgr.cpp5
-rw-r--r--src/server/game/Conditions/DisableMgr.h1
-rw-r--r--src/server/game/DataStores/DB2Stores.cpp119
-rw-r--r--src/server/game/DataStores/DB2Stores.h102
-rw-r--r--src/server/game/DataStores/DB2Structure.h4
-rw-r--r--src/server/game/DungeonFinding/LFG.cpp1
-rw-r--r--src/server/game/DungeonFinding/LFG.h4
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp22
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.h1
-rw-r--r--src/server/game/DungeonFinding/LFGQueue.h1
-rw-r--r--src/server/game/Entities/Corpse/Corpse.cpp5
-rw-r--r--src/server/game/Entities/Corpse/Corpse.h4
-rw-r--r--src/server/game/Entities/Creature/Creature.h28
-rw-r--r--src/server/game/Entities/Creature/CreatureGroups.cpp7
-rw-r--r--src/server/game/Entities/Creature/CreatureGroups.h2
-rw-r--r--src/server/game/Entities/Creature/GossipDef.cpp9
-rw-r--r--src/server/game/Entities/Creature/GossipDef.h1
-rw-r--r--src/server/game/Entities/DynamicObject/DynamicObject.cpp7
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp10
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h4
-rw-r--r--src/server/game/Entities/Item/Item.cpp53
-rw-r--r--src/server/game/Entities/Item/Item.h6
-rw-r--r--src/server/game/Entities/Item/ItemEnchantmentMgr.cpp30
-rw-r--r--src/server/game/Entities/Item/ItemEnchantmentMgr.h2
-rw-r--r--src/server/game/Entities/Item/ItemTemplate.h3
-rw-r--r--src/server/game/Entities/Object/Object.cpp7
-rw-r--r--src/server/game/Entities/Object/Object.h4
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.cpp20
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.h43
-rw-r--r--src/server/game/Entities/Object/Position.cpp35
-rw-r--r--src/server/game/Entities/Object/Position.h37
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateData.cpp4
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateData.h1
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp15
-rw-r--r--src/server/game/Entities/Player/CUFProfile.h116
-rw-r--r--src/server/game/Entities/Player/CollectionMgr.cpp39
-rw-r--r--src/server/game/Entities/Player/CollectionMgr.h16
-rw-r--r--src/server/game/Entities/Player/Player.cpp17
-rw-r--r--src/server/game/Entities/Player/Player.h162
-rw-r--r--src/server/game/Entities/Player/PlayerTaxi.cpp18
-rw-r--r--src/server/game/Entities/Player/SocialMgr.cpp3
-rw-r--r--src/server/game/Entities/Player/SocialMgr.h3
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp13
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp2
-rw-r--r--src/server/game/Entities/Unit/Unit.h295
-rw-r--r--src/server/game/Entities/Unit/UnitDefines.h322
-rw-r--r--src/server/game/Events/GameEventMgr.cpp3
-rw-r--r--src/server/game/Events/GameEventMgr.h3
-rw-r--r--src/server/game/Garrison/Garrison.cpp5
-rw-r--r--src/server/game/Garrison/Garrison.h13
-rw-r--r--src/server/game/Garrison/GarrisonMap.cpp3
-rw-r--r--src/server/game/Garrison/GarrisonMgr.cpp12
-rw-r--r--src/server/game/Garrison/GarrisonMgr.h11
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp78
-rw-r--r--src/server/game/Globals/ObjectMgr.h153
-rw-r--r--src/server/game/Grids/ObjectGridLoader.cpp1
-rw-r--r--src/server/game/Groups/Group.cpp46
-rw-r--r--src/server/game/Groups/Group.h3
-rw-r--r--src/server/game/Groups/GroupMgr.cpp3
-rw-r--r--src/server/game/Guilds/Guild.cpp27
-rw-r--r--src/server/game/Guilds/Guild.h12
-rw-r--r--src/server/game/Guilds/GuildFinderMgr.cpp16
-rw-r--r--src/server/game/Guilds/GuildFinderMgr.h23
-rw-r--r--src/server/game/Guilds/GuildMgr.cpp8
-rw-r--r--src/server/game/Guilds/GuildMgr.h10
-rw-r--r--src/server/game/Handlers/AuctionHouseHandler.cpp15
-rw-r--r--src/server/game/Handlers/AuthHandler.cpp3
-rw-r--r--src/server/game/Handlers/BattleGroundHandler.cpp1
-rw-r--r--src/server/game/Handlers/BlackMarketHandler.cpp6
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp15
-rw-r--r--src/server/game/Handlers/ChannelHandler.cpp100
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp11
-rw-r--r--src/server/game/Handlers/GarrisonHandler.cpp1
-rw-r--r--src/server/game/Handlers/GuildFinderHandler.cpp10
-rw-r--r--src/server/game/Handlers/HotfixHandler.cpp1
-rw-r--r--src/server/game/Handlers/InspectHandler.cpp4
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp17
-rw-r--r--src/server/game/Handlers/LFGHandler.cpp7
-rw-r--r--src/server/game/Handlers/LootHandler.cpp11
-rw-r--r--src/server/game/Handlers/MailHandler.cpp23
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp47
-rw-r--r--src/server/game/Handlers/NPCHandler.cpp1
-rw-r--r--src/server/game/Handlers/PetHandler.cpp27
-rw-r--r--src/server/game/Handlers/PetitionsHandler.cpp12
-rw-r--r--src/server/game/Handlers/QueryHandler.cpp11
-rw-r--r--src/server/game/Handlers/QuestHandler.cpp24
-rw-r--r--src/server/game/Handlers/ReferAFriendHandler.cpp5
-rw-r--r--src/server/game/Handlers/SocialHandler.cpp9
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp4
-rw-r--r--src/server/game/Handlers/TicketHandler.cpp1
-rw-r--r--src/server/game/Handlers/ToyHandler.cpp3
-rw-r--r--src/server/game/Handlers/TradeHandler.cpp19
-rw-r--r--src/server/game/Handlers/TransmogrificationHandler.cpp1
-rw-r--r--src/server/game/Instances/InstanceSaveMgr.cpp19
-rw-r--r--src/server/game/Instances/InstanceSaveMgr.h2
-rw-r--r--src/server/game/Instances/InstanceScript.cpp14
-rw-r--r--src/server/game/Loot/Loot.cpp828
-rw-r--r--src/server/game/Loot/Loot.h314
-rw-r--r--src/server/game/Loot/LootMgr.cpp782
-rw-r--r--src/server/game/Loot/LootMgr.h324
-rw-r--r--src/server/game/Mails/Mail.cpp15
-rw-r--r--src/server/game/Maps/Map.cpp6
-rw-r--r--src/server/game/Maps/Map.h2
-rw-r--r--src/server/game/Maps/MapInstanced.cpp15
-rw-r--r--src/server/game/Maps/MapScripts.cpp9
-rw-r--r--src/server/game/Maps/TransportMgr.cpp4
-rw-r--r--src/server/game/Maps/ZoneScript.cpp24
-rw-r--r--src/server/game/Maps/ZoneScript.h15
-rw-r--r--src/server/game/Miscellaneous/Formulas.h1
-rw-r--r--src/server/game/Miscellaneous/SharedDefines.h46
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp17
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvP.cpp18
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvP.h20
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp4
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvPMgr.h1
-rw-r--r--src/server/game/Pools/PoolMgr.cpp8
-rw-r--r--src/server/game/Pools/PoolMgr.h12
-rw-r--r--src/server/game/Quests/QuestDef.cpp1
-rw-r--r--src/server/game/Quests/QuestDef.h5
-rw-r--r--src/server/game/Reputation/ReputationMgr.cpp15
-rw-r--r--src/server/game/Reputation/ReputationMgr.h2
-rw-r--r--src/server/game/Scenarios/InstanceScenario.cpp4
-rw-r--r--src/server/game/Scenarios/Scenario.cpp5
-rw-r--r--src/server/game/Scenarios/Scenario.h1
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp45
-rw-r--r--src/server/game/Scripting/ScriptMgr.h27
-rw-r--r--src/server/game/Scripting/ScriptReloadMgr.cpp38
-rw-r--r--src/server/game/Scripting/ScriptSystem.cpp7
-rw-r--r--src/server/game/Scripting/ScriptSystem.h5
-rw-r--r--src/server/game/Server/Packet.cpp9
-rw-r--r--src/server/game/Server/Packets/AchievementPackets.h2
-rw-r--r--src/server/game/Server/Packets/ArtifactPackets.h2
-rw-r--r--src/server/game/Server/Packets/AuctionHousePackets.cpp9
-rw-r--r--src/server/game/Server/Packets/AuctionHousePackets.h12
-rw-r--r--src/server/game/Server/Packets/AuthenticationPackets.cpp20
-rw-r--r--src/server/game/Server/Packets/AuthenticationPackets.h22
-rw-r--r--src/server/game/Server/Packets/BankPackets.cpp1
-rw-r--r--src/server/game/Server/Packets/BankPackets.h3
-rw-r--r--src/server/game/Server/Packets/BattlePetPackets.cpp11
-rw-r--r--src/server/game/Server/Packets/BattlePetPackets.h12
-rw-r--r--src/server/game/Server/Packets/BattlegroundPackets.h7
-rw-r--r--src/server/game/Server/Packets/BattlenetPackets.h2
-rw-r--r--src/server/game/Server/Packets/BlackMarketPackets.cpp29
-rw-r--r--src/server/game/Server/Packets/BlackMarketPackets.h7
-rw-r--r--src/server/game/Server/Packets/CalendarPackets.cpp1
-rw-r--r--src/server/game/Server/Packets/CalendarPackets.h4
-rw-r--r--src/server/game/Server/Packets/ChannelPackets.cpp70
-rw-r--r--src/server/game/Server/Packets/ChannelPackets.h32
-rw-r--r--src/server/game/Server/Packets/CharacterPackets.cpp1
-rw-r--r--src/server/game/Server/Packets/CharacterPackets.h1
-rw-r--r--src/server/game/Server/Packets/ChatPackets.h3
-rw-r--r--src/server/game/Server/Packets/GarrisonPackets.h3
-rw-r--r--src/server/game/Server/Packets/ItemPackets.cpp218
-rw-r--r--src/server/game/Server/Packets/ItemPackets.h63
-rw-r--r--src/server/game/Server/Packets/ItemPacketsCommon.cpp237
-rw-r--r--src/server/game/Server/Packets/ItemPacketsCommon.h103
-rw-r--r--src/server/game/Server/Packets/LFGPackets.cpp20
-rw-r--r--src/server/game/Server/Packets/LFGPackets.h13
-rw-r--r--src/server/game/Server/Packets/LFGPacketsCommon.cpp38
-rw-r--r--src/server/game/Server/Packets/LFGPacketsCommon.h41
-rw-r--r--src/server/game/Server/Packets/MiscPackets.cpp12
-rw-r--r--src/server/game/Server/Packets/MiscPackets.h28
-rw-r--r--src/server/game/Server/Packets/PacketUtilities.h2
-rw-r--r--src/server/game/Server/Packets/PartyPackets.cpp9
-rw-r--r--src/server/game/Server/Packets/PetPackets.h1
-rw-r--r--src/server/game/Server/Packets/QueryPackets.cpp1
-rw-r--r--src/server/game/Server/Packets/SpellPackets.h1
-rw-r--r--src/server/game/Server/Packets/TaxiPackets.h30
-rw-r--r--src/server/game/Server/Packets/TicketPackets.cpp3
-rw-r--r--src/server/game/Server/Packets/TicketPackets.h2
-rw-r--r--src/server/game/Server/Protocol/Opcodes.cpp34
-rw-r--r--src/server/game/Server/Protocol/PacketLog.cpp28
-rw-r--r--src/server/game/Server/Protocol/PacketLog.h15
-rw-r--r--src/server/game/Server/WorldPacket.h3
-rw-r--r--src/server/game/Server/WorldSession.cpp58
-rw-r--r--src/server/game/Server/WorldSession.h79
-rw-r--r--src/server/game/Server/WorldSocket.cpp20
-rw-r--r--src/server/game/Server/WorldSocket.h24
-rw-r--r--src/server/game/Server/WorldSocketMgr.cpp4
-rw-r--r--src/server/game/Services/WorldserverService.cpp6
-rw-r--r--src/server/game/Skills/SkillDiscovery.cpp1
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp38
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp1
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.h14
-rw-r--r--src/server/game/Spells/SpellEffects.cpp3
-rw-r--r--src/server/game/Spells/SpellHistory.cpp1
-rw-r--r--src/server/game/Spells/SpellHistory.h3
-rw-r--r--src/server/game/Spells/SpellInfo.cpp1
-rw-r--r--src/server/game/Spells/SpellMgr.cpp16
-rw-r--r--src/server/game/Spells/SpellScript.cpp5
-rw-r--r--src/server/game/Spells/SpellScript.h2
-rw-r--r--src/server/game/Support/SupportMgr.cpp71
-rw-r--r--src/server/game/Support/SupportMgr.h39
-rw-r--r--src/server/game/Texts/CreatureTextMgr.cpp11
-rw-r--r--src/server/game/Texts/CreatureTextMgr.h1
-rw-r--r--src/server/game/Tools/CharacterDatabaseCleaner.cpp1
-rw-r--r--src/server/game/Tools/PlayerDump.cpp6
-rw-r--r--src/server/game/Warden/WardenCheckMgr.cpp11
-rw-r--r--src/server/game/Warden/WardenCheckMgr.h11
-rw-r--r--src/server/game/Warden/WardenWin.cpp7
-rw-r--r--src/server/game/Weather/WeatherMgr.cpp5
-rw-r--r--src/server/game/World/World.cpp43
-rw-r--r--src/server/game/World/World.h48
-rw-r--r--src/server/scripts/Commands/cs_account.cpp2
-rw-r--r--src/server/scripts/Commands/cs_arena.cpp5
-rw-r--r--src/server/scripts/Commands/cs_ban.cpp2
-rw-r--r--src/server/scripts/Commands/cs_battlenet_account.cpp4
-rw-r--r--src/server/scripts/Commands/cs_character.cpp3
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp34
-rw-r--r--src/server/scripts/Commands/cs_disable.cpp5
-rw-r--r--src/server/scripts/Commands/cs_gm.cpp12
-rw-r--r--src/server/scripts/Commands/cs_go.cpp9
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp14
-rw-r--r--src/server/scripts/Commands/cs_group.cpp5
-rw-r--r--src/server/scripts/Commands/cs_guild.cpp1
-rw-r--r--src/server/scripts/Commands/cs_lfg.cpp7
-rw-r--r--src/server/scripts/Commands/cs_list.cpp6
-rw-r--r--src/server/scripts/Commands/cs_lookup.cpp2
-rw-r--r--src/server/scripts/Commands/cs_message.cpp4
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp37
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp6
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp15
-rw-r--r--src/server/scripts/Commands/cs_pet.cpp1
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp2
-rw-r--r--src/server/scripts/Commands/cs_rbac.cpp4
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp3
-rw-r--r--src/server/scripts/Commands/cs_reset.cpp2
-rw-r--r--src/server/scripts/Commands/cs_send.cpp1
-rw-r--r--src/server/scripts/Commands/cs_server.cpp3
-rw-r--r--src/server/scripts/Commands/cs_tele.cpp1
-rw-r--r--src/server/scripts/Commands/cs_ticket.cpp2
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/zone_tol_barad.cpp9
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp1
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp1
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp1
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp1
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp1
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp1
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp1
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp10
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp3
-rw-r--r--src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp3
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp1
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp5
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp17
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h1
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp1
-rw-r--r--src/server/scripts/Northrend/zone_dalaran.cpp1
-rw-r--r--src/server/scripts/Northrend/zone_wintergrasp.cpp13
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp1
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp1
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp1
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp1
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp1
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp7
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp1
-rw-r--r--src/server/scripts/Outland/zone_hellfire_peninsula.cpp5
-rw-r--r--src/server/scripts/Outland/zone_netherstorm.cpp5
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp5
-rw-r--r--src/server/scripts/Spells/spell_item.cpp21
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp7
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp16
-rw-r--r--src/server/scripts/World/action_ip_logger.cpp1
-rw-r--r--src/server/scripts/World/chat_log.cpp1
-rw-r--r--src/server/scripts/World/duel_reset.cpp1
-rw-r--r--src/server/scripts/World/go_scripts.cpp5
-rw-r--r--src/server/scripts/World/item_scripts.cpp4
-rw-r--r--src/server/scripts/World/npc_professions.cpp5
-rw-r--r--src/server/scripts/World/npcs_special.cpp23
357 files changed, 4730 insertions, 3825 deletions
diff --git a/src/common/Common.h b/src/common/Common.h
index 7a1029c5475..e33210ecd3b 100644
--- a/src/common/Common.h
+++ b/src/common/Common.h
@@ -79,7 +79,7 @@ enum AccountTypes
SEC_CONSOLE = 4 // must be always last in list, accounts must have less security level always also
};
-enum LocaleConstant
+enum LocaleConstant : uint8
{
LOCALE_enUS = 0,
LOCALE_koKR = 1,
diff --git a/src/server/game/AI/CoreAI/GameObjectAI.cpp b/src/server/game/AI/CoreAI/GameObjectAI.cpp
index af03c0d9f5b..3c91f21a6b2 100644
--- a/src/server/game/AI/CoreAI/GameObjectAI.cpp
+++ b/src/server/game/AI/CoreAI/GameObjectAI.cpp
@@ -17,6 +17,8 @@
*/
#include "GameObjectAI.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
//GameObjectAI::GameObjectAI(GameObject* g) : go(g) { }
int GameObjectAI::Permissible(const GameObject* go)
@@ -27,3 +29,8 @@ int GameObjectAI::Permissible(const GameObject* go)
}
NullGameObjectAI::NullGameObjectAI(GameObject* g) : GameObjectAI(g) { }
+
+int NullGameObjectAI::Permissible(GameObject const* /*go*/)
+{
+ return PERMIT_BASE_IDLE;
+}
diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h
index c8b1a6f6359..8e52f0170fc 100644
--- a/src/server/game/AI/CoreAI/GameObjectAI.h
+++ b/src/server/game/AI/CoreAI/GameObjectAI.h
@@ -20,11 +20,11 @@
#define TRINITY_GAMEOBJECTAI_H
#include "Define.h"
-#include <list>
-#include "Object.h"
#include "QuestDef.h"
-#include "GameObject.h"
-#include "CreatureAI.h"
+#include <list>
+
+class GameObject;
+class Unit;
class TC_GAME_API GameObjectAI
{
@@ -70,6 +70,6 @@ class TC_GAME_API NullGameObjectAI : public GameObjectAI
void UpdateAI(uint32 /*diff*/) override { }
- static int Permissible(GameObject const* /*go*/) { return PERMIT_BASE_IDLE; }
+ static int Permissible(GameObject const* /*go*/);
};
#endif
diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp
index 8b5f2c02700..25757ef5025 100644
--- a/src/server/game/AI/CoreAI/GuardAI.cpp
+++ b/src/server/game/AI/CoreAI/GuardAI.cpp
@@ -18,6 +18,7 @@
#include "GuardAI.h"
#include "Errors.h"
+#include "Log.h"
#include "Player.h"
int GuardAI::Permissible(Creature const* creature)
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index f89ce1d2425..413e5555e45 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -17,17 +17,18 @@
*/
#include "PetAI.h"
+#include "Creature.h"
#include "Errors.h"
+#include "Group.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
#include "Pet.h"
#include "Player.h"
#include "Spell.h"
-#include "ObjectAccessor.h"
+#include "SpellHistory.h"
+#include "SpellInfo.h"
#include "SpellMgr.h"
-#include "Creature.h"
#include "Util.h"
-#include "Group.h"
-#include "SpellInfo.h"
-#include "SpellHistory.h"
int PetAI::Permissible(const Creature* creature)
{
diff --git a/src/server/game/AI/CoreAI/ReactorAI.cpp b/src/server/game/AI/CoreAI/ReactorAI.cpp
index 31ab86e4dfc..0d833570861 100644
--- a/src/server/game/AI/CoreAI/ReactorAI.cpp
+++ b/src/server/game/AI/CoreAI/ReactorAI.cpp
@@ -16,8 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ByteBuffer.h"
#include "ReactorAI.h"
+#include "Creature.h"
int ReactorAI::Permissible(const Creature* creature)
{
diff --git a/src/server/game/AI/CoreAI/ReactorAI.h b/src/server/game/AI/CoreAI/ReactorAI.h
index fcd2ff41f68..5c38ab4315a 100644
--- a/src/server/game/AI/CoreAI/ReactorAI.h
+++ b/src/server/game/AI/CoreAI/ReactorAI.h
@@ -21,8 +21,6 @@
#include "CreatureAI.h"
-class Unit;
-
class TC_GAME_API ReactorAI : public CreatureAI
{
public:
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp
index 86ebe8714d3..65ce74106d3 100644
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
@@ -230,6 +230,40 @@ void UnitAI::FillAISpellInfo()
}
}
+bool DefaultTargetSelector::operator()(Unit const* target) const
+{
+ if (!me)
+ return false;
+
+ if (!target)
+ return false;
+
+ if (m_playerOnly && (target->GetTypeId() != TYPEID_PLAYER))
+ return false;
+
+ if (m_dist > 0.0f && !me->IsWithinCombatRange(target, m_dist))
+ return false;
+
+ if (m_dist < 0.0f && me->IsWithinCombatRange(target, -m_dist))
+ return false;
+
+ if (m_aura)
+ {
+ if (m_aura > 0)
+ {
+ if (!target->HasAura(m_aura))
+ return false;
+ }
+ else
+ {
+ if (target->HasAura(-m_aura))
+ return false;
+ }
+ }
+
+ return true;
+}
+
SpellTargetSelector::SpellTargetSelector(Unit* caster, uint32 spellId) :
_caster(caster), _spellInfo(sSpellMgr->GetSpellInfo(spellId))
{
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index eeb49a46123..c9f56d5caba 100644
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -25,6 +25,17 @@
#include "EventMap.h"
#include <list>
+#define CAST_AI(a, b) (dynamic_cast<a*>(b))
+#define ENSURE_AI(a,b) (EnsureAI<a>(b))
+
+template<class T, class U>
+inline T* EnsureAI(U* ai)
+{
+ T* cast_ai = dynamic_cast<T*>(ai);
+ ASSERT(cast_ai);
+ return cast_ai;
+};
+
class Player;
class Quest;
struct AISpellInfoType;
@@ -53,39 +64,7 @@ struct TC_GAME_API DefaultTargetSelector : public std::unary_function<Unit*, boo
// aura: if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura
DefaultTargetSelector(Unit const* unit, float dist, bool playerOnly, int32 aura) : me(unit), m_dist(dist), m_playerOnly(playerOnly), m_aura(aura) { }
- bool operator()(Unit const* target) const
- {
- if (!me)
- return false;
-
- if (!target)
- return false;
-
- if (m_playerOnly && (target->GetTypeId() != TYPEID_PLAYER))
- return false;
-
- if (m_dist > 0.0f && !me->IsWithinCombatRange(target, m_dist))
- return false;
-
- if (m_dist < 0.0f && me->IsWithinCombatRange(target, -m_dist))
- return false;
-
- if (m_aura)
- {
- if (m_aura > 0)
- {
- if (!target->HasAura(m_aura))
- return false;
- }
- else
- {
- if (target->HasAura(-m_aura))
- return false;
- }
- }
-
- return true;
- }
+ bool operator()(Unit const* target) const;
};
// Target selector for spell casts checking range, auras and attributes
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index 175c2784654..faac3ad6767 100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -41,6 +41,14 @@ void CreatureAI::OnCharmed(bool apply)
AISpellInfoType* UnitAI::AISpellInfo;
AISpellInfoType* GetAISpellInfo(uint32 i) { return &CreatureAI::AISpellInfo[i]; }
+CreatureAI::CreatureAI(Creature* creature) : UnitAI(creature), me(creature), _boundary(nullptr), m_MoveInLineOfSight_locked(false)
+{
+}
+
+CreatureAI::~CreatureAI()
+{
+}
+
void CreatureAI::Talk(uint8 id, WorldObject const* whisperTarget /*= nullptr*/)
{
sCreatureTextMgr->SendChat(me, id, whisperTarget);
@@ -363,6 +371,12 @@ bool CreatureAI::CheckBoundary(Position const* who) const
return true;
}
+void CreatureAI::SetBoundary(CreatureBoundary const* boundary)
+{
+ _boundary = boundary;
+ me->DoImmediateBoundaryCheck();
+}
+
bool CreatureAI::CheckInRoom()
{
if (CheckBoundary())
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index 72c2e254c47..0e7652569fb 100644
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -19,7 +19,6 @@
#ifndef TRINITY_CREATUREAI_H
#define TRINITY_CREATUREAI_H
-#include "Creature.h"
#include "UnitAI.h"
#include "AreaBoundary.h"
#include "Common.h"
@@ -81,7 +80,7 @@ class TC_GAME_API CreatureAI : public UnitAI
Creature* DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
bool CheckBoundary(Position const* who = nullptr) const;
- void SetBoundary(CreatureBoundary const* boundary) { _boundary = boundary; me->DoImmediateBoundaryCheck(); }
+ void SetBoundary(CreatureBoundary const* boundary);
public:
enum EvadeReason
{
@@ -92,11 +91,11 @@ class TC_GAME_API CreatureAI : public UnitAI
EVADE_REASON_OTHER
};
- void Talk(uint8 id, WorldObject const* whisperTarget = nullptr);
+ explicit CreatureAI(Creature* creature);
- explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), _boundary(nullptr), m_MoveInLineOfSight_locked(false) { }
+ virtual ~CreatureAI();
- virtual ~CreatureAI() { }
+ void Talk(uint8 id, WorldObject const* whisperTarget = nullptr);
/// == Reactions At =================================
diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp
index d88a888aec6..9c84bb4508e 100644
--- a/src/server/game/AI/CreatureAISelector.cpp
+++ b/src/server/game/AI/CreatureAISelector.cpp
@@ -18,6 +18,7 @@
#include "Creature.h"
#include "CreatureAISelector.h"
+#include "GameObject.h"
#include "PassiveAI.h"
#include "Log.h"
#include "MovementGenerator.h"
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 463d121bced..1509db2de59 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -22,6 +22,7 @@
#include "GridNotifiersImpl.h"
#include "Cell.h"
#include "CellImpl.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "AreaBoundary.h"
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index 3cb9677f00a..0c1cf34aff2 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -25,17 +25,6 @@
#include "InstanceScript.h"
#include "TaskScheduler.h"
-#define CAST_AI(a, b) (dynamic_cast<a*>(b))
-#define ENSURE_AI(a,b) (EnsureAI<a>(b))
-
-template<class T, class U>
-T* EnsureAI(U* ai)
-{
- T* cast_ai = dynamic_cast<T*>(ai);
- ASSERT(cast_ai);
- return cast_ai;
-};
-
class InstanceScript;
class TC_GAME_API SummonList
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index abd3b90f69f..f3cab9bb02e 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -23,9 +23,10 @@ SDComment:
SDCategory: Npc
EndScriptData */
+#include "ScriptedEscortAI.h"
+#include "Log.h"
#include "Player.h"
#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
#include "Group.h"
enum Points
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
index e1bf3af5343..8d24d662a5b 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
@@ -19,8 +19,11 @@
#ifndef SC_ESCORTAI_H
#define SC_ESCORTAI_H
+#include "ScriptedCreature.h"
#include "ScriptSystem.h"
+class Quest;
+
#define DEFAULT_MAX_PLAYER_DISTANCE 50
struct Escort_Waypoint
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index 4a75c2a2c6f..a563e76999c 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -23,9 +23,10 @@ SDComment: This AI is under development
SDCategory: Npc
EndScriptData */
+#include "ScriptedFollowerAI.h"
+#include "Log.h"
#include "Player.h"
#include "ScriptedCreature.h"
-#include "ScriptedFollowerAI.h"
#include "Group.h"
const float MAX_PLAYER_DISTANCE = 100.0f;
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
index 6b5b06490f0..c938a3360c3 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
@@ -19,8 +19,11 @@
#ifndef SC_FOLLOWERAI_H
#define SC_FOLLOWERAI_H
+#include "ScriptedCreature.h"
#include "ScriptSystem.h"
+class Quest;
+
enum eFollowState
{
STATE_FOLLOW_NONE = 0x000,
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 6d27b39ea40..18ea269fbb0 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -15,15 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "DatabaseEnv.h"
-#include "ObjectMgr.h"
-#include "ObjectDefines.h"
-#include "GridDefines.h"
-#include "GridNotifiers.h"
-#include "SpellMgr.h"
-#include "Cell.h"
-#include "Group.h"
#include "SmartAI.h"
+#include "Creature.h"
+#include "GameObject.h"
+#include "Group.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
+#include "PetDefines.h"
+#include "Player.h"
#include "ScriptMgr.h"
SmartAI::SmartAI(Creature* c) : CreatureAI(c)
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index 92793c17e58..c93bf046007 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -18,15 +18,12 @@
#ifndef TRINITY_SMARTAI_H
#define TRINITY_SMARTAI_H
-#include "Common.h"
-#include "Creature.h"
+#include "Define.h"
#include "CreatureAI.h"
-#include "Unit.h"
-#include "Spell.h"
-
-#include "SmartScript.h"
-#include "SmartScriptMgr.h"
#include "GameObjectAI.h"
+#include "SmartScript.h"
+
+struct WayPoint;
enum SmartEscortState
{
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index b3dfb149562..22597d36fab 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -15,27 +15,25 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Cell.h"
+#include "SmartScript.h"
#include "CellImpl.h"
#include "ChatTextBuilder.h"
+#include "Creature.h"
#include "CreatureTextMgr.h"
-#include "DatabaseEnv.h"
-#include "GossipDef.h"
-#include "GridDefines.h"
-#include "GridNotifiers.h"
+#include "GameEventMgr.h"
+#include "GameObject.h"
#include "GridNotifiersImpl.h"
-#include "Group.h"
#include "InstanceScript.h"
#include "Language.h"
-#include "ObjectDefines.h"
-#include "ObjectMgr.h"
+#include "Log.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Random.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SmartAI.h"
-#include "SmartScript.h"
-#include "SpellMgr.h"
+#include "SpellAuras.h"
#include "Vehicle.h"
-#include "GameEventMgr.h"
SmartScript::SmartScript()
{
@@ -64,6 +62,113 @@ SmartScript::~SmartScript()
mCounterList.clear();
}
+bool SmartScript::IsSmart(Creature* c /*= NULL*/)
+{
+ bool smart = true;
+ if (c && c->GetAIName() != "SmartAI")
+ smart = false;
+
+ if (!me || me->GetAIName() != "SmartAI")
+ smart = false;
+
+ if (!smart)
+ TC_LOG_ERROR("sql.sql", "SmartScript: Action target Creature (GUID: " UI64FMTD " Entry: %u) is not using SmartAI, action called by Creature (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(c ? c->GetSpawnId() : UI64LIT(0)), c ? c->GetEntry() : 0, uint64(me ? me->GetSpawnId() : UI64LIT(0)), me ? me->GetEntry() : 0);
+
+ return smart;
+}
+
+bool SmartScript::IsSmartGO(GameObject* g /*= NULL*/)
+{
+ bool smart = true;
+ if (g && g->GetAIName() != "SmartGameObjectAI")
+ smart = false;
+
+ if (!go || go->GetAIName() != "SmartGameObjectAI")
+ smart = false;
+ if (!smart)
+ TC_LOG_ERROR("sql.sql", "SmartScript: Action target GameObject (GUID: " UI64FMTD " Entry: %u) is not using SmartGameObjectAI, action called by GameObject (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(g ? g->GetSpawnId() : UI64LIT(0)), g ? g->GetEntry() : 0, uint64(go ? go->GetSpawnId() : UI64LIT(0)), go ? go->GetEntry() : 0);
+
+ return smart;
+}
+
+void SmartScript::StoreTargetList(ObjectList* targets, uint32 id)
+{
+ if (!targets)
+ return;
+
+ if (mTargetStorage->find(id) != mTargetStorage->end())
+ {
+ // check if already stored
+ if ((*mTargetStorage)[id]->Equals(targets))
+ return;
+
+ delete (*mTargetStorage)[id];
+ }
+
+ (*mTargetStorage)[id] = new ObjectGuidList(targets, GetBaseObject());
+}
+
+ObjectList* SmartScript::GetTargetList(uint32 id)
+{
+ ObjectListMap::iterator itr = mTargetStorage->find(id);
+ if (itr != mTargetStorage->end())
+ return (*itr).second->GetObjectList();
+ return NULL;
+}
+
+void SmartScript::StoreCounter(uint32 id, uint32 value, uint32 reset)
+{
+ CounterMap::const_iterator itr = mCounterList.find(id);
+ if (itr != mCounterList.end())
+ {
+ if (reset == 0)
+ value += GetCounterValue(id);
+ mCounterList.erase(id);
+ }
+
+ mCounterList.insert(std::make_pair(id, value));
+ ProcessEventsFor(SMART_EVENT_COUNTER_SET);
+}
+
+uint32 SmartScript::GetCounterId(uint32 id)
+{
+ CounterMap::iterator itr = mCounterList.find(id);
+ if (itr != mCounterList.end())
+ return itr->first;
+ return 0;
+}
+
+uint32 SmartScript::GetCounterValue(uint32 id)
+{
+ CounterMap::iterator itr = mCounterList.find(id);
+ if (itr != mCounterList.end())
+ return itr->second;
+ return 0;
+}
+
+GameObject* SmartScript::FindGameObjectNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
+{
+ auto bounds = searchObject->GetMap()->GetGameObjectBySpawnIdStore().equal_range(guid);
+ if (bounds.first == bounds.second)
+ return nullptr;
+
+ return bounds.first->second;
+}
+
+Creature* SmartScript::FindCreatureNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
+{
+ auto bounds = searchObject->GetMap()->GetCreatureBySpawnIdStore().equal_range(guid);
+ if (bounds.first == bounds.second)
+ return nullptr;
+
+ auto creatureItr = std::find_if(bounds.first, bounds.second, [](Map::CreatureBySpawnIdContainer::value_type const& pair)
+ {
+ return pair.second->IsAlive();
+ });
+
+ return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
+}
+
void SmartScript::OnReset()
{
SetPhase(0);
@@ -81,6 +186,35 @@ void SmartScript::OnReset()
mCounterList.clear();
}
+void SmartScript::ResetBaseObject()
+{
+ WorldObject* lookupRoot = me;
+ if (!lookupRoot)
+ lookupRoot = go;
+
+ if (lookupRoot)
+ {
+ if (!meOrigGUID.IsEmpty())
+ {
+ if (Creature* m = ObjectAccessor::GetCreature(*lookupRoot, meOrigGUID))
+ {
+ me = m;
+ go = NULL;
+ }
+ }
+ if (!goOrigGUID.IsEmpty())
+ {
+ if (GameObject* o = ObjectAccessor::GetGameObject(*lookupRoot, goOrigGUID))
+ {
+ me = NULL;
+ go = o;
+ }
+ }
+ }
+ goOrigGUID.Clear();
+ meOrigGUID.Clear();
+}
+
void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob, std::string const& varString)
{
for (SmartAIEventList::iterator i = mEvents.begin(); i != mEvents.end(); ++i)
@@ -1814,7 +1948,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_CROSS_CAST:
{
- ObjectList* casters = GetTargets(CreateEvent(SMART_EVENT_UPDATE_IC, 0, 0, 0, 0, 0, SMART_ACTION_NONE, 0, 0, 0, 0, 0, 0, (SMARTAI_TARGETS)e.action.crossCast.targetType, e.action.crossCast.targetParam1, e.action.crossCast.targetParam2, e.action.crossCast.targetParam3, 0), unit);
+ ObjectList* casters = GetTargets(CreateSmartEvent(SMART_EVENT_UPDATE_IC, 0, 0, 0, 0, 0, SMART_ACTION_NONE, 0, 0, 0, 0, 0, 0, (SMARTAI_TARGETS)e.action.crossCast.targetType, e.action.crossCast.targetParam1, e.action.crossCast.targetParam2, e.action.crossCast.targetParam3, 0), unit);
if (!casters)
break;
@@ -2395,7 +2529,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
case SMART_ACTION_RANDOM_SOUND:
{
std::vector<uint32> sounds;
- std::copy_if(e.action.randomSound.sounds.begin(), e.action.randomSound.sounds.end(),
+ std::copy_if(std::begin(e.action.randomSound.sounds), std::end(e.action.randomSound.sounds),
std::back_inserter(sounds), [](uint32 sound) { return sound != 0; });
bool onlySelf = e.action.randomSound.onlySelf != 0;
@@ -2597,10 +2731,10 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e)
void SmartScript::AddEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask)
{
- mInstallEvents.push_back(CreateEvent(e, event_flags, event_param1, event_param2, event_param3, event_param4, action, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, t, target_param1, target_param2, target_param3, phaseMask));
+ mInstallEvents.push_back(CreateSmartEvent(e, event_flags, event_param1, event_param2, event_param3, event_param4, action, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, t, target_param1, target_param2, target_param3, phaseMask));
}
-SmartScriptHolder SmartScript::CreateEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask)
+SmartScriptHolder SmartScript::CreateSmartEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask)
{
SmartScriptHolder script;
script.event.type = e;
@@ -3637,6 +3771,69 @@ void SmartScript::InstallEvents()
}
}
+void SmartScript::RemoveStoredEvent(uint32 id)
+{
+ if (!mStoredEvents.empty())
+ {
+ for (SmartAIEventList::iterator i = mStoredEvents.begin(); i != mStoredEvents.end(); ++i)
+ {
+ if (i->event_id == id)
+ {
+ mStoredEvents.erase(i);
+ return;
+ }
+ }
+ }
+}
+
+WorldObject* SmartScript::GetBaseObject()
+{
+ WorldObject* obj = nullptr;
+ if (me)
+ obj = me;
+ else if (go)
+ obj = go;
+ return obj;
+}
+
+WorldObject* SmartScript::GetBaseObjectOrUnit(Unit* unit)
+{
+ WorldObject* summoner = GetBaseObject();
+
+ if (!summoner && unit)
+ return unit;
+
+ return summoner;
+}
+
+bool SmartScript::IsUnit(WorldObject* obj)
+{
+ return obj && (obj->GetTypeId() == TYPEID_UNIT || obj->GetTypeId() == TYPEID_PLAYER);
+}
+
+bool SmartScript::IsPlayer(WorldObject* obj)
+{
+ return obj && obj->GetTypeId() == TYPEID_PLAYER;
+}
+
+bool SmartScript::IsCreature(WorldObject* obj)
+{
+ return obj && obj->GetTypeId() == TYPEID_UNIT;
+}
+
+bool SmartScript::IsCreatureInControlOfSelf(WorldObject* obj)
+{
+ if (Creature* creatureObj = obj ? obj->ToCreature() : nullptr)
+ return !creatureObj->IsCharmed() && !creatureObj->IsControlledByPlayer();
+ else
+ return false;
+}
+
+bool SmartScript::IsGameObject(WorldObject* obj)
+{
+ return obj && obj->GetTypeId() == TYPEID_GAMEOBJECT;
+}
+
void SmartScript::OnUpdate(uint32 const diff)
{
if ((mScriptType == SMART_SCRIPT_TYPE_CREATURE || mScriptType == SMART_SCRIPT_TYPE_GAMEOBJECT) && !GetBaseObject())
diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h
index b3294736e3f..e41e09c9f8c 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -18,17 +18,17 @@
#ifndef TRINITY_SMARTSCRIPT_H
#define TRINITY_SMARTSCRIPT_H
-#include "Common.h"
-#include "Creature.h"
-#include "CreatureAI.h"
-#include "Unit.h"
-#include "Spell.h"
-#include "GridNotifiers.h"
-
+#include "Define.h"
#include "SmartScriptMgr.h"
-//#include "SmartAI.h"
+class Creature;
+class GameObject;
class Player;
+class SpellInfo;
+class Unit;
+class WorldObject;
+struct AreaTriggerEntry;
+struct SceneTemplate;
class TC_GAME_API SmartScript
{
@@ -51,56 +51,18 @@ class TC_GAME_API SmartScript
ObjectList* GetTargets(SmartScriptHolder const& e, Unit* invoker = nullptr);
ObjectList* GetWorldObjectsInDist(float dist);
void InstallTemplate(SmartScriptHolder const& e);
- SmartScriptHolder CreateEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask = 0);
+ SmartScriptHolder CreateSmartEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask = 0);
void AddEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask = 0);
void SetPathId(uint32 id) { mPathId = id; }
uint32 GetPathId() const { return mPathId; }
- WorldObject* GetBaseObject()
- {
- WorldObject* obj = nullptr;
- if (me)
- obj = me;
- else if (go)
- obj = go;
- return obj;
- }
- WorldObject* GetBaseObjectOrUnit(Unit* unit)
- {
- WorldObject* summoner = GetBaseObject();
-
- if (!summoner && unit)
- return unit;
-
- return summoner;
- }
-
- static bool IsUnit(WorldObject* obj)
- {
- return obj && (obj->GetTypeId() == TYPEID_UNIT || obj->GetTypeId() == TYPEID_PLAYER);
- }
-
- static bool IsPlayer(WorldObject* obj)
- {
- return obj && obj->GetTypeId() == TYPEID_PLAYER;
- }
- static bool IsCreature(WorldObject* obj)
- {
- return obj && obj->GetTypeId() == TYPEID_UNIT;
- }
-
- static bool IsCreatureInControlOfSelf(WorldObject* obj)
- {
- if (Creature* creatureObj = obj ? obj->ToCreature() : nullptr)
- return !creatureObj->IsCharmed() && !creatureObj->IsControlledByPlayer();
- else
- return false;
- }
-
- static bool IsGameObject(WorldObject* obj)
- {
- return obj && obj->GetTypeId() == TYPEID_GAMEOBJECT;
- }
+ WorldObject* GetBaseObject();
+ WorldObject* GetBaseObjectOrUnit(Unit* unit);
+ static bool IsUnit(WorldObject* obj);
+ static bool IsPlayer(WorldObject* obj);
+ static bool IsCreature(WorldObject* obj);
+ static bool IsCreatureInControlOfSelf(WorldObject* obj);
+ static bool IsGameObject(WorldObject* obj);
void OnUpdate(const uint32 diff);
void OnMoveInLineOfSight(Unit* who);
@@ -110,144 +72,23 @@ class TC_GAME_API SmartScript
void DoFindFriendlyMissingBuff(std::list<Creature*>& list, float range, uint32 spellid);
Unit* DoFindClosestFriendlyInRange(float range, bool playerOnly);
- void StoreTargetList(ObjectList* targets, uint32 id)
- {
- if (!targets)
- return;
-
- if (mTargetStorage->find(id) != mTargetStorage->end())
- {
- // check if already stored
- if ((*mTargetStorage)[id]->Equals(targets))
- return;
-
- delete (*mTargetStorage)[id];
- }
-
- (*mTargetStorage)[id] = new ObjectGuidList(targets, GetBaseObject());
- }
-
- bool IsSmart(Creature* c = nullptr)
- {
- bool smart = true;
- if (c && c->GetAIName() != "SmartAI")
- smart = false;
-
- if (!me || me->GetAIName() != "SmartAI")
- smart = false;
-
- if (!smart)
- TC_LOG_ERROR("sql.sql", "SmartScript: Action target Creature (GUID: " UI64FMTD " Entry: %u) is not using SmartAI, action called by Creature (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(c ? c->GetSpawnId() : UI64LIT(0)), c ? c->GetEntry() : 0, uint64(me ? me->GetSpawnId() : UI64LIT(0)), me ? me->GetEntry() : 0);
+ bool IsSmart(Creature* c = NULL);
+ bool IsSmartGO(GameObject* g = NULL);
- return smart;
- }
-
- bool IsSmartGO(GameObject* g = nullptr)
- {
- bool smart = true;
- if (g && g->GetAIName() != "SmartGameObjectAI")
- smart = false;
-
- if (!go || go->GetAIName() != "SmartGameObjectAI")
- smart = false;
- if (!smart)
- TC_LOG_ERROR("sql.sql", "SmartScript: Action target GameObject (GUID: " UI64FMTD " Entry: %u) is not using SmartGameObjectAI, action called by GameObject (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(g ? g->GetSpawnId() : UI64LIT(0)), g ? g->GetEntry() : 0, uint64(go ? go->GetSpawnId() : UI64LIT(0)), go ? go->GetEntry() : 0);
-
- return smart;
- }
-
- ObjectList* GetTargetList(uint32 id)
- {
- ObjectListMap::iterator itr = mTargetStorage->find(id);
- if (itr != mTargetStorage->end())
- return (*itr).second->GetObjectList();
- return nullptr;
- }
-
- void StoreCounter(uint32 id, uint32 value, uint32 reset)
- {
- CounterMap::const_iterator itr = mCounterList.find(id);
- if (itr != mCounterList.end())
- {
- if (reset == 0)
- value += GetCounterValue(id);
- mCounterList.erase(id);
- }
+ void StoreTargetList(ObjectList* targets, uint32 id);
+ ObjectList* GetTargetList(uint32 id);
- mCounterList.insert(std::make_pair(id, value));
- ProcessEventsFor(SMART_EVENT_COUNTER_SET);
- }
+ void StoreCounter(uint32 id, uint32 value, uint32 reset);
+ uint32 GetCounterId(uint32 id);
+ uint32 GetCounterValue(uint32 id);
- uint32 GetCounterId(uint32 id)
- {
- CounterMap::iterator itr = mCounterList.find(id);
- if (itr != mCounterList.end())
- return itr->first;
- return 0;
- }
-
- uint32 GetCounterValue(uint32 id)
- {
- CounterMap::iterator itr = mCounterList.find(id);
- if (itr != mCounterList.end())
- return itr->second;
- return 0;
- }
-
- GameObject* FindGameObjectNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
- {
- auto bounds = searchObject->GetMap()->GetGameObjectBySpawnIdStore().equal_range(guid);
- if (bounds.first == bounds.second)
- return nullptr;
-
- return bounds.first->second;
- }
-
- Creature* FindCreatureNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
- {
- auto bounds = searchObject->GetMap()->GetCreatureBySpawnIdStore().equal_range(guid);
- if (bounds.first == bounds.second)
- return nullptr;
-
- auto creatureItr = std::find_if(bounds.first, bounds.second, [](Map::CreatureBySpawnIdContainer::value_type const& pair)
- {
- return pair.second->IsAlive();
- });
-
- return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
- }
+ GameObject* FindGameObjectNear(WorldObject* searchObject, ObjectGuid::LowType guid) const;
+ Creature* FindCreatureNear(WorldObject* searchObject, ObjectGuid::LowType guid) const;
ObjectListMap* mTargetStorage;
void OnReset();
- void ResetBaseObject()
- {
- WorldObject* lookupRoot = me;
- if (!lookupRoot)
- lookupRoot = go;
-
- if (lookupRoot)
- {
- if (!meOrigGUID.IsEmpty())
- {
- if (Creature* m = ObjectAccessor::GetCreature(*lookupRoot, meOrigGUID))
- {
- me = m;
- go = nullptr;
- }
- }
- if (!goOrigGUID.IsEmpty())
- {
- if (GameObject* o = ObjectAccessor::GetGameObject(*lookupRoot, goOrigGUID))
- {
- me = nullptr;
- go = o;
- }
- }
- }
- goOrigGUID.Clear();
- meOrigGUID.Clear();
- }
+ void ResetBaseObject();
//TIMED_ACTIONLIST (script type 9 aka script9)
void SetScript9(SmartScriptHolder& e, uint32 entry);
@@ -291,7 +132,7 @@ class TC_GAME_API SmartScript
uint32 mPathId;
SmartAIEventList mStoredEvents;
- std::list<uint32>mRemIDs;
+ std::list<uint32> mRemIDs;
uint32 mTextTimer;
uint32 mLastTextID;
@@ -301,20 +142,7 @@ class TC_GAME_API SmartScript
SMARTAI_TEMPLATE mTemplate;
void InstallEvents();
- void RemoveStoredEvent(uint32 id)
- {
- if (!mStoredEvents.empty())
- {
- for (SmartAIEventList::iterator i = mStoredEvents.begin(); i != mStoredEvents.end(); ++i)
- {
- if (i->event_id == id)
- {
- mStoredEvents.erase(i);
- return;
- }
- }
- }
- }
+ void RemoveStoredEvent(uint32 id);
};
#endif
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index b0ef253d7b5..e20c512b93c 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -15,19 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "SmartScriptMgr.h"
+#include "CreatureTextMgr.h"
#include "DatabaseEnv.h"
-#include "ObjectMgr.h"
-#include "ObjectDefines.h"
-#include "GridDefines.h"
-#include "GridNotifiers.h"
-#include "InstanceScript.h"
-#include "SpellMgr.h"
-#include "Cell.h"
#include "GameEventMgr.h"
-#include "CreatureTextMgr.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "SpellInfo.h"
-
-#include "SmartScriptMgr.h"
+#include "SpellMgr.h"
SmartWaypointMgr* SmartWaypointMgr::instance()
{
@@ -313,6 +309,43 @@ void SmartAIMgr::LoadSmartAIFromDB()
UnLoadHelperStores();
}
+SmartAIEventList SmartAIMgr::GetScript(int32 entry, SmartScriptType type)
+{
+ SmartAIEventList temp;
+ if (mEventMap[uint32(type)].find(entry) != mEventMap[uint32(type)].end())
+ return mEventMap[uint32(type)][entry];
+ else
+ {
+ if (entry > 0)//first search is for guid (negative), do not drop error if not found
+ TC_LOG_DEBUG("scripts.ai", "SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type));
+ return temp;
+ }
+}
+
+SmartScriptHolder& SmartAIMgr::FindLinkedSourceEvent(SmartAIEventList& list, uint32 eventId)
+{
+ SmartAIEventList::iterator itr = std::find_if(list.begin(), list.end(),
+ [eventId](SmartScriptHolder& source) { return source.link == eventId; });
+
+ if (itr != list.end())
+ return *itr;
+
+ static SmartScriptHolder SmartScriptHolderDummy;
+ return SmartScriptHolderDummy;
+}
+
+SmartScriptHolder& SmartAIMgr::FindLinkedEvent(SmartAIEventList& list, uint32 link)
+{
+ SmartAIEventList::iterator itr = std::find_if(list.begin(), list.end(),
+ [link](SmartScriptHolder& linked) { return linked.event_id == link && linked.GetEventType() == SMART_EVENT_LINK; });
+
+ if (itr != list.end())
+ return *itr;
+
+ static SmartScriptHolder SmartScriptHolderDummy;
+ return SmartScriptHolderDummy;
+}
+
bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (std::abs(e.target.o) > 2 * float(M_PI))
@@ -395,6 +428,126 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
return true;
}
+bool SmartAIMgr::IsMinMaxValid(SmartScriptHolder const& e, uint32 min, uint32 max)
+{
+ if (max < min)
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
+ return false;
+ }
+ return true;
+}
+
+bool SmartAIMgr::NotNULL(SmartScriptHolder const& e, uint32 data)
+{
+ if (!data)
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ return false;
+ }
+ return true;
+}
+
+bool SmartAIMgr::IsCreatureValid(SmartScriptHolder const& e, uint32 entry)
+{
+ if (!sObjectMgr->GetCreatureTemplate(entry))
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ return false;
+ }
+ return true;
+}
+
+bool SmartAIMgr::IsQuestValid(SmartScriptHolder const& e, uint32 entry)
+{
+ if (!sObjectMgr->GetQuestTemplate(entry))
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ return false;
+ }
+ return true;
+}
+
+bool SmartAIMgr::IsGameObjectValid(SmartScriptHolder const& e, uint32 entry)
+{
+ if (!sObjectMgr->GetGameObjectTemplate(entry))
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ return false;
+ }
+ return true;
+}
+
+bool SmartAIMgr::IsSpellValid(SmartScriptHolder const& e, uint32 entry)
+{
+ if (!sSpellMgr->GetSpellInfo(entry))
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ return false;
+ }
+ return true;
+}
+
+bool SmartAIMgr::IsItemValid(SmartScriptHolder const& e, uint32 entry)
+{
+ if (!sItemStore.LookupEntry(entry))
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ return false;
+ }
+ return true;
+}
+
+bool SmartAIMgr::IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry)
+{
+ if (!sEmotesTextStore.LookupEntry(entry))
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ return false;
+ }
+ return true;
+}
+
+bool SmartAIMgr::IsEmoteValid(SmartScriptHolder const& e, uint32 entry)
+{
+ if (!sEmotesStore.LookupEntry(entry))
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ return false;
+ }
+ return true;
+}
+
+bool SmartAIMgr::IsAreaTriggerValid(SmartScriptHolder const& e, uint32 entry)
+{
+ if (!sAreaTriggerStore.LookupEntry(entry))
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ return false;
+ }
+ return true;
+}
+
+bool SmartAIMgr::IsSoundValid(SmartScriptHolder const& e, uint32 entry)
+{
+ if (!sSoundKitStore.LookupEntry(entry))
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ return false;
+ }
+ return true;
+}
+
+bool SmartAIMgr::IsAnimKitValid(SmartScriptHolder const& e, uint32 entry)
+{
+ if (!sAnimKitStore.LookupEntry(entry))
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent AnimKit entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ return false;
+ }
+ return true;
+}
+
bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.event.type >= SMART_EVENT_END)
@@ -869,7 +1022,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
case SMART_ACTION_RANDOM_SOUND:
{
- if (std::all_of(e.action.randomSound.sounds.begin(), e.action.randomSound.sounds.end(), [](uint32 sound) { return sound == 0; }))
+ if (std::all_of(std::begin(e.action.randomSound.sounds), std::end(e.action.randomSound.sounds), [](uint32 sound) { return sound == 0; }))
{
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u does not have any non-zero sound",
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
@@ -1438,3 +1591,34 @@ CacheSpellContainerBounds SmartAIMgr::GetCreateItemSpellContainerBounds(uint32 i
return CreateItemSpellStore.equal_range(itemId);
}
+ObjectGuidList::ObjectGuidList(ObjectList* objectList, WorldObject* baseObject)
+{
+ ASSERT(objectList != NULL);
+ m_objectList = objectList;
+ m_baseObject = baseObject;
+ m_guidList = new GuidList();
+
+ for (ObjectList::iterator itr = objectList->begin(); itr != objectList->end(); ++itr)
+ {
+ m_guidList->push_back((*itr)->GetGUID());
+ }
+}
+
+ObjectList* ObjectGuidList::GetObjectList()
+{
+ if (m_baseObject)
+ {
+ //sanitize list using m_guidList
+ m_objectList->clear();
+
+ for (GuidList::iterator itr = m_guidList->begin(); itr != m_guidList->end(); ++itr)
+ {
+ if (WorldObject* obj = ObjectAccessor::GetWorldObject(*m_baseObject, *itr))
+ m_objectList->push_back(obj);
+ else
+ TC_LOG_DEBUG("scripts.ai", "SmartScript::mTargetStorage stores a guid to an invalid object: %s", itr->ToString().c_str());
+ }
+ }
+
+ return m_objectList;
+}
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 6f66f19e475..171e7e4643a 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -18,15 +18,14 @@
#ifndef TRINITY_SMARTSCRIPTMGR_H
#define TRINITY_SMARTSCRIPTMGR_H
-#include "Common.h"
-#include "Creature.h"
-#include "CreatureAI.h"
-#include "Unit.h"
-#include "Spell.h"
-#include "DB2Stores.h"
+#include "Define.h"
+#include "ObjectGuid.h"
+#include <map>
+#include <string>
+#include <unordered_map>
-//#include "SmartScript.h"
-//#include "SmartAI.h"
+class WorldObject;
+enum SpellEffIndex : uint8;
struct WayPoint
{
@@ -1075,7 +1074,7 @@ struct SmartAction
struct
{
- std::array<uint32, SMART_ACTION_PARAM_COUNT - 1> sounds;
+ uint32 sounds[SMART_ACTION_PARAM_COUNT - 1];
uint32 onlySelf;
} randomSound;
@@ -1471,37 +1470,9 @@ class ObjectGuidList
WorldObject* m_baseObject;
public:
- ObjectGuidList(ObjectList* objectList, WorldObject* baseObject)
- {
- ASSERT(objectList != NULL);
- m_objectList = objectList;
- m_baseObject = baseObject;
- m_guidList = new GuidList();
-
- for (ObjectList::iterator itr = objectList->begin(); itr != objectList->end(); ++itr)
- {
- m_guidList->push_back((*itr)->GetGUID());
- }
- }
-
- ObjectList* GetObjectList()
- {
- if (m_baseObject)
- {
- //sanitize list using m_guidList
- m_objectList->clear();
+ ObjectGuidList(ObjectList* objectList, WorldObject* baseObject);
- for (GuidList::iterator itr = m_guidList->begin(); itr != m_guidList->end(); ++itr)
- {
- if (WorldObject* obj = ObjectAccessor::GetWorldObject(*m_baseObject, *itr))
- m_objectList->push_back(obj);
- else
- TC_LOG_DEBUG("scripts.ai", "SmartScript::mTargetStorage stores a guid to an invalid object: %s", itr->ToString().c_str());
- }
- }
-
- return m_objectList;
- }
+ ObjectList* GetObjectList();
bool Equals(ObjectList* objectList)
{
@@ -1559,42 +1530,11 @@ class TC_GAME_API SmartAIMgr
void LoadSmartAIFromDB();
- SmartAIEventList GetScript(int32 entry, SmartScriptType type)
- {
- SmartAIEventList temp;
- if (mEventMap[uint32(type)].find(entry) != mEventMap[uint32(type)].end())
- return mEventMap[uint32(type)][entry];
- else
- {
- if (entry > 0)//first search is for guid (negative), do not drop error if not found
- TC_LOG_DEBUG("scripts.ai", "SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type));
- return temp;
- }
- }
-
- static SmartScriptHolder& FindLinkedSourceEvent(SmartAIEventList& list, uint32 eventId)
- {
- SmartAIEventList::iterator itr = std::find_if(list.begin(), list.end(),
- [eventId](SmartScriptHolder& source) { return source.link == eventId; });
-
- if (itr != list.end())
- return *itr;
-
- static SmartScriptHolder SmartScriptHolderDummy;
- return SmartScriptHolderDummy;
- }
-
- static SmartScriptHolder& FindLinkedEvent(SmartAIEventList& list, uint32 link)
- {
- SmartAIEventList::iterator itr = std::find_if(list.begin(), list.end(),
- [link](SmartScriptHolder& linked) { return linked.event_id == link && linked.GetEventType() == SMART_EVENT_LINK; });
+ SmartAIEventList GetScript(int32 entry, SmartScriptType type);
- if (itr != list.end())
- return *itr;
+ static SmartScriptHolder& FindLinkedSourceEvent(SmartAIEventList& list, uint32 eventId);
- static SmartScriptHolder SmartScriptHolderDummy;
- return SmartScriptHolderDummy;
- }
+ static SmartScriptHolder& FindLinkedEvent(SmartAIEventList& list, uint32 link);
private:
//event stores
@@ -1602,16 +1542,7 @@ class TC_GAME_API SmartAIMgr
bool IsEventValid(SmartScriptHolder& e);
bool IsTargetValid(SmartScriptHolder const& e);
-
- bool IsMinMaxValid(SmartScriptHolder const& e, uint32 min, uint32 max)
- {
- if (max < min)
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
- return false;
- }
- return true;
- }
+ bool IsMinMaxValid(SmartScriptHolder const& e, uint32 min, uint32 max);
/*inline bool IsPercentValid(SmartScriptHolder e, int32 pct)
{
@@ -1623,116 +1554,17 @@ class TC_GAME_API SmartAIMgr
return true;
}*/
- bool NotNULL(SmartScriptHolder const& e, uint32 data)
- {
- if (!data)
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
- return false;
- }
- return true;
- }
-
- bool IsCreatureValid(SmartScriptHolder const& e, uint32 entry)
- {
- if (!sObjectMgr->GetCreatureTemplate(entry))
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
- return false;
- }
- return true;
- }
-
- bool IsQuestValid(SmartScriptHolder const& e, uint32 entry)
- {
- if (!sObjectMgr->GetQuestTemplate(entry))
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
- return false;
- }
- return true;
- }
-
- bool IsGameObjectValid(SmartScriptHolder const& e, uint32 entry)
- {
- if (!sObjectMgr->GetGameObjectTemplate(entry))
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
- return false;
- }
- return true;
- }
-
- bool IsSpellValid(SmartScriptHolder const& e, uint32 entry)
- {
- if (!sSpellMgr->GetSpellInfo(entry))
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
- return false;
- }
- return true;
- }
-
- bool IsItemValid(SmartScriptHolder const& e, uint32 entry)
- {
- if (!sItemStore.LookupEntry(entry))
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
- return false;
- }
- return true;
- }
-
- bool IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry)
- {
- if (!sEmotesTextStore.LookupEntry(entry))
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
- return false;
- }
- return true;
- }
-
- bool IsEmoteValid(SmartScriptHolder const& e, uint32 entry)
- {
- if (!sEmotesStore.LookupEntry(entry))
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
- return false;
- }
- return true;
- }
-
- bool IsAreaTriggerValid(SmartScriptHolder const& e, uint32 entry)
- {
- if (!sAreaTriggerStore.LookupEntry(entry))
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
- return false;
- }
- return true;
- }
-
- bool IsSoundValid(SmartScriptHolder const& e, uint32 entry)
- {
- if (!sSoundKitStore.LookupEntry(entry))
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
- return false;
- }
- return true;
- }
-
- bool IsAnimKitValid(SmartScriptHolder const& e, uint32 entry)
- {
- if (!sAnimKitStore.LookupEntry(entry))
- {
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent AnimKit entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
- return false;
- }
- return true;
- }
-
+ bool NotNULL(SmartScriptHolder const& e, uint32 data);
+ bool IsCreatureValid(SmartScriptHolder const& e, uint32 entry);
+ bool IsQuestValid(SmartScriptHolder const& e, uint32 entry);
+ bool IsGameObjectValid(SmartScriptHolder const& e, uint32 entry);
+ bool IsSpellValid(SmartScriptHolder const& e, uint32 entry);
+ bool IsItemValid(SmartScriptHolder const& e, uint32 entry);
+ bool IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry);
+ bool IsEmoteValid(SmartScriptHolder const& e, uint32 entry);
+ bool IsAreaTriggerValid(SmartScriptHolder const& e, uint32 entry);
+ bool IsSoundValid(SmartScriptHolder const& e, uint32 entry);
+ bool IsAnimKitValid(SmartScriptHolder const& e, uint32 entry);
bool IsTextValid(SmartScriptHolder const& e, uint32 id);
// Helpers
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index f1740154c07..a6df13e4dcd 100644
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -22,9 +22,11 @@
#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
+#include "Realm.h"
#include "ScriptMgr.h"
#include "Util.h"
#include "SHA1.h"
+#include "World.h"
#include "WorldSession.h"
AccountMgr::AccountMgr() { }
diff --git a/src/server/game/Accounts/BattlenetAccountMgr.cpp b/src/server/game/Accounts/BattlenetAccountMgr.cpp
index 3909de055e7..b6121b67c22 100644
--- a/src/server/game/Accounts/BattlenetAccountMgr.cpp
+++ b/src/server/game/Accounts/BattlenetAccountMgr.cpp
@@ -15,8 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "AccountMgr.h"
#include "BattlenetAccountMgr.h"
+#include "AccountMgr.h"
#include "DatabaseEnv.h"
#include "Util.h"
#include "SHA256.h"
diff --git a/src/server/game/Accounts/RBAC.cpp b/src/server/game/Accounts/RBAC.cpp
index 5e7499cf9ab..bef26f25039 100644
--- a/src/server/game/Accounts/RBAC.cpp
+++ b/src/server/game/Accounts/RBAC.cpp
@@ -17,8 +17,8 @@
#include "RBAC.h"
#include "AccountMgr.h"
+#include "DatabaseEnv.h"
#include "Log.h"
-#include "QueryCallback.h"
#include <sstream>
namespace rbac
diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h
index 7eb60a6a34c..362801344b3 100644
--- a/src/server/game/Accounts/RBAC.h
+++ b/src/server/game/Accounts/RBAC.h
@@ -40,7 +40,8 @@
#ifndef _RBAC_H
#define _RBAC_H
-#include "DatabaseEnv.h"
+#include "Define.h"
+#include "DatabaseEnvFwd.h"
#include <string>
#include <set>
#include <map>
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 429593fff47..523c12ac099 100644
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -20,11 +20,15 @@
#include "AchievementPackets.h"
#include "CellImpl.h"
#include "ChatTextBuilder.h"
+#include "DatabaseEnv.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
+#include "Guild.h"
#include "GuildMgr.h"
#include "Language.h"
+#include "Log.h"
#include "ObjectMgr.h"
+#include "World.h"
struct VisibleAchievementCheck
{
diff --git a/src/server/game/Achievements/CriteriaHandler.cpp b/src/server/game/Achievements/CriteriaHandler.cpp
index 50d91a7fdff..0925e5464e9 100644
--- a/src/server/game/Achievements/CriteriaHandler.cpp
+++ b/src/server/game/Achievements/CriteriaHandler.cpp
@@ -18,12 +18,14 @@
#include "CriteriaHandler.h"
#include "ArenaTeamMgr.h"
#include "Battleground.h"
+#include "DatabaseEnv.h"
#include "DB2Stores.h"
#include "DisableMgr.h"
#include "GameEventMgr.h"
#include "Garrison.h"
#include "Group.h"
#include "InstanceScript.h"
+#include "Log.h"
#include "MapManager.h"
#include "ObjectMgr.h"
#include "Player.h"
diff --git a/src/server/game/Achievements/CriteriaHandler.h b/src/server/game/Achievements/CriteriaHandler.h
index b69379ddc19..c8b96b144cd 100644
--- a/src/server/game/Achievements/CriteriaHandler.h
+++ b/src/server/game/Achievements/CriteriaHandler.h
@@ -20,7 +20,7 @@
#include "DBCEnums.h"
#include "ObjectGuid.h"
-#include "Transaction.h"
+#include "DatabaseEnvFwd.h"
#include "Common.h"
#include <map>
#include <unordered_map>
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index c6651630093..3fb1b7ca7af 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -16,19 +16,21 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "AuctionHouseMgr.h"
+#include "AuctionHousePackets.h"
+#include "AccountMgr.h"
#include "Common.h"
+#include "DatabaseEnv.h"
+#include "Item.h"
+#include "Language.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
+#include "Realm.h"
+#include "ScriptMgr.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
-#include "DatabaseEnv.h"
-#include "ScriptMgr.h"
-#include "AccountMgr.h"
-#include "AuctionHouseMgr.h"
-#include "Item.h"
-#include "Language.h"
-#include "Log.h"
#include <vector>
enum eAuctionHouse
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h
index 9227fb1c611..ded222bed97 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.h
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h
@@ -19,16 +19,31 @@
#ifndef _AUCTION_HOUSE_MGR_H
#define _AUCTION_HOUSE_MGR_H
-#include "Common.h"
-#include "DatabaseEnv.h"
+#include "Define.h"
+#include "DatabaseEnvFwd.h"
+#include "ItemTemplate.h"
#include "ObjectGuid.h"
-#include "AuctionHousePackets.h"
+#include "Optional.h"
+#include <map>
#include <set>
+#include <unordered_map>
class Item;
class Player;
class WorldPacket;
+namespace WorldPackets
+{
+ namespace AuctionHouse
+ {
+ struct AuctionItem;
+ class AuctionListBidderItemsResult;
+ class AuctionListOwnerItemsResult;
+ class AuctionListItemsResult;
+ class AuctionReplicateResponse;
+ }
+}
+
#define MIN_AUCTION_TIME (12*HOUR)
enum AuctionError
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
index 5bcaa084950..d7f7c26942f 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
@@ -15,10 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Log.h"
+#include "AuctionHouseBotBuyer.h"
+#include "DatabaseEnv.h"
#include "Item.h"
#include "ItemTemplate.h"
-#include "AuctionHouseBotBuyer.h"
+#include "Log.h"
#include "Random.h"
AuctionBotBuyer::AuctionBotBuyer() : _checkInterval(20 * MINUTE)
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
index 4c74727a03e..f943995a152 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
@@ -15,10 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "AuctionHouseBotSeller.h"
+#include "AuctionHouseMgr.h"
+#include "DatabaseEnv.h"
#include "Log.h"
#include "ObjectMgr.h"
-#include "AuctionHouseMgr.h"
-#include "AuctionHouseBotSeller.h"
#include "Random.h"
AuctionBotSeller::AuctionBotSeller()
@@ -988,7 +989,7 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
// Update the just created item so that if it needs random properties it has them.
// Ex: Notched Shortsword of Stamina will only generate as a Notched Shortsword without this.
- item->SetItemRandomProperties(Item::GenerateItemRandomPropertyId(itemId));
+ item->SetItemRandomProperties(GenerateItemRandomPropertyId(itemId));
uint32 buyoutPrice;
uint32 bidPrice = 0;
diff --git a/src/server/game/BattlePets/BattlePetMgr.cpp b/src/server/game/BattlePets/BattlePetMgr.cpp
index c1658216063..e1f254daeef 100644
--- a/src/server/game/BattlePets/BattlePetMgr.cpp
+++ b/src/server/game/BattlePets/BattlePetMgr.cpp
@@ -15,13 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "BattlePetMgr.h"
#include "Containers.h"
+#include "DatabaseEnv.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "Player.h"
#include "WorldSession.h"
-
void BattlePetMgr::BattlePet::CalculateStats()
{
float health = 0.0f;
diff --git a/src/server/game/BattlePets/BattlePetMgr.h b/src/server/game/BattlePets/BattlePetMgr.h
index 842b4dc02c0..48e3393fb57 100644
--- a/src/server/game/BattlePets/BattlePetMgr.h
+++ b/src/server/game/BattlePets/BattlePetMgr.h
@@ -18,6 +18,7 @@
#ifndef BattlePetMgr_h__
#define BattlePetMgr_h__
+#include "DatabaseEnvFwd.h"
#include "DB2Stores.h"
#include "BattlePetPackets.h"
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 533674ff156..7eca59ffd73 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -24,12 +24,15 @@
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "GroupMgr.h"
+#include "Log.h"
#include "Map.h"
#include "MapManager.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "WorldPacket.h"
+#include "BattlegroundPackets.h"
#include "MiscPackets.h"
+#include "WorldStatePackets.h"
Battlefield::Battlefield()
{
@@ -252,6 +255,11 @@ void Battlefield::InvitePlayersInZoneToWar()
}
}
+uint64 Battlefield::GetQueueId() const
+{
+ return MAKE_PAIR64(m_BattleId | 0x20000, 0x1F100000);
+}
+
void Battlefield::InvitePlayerToWar(Player* player)
{
if (!player)
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
index acd07fb34c8..71b48f81de1 100644
--- a/src/server/game/Battlefield/Battlefield.h
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -18,10 +18,10 @@
#ifndef BATTLEFIELD_H_
#define BATTLEFIELD_H_
-#include "ObjectDefines.h"
+#include "Position.h"
#include "SharedDefines.h"
#include "ZoneScript.h"
-#include "Packets/WorldStatePackets.h"
+#include <map>
enum BattlefieldTypes
{
@@ -67,14 +67,31 @@ enum BattlefieldTimers
};
// some class predefs
-class Player;
-class GameObject;
-class WorldPacket;
+class Battlefield;
+class BfGraveyard;
class Creature;
+class GameObject;
+class Group;
+class Map;
+class Player;
class Unit;
+class WorldPacket;
-class Battlefield;
-class BfGraveyard;
+struct Position;
+struct WorldSafeLocsEntry;
+
+namespace WorldPackets
+{
+ namespace WorldState
+ {
+ class InitWorldStates;
+ }
+}
+
+namespace G3D
+{
+ class Quat;
+}
typedef std::vector<BfGraveyard*> GraveyardVect;
typedef std::map<ObjectGuid, time_t> PlayerTimerMap;
@@ -234,7 +251,7 @@ class TC_GAME_API Battlefield : public ZoneScript
uint32 GetTypeId() const { return m_TypeId; }
uint32 GetZoneId() const { return m_ZoneId; }
- uint64 GetQueueId() const { return MAKE_PAIR64(m_BattleId | 0x20000, 0x1F100000); }
+ uint64 GetQueueId() const;
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
diff --git a/src/server/game/Battlefield/Zones/BattlefieldTB.cpp b/src/server/game/Battlefield/Zones/BattlefieldTB.cpp
index 88a13344ace..0163b6c0195 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldTB.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldTB.cpp
@@ -34,6 +34,7 @@
#include "SpellAuras.h"
#include "TemporarySummon.h"
#include "WorldSession.h"
+#include "WorldStatePackets.h"
BattlefieldTB::~BattlefieldTB() { }
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
index ff6476bc06d..815b37064bb 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -24,12 +24,14 @@
#include "CreatureTextMgr.h"
#include "Battleground.h"
#include "MapManager.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "SpellAuras.h"
#include "TemporarySummon.h"
#include "WorldSession.h"
+#include "WorldStatePackets.h"
struct BfWGCoordGY
{
diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp
index 196c871ce28..390a2395251 100644
--- a/src/server/game/Battlegrounds/Arena.cpp
+++ b/src/server/game/Battlegrounds/Arena.cpp
@@ -21,9 +21,11 @@
#include "GuildMgr.h"
#include "Guild.h"
#include "Language.h"
+#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "World.h"
+#include "WorldStatePackets.h"
#include "WorldSession.h"
Arena::Arena()
diff --git a/src/server/game/Battlegrounds/ArenaScore.h b/src/server/game/Battlegrounds/ArenaScore.h
index fa932a22948..cc6693dcd07 100644
--- a/src/server/game/Battlegrounds/ArenaScore.h
+++ b/src/server/game/Battlegrounds/ArenaScore.h
@@ -22,6 +22,7 @@
#include "SharedDefines.h"
#include "Player.h"
#include "ObjectAccessor.h"
+#include <sstream>
struct TC_GAME_API ArenaScore : public BattlegroundScore
{
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 8c009782897..a4cffb5f540 100644
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -16,15 +16,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ArenaTeam.h"
+#include "ArenaTeamMgr.h"
+#include "DatabaseEnv.h"
+#include "Group.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "WorldPacket.h"
-#include "ArenaTeam.h"
#include "World.h"
-#include "Group.h"
-#include "ArenaTeamMgr.h"
+#include "WorldPacket.h"
#include "WorldSession.h"
-#include "Opcodes.h"
ArenaTeam::ArenaTeam()
: TeamId(0), Type(0), TeamName(), CaptainGuid(), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 928ac0f1b30..d8c01e0c935 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -22,11 +22,13 @@
#include "BattlegroundScore.h"
#include "Creature.h"
#include "CreatureTextMgr.h"
+#include "DatabaseEnv.h"
#include "Formulas.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "GuildMgr.h"
#include "Guild.h"
+#include "Log.h"
#include "Object.h"
#include "ObjectMgr.h"
#include "Player.h"
@@ -35,7 +37,9 @@
#include "Util.h"
#include "WorldPacket.h"
#include "Transport.h"
+#include "BattlegroundPackets.h"
#include "MiscPackets.h"
+#include "WorldStatePackets.h"
namespace Trinity
{
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 182278fb615..5c5fc5b8076 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -26,8 +26,6 @@
#include "WorldPacket.h"
#include "Object.h"
#include "GameObject.h"
-#include "Packets/WorldStatePackets.h"
-#include "Packets/BattlegroundPackets.h"
#include "EventMap.h"
class Creature;
@@ -42,6 +40,20 @@ class BattlegroundMap;
struct PvpDifficultyEntry;
struct WorldSafeLocsEntry;
+namespace WorldPackets
+{
+ namespace Battleground
+ {
+ class PVPLogData;
+ struct BattlegroundPlayerPosition;
+ }
+
+ namespace WorldState
+ {
+ class InitWorldStates;
+ }
+}
+
enum BattlegroundCriteriaId
{
BG_CRITERIA_CHECK_RESILIENT_VICTORY,
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index aedce2d6f51..9705521f5d2 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -16,34 +16,36 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "ObjectMgr.h"
-#include "World.h"
-#include "WorldPacket.h"
-
#include "BattlegroundMgr.h"
-#include "BattlegroundAV.h"
#include "BattlegroundAB.h"
+#include "BattlegroundAV.h"
+#include "BattlegroundBE.h"
+#include "BattlegroundBFG.h"
+#include "BattlegroundDS.h"
#include "BattlegroundEY.h"
-#include "BattlegroundWS.h"
+#include "BattlegroundIC.h"
#include "BattlegroundNA.h"
-#include "BattlegroundBE.h"
+#include "BattlegroundPackets.h"
#include "BattlegroundRL.h"
-#include "BattlegroundSA.h"
-#include "BattlegroundDS.h"
#include "BattlegroundRV.h"
-#include "BattlegroundIC.h"
+#include "BattlegroundSA.h"
#include "BattlegroundTP.h"
-#include "BattlegroundBFG.h"
+#include "BattlegroundWS.h"
+#include "Common.h"
+#include "Containers.h"
+#include "DatabaseEnv.h"
+#include "DisableMgr.h"
+#include "GameEventMgr.h"
+#include "Log.h"
#include "Map.h"
#include "MapInstanced.h"
#include "MapManager.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
#include "Player.h"
-#include "GameEventMgr.h"
#include "SharedDefines.h"
-#include "DisableMgr.h"
-#include "Opcodes.h"
-#include "Containers.h"
+#include "World.h"
+#include "WorldPacket.h"
/*********************************************************/
/*** BATTLEGROUND MANAGER ***/
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index fab6202d854..dc77288b738 100644
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -18,6 +18,7 @@
#include "ArenaTeam.h"
#include "ArenaTeamMgr.h"
+#include "BattlegroundPackets.h"
#include "BattlegroundMgr.h"
#include "BattlegroundQueue.h"
#include "Chat.h"
@@ -25,6 +26,7 @@
#include "Log.h"
#include "Language.h"
#include "Player.h"
+#include "World.h"
/*********************************************************/
/*** BATTLEGROUND QUEUE SYSTEM ***/
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index e140f8a4ae9..61360b254fc 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -26,6 +26,7 @@
#include "Random.h"
#include "Util.h"
#include "WorldSession.h"
+#include "WorldStatePackets.h"
BattlegroundAB::BattlegroundAB()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index afd1eca65c9..6dd3fdedb28 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -17,14 +17,13 @@
*/
#include "BattlegroundAV.h"
-
-#include "ObjectMgr.h"
-#include "WorldPacket.h"
-
#include "GameObject.h"
#include "Language.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptedCreature.h"
+#include "WorldPacket.h"
#include "WorldSession.h"
BattlegroundAV::BattlegroundAV()
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
index 06da80850bf..438c4d022da 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
@@ -20,6 +20,7 @@
#include "Log.h"
#include "Player.h"
#include "WorldPacket.h"
+#include "WorldStatePackets.h"
BattlegroundBE::BattlegroundBE()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
index a3e8ad37227..4277378c1c2 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
@@ -22,6 +22,7 @@
#include "Player.h"
#include "Random.h"
#include "WorldPacket.h"
+#include "WorldStatePackets.h"
BattlegroundDS::BattlegroundDS()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index 69b4b392735..7c4d06bdc28 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -25,6 +25,8 @@
#include "Player.h"
#include "Random.h"
#include "Util.h"
+#include "BattlegroundPackets.h"
+#include "WorldStatePackets.h"
// these variables aren't used outside of this file, so declare them only here
uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] =
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index 66259716cf5..4ffb91327f5 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -16,16 +16,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Player.h"
-#include "Battleground.h"
#include "BattlegroundIC.h"
-#include "Language.h"
-#include "WorldPacket.h"
#include "GameObject.h"
+#include "Language.h"
+#include "Log.h"
#include "ObjectMgr.h"
-#include "Vehicle.h"
-#include "Transport.h"
+#include "Player.h"
#include "ScriptedCreature.h"
+#include "Transport.h"
+#include "Vehicle.h"
+#include "WorldPacket.h"
BattlegroundIC::BattlegroundIC()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
index 7aab709f4cd..fda6f41790b 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
@@ -20,6 +20,7 @@
#include "Log.h"
#include "Player.h"
#include "WorldPacket.h"
+#include "WorldStatePackets.h"
BattlegroundNA::BattlegroundNA()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
index 8fb48819011..772b6de91b8 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
@@ -20,6 +20,7 @@
#include "Log.h"
#include "Player.h"
#include "WorldPacket.h"
+#include "WorldStatePackets.h"
BattlegroundRL::BattlegroundRL()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
index 6bf61e24914..6233bd0d2bf 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
@@ -22,6 +22,7 @@
#include "ObjectAccessor.h"
#include "Player.h"
#include "WorldPacket.h"
+#include "WorldStatePackets.h"
BattlegroundRV::BattlegroundRV()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index 0fa25fc3f78..06c57d50049 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -19,6 +19,7 @@
#include "BattlegroundSA.h"
#include "GameObject.h"
#include "Language.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptedCreature.h"
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index bbf9fa5c077..6ab9970aea1 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -24,6 +24,8 @@
#include "BattlegroundMgr.h"
#include "Player.h"
#include "WorldPacket.h"
+#include "BattlegroundPackets.h"
+#include "WorldStatePackets.h"
// these variables aren't used outside of this file, so declare them only here
enum BG_WSG_Rewards
diff --git a/src/server/game/BlackMarket/BlackMarketMgr.cpp b/src/server/game/BlackMarket/BlackMarketMgr.cpp
index 4710519084a..8d1f1588909 100644
--- a/src/server/game/BlackMarket/BlackMarketMgr.cpp
+++ b/src/server/game/BlackMarket/BlackMarketMgr.cpp
@@ -16,11 +16,19 @@
*/
#include "BlackMarketMgr.h"
+#include "AccountMgr.h"
#include "BlackMarketPackets.h"
#include "Containers.h"
+#include "DatabaseEnv.h"
+#include "Language.h"
+#include "Log.h"
+#include "Mail.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "Language.h"
+#include "Realm.h"
+#include "World.h"
+#include <sstream>
BlackMarketMgr::BlackMarketMgr()
{
@@ -208,8 +216,30 @@ void BlackMarketMgr::BuildItemsResponse(WorldPackets::BlackMarket::BlackMarketRe
packet.Items.reserve(_auctions.size());
for (auto itr = _auctions.begin(); itr != _auctions.end(); ++itr)
{
+ BlackMarketTemplate const* templ = itr->second->GetTemplate();
+
WorldPackets::BlackMarket::BlackMarketItem item;
- item.Initialize(itr->second, player);
+ item.MarketID = itr->second->GetMarketId();
+ item.SellerNPC = templ->SellerNPC;
+ item.Item = templ->Item;
+ item.Quantity = templ->Quantity;
+
+ // No bids yet
+ if (!itr->second->GetNumBids())
+ {
+ item.MinBid = templ->MinBid;
+ item.MinIncrement = 1;
+ }
+ else
+ {
+ item.MinIncrement = itr->second->GetMinIncrement(); // 5% increment minimum
+ item.MinBid = itr->second->GetCurrentBid() + item.MinIncrement;
+ }
+
+ item.CurrentBid = itr->second->GetCurrentBid();
+ item.SecondsRemaining = itr->second->GetSecondsRemaining();
+ item.HighBid = (itr->second->GetBidder() == player->GetGUID().GetCounter());
+ item.NumBids = itr->second->GetNumBids();
packet.Items.push_back(item);
}
diff --git a/src/server/game/BlackMarket/BlackMarketMgr.h b/src/server/game/BlackMarket/BlackMarketMgr.h
index a2013a719a2..7ff5f57714f 100644
--- a/src/server/game/BlackMarket/BlackMarketMgr.h
+++ b/src/server/game/BlackMarket/BlackMarketMgr.h
@@ -18,10 +18,13 @@
#ifndef BLACK_MARKET_H
#define BLACK_MARKET_H
-#include "Common.h"
+#include "SharedDefines.h"
+#include "DatabaseEnvFwd.h"
#include "ObjectGuid.h"
-#include "ItemPackets.h"
-#include "Item.h"
+#include "ItemPacketsCommon.h"
+#include <unordered_map>
+
+class Player;
namespace WorldPackets
{
diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp
index 9d90d5301a9..73ca33e9ba2 100644
--- a/src/server/game/Calendar/CalendarMgr.cpp
+++ b/src/server/game/Calendar/CalendarMgr.cpp
@@ -16,13 +16,15 @@
*/
#include "CalendarMgr.h"
-#include "QueryResult.h"
-#include "Log.h"
-#include "Player.h"
+#include "CalendarPackets.h"
+#include "DatabaseEnv.h"
+#include "Guild.h"
#include "GuildMgr.h"
+#include "Log.h"
+#include "Mail.h"
#include "ObjectAccessor.h"
#include "Opcodes.h"
-#include "CalendarPackets.h"
+#include "Player.h"
CalendarInvite::~CalendarInvite()
{
diff --git a/src/server/game/Calendar/CalendarMgr.h b/src/server/game/Calendar/CalendarMgr.h
index a709923f708..2081eca6b0d 100644
--- a/src/server/game/Calendar/CalendarMgr.h
+++ b/src/server/game/Calendar/CalendarMgr.h
@@ -19,9 +19,14 @@
#define TRINITY_CALENDARMGR_H
#include "Common.h"
-#include "DatabaseEnv.h"
-#include "WorldPacket.h"
+#include "DatabaseEnvFwd.h"
#include "ObjectGuid.h"
+#include <deque>
+#include <map>
+#include <set>
+#include <vector>
+
+class WorldPacket;
enum CalendarMailAnswers
{
diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index d587b1fef4e..5605cb730eb 100644
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -17,14 +17,15 @@
*/
#include "Channel.h"
-#include "ChannelAppenders.h"
#include "AccountMgr.h"
+#include "ChannelAppenders.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "DatabaseEnv.h"
-#include "ObjectMgr.h"
#include "Language.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "Player.h"
#include "SocialMgr.h"
#include "World.h"
diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h
index 50dd5c8ee96..d094fec6435 100644
--- a/src/server/game/Chat/Channels/Channel.h
+++ b/src/server/game/Chat/Channels/Channel.h
@@ -21,8 +21,8 @@
#include "Common.h"
#include "ObjectGuid.h"
-#include "WorldPacket.h"
#include <map>
+#include <unordered_set>
class Player;
diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h
index 66d57c38d55..866717a422e 100644
--- a/src/server/game/Chat/Channels/ChannelMgr.h
+++ b/src/server/game/Chat/Channels/ChannelMgr.h
@@ -18,11 +18,14 @@
#ifndef __TRINITY_CHANNELMGR_H
#define __TRINITY_CHANNELMGR_H
-#include "Common.h"
+#include "Define.h"
#include "Hash.h"
+#include <string>
#include <unordered_map>
class Channel;
+class Player;
+struct AreaTableEntry;
class TC_GAME_API ChannelMgr
{
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index b935734a0f8..a4596f64549 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -17,21 +17,21 @@
*/
#include "Common.h"
-#include "ObjectMgr.h"
-#include "World.h"
-#include "WorldSession.h"
-#include "DatabaseEnv.h"
-
#include "AccountMgr.h"
#include "CellImpl.h"
#include "Chat.h"
+#include "ChatLink.h"
+#include "DatabaseEnv.h"
#include "GridNotifiersImpl.h"
+#include "Group.h"
#include "Language.h"
#include "Log.h"
+#include "ObjectMgr.h"
#include "Player.h"
+#include "Realm.h"
#include "ScriptMgr.h"
-#include "ChatLink.h"
-#include "Group.h"
+#include "World.h"
+#include "WorldSession.h"
ChatCommand::ChatCommand(char const* name, uint32 permission, bool allowConsole, pHandler handler, std::string help, std::vector<ChatCommand> childCommands /*= std::vector<ChatCommand>()*/)
: Name(ASSERT_NOTNULL(name)), Permission(permission), AllowConsole(allowConsole), Handler(handler), Help(std::move(help)), ChildCommands(std::move(childCommands))
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index e20479d8c51..e6cb5e445f1 100644
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -29,6 +29,7 @@
class ChatHandler;
class Creature;
+class GameObject;
class Group;
class Player;
class Unit;
@@ -37,6 +38,8 @@ class WorldObject;
struct GameTele;
+enum LocaleConstant : uint8;
+
class TC_GAME_API ChatCommand
{
typedef bool(*pHandler)(ChatHandler*, char const*);
diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp
index 6beae331e51..74f1a1c8696 100644
--- a/src/server/game/Chat/ChatLink.cpp
+++ b/src/server/game/Chat/ChatLink.cpp
@@ -16,6 +16,7 @@
*/
#include "ChatLink.h"
+#include "Log.h"
#include "SpellMgr.h"
#include "ObjectMgr.h"
#include "SpellInfo.h"
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 0ad512f2578..b292ed3c63e 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -18,9 +18,12 @@
#include "ConditionMgr.h"
#include "AchievementMgr.h"
+#include "DatabaseEnv.h"
#include "GameEventMgr.h"
#include "Group.h"
#include "InstanceScript.h"
+#include "Log.h"
+#include "LootMgr.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "Pet.h"
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index 14eef8db623..4b77e9e99fa 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -19,7 +19,7 @@
#ifndef TRINITY_CONDITIONMGR_H
#define TRINITY_CONDITIONMGR_H
-#include "Common.h"
+#include "Define.h"
#include "Hash.h"
#include <array>
#include <unordered_map>
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index 619bebadf8d..7cf027d0d85 100644
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -18,10 +18,13 @@
#include "DisableMgr.h"
#include "CriteriaHandler.h"
+#include "DatabaseEnv.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "OutdoorPvP.h"
-#include "SpellMgr.h"
#include "Player.h"
+#include "SpellMgr.h"
+#include "VMapManager2.h"
#include "World.h"
namespace DisableMgr
diff --git a/src/server/game/Conditions/DisableMgr.h b/src/server/game/Conditions/DisableMgr.h
index 43d7bdae30d..40990d56120 100644
--- a/src/server/game/Conditions/DisableMgr.h
+++ b/src/server/game/Conditions/DisableMgr.h
@@ -19,7 +19,6 @@
#ifndef TRINITY_DISABLEMGR_H
#define TRINITY_DISABLEMGR_H
-#include "VMapManager2.h"
#include "Define.h"
class Unit;
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp
index 4eb4742da45..f001f3e35ff 100644
--- a/src/server/game/DataStores/DB2Stores.cpp
+++ b/src/server/game/DataStores/DB2Stores.cpp
@@ -20,9 +20,13 @@
#include "Containers.h"
#include "DatabaseEnv.h"
#include "DB2LoadInfo.h"
+#include "Hash.h"
#include "Log.h"
+#include "Regex.h"
#include "TransportMgr.h"
#include "World.h"
+#include <array>
+#include <sstream>
#include <cctype>
// temporary hack until includes are sorted out (don't want to pull in Windows.h)
@@ -248,10 +252,106 @@ TaxiMask sAllianceTaxiNodesMask;
TaxiPathSetBySource sTaxiPathSetBySource;
TaxiPathNodesByPath sTaxiPathNodesByPath;
+DEFINE_DB2_SET_COMPARATOR(ChrClassesXPowerTypesEntry)
+
+typedef std::map<uint32 /*hash*/, DB2StorageBase*> StorageMap;
+typedef std::unordered_map<uint32 /*areaGroupId*/, std::vector<uint32/*areaId*/>> AreaGroupMemberContainer;
+typedef std::unordered_map<uint32, std::vector<ArtifactPowerEntry const*>> ArtifactPowersContainer;
+typedef std::unordered_map<uint32, std::unordered_set<uint32>> ArtifactPowerLinksContainer;
+typedef std::unordered_map<std::pair<uint32, uint8>, ArtifactPowerRankEntry const*> ArtifactPowerRanksContainer;
+typedef std::unordered_multimap<uint32, CharSectionsEntry const*> CharSectionsContainer;
+typedef std::unordered_map<uint32, CharStartOutfitEntry const*> CharStartOutfitContainer;
+typedef ChrSpecializationEntry const* ChrSpecializationByIndexContainer[MAX_CLASSES + 1][MAX_SPECIALIZATIONS];
+typedef std::unordered_map<uint32, ChrSpecializationEntry const*> ChrSpecialzationByClassContainer;
+typedef std::unordered_map<uint32 /*curveID*/, std::vector<CurvePointEntry const*>> CurvePointsContainer;
+typedef std::map<std::tuple<uint32, uint8, uint8, uint8>, EmotesTextSoundEntry const*> EmotesTextSoundContainer;
+typedef std::unordered_map<uint32, std::vector<uint32>> FactionTeamContainer;
+typedef std::unordered_map<uint32, HeirloomEntry const*> HeirloomItemsContainer;
+typedef std::unordered_map<uint32 /*glyphPropertiesId*/, std::vector<uint32>> GlyphBindableSpellsContainer;
+typedef std::unordered_map<uint32 /*glyphPropertiesId*/, std::vector<uint32>> GlyphRequiredSpecsContainer;
+typedef std::unordered_map<uint32 /*bonusListId*/, DB2Manager::ItemBonusList> ItemBonusListContainer;
+typedef std::unordered_map<int16, uint32> ItemBonusListLevelDeltaContainer;
+typedef std::unordered_multimap<uint32 /*itemId*/, uint32 /*bonusTreeId*/> ItemToBonusTreeContainer;
+typedef std::unordered_map<uint32 /*itemId*/, ItemChildEquipmentEntry const*> ItemChildEquipmentContainer;
+typedef std::array<ItemClassEntry const*, 19> ItemClassByOldEnumContainer;
+typedef std::unordered_map<uint32 /*itemId | appearanceMod << 24*/, ItemModifiedAppearanceEntry const*> ItemModifiedAppearanceByItemContainer;
+typedef std::unordered_map<uint32, std::set<ItemBonusTreeNodeEntry const*>> ItemBonusTreeContainer;
+typedef std::unordered_map<uint32, std::vector<ItemSetSpellEntry const*>> ItemSetSpellContainer;
+typedef std::unordered_map<uint32, std::vector<ItemSpecOverrideEntry const*>> ItemSpecOverridesContainer;
+typedef std::unordered_map<uint32, MountEntry const*> MountContainer;
+typedef std::unordered_map<uint32, DB2Manager::MountTypeXCapabilitySet> MountCapabilitiesByTypeContainer;
+typedef std::unordered_map<uint32, DB2Manager::MountXDisplayContainer> MountDisplaysCointainer;
+typedef std::unordered_map<uint32, std::array<std::vector<NameGenEntry const*>, 2>> NameGenContainer;
+typedef std::array<std::vector<Trinity::wregex>, TOTAL_LOCALES + 1> NameValidationRegexContainer;
+typedef std::unordered_map<uint32, std::set<uint32>> PhaseGroupContainer;
+typedef std::array<PowerTypeEntry const*, MAX_POWERS> PowerTypesContainer;
+typedef std::unordered_map<uint32, std::pair<std::vector<QuestPackageItemEntry const*>, std::vector<QuestPackageItemEntry const*>>> QuestPackageItemContainer;
+typedef std::unordered_map<uint32, uint32> RulesetItemUpgradeContainer;
+typedef std::unordered_multimap<uint32, SkillRaceClassInfoEntry const*> SkillRaceClassInfoContainer;
+typedef std::unordered_map<uint32, std::vector<SpecializationSpellsEntry const*>> SpecializationSpellsContainer;
+typedef std::unordered_map<uint32, std::vector<SpellPowerEntry const*>> SpellPowerContainer;
+typedef std::unordered_map<uint32, std::unordered_map<uint32, std::vector<SpellPowerEntry const*>>> SpellPowerDifficultyContainer;
+typedef std::unordered_map<uint32, std::vector<SpellProcsPerMinuteModEntry const*>> SpellProcsPerMinuteModContainer;
+typedef std::vector<TalentEntry const*> TalentsByPosition[MAX_CLASSES][MAX_TALENT_TIERS][MAX_TALENT_COLUMNS];
+typedef std::unordered_set<uint32> ToyItemIdsContainer;
+typedef std::tuple<int16, int8, int32> WMOAreaTableKey;
+typedef std::map<WMOAreaTableKey, WMOAreaTableEntry const*> WMOAreaTableLookupContainer;
+typedef std::unordered_map<uint32, WorldMapAreaEntry const*> WorldMapAreaByAreaIDContainer;
+namespace
+{
+ StorageMap _stores;
+ std::map<int32, HotfixData> _hotfixData;
+
+ AreaGroupMemberContainer _areaGroupMembers;
+ ArtifactPowersContainer _artifactPowers;
+ ArtifactPowerLinksContainer _artifactPowerLinks;
+ ArtifactPowerRanksContainer _artifactPowerRanks;
+ CharSectionsContainer _charSections;
+ CharStartOutfitContainer _charStartOutfits;
+ uint32 _powersByClass[MAX_CLASSES][MAX_POWERS];
+ ChrSpecializationByIndexContainer _chrSpecializationsByIndex;
+ ChrSpecialzationByClassContainer _defaultChrSpecializationsByClass;
+ CurvePointsContainer _curvePoints;
+ EmotesTextSoundContainer _emoteTextSounds;
+ FactionTeamContainer _factionTeams;
+ HeirloomItemsContainer _heirlooms;
+ GlyphBindableSpellsContainer _glyphBindableSpells;
+ GlyphRequiredSpecsContainer _glyphRequiredSpecs;
+ ItemBonusListContainer _itemBonusLists;
+ ItemBonusListLevelDeltaContainer _itemLevelDeltaToBonusListContainer;
+ ItemBonusTreeContainer _itemBonusTrees;
+ ItemChildEquipmentContainer _itemChildEquipment;
+ ItemClassByOldEnumContainer _itemClassByOldEnum;
+ std::unordered_set<uint32> _itemsWithCurrencyCost;
+ ItemModifiedAppearanceByItemContainer _itemModifiedAppearancesByItem;
+ ItemToBonusTreeContainer _itemToBonusTree;
+ ItemSetSpellContainer _itemSetSpells;
+ ItemSpecOverridesContainer _itemSpecOverrides;
+ DB2Manager::MapDifficultyContainer _mapDifficulties;
+ MountContainer _mountsBySpellId;
+ MountCapabilitiesByTypeContainer _mountCapabilitiesByType;
+ MountDisplaysCointainer _mountDisplays;
+ NameGenContainer _nameGenData;
+ NameValidationRegexContainer _nameValidators;
+ PhaseGroupContainer _phasesByGroup;
+ PowerTypesContainer _powerTypes;
+ QuestPackageItemContainer _questPackages;
+ RulesetItemUpgradeContainer _rulesetItemUpgrade;
+ SkillRaceClassInfoContainer _skillRaceClassInfoBySkill;
+ SpecializationSpellsContainer _specializationSpellsBySpec;
+ SpellPowerContainer _spellPowers;
+ SpellPowerDifficultyContainer _spellPowerDifficulties;
+ SpellProcsPerMinuteModContainer _spellProcsPerMinuteMods;
+ TalentsByPosition _talentsByPosition;
+ ToyItemIdsContainer _toys;
+ WMOAreaTableLookupContainer _wmoAreaTableLookup;
+ WorldMapAreaByAreaIDContainer _worldMapAreaByAreaID;
+}
+
typedef std::vector<std::string> DB2StoreProblemList;
template<class T, template<class> class DB2>
-inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, DB2Manager::StorageMap& stores, DB2StorageBase* storage, std::string const& db2Path, uint32 defaultLocale, DB2<T> const& /*hint*/)
+inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, StorageMap& stores, DB2StorageBase* storage, std::string const& db2Path, uint32 defaultLocale, DB2<T> const& /*hint*/)
{
// validate structure
DB2LoadInfo const* loadInfo = storage->GetLoadInfo();
@@ -1011,6 +1111,11 @@ void DB2Manager::LoadHotfixData()
TC_LOG_INFO("server.loading", ">> Loaded %u hotfix records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
+std::map<int32, HotfixData> const& DB2Manager::GetHotfixData() const
+{
+ return _hotfixData;
+}
+
std::vector<uint32> DB2Manager::GetAreasForGroup(uint32 areaGroupId) const
{
auto itr = _areaGroupMembers.find(areaGroupId);
@@ -1395,6 +1500,11 @@ ItemClassEntry const* DB2Manager::GetItemClassByOldEnum(uint32 itemClass) const
return _itemClassByOldEnum[itemClass];
}
+bool DB2Manager::HasItemCurrencyCost(uint32 itemId) const
+{
+ return _itemsWithCurrencyCost.count(itemId) > 0;
+}
+
uint32 DB2Manager::GetItemDisplayId(uint32 itemId, uint32 appearanceModId) const
{
if (ItemModifiedAppearanceEntry const* modifiedAppearance = GetItemModifiedAppearance(itemId, appearanceModId))
@@ -1480,6 +1590,11 @@ uint32 DB2Manager::GetLiquidFlags(uint32 liquidType)
return 0;
}
+DB2Manager::MapDifficultyContainer const& DB2Manager::GetMapDifficulties() const
+{
+ return _mapDifficulties;
+}
+
MapDifficultyEntry const* DB2Manager::GetDefaultMapDifficulty(uint32 mapId, Difficulty* difficulty /*= nullptr*/) const
{
auto itr = _mapDifficulties.find(mapId);
@@ -1888,7 +2003,7 @@ void DB2Manager::DeterminaAlternateMapPosition(uint32 mapId, float x, float y, f
newPos->Y = y + transformation->RegionOffset.Y;
}
-bool DB2Manager::ChrClassesXPowerTypesEntryComparator::Compare(ChrClassesXPowerTypesEntry const* left, ChrClassesXPowerTypesEntry const* right)
+bool ChrClassesXPowerTypesEntryComparator::Compare(ChrClassesXPowerTypesEntry const* left, ChrClassesXPowerTypesEntry const* right)
{
if (left->ClassID != right->ClassID)
return left->ClassID < right->ClassID;
diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h
index 8bc6acb986d..9b156babe80 100644
--- a/src/server/game/DataStores/DB2Stores.h
+++ b/src/server/game/DataStores/DB2Stores.h
@@ -20,10 +20,7 @@
#include "DB2Store.h"
#include "DB2Structure.h"
-#include "Hash.h"
#include "SharedDefines.h"
-#include "Regex.h"
-#include <array>
#include <map>
#include <set>
#include <unordered_map>
@@ -247,56 +244,12 @@ struct HotfixData
class TC_GAME_API DB2Manager
{
public:
- DEFINE_DB2_SET_COMPARATOR(ChrClassesXPowerTypesEntry)
DEFINE_DB2_SET_COMPARATOR(MountTypeXCapabilityEntry)
- typedef std::map<uint32 /*hash*/, DB2StorageBase*> StorageMap;
- typedef std::unordered_map<uint32 /*areaGroupId*/, std::vector<uint32/*areaId*/>> AreaGroupMemberContainer;
- typedef std::unordered_map<uint32, std::vector<ArtifactPowerEntry const*>> ArtifactPowersContainer;
- typedef std::unordered_map<uint32, std::unordered_set<uint32>> ArtifactPowerLinksContainer;
- typedef std::unordered_map<std::pair<uint32, uint8>, ArtifactPowerRankEntry const*> ArtifactPowerRanksContainer;
- typedef std::unordered_multimap<uint32, CharSectionsEntry const*> CharSectionsContainer;
- typedef std::unordered_map<uint32, CharStartOutfitEntry const*> CharStartOutfitContainer;
- typedef ChrSpecializationEntry const* ChrSpecializationByIndexContainer[MAX_CLASSES + 1][MAX_SPECIALIZATIONS];
- typedef std::unordered_map<uint32, ChrSpecializationEntry const*> ChrSpecialzationByClassContainer;
- typedef std::unordered_map<uint32 /*curveID*/, std::vector<CurvePointEntry const*>> CurvePointsContainer;
- typedef std::map<std::tuple<uint32, uint8, uint8, uint8>, EmotesTextSoundEntry const*> EmotesTextSoundContainer;
- typedef std::unordered_map<uint32, std::vector<uint32>> FactionTeamContainer;
- typedef std::unordered_map<uint32, HeirloomEntry const*> HeirloomItemsContainer;
- typedef std::unordered_map<uint32 /*glyphPropertiesId*/, std::vector<uint32>> GlyphBindableSpellsContainer;
- typedef std::unordered_map<uint32 /*glyphPropertiesId*/, std::vector<uint32>> GlyphRequiredSpecsContainer;
typedef std::vector<ItemBonusEntry const*> ItemBonusList;
- typedef std::unordered_map<uint32 /*bonusListId*/, ItemBonusList> ItemBonusListContainer;
- typedef std::unordered_map<int16, uint32> ItemBonusListLevelDeltaContainer;
- typedef std::unordered_multimap<uint32 /*itemId*/, uint32 /*bonusTreeId*/> ItemToBonusTreeContainer;
- typedef std::unordered_map<uint32 /*itemId*/, ItemChildEquipmentEntry const*> ItemChildEquipmentContainer;
- typedef std::array<ItemClassEntry const*, 19> ItemClassByOldEnumContainer;
- typedef std::unordered_map<uint32 /*itemId | appearanceMod << 24*/, ItemModifiedAppearanceEntry const*> ItemModifiedAppearanceByItemContainer;
- typedef std::unordered_map<uint32, std::set<ItemBonusTreeNodeEntry const*>> ItemBonusTreeContainer;
- typedef std::unordered_map<uint32, std::vector<ItemSetSpellEntry const*>> ItemSetSpellContainer;
- typedef std::unordered_map<uint32, std::vector<ItemSpecOverrideEntry const*>> ItemSpecOverridesContainer;
typedef std::unordered_map<uint32, std::unordered_map<uint32, MapDifficultyEntry const*>> MapDifficultyContainer;
- typedef std::unordered_map<uint32, MountEntry const*> MountContainer;
typedef std::set<MountTypeXCapabilityEntry const*, MountTypeXCapabilityEntryComparator> MountTypeXCapabilitySet;
- typedef std::unordered_map<uint32, MountTypeXCapabilitySet> MountCapabilitiesByTypeContainer;
typedef std::vector<MountXDisplayEntry const*> MountXDisplayContainer;
- typedef std::unordered_map<uint32, MountXDisplayContainer> MountDisplaysCointainer;
- typedef std::unordered_map<uint32, std::array<std::vector<NameGenEntry const*>, 2>> NameGenContainer;
- typedef std::array<std::vector<Trinity::wregex>, TOTAL_LOCALES + 1> NameValidationRegexContainer;
- typedef std::unordered_map<uint32, std::set<uint32>> PhaseGroupContainer;
- typedef std::array<PowerTypeEntry const*, MAX_POWERS> PowerTypesContainer;
- typedef std::unordered_map<uint32, std::pair<std::vector<QuestPackageItemEntry const*>, std::vector<QuestPackageItemEntry const*>>> QuestPackageItemContainer;
- typedef std::unordered_map<uint32, uint32> RulesetItemUpgradeContainer;
- typedef std::unordered_multimap<uint32, SkillRaceClassInfoEntry const*> SkillRaceClassInfoContainer;
- typedef std::unordered_map<uint32, std::vector<SpecializationSpellsEntry const*>> SpecializationSpellsContainer;
- typedef std::unordered_map<uint32, std::vector<SpellPowerEntry const*>> SpellPowerContainer;
- typedef std::unordered_map<uint32, std::unordered_map<uint32, std::vector<SpellPowerEntry const*>>> SpellPowerDifficultyContainer;
- typedef std::unordered_map<uint32, std::vector<SpellProcsPerMinuteModEntry const*>> SpellProcsPerMinuteModContainer;
- typedef std::vector<TalentEntry const*> TalentsByPosition[MAX_CLASSES][MAX_TALENT_TIERS][MAX_TALENT_COLUMNS];
- typedef std::unordered_set<uint32> ToyItemIdsContainer;
- typedef std::tuple<int16, int8, int32> WMOAreaTableKey;
- typedef std::map<WMOAreaTableKey, WMOAreaTableEntry const*> WMOAreaTableLookupContainer;
- typedef std::unordered_map<uint32, WorldMapAreaEntry const*> WorldMapAreaByAreaIDContainer;
static DB2Manager& Instance();
@@ -304,7 +257,7 @@ public:
DB2StorageBase const* GetStorage(uint32 type) const;
void LoadHotfixData();
- std::map<int32, HotfixData> const& GetHotfixData() const { return _hotfixData; }
+ std::map<int32, HotfixData> const& GetHotfixData() const;
std::vector<uint32> GetAreasForGroup(uint32 areaGroupId) const;
std::vector<ArtifactPowerEntry const*> GetArtifactPowers(uint8 artifactId) const;
@@ -330,7 +283,7 @@ public:
std::set<uint32> GetItemBonusTree(uint32 itemId, uint32 itemBonusTreeMod) const;
ItemChildEquipmentEntry const* GetItemChildEquipment(uint32 itemId) const;
ItemClassEntry const* GetItemClassByOldEnum(uint32 itemClass) const;
- bool HasItemCurrencyCost(uint32 itemId) const { return _itemsWithCurrencyCost.count(itemId) > 0; }
+ bool HasItemCurrencyCost(uint32 itemId) const;
uint32 GetItemDisplayId(uint32 itemId, uint32 appearanceModId) const;
ItemModifiedAppearanceEntry const* GetItemModifiedAppearance(uint32 itemId, uint32 appearanceModId) const;
ItemModifiedAppearanceEntry const* GetDefaultItemModifiedAppearance(uint32 itemId) const;
@@ -339,7 +292,7 @@ public:
static LfgDungeonsEntry const* GetLfgDungeon(uint32 mapId, Difficulty difficulty);
static uint32 GetDefaultMapLight(uint32 mapId);
static uint32 GetLiquidFlags(uint32 liquidType);
- MapDifficultyContainer const& GetMapDifficulties() const { return _mapDifficulties; }
+ MapDifficultyContainer const& GetMapDifficulties() const;
MapDifficultyEntry const* GetDefaultMapDifficulty(uint32 mapId, Difficulty* difficulty = nullptr) const;
MapDifficultyEntry const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty) const;
MapDifficultyEntry const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty) const;
@@ -369,55 +322,6 @@ public:
void Zone2MapCoordinates(uint32 areaId, float& x, float& y) const;
void Map2ZoneCoordinates(uint32 areaId, float& x, float& y) const;
static void DeterminaAlternateMapPosition(uint32 mapId, float x, float y, float z, uint32* newMapId = nullptr, DBCPosition2D* newPos = nullptr);
-
-private:
- StorageMap _stores;
- std::map<int32, HotfixData> _hotfixData;
-
- AreaGroupMemberContainer _areaGroupMembers;
- ArtifactPowersContainer _artifactPowers;
- ArtifactPowerLinksContainer _artifactPowerLinks;
- ArtifactPowerRanksContainer _artifactPowerRanks;
- CharSectionsContainer _charSections;
- CharStartOutfitContainer _charStartOutfits;
- uint32 _powersByClass[MAX_CLASSES][MAX_POWERS];
- ChrSpecializationByIndexContainer _chrSpecializationsByIndex;
- ChrSpecialzationByClassContainer _defaultChrSpecializationsByClass;
- CurvePointsContainer _curvePoints;
- EmotesTextSoundContainer _emoteTextSounds;
- FactionTeamContainer _factionTeams;
- HeirloomItemsContainer _heirlooms;
- GlyphBindableSpellsContainer _glyphBindableSpells;
- GlyphRequiredSpecsContainer _glyphRequiredSpecs;
- ItemBonusListContainer _itemBonusLists;
- ItemBonusListLevelDeltaContainer _itemLevelDeltaToBonusListContainer;
- ItemBonusTreeContainer _itemBonusTrees;
- ItemChildEquipmentContainer _itemChildEquipment;
- ItemClassByOldEnumContainer _itemClassByOldEnum;
- std::unordered_set<uint32> _itemsWithCurrencyCost;
- ItemModifiedAppearanceByItemContainer _itemModifiedAppearancesByItem;
- ItemToBonusTreeContainer _itemToBonusTree;
- ItemSetSpellContainer _itemSetSpells;
- ItemSpecOverridesContainer _itemSpecOverrides;
- MapDifficultyContainer _mapDifficulties;
- MountContainer _mountsBySpellId;
- MountCapabilitiesByTypeContainer _mountCapabilitiesByType;
- MountDisplaysCointainer _mountDisplays;
- NameGenContainer _nameGenData;
- NameValidationRegexContainer _nameValidators;
- PhaseGroupContainer _phasesByGroup;
- PowerTypesContainer _powerTypes;
- QuestPackageItemContainer _questPackages;
- RulesetItemUpgradeContainer _rulesetItemUpgrade;
- SkillRaceClassInfoContainer _skillRaceClassInfoBySkill;
- SpecializationSpellsContainer _specializationSpellsBySpec;
- SpellPowerContainer _spellPowers;
- SpellPowerDifficultyContainer _spellPowerDifficulties;
- SpellProcsPerMinuteModContainer _spellProcsPerMinuteMods;
- TalentsByPosition _talentsByPosition;
- ToyItemIdsContainer _toys;
- WMOAreaTableLookupContainer _wmoAreaTableLookup;
- WorldMapAreaByAreaIDContainer _worldMapAreaByAreaID;
};
#define sDB2Manager DB2Manager::Instance()
diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h
index ec141cb062a..c0da73c4a46 100644
--- a/src/server/game/DataStores/DB2Structure.h
+++ b/src/server/game/DataStores/DB2Structure.h
@@ -18,12 +18,14 @@
#ifndef TRINITY_DB2STRUCTURE_H
#define TRINITY_DB2STRUCTURE_H
-#include "Common.h"
+#include "Define.h"
#include "DBCEnums.h"
#include "Util.h"
#pragma pack(push, 1)
+struct LocalizedString;
+
struct AchievementEntry
{
LocalizedString* Title;
diff --git a/src/server/game/DungeonFinding/LFG.cpp b/src/server/game/DungeonFinding/LFG.cpp
index 497db7fd749..b39a304d548 100644
--- a/src/server/game/DungeonFinding/LFG.cpp
+++ b/src/server/game/DungeonFinding/LFG.cpp
@@ -18,6 +18,7 @@
#include "LFG.h"
#include "Language.h"
#include "ObjectMgr.h"
+#include <sstream>
namespace lfg
{
diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h
index 09d63b6d47e..3b6e29862a1 100644
--- a/src/server/game/DungeonFinding/LFG.h
+++ b/src/server/game/DungeonFinding/LFG.h
@@ -18,9 +18,11 @@
#ifndef _LFG_H
#define _LFG_H
-#include "Common.h"
+#include "Define.h"
#include "ObjectGuid.h"
#include <map>
+#include <set>
+#include <string>
namespace lfg
{
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index ed5b286f5cd..a31c45cee52 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -15,23 +15,25 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "SharedDefines.h"
-#include "DisableMgr.h"
-#include "ObjectMgr.h"
-#include "SocialMgr.h"
#include "LFGMgr.h"
-#include "LFGScripts.h"
+#include "DatabaseEnv.h"
+#include "DisableMgr.h"
+#include "GameEventMgr.h"
+#include "Group.h"
+#include "GroupMgr.h"
+#include "InstanceSaveMgr.h"
#include "LFGGroupData.h"
#include "LFGPlayerData.h"
#include "LFGQueue.h"
-#include "Group.h"
+#include "LFGScripts.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "Player.h"
#include "RBAC.h"
-#include "GroupMgr.h"
-#include "GameEventMgr.h"
+#include "SharedDefines.h"
+#include "SocialMgr.h"
+#include "World.h"
#include "WorldSession.h"
-#include "InstanceSaveMgr.h"
namespace lfg
{
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index 04bf633c2f7..e7b18c816cd 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -18,6 +18,7 @@
#ifndef _LFGMGR_H
#define _LFGMGR_H
+#include "Common.h"
#include "Field.h"
#include "LFG.h"
#include "LFGQueue.h"
diff --git a/src/server/game/DungeonFinding/LFGQueue.h b/src/server/game/DungeonFinding/LFGQueue.h
index e24cbb80c6f..55a814ed0f9 100644
--- a/src/server/game/DungeonFinding/LFGQueue.h
+++ b/src/server/game/DungeonFinding/LFGQueue.h
@@ -19,6 +19,7 @@
#define _LFGQUEUE_H
#include "LFG.h"
+#include <list>
namespace lfg
{
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index aa8a6249cf5..91adaa4ca34 100644
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -18,11 +18,12 @@
#include "Common.h"
#include "Corpse.h"
+#include "DatabaseEnv.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "UpdateData.h"
-#include "ObjectAccessor.h"
-#include "DatabaseEnv.h"
+#include "World.h"
Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type)
{
diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h
index 2ce17d8cc82..fa6e0e34ae0 100644
--- a/src/server/game/Entities/Corpse/Corpse.h
+++ b/src/server/game/Entities/Corpse/Corpse.h
@@ -20,9 +20,9 @@
#define TRINITYCORE_CORPSE_H
#include "Object.h"
-#include "DatabaseEnv.h"
+#include "DatabaseEnvFwd.h"
#include "GridDefines.h"
-#include "LootMgr.h"
+#include "Loot.h"
enum CorpseType
{
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 827ffbffd28..2ebc31a291e 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -23,8 +23,8 @@
#include "Duration.h"
#include "Unit.h"
#include "ItemTemplate.h"
-#include "LootMgr.h"
-#include "DatabaseEnv.h"
+#include "Loot.h"
+#include "DatabaseEnvFwd.h"
#include "MapObject.h"
#include <list>
@@ -489,17 +489,6 @@ struct CreatureLocale
std::vector<std::string> TitleAlt;
};
-struct GossipMenuItemsLocale
-{
- std::vector<std::string> OptionText;
- std::vector<std::string> BoxText;
-};
-
-struct PointOfInterestLocale
-{
- std::vector<std::string> Name;
-};
-
struct EquipmentItem
{
uint32 ItemId = 0;
@@ -569,19 +558,6 @@ enum InhabitTypeValues
INHABIT_ANYWHERE = INHABIT_GROUND | INHABIT_WATER | INHABIT_AIR | INHABIT_ROOT
};
-// Enums used by StringTextData::Type (CreatureEventAI)
-enum ChatType
-{
- CHAT_TYPE_SAY = 0,
- CHAT_TYPE_YELL = 1,
- CHAT_TYPE_TEXT_EMOTE = 2,
- CHAT_TYPE_BOSS_EMOTE = 3,
- CHAT_TYPE_WHISPER = 4,
- CHAT_TYPE_BOSS_WHISPER = 5,
- CHAT_TYPE_ZONE_YELL = 6,
- CHAT_TYPE_END = 255
-};
-
#pragma pack(pop)
// `creature_addon` table
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index 860a7a20c4e..e92506f3a9a 100644
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -16,11 +16,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Creature.h"
#include "CreatureGroups.h"
-#include "ObjectMgr.h"
-
+#include "Creature.h"
#include "CreatureAI.h"
+#include "DatabaseEnv.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#define MAX_DESYNC 5.0f
diff --git a/src/server/game/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h
index 1bfe3f70a92..c4746f181c6 100644
--- a/src/server/game/Entities/Creature/CreatureGroups.h
+++ b/src/server/game/Entities/Creature/CreatureGroups.h
@@ -20,11 +20,13 @@
#define _FORMATIONS_H
#include "Define.h"
+#include "ObjectGuid.h"
#include <unordered_map>
#include <map>
class Creature;
class CreatureGroup;
+class Unit;
struct FormationInfo
{
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 2c2d7699706..26b0509f13f 100644
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -16,13 +16,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "QuestDef.h"
#include "GossipDef.h"
-#include "ObjectMgr.h"
-#include "WorldSession.h"
#include "Formulas.h"
-#include "QuestPackets.h"
+#include "Log.h"
#include "NPCPackets.h"
+#include "ObjectMgr.h"
+#include "QuestDef.h"
+#include "QuestPackets.h"
+#include "WorldSession.h"
GossipMenu::GossipMenu()
{
diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h
index dbc9884b3d7..222443188fa 100644
--- a/src/server/game/Entities/Creature/GossipDef.h
+++ b/src/server/game/Entities/Creature/GossipDef.h
@@ -23,6 +23,7 @@
#include "ObjectGuid.h"
#include "QuestDef.h"
#include "NPCHandler.h"
+#include <map>
class WorldSession;
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
index bd2ce99c264..3a2708e80fe 100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
@@ -17,14 +17,13 @@
*/
#include "Common.h"
-#include "Opcodes.h"
-#include "World.h"
-#include "ObjectAccessor.h"
-#include "DatabaseEnv.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
#include "ScriptMgr.h"
#include "Transport.h"
+#include "World.h"
DynamicObject::DynamicObject(bool isWorldObject) : WorldObject(isWorldObject),
_aura(NULL), _removedAura(NULL), _caster(NULL), _duration(0), _spellXSpellVisualId(0), _isViewpoint(false)
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index dc749949fe9..9ecc85478b2 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -16,25 +16,29 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "GameObjectAI.h"
+#include "GameObject.h"
+#include "ArtifactPackets.h"
#include "Battleground.h"
#include "CellImpl.h"
#include "CreatureAISelector.h"
+#include "DatabaseEnv.h"
+#include "GameObjectAI.h"
#include "GameObjectModel.h"
#include "GameObjectPackets.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "GroupMgr.h"
-#include "ArtifactPackets.h"
+#include "Log.h"
+#include "LootMgr.h"
#include "MiscPackets.h"
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
#include "PoolMgr.h"
#include "ScriptMgr.h"
#include "SpellMgr.h"
+#include "Transport.h"
#include "UpdateFieldFlags.h"
#include "World.h"
-#include "Transport.h"
GameObject::GameObject() : WorldObject(false), MapObject(),
m_model(nullptr), m_goValue(), m_AI(nullptr), _animKitId(0)
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 3a24e704ad3..e5951dec833 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -23,8 +23,8 @@
#include "SharedDefines.h"
#include "Unit.h"
#include "Object.h"
-#include "LootMgr.h"
-#include "DatabaseEnv.h"
+#include "Loot.h"
+#include "DatabaseEnvFwd.h"
#include "MapObject.h"
#include <G3D/Quat.h>
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 6c97161ba3a..fd671d7386b 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -16,25 +16,27 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
#include "Item.h"
-#include "ObjectMgr.h"
-#include "WorldPacket.h"
+#include "ArtifactPackets.h"
+#include "CollectionMgr.h"
+#include "Common.h"
+#include "ConditionMgr.h"
#include "DatabaseEnv.h"
+#include "GameTables.h"
#include "ItemEnchantmentMgr.h"
-#include "SpellMgr.h"
-#include "SpellInfo.h"
-#include "ScriptMgr.h"
-#include "ConditionMgr.h"
-#include "Player.h"
-#include "Opcodes.h"
-#include "WorldSession.h"
#include "ItemPackets.h"
+#include "Log.h"
+#include "LootMgr.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
#include "TradeData.h"
-#include "GameTables.h"
-#include "CollectionMgr.h"
-#include "ArtifactPackets.h"
#include "UpdateData.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
void AddItemsSetItem(Player* player, Item* item)
{
@@ -898,31 +900,6 @@ uint32 Item::GetSkill()
return proto->GetSkill();
}
-ItemRandomEnchantmentId Item::GenerateItemRandomPropertyId(uint32 item_id)
-{
- ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id);
- if (!itemProto)
- return{};
-
- // item must have one from this field values not null if it can have random enchantments
- if (!itemProto->GetRandomProperty() && !itemProto->GetRandomSuffix())
- return{};
-
- // item can have not null only one from field values
- if (itemProto->GetRandomProperty() && itemProto->GetRandomSuffix())
- {
- TC_LOG_ERROR("sql.sql", "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->GetId(), itemProto->GetRandomProperty(), itemProto->GetRandomSuffix());
- return{};
- }
-
- // RandomProperty case
- if (itemProto->GetRandomProperty())
- return GetItemEnchantMod(itemProto->GetRandomProperty(), ItemRandomEnchantmentType::Property);
- // RandomSuffix case
- else
- return GetItemEnchantMod(itemProto->GetRandomSuffix(), ItemRandomEnchantmentType::Suffix);
-}
-
void Item::SetItemRandomProperties(ItemRandomEnchantmentId const& randomPropId)
{
if (!randomPropId.Id)
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index bd78aaf1e06..91b55982f56 100644
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -21,10 +21,11 @@
#include "Common.h"
#include "Object.h"
-#include "LootMgr.h"
+#include "Loot.h"
#include "ItemEnchantmentMgr.h"
#include "ItemTemplate.h"
-#include "DatabaseEnv.h"
+#include "DatabaseEnvFwd.h"
+#include <unordered_set>
class SpellInfo;
class Bag;
@@ -404,7 +405,6 @@ class TC_GAME_API Item : public Object
uint32 GetItemSuffixFactor() const { return GetUInt32Value(ITEM_FIELD_PROPERTY_SEED); }
void SetItemRandomProperties(ItemRandomEnchantmentId const& randomPropId);
void UpdateItemSuffixFactor();
- static ItemRandomEnchantmentId GenerateItemRandomPropertyId(uint32 item_id);
ItemRandomEnchantmentId GetItemRandomEnchantmentId() const { return m_randomEnchantment; }
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster = ObjectGuid::Empty);
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner);
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index a9bef8e415f..92e6bd8097d 100644
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -19,10 +19,13 @@
#include "ItemEnchantmentMgr.h"
#include "Containers.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
+#include "ItemTemplate.h"
#include "Log.h"
#include "ObjectMgr.h"
-#include "Util.h"
#include "Random.h"
+#include "Timer.h"
+#include "Util.h"
#include <list>
#include <vector>
@@ -158,6 +161,31 @@ ItemRandomEnchantmentId GetItemEnchantMod(int32 entry, ItemRandomEnchantmentType
return{ selectedItr->type, selectedItr->ench };
}
+ItemRandomEnchantmentId GenerateItemRandomPropertyId(uint32 item_id)
+{
+ ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id);
+ if (!itemProto)
+ return{};
+
+ // item must have one from this field values not null if it can have random enchantments
+ if (!itemProto->GetRandomProperty() && !itemProto->GetRandomSuffix())
+ return{};
+
+ // item can have not null only one from field values
+ if (itemProto->GetRandomProperty() && itemProto->GetRandomSuffix())
+ {
+ TC_LOG_ERROR("sql.sql", "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->GetId(), itemProto->GetRandomProperty(), itemProto->GetRandomSuffix());
+ return{};
+ }
+
+ // RandomProperty case
+ if (itemProto->GetRandomProperty())
+ return GetItemEnchantMod(itemProto->GetRandomProperty(), ItemRandomEnchantmentType::Property);
+ // RandomSuffix case
+ else
+ return GetItemEnchantMod(itemProto->GetRandomSuffix(), ItemRandomEnchantmentType::Suffix);
+}
+
uint32 GenerateEnchSuffixFactor(uint32 item_id)
{
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id);
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.h b/src/server/game/Entities/Item/ItemEnchantmentMgr.h
index e2f0785ccd4..24b4b2284ac 100644
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.h
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.h
@@ -38,7 +38,7 @@ struct ItemRandomEnchantmentId
};
TC_GAME_API void LoadRandomEnchantmentsTable();
-TC_GAME_API ItemRandomEnchantmentId GetItemEnchantMod(int32 entry, ItemRandomEnchantmentType type);
+TC_GAME_API ItemRandomEnchantmentId GenerateItemRandomPropertyId(uint32 item_id);
TC_GAME_API uint32 GenerateEnchSuffixFactor(uint32 item_id);
TC_GAME_API uint32 GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subclass);
diff --git a/src/server/game/Entities/Item/ItemTemplate.h b/src/server/game/Entities/Item/ItemTemplate.h
index 71cb552f752..c40cb3791db 100644
--- a/src/server/game/Entities/Item/ItemTemplate.h
+++ b/src/server/game/Entities/Item/ItemTemplate.h
@@ -19,9 +19,12 @@
#ifndef _ITEMPROTOTYPE_H
#define _ITEMPROTOTYPE_H
+#include "Common.h"
#include "DB2Structure.h"
#include "SharedDefines.h"
#include <bitset>
+#include <unordered_map>
+#include <vector>
enum ItemModType
{
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index c59ae332c9e..a97451b1c05 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -127,7 +127,6 @@ void Object::_Create(ObjectGuid const& guid)
SetGuidValue(OBJECT_FIELD_GUID, guid);
SetUInt16Value(OBJECT_FIELD_TYPE, 0, m_objectType);
- m_PackGUID.Set(guid);
}
std::string Object::_ConcatFields(uint16 startIndex, uint16 size) const
@@ -239,7 +238,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
ByteBuffer buf(0x400);
buf << uint8(updateType);
- buf << GetPackGUID();
+ buf << GetGUID();
buf << uint8(m_objectTypeId);
BuildMovementUpdate(&buf, flags);
@@ -267,7 +266,7 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) c
ByteBuffer buf(500);
buf << uint8(UPDATETYPE_VALUES);
- buf << GetPackGUID();
+ buf << GetGUID();
BuildValuesUpdate(UPDATETYPE_VALUES, &buf, target);
BuildDynamicValuesUpdate(UPDATETYPE_VALUES, &buf, target);
@@ -385,7 +384,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const
bool HasFall = HasFallDirection || unit->m_movementInfo.jump.fallTime != 0;
bool HasSpline = unit->IsSplineEnabled();
- *data << GetPackGUID(); // MoverGUID
+ *data << GetGUID(); // MoverGUID
*data << uint32(unit->m_movementInfo.time); // MoveTime
*data << float(unit->GetPositionX());
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index bc332f74ce9..3030364ed2f 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -25,6 +25,7 @@
#include "ObjectGuid.h"
#include "Position.h"
#include "SharedDefines.h"
+
#include "UpdateFields.h"
#include <list>
#include <set>
@@ -170,7 +171,6 @@ class TC_GAME_API Object
virtual void RemoveFromWorld();
ObjectGuid const& GetGUID() const { return GetGuidValue(OBJECT_FIELD_GUID); }
- PackedGuid const& GetPackGUID() const { return m_PackGUID; }
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
@@ -373,8 +373,6 @@ class TC_GAME_API Object
private:
bool m_inWorld;
- PackedGuid m_PackGUID;
-
// for output helpfull error messages from asserts
bool PrintIndexError(uint32 index, bool set) const;
Object(Object const& right) = delete;
diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp
index a353a8a2afd..a3a1b235c3b 100644
--- a/src/server/game/Entities/Object/ObjectGuid.cpp
+++ b/src/server/game/Entities/Object/ObjectGuid.cpp
@@ -17,9 +17,11 @@
*/
#include "ObjectGuid.h"
+#include "ByteBuffer.h"
#include "Errors.h"
#include "Hash.h"
#include "Log.h"
+#include "Realm.h"
#include "World.h"
#include <sstream>
#include <iomanip>
@@ -148,10 +150,16 @@ void ObjectGuid::SetRawValue(std::vector<uint8> const& guid)
memcpy(this, guid.data(), sizeof(*this));
}
-void PackedGuid::Set(ObjectGuid const& guid)
+uint8& ObjectGuid::operator[](uint32 index)
{
- _packedGuid.clear();
- _packedGuid << guid;
+ ASSERT(index < sizeof(uint64) * 2);
+ return ((uint8*)&_low)[index];
+}
+
+uint8 const& ObjectGuid::operator[](uint32 index) const
+{
+ ASSERT(index < sizeof(uint64) * 2);
+ return ((uint8 const*)&_low)[index];
}
ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid)
@@ -184,12 +192,6 @@ ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid)
return buf;
}
-ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid)
-{
- buf.append(guid._packedGuid);
- return buf;
-}
-
std::ostream& operator<<(std::ostream& stream, ObjectGuid const& guid)
{
std::ostringstream tmp;
diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h
index bcb029b2deb..131f911f77d 100644
--- a/src/server/game/Entities/Object/ObjectGuid.h
+++ b/src/server/game/Entities/Object/ObjectGuid.h
@@ -19,14 +19,14 @@
#ifndef ObjectGuid_h__
#define ObjectGuid_h__
-#include "ByteBuffer.h"
+#include "Define.h"
#include <deque>
#include <functional>
#include <list>
#include <set>
#include <type_traits>
-#include <unordered_set>
#include <vector>
+#include <unordered_set>
enum TypeID
{
@@ -199,8 +199,7 @@ struct ObjectGuidTraits<HighGuid::Transport>
static bool const MapSpecific = true;
};
-class ObjectGuid;
-class PackedGuid;
+class ByteBuffer;
#pragma pack(push, 1)
@@ -248,19 +247,8 @@ class TC_GAME_API ObjectGuid
LowType GetMaxCounter() const { return GetMaxCounter(GetHigh()); }
- // deprecated
- uint8& operator[](uint32 index)
- {
- //ASSERT(index < sizeof(uint64) * 2);
- return ((uint8*)&_low)[index];
- }
-
- // deprecated
- uint8 const& operator[](uint32 index) const
- {
- //ASSERT(index < sizeof(uint64) * 2);
- return ((uint8 const*)&_low)[index];
- }
+ uint8& operator[](uint32 index);
+ uint8 const& operator[](uint32 index) const;
bool IsEmpty() const { return _low == 0 && _high == 0; }
bool IsCreature() const { return GetHigh() == HighGuid::Creature; }
@@ -360,25 +348,6 @@ typedef std::deque<ObjectGuid> GuidDeque;
typedef std::vector<ObjectGuid> GuidVector;
typedef std::unordered_set<ObjectGuid> GuidUnorderedSet;
-// maximum buffer size for packed guid is 18 bytes
-#define PACKED_GUID_MIN_BUFFER_SIZE 18
-
-class TC_GAME_API PackedGuid
-{
- friend TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid);
-
- public:
- explicit PackedGuid() : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { _packedGuid << uint16(0); }
- explicit PackedGuid(ObjectGuid const& guid) : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { Set(guid); }
-
- void Set(ObjectGuid const& guid);
-
- size_t size() const { return _packedGuid.size(); }
-
- private:
- ByteBuffer _packedGuid;
-};
-
class TC_GAME_API ObjectGuidGeneratorBase
{
public:
@@ -410,8 +379,6 @@ public:
TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid);
TC_GAME_API ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid);
-TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid);
-
TC_GAME_API std::ostream& operator<<(std::ostream& stream, ObjectGuid const& guid);
namespace std
diff --git a/src/server/game/Entities/Object/Position.cpp b/src/server/game/Entities/Object/Position.cpp
index 63120fff443..74ead0a6f8e 100644
--- a/src/server/game/Entities/Object/Position.cpp
+++ b/src/server/game/Entities/Object/Position.cpp
@@ -21,6 +21,7 @@
#include "Random.h"
#include <G3D/g3dmath.h>
+#include <sstream>
bool Position::operator==(Position const &a)
{
@@ -43,6 +44,26 @@ bool Position::IsPositionValid() const
return Trinity::IsValidMapCoord(m_positionX, m_positionY, m_positionZ, m_orientation);
}
+float Position::GetExactDist2d(const float x, const float y) const
+{
+ return std::sqrt(GetExactDist2dSq(x, y));
+}
+
+float Position::GetExactDist2d(Position const* pos) const
+{
+ return std::sqrt(GetExactDist2dSq(pos));
+}
+
+float Position::GetExactDist(float x, float y, float z) const
+{
+ return std::sqrt(GetExactDistSq(x, y, z));
+}
+
+float Position::GetExactDist(Position const* pos) const
+{
+ return std::sqrt(GetExactDistSq(pos));
+}
+
void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset) const
{
float dx = endPos.GetPositionX() - GetPositionX();
@@ -165,6 +186,20 @@ std::string Position::ToString() const
return sstr.str();
}
+float Position::NormalizeOrientation(float o)
+{
+ // fmod only supports positive numbers. Thus we have
+ // to emulate negative numbers
+ if (o < 0)
+ {
+ float mod = o *-1;
+ mod = std::fmod(mod, 2.0f * static_cast<float>(M_PI));
+ mod = -mod + 2.0f * static_cast<float>(M_PI);
+ return mod;
+ }
+ return std::fmod(o, 2.0f * static_cast<float>(M_PI));
+}
+
ByteBuffer& operator<<(ByteBuffer& buf, Position::ConstStreamer<Position::XY> const& streamer)
{
buf << streamer.Pos->GetPositionX();
diff --git a/src/server/game/Entities/Object/Position.h b/src/server/game/Entities/Object/Position.h
index 381f970a014..f045eb93824 100644
--- a/src/server/game/Entities/Object/Position.h
+++ b/src/server/game/Entities/Object/Position.h
@@ -18,7 +18,8 @@
#ifndef Trinity_game_Position_h__
#define Trinity_game_Position_h__
-#include "Common.h"
+#include "Define.h"
+#include <string>
#include <cmath>
class ByteBuffer;
@@ -136,10 +137,7 @@ public:
float dx = m_positionX - x; float dy = m_positionY - y; return dx*dx + dy*dy;
}
- float GetExactDist2d(const float x, const float y) const
- {
- return std::sqrt(GetExactDist2dSq(x, y));
- }
+ float GetExactDist2d(const float x, const float y) const;
float GetExactDist2dSq(Position const& pos) const
{
@@ -156,20 +154,14 @@ public:
float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; return dx*dx + dy*dy;
}
- float GetExactDist2d(Position const* pos) const
- {
- return std::sqrt(GetExactDist2dSq(pos));
- }
+ float GetExactDist2d(Position const* pos) const;
float GetExactDistSq(float x, float y, float z) const
{
float dz = m_positionZ - z; return GetExactDist2dSq(x, y) + dz*dz;
}
- float GetExactDist(float x, float y, float z) const
- {
- return std::sqrt(GetExactDistSq(x, y, z));
- }
+ float GetExactDist(float x, float y, float z) const;
float GetExactDistSq(Position const& pos) const
{
@@ -186,10 +178,7 @@ public:
float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; float dz = m_positionZ - pos->m_positionZ; return dx*dx + dy*dy + dz*dz;
}
- float GetExactDist(Position const* pos) const
- {
- return std::sqrt(GetExactDistSq(pos));
- }
+ float GetExactDist(Position const* pos) const;
void GetPositionOffsetTo(Position const & endPos, Position & retOffset) const;
Position GetPositionWithOffset(Position const& offset) const;
@@ -234,19 +223,7 @@ public:
std::string ToString() const;
// modulos a radian orientation to the range of 0..2PI
- static float NormalizeOrientation(float o)
- {
- // fmod only supports positive numbers. Thus we have
- // to emulate negative numbers
- if (o < 0)
- {
- float mod = o *-1;
- mod = std::fmod(mod, 2.0f * static_cast<float>(M_PI));
- mod = -mod + 2.0f * static_cast<float>(M_PI);
- return mod;
- }
- return std::fmod(o, 2.0f * static_cast<float>(M_PI));
- }
+ static float NormalizeOrientation(float o);
};
#define MAPID_INVALID 0xFFFFFFFF
diff --git a/src/server/game/Entities/Object/Updates/UpdateData.cpp b/src/server/game/Entities/Object/Updates/UpdateData.cpp
index 7a59f1cf236..1358d7a8568 100644
--- a/src/server/game/Entities/Object/Updates/UpdateData.cpp
+++ b/src/server/game/Entities/Object/Updates/UpdateData.cpp
@@ -16,11 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "ByteBuffer.h"
+#include "UpdateData.h"
#include "Errors.h"
#include "WorldPacket.h"
-#include "UpdateData.h"
#include "Opcodes.h"
UpdateData::UpdateData(uint32 map) : m_map(map), m_blockCount(0) { }
diff --git a/src/server/game/Entities/Object/Updates/UpdateData.h b/src/server/game/Entities/Object/Updates/UpdateData.h
index 7e7d86590d9..ca3bdcd4cce 100644
--- a/src/server/game/Entities/Object/Updates/UpdateData.h
+++ b/src/server/game/Entities/Object/Updates/UpdateData.h
@@ -19,6 +19,7 @@
#ifndef __UPDATEDATA_H
#define __UPDATEDATA_H
+#include "Define.h"
#include "ByteBuffer.h"
#include "ObjectGuid.h"
#include <set>
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 304d7a1bbad..63ca784c2ff 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -16,22 +16,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Pet.h"
#include "Common.h"
#include "DatabaseEnv.h"
+#include "Group.h"
#include "Log.h"
-#include "WorldPacket.h"
-#include "SpellPackets.h"
#include "ObjectMgr.h"
-#include "SpellMgr.h"
-#include "Pet.h"
+#include "Opcodes.h"
#include "PetPackets.h"
-#include "SpellAuras.h"
#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
#include "SpellHistory.h"
+#include "SpellMgr.h"
+#include "SpellPackets.h"
#include "Unit.h"
#include "Util.h"
-#include "Group.h"
-#include "Opcodes.h"
+#include "World.h"
+#include "WorldPacket.h"
#include "WorldSession.h"
#define PET_XP_FACTOR 0.05f
diff --git a/src/server/game/Entities/Player/CUFProfile.h b/src/server/game/Entities/Player/CUFProfile.h
new file mode 100644
index 00000000000..c1ac073f611
--- /dev/null
+++ b/src/server/game/Entities/Player/CUFProfile.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * 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 CUFProfile_h__
+#define CUFProfile_h__
+
+#include "Define.h"
+#include <bitset>
+#include <string>
+
+/// Maximum number of CompactUnitFrames profiles
+#define MAX_CUF_PROFILES 5
+
+/// Bit index used in the many bool options of CompactUnitFrames
+enum CUFBoolOptions
+{
+ CUF_KEEP_GROUPS_TOGETHER,
+ CUF_DISPLAY_PETS,
+ CUF_DISPLAY_MAIN_TANK_AND_ASSIST,
+ CUF_DISPLAY_HEAL_PREDICTION,
+ CUF_DISPLAY_AGGRO_HIGHLIGHT,
+ CUF_DISPLAY_ONLY_DISPELLABLE_DEBUFFS,
+ CUF_DISPLAY_POWER_BAR,
+ CUF_DISPLAY_BORDER,
+ CUF_USE_CLASS_COLORS,
+ CUF_DISPLAY_HORIZONTAL_GROUPS,
+ CUF_DISPLAY_NON_BOSS_DEBUFFS,
+ CUF_DYNAMIC_POSITION,
+ CUF_LOCKED,
+ CUF_SHOWN,
+ CUF_AUTO_ACTIVATE_2_PLAYERS,
+ CUF_AUTO_ACTIVATE_3_PLAYERS,
+ CUF_AUTO_ACTIVATE_5_PLAYERS,
+ CUF_AUTO_ACTIVATE_10_PLAYERS,
+ CUF_AUTO_ACTIVATE_15_PLAYERS,
+ CUF_AUTO_ACTIVATE_25_PLAYERS,
+ CUF_AUTO_ACTIVATE_40_PLAYERS,
+ CUF_AUTO_ACTIVATE_SPEC_1,
+ CUF_AUTO_ACTIVATE_SPEC_2,
+ CUF_AUTO_ACTIVATE_SPEC_3,
+ CUF_AUTO_ACTIVATE_SPEC_4,
+ CUF_AUTO_ACTIVATE_PVP,
+ CUF_AUTO_ACTIVATE_PVE,
+
+ CUF_BOOL_OPTIONS_COUNT,
+};
+
+/// Represents a CompactUnitFrame profile
+struct CUFProfile
+{
+ CUFProfile() : ProfileName(), BoolOptions() // might want to change default value for options
+ {
+ FrameHeight = 0;
+ FrameWidth = 0;
+ SortBy = 0;
+ HealthText = 0;
+ TopPoint = 0;
+ BottomPoint = 0;
+ LeftPoint = 0;
+ TopOffset = 0;
+ BottomOffset = 0;
+ LeftOffset = 0;
+ }
+
+ CUFProfile(std::string const& name, uint16 frameHeight, uint16 frameWidth, uint8 sortBy, uint8 healthText, uint32 boolOptions,
+ uint8 topPoint, uint8 bottomPoint, uint8 leftPoint, uint16 topOffset, uint16 bottomOffset, uint16 leftOffset)
+ : ProfileName(name), BoolOptions(int(boolOptions))
+ {
+ FrameHeight = frameHeight;
+ FrameWidth = frameWidth;
+ SortBy = sortBy;
+ HealthText = healthText;
+ TopPoint = topPoint;
+ BottomPoint = bottomPoint;
+ LeftPoint = leftPoint;
+ TopOffset = topOffset;
+ BottomOffset = bottomOffset;
+ LeftOffset = leftOffset;
+ }
+
+ std::string ProfileName;
+ uint16 FrameHeight;
+ uint16 FrameWidth;
+ uint8 SortBy;
+ uint8 HealthText;
+
+ // LeftAlign, TopAlight, BottomAlign
+ uint8 TopPoint;
+ uint8 BottomPoint;
+ uint8 LeftPoint;
+
+ // LeftOffset, TopOffset and BottomOffset
+ uint16 TopOffset;
+ uint16 BottomOffset;
+ uint16 LeftOffset;
+
+ std::bitset<CUF_BOOL_OPTIONS_COUNT> BoolOptions;
+
+ // More fields can be added to BoolOptions without changing DB schema (up to 32, currently 27)
+};
+
+#endif // CUFProfile_h__
diff --git a/src/server/game/Entities/Player/CollectionMgr.cpp b/src/server/game/Entities/Player/CollectionMgr.cpp
index a4c8c179cf3..f52408f1c4b 100644
--- a/src/server/game/Entities/Player/CollectionMgr.cpp
+++ b/src/server/game/Entities/Player/CollectionMgr.cpp
@@ -16,10 +16,17 @@
*/
#include "CollectionMgr.h"
+#include "DatabaseEnv.h"
+#include "DB2Stores.h"
+#include "Item.h"
+#include "Log.h"
#include "MiscPackets.h"
#include "ObjectMgr.h"
#include "Player.h"
+#include "Timer.h"
#include "TransmogrificationPackets.h"
+#include "WorldSession.h"
+#include <boost/dynamic_bitset.hpp>
namespace
{
@@ -63,7 +70,11 @@ void CollectionMgr::LoadMountDefinitions()
TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " mount definitions in %u ms", FactionSpecificMounts.size(), GetMSTimeDiffToNow(oldMSTime));
}
-CollectionMgr::CollectionMgr(WorldSession* owner) : _owner(owner), _appearances()
+CollectionMgr::CollectionMgr(WorldSession* owner) : _owner(owner), _appearances(Trinity::make_unique<boost::dynamic_bitset<uint32>>())
+{
+}
+
+CollectionMgr::~CollectionMgr()
{
}
@@ -438,7 +449,7 @@ private:
void CollectionMgr::LoadItemAppearances()
{
- boost::to_block_range(_appearances, DynamicBitsetBlockOutputIterator([this](uint32 blockValue)
+ boost::to_block_range(*_appearances, DynamicBitsetBlockOutputIterator([this](uint32 blockValue)
{
_owner->GetPlayer()->AddDynamicValue(PLAYER_DYNAMIC_FIELD_TRANSMOG, blockValue);
}));
@@ -463,7 +474,7 @@ void CollectionMgr::LoadAccountItemAppearances(PreparedQueryResult knownAppearan
} while (knownAppearances->NextRow());
- _appearances.init_from_block_range(blocks.begin(), blocks.end());
+ _appearances->init_from_block_range(blocks.begin(), blocks.end());
}
if (favoriteAppearances)
@@ -489,17 +500,17 @@ void CollectionMgr::LoadAccountItemAppearances(PreparedQueryResult knownAppearan
{
ItemModifiedAppearanceEntry const* hiddenAppearance = sDB2Manager.GetItemModifiedAppearance(hiddenItem, 0);
ASSERT(hiddenAppearance);
- if (_appearances.size() <= hiddenAppearance->ID)
- _appearances.resize(hiddenAppearance->ID + 1);
+ if (_appearances->size() <= hiddenAppearance->ID)
+ _appearances->resize(hiddenAppearance->ID + 1);
- _appearances.set(hiddenAppearance->ID);
+ _appearances->set(hiddenAppearance->ID);
}
}
void CollectionMgr::SaveAccountItemAppearances(SQLTransaction& trans)
{
uint16 blockIndex = 0;
- boost::to_block_range(_appearances, DynamicBitsetBlockOutputIterator([this, &blockIndex, trans](uint32 blockValue)
+ boost::to_block_range(*_appearances, DynamicBitsetBlockOutputIterator([this, &blockIndex, trans](uint32 blockValue)
{
if (blockValue) // this table is only appended/bits are set (never cleared) so don't save empty blocks
{
@@ -657,7 +668,7 @@ bool CollectionMgr::CanAddAppearance(ItemModifiedAppearanceEntry const* itemModi
if (!(itemTemplate->GetFlags2() & ITEM_FLAG2_IGNORE_QUALITY_FOR_ITEM_VISUAL_SOURCE) || !(itemTemplate->GetFlags3() & ITEM_FLAG3_ACTS_AS_TRANSMOG_HIDDEN_VISUAL_OPTION))
return false;
- if (itemModifiedAppearance->ID < _appearances.size() && _appearances.test(itemModifiedAppearance->ID))
+ if (itemModifiedAppearance->ID < _appearances->size() && _appearances->test(itemModifiedAppearance->ID))
return false;
return true;
@@ -665,16 +676,16 @@ bool CollectionMgr::CanAddAppearance(ItemModifiedAppearanceEntry const* itemModi
void CollectionMgr::AddItemAppearance(ItemModifiedAppearanceEntry const* itemModifiedAppearance)
{
- if (_appearances.size() <= itemModifiedAppearance->ID)
+ if (_appearances->size() <= itemModifiedAppearance->ID)
{
- std::size_t numBlocks = _appearances.num_blocks();
- _appearances.resize(itemModifiedAppearance->ID + 1);
- numBlocks = _appearances.num_blocks() - numBlocks;
+ std::size_t numBlocks = _appearances->num_blocks();
+ _appearances->resize(itemModifiedAppearance->ID + 1);
+ numBlocks = _appearances->num_blocks() - numBlocks;
while (numBlocks--)
_owner->GetPlayer()->AddDynamicValue(PLAYER_DYNAMIC_FIELD_TRANSMOG, 0);
}
- _appearances.set(itemModifiedAppearance->ID);
+ _appearances->set(itemModifiedAppearance->ID);
uint32 blockIndex = itemModifiedAppearance->ID / 32;
uint32 bitIndex = itemModifiedAppearance->ID % 32;
uint32 currentMask = _owner->GetPlayer()->GetDynamicValue(PLAYER_DYNAMIC_FIELD_TRANSMOG, blockIndex);
@@ -716,7 +727,7 @@ void CollectionMgr::RemoveTemporaryAppearance(Item* item)
std::pair<bool, bool> CollectionMgr::HasItemAppearance(uint32 itemModifiedAppearanceId) const
{
- if (itemModifiedAppearanceId < _appearances.size() && _appearances.test(itemModifiedAppearanceId))
+ if (itemModifiedAppearanceId < _appearances->size() && _appearances->test(itemModifiedAppearanceId))
return{ true, false };
if (_temporaryAppearances.find(itemModifiedAppearanceId) != _temporaryAppearances.end())
diff --git a/src/server/game/Entities/Player/CollectionMgr.h b/src/server/game/Entities/Player/CollectionMgr.h
index 5b96396f5e6..5150ea3963a 100644
--- a/src/server/game/Entities/Player/CollectionMgr.h
+++ b/src/server/game/Entities/Player/CollectionMgr.h
@@ -18,9 +18,16 @@
#ifndef CollectionMgr_h__
#define CollectionMgr_h__
-#include "WorldSession.h"
-#include <boost/dynamic_bitset.hpp>
-
+#include "Define.h"
+#include "DatabaseEnvFwd.h"
+#include "ObjectGuid.h"
+#include <boost/dynamic_bitset_fwd.hpp>
+#include <map>
+#include <unordered_map>
+#include <unordered_set>
+
+class Item;
+class WorldSession;
struct ItemModifiedAppearanceEntry;
enum HeirloomPlayerFlags
@@ -62,6 +69,7 @@ class TC_GAME_API CollectionMgr
{
public:
explicit CollectionMgr(WorldSession* owner);
+ ~CollectionMgr();
static void LoadMountDefinitions();
@@ -132,7 +140,7 @@ private:
ToyBoxContainer _toys;
HeirloomContainer _heirlooms;
MountContainer _mounts;
- boost::dynamic_bitset<uint32> _appearances;
+ std::unique_ptr<boost::dynamic_bitset<uint32>> _appearances;
std::unordered_map<uint32, std::unordered_set<ObjectGuid>> _temporaryAppearances;
std::unordered_map<uint32, FavoriteAppearanceState> _favoriteAppearances;
};
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index ef23b8b4495..443c1aefc82 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -28,6 +28,7 @@
#include "BattlefieldWG.h"
#include "Battleground.h"
#include "BattlegroundMgr.h"
+#include "BattlegroundPackets.h"
#include "BattlegroundScore.h"
#include "BattlePetMgr.h"
#include "CellImpl.h"
@@ -68,6 +69,7 @@
#include "LFGMgr.h"
#include "Language.h"
#include "Log.h"
+#include "LootMgr.h"
#include "LootPackets.h"
#include "MailPackets.h"
#include "MapManager.h"
@@ -83,6 +85,7 @@
#include "QueryHolder.h"
#include "QuestDef.h"
#include "QuestPackets.h"
+#include "Realm.h"
#include "ReputationMgr.h"
#include "Scenario.h"
#include "SkillDiscovery.h"
@@ -724,7 +727,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
InventoryResult msg = CanStoreNewItem(INVENTORY_SLOT_BAG_0, NULL_SLOT, sDest, titem_id, titem_amount);
if (msg == EQUIP_ERR_OK)
{
- StoreNewItem(sDest, titem_id, true, Item::GenerateItemRandomPropertyId(titem_id));
+ StoreNewItem(sDest, titem_id, true, GenerateItemRandomPropertyId(titem_id));
return true; // stored
}
@@ -15073,7 +15076,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
ItemPosCountVec dest;
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, reward, quest->RewardChoiceItemCount[i]) == EQUIP_ERR_OK)
{
- Item* item = StoreNewItem(dest, reward, true, Item::GenerateItemRandomPropertyId(reward));
+ Item* item = StoreNewItem(dest, reward, true, GenerateItemRandomPropertyId(reward));
SendNewItem(item, quest->RewardChoiceItemCount[i], true, false);
}
}
@@ -15097,7 +15100,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
ItemPosCountVec dest;
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, questPackageItem->ItemID, questPackageItem->ItemCount) == EQUIP_ERR_OK)
{
- Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, Item::GenerateItemRandomPropertyId(questPackageItem->ItemID));
+ Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, GenerateItemRandomPropertyId(questPackageItem->ItemID));
SendNewItem(item, questPackageItem->ItemCount, true, false);
}
}
@@ -15116,7 +15119,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
ItemPosCountVec dest;
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, questPackageItem->ItemID, questPackageItem->ItemCount) == EQUIP_ERR_OK)
{
- Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, Item::GenerateItemRandomPropertyId(questPackageItem->ItemID));
+ Item* item = StoreNewItem(dest, questPackageItem->ItemID, true, GenerateItemRandomPropertyId(questPackageItem->ItemID));
SendNewItem(item, questPackageItem->ItemCount, true, false);
}
}
@@ -15133,7 +15136,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
ItemPosCountVec dest;
if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardItemCount[i]) == EQUIP_ERR_OK)
{
- Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
+ Item* item = StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId));
SendNewItem(item, quest->RewardItemCount[i], true, false);
}
else if (quest->IsDFQuest())
@@ -22124,7 +22127,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
}
Item* it = bStore ?
- StoreNewItem(vDest, item, true, Item::GenerateItemRandomPropertyId(item), {}, 0, {}, false) :
+ StoreNewItem(vDest, item, true, GenerateItemRandomPropertyId(item), {}, 0, {}, false) :
EquipNewItem(uiDest, item, true);
if (it)
{
@@ -26615,7 +26618,7 @@ bool Player::AddItem(uint32 itemId, uint32 count)
return false;
}
- Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
+ Item* item = StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId));
if (item)
SendNewItem(item, count, true, false);
else
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index f6f7e75ca99..6dcb1f99900 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -22,7 +22,7 @@
#include "DB2Stores.h"
#include "GroupReference.h"
#include "MapReference.h"
-
+#include "CUFProfile.h"
#include "Item.h"
#include "PetDefines.h"
#include "QuestDef.h"
@@ -34,7 +34,9 @@
#include "TradeData.h"
#include "CinematicMgr.h"
#include "SceneMgr.h"
+#include <queue>
+struct AccessRequirement;
struct CreatureTemplate;
struct Mail;
struct ItemExtendedCostEntry;
@@ -202,97 +204,6 @@ typedef std::unordered_map<uint32, PlayerSpell*> PlayerSpellMap;
typedef std::list<SpellModifier*> SpellModList;
typedef std::unordered_map<uint32, PlayerCurrency> PlayerCurrenciesMap;
-/// Maximum number of CompactUnitFrames profiles
-#define MAX_CUF_PROFILES 5
-
-/// Bit index used in the many bool options of CompactUnitFrames
-enum CUFBoolOptions
-{
- CUF_KEEP_GROUPS_TOGETHER,
- CUF_DISPLAY_PETS,
- CUF_DISPLAY_MAIN_TANK_AND_ASSIST,
- CUF_DISPLAY_HEAL_PREDICTION,
- CUF_DISPLAY_AGGRO_HIGHLIGHT,
- CUF_DISPLAY_ONLY_DISPELLABLE_DEBUFFS,
- CUF_DISPLAY_POWER_BAR,
- CUF_DISPLAY_BORDER,
- CUF_USE_CLASS_COLORS,
- CUF_DISPLAY_HORIZONTAL_GROUPS,
- CUF_DISPLAY_NON_BOSS_DEBUFFS,
- CUF_DYNAMIC_POSITION,
- CUF_LOCKED,
- CUF_SHOWN,
- CUF_AUTO_ACTIVATE_2_PLAYERS,
- CUF_AUTO_ACTIVATE_3_PLAYERS,
- CUF_AUTO_ACTIVATE_5_PLAYERS,
- CUF_AUTO_ACTIVATE_10_PLAYERS,
- CUF_AUTO_ACTIVATE_15_PLAYERS,
- CUF_AUTO_ACTIVATE_25_PLAYERS,
- CUF_AUTO_ACTIVATE_40_PLAYERS,
- CUF_AUTO_ACTIVATE_SPEC_1,
- CUF_AUTO_ACTIVATE_SPEC_2,
- CUF_AUTO_ACTIVATE_SPEC_3,
- CUF_AUTO_ACTIVATE_SPEC_4,
- CUF_AUTO_ACTIVATE_PVP,
- CUF_AUTO_ACTIVATE_PVE,
-
- CUF_BOOL_OPTIONS_COUNT,
-};
-
-/// Represents a CompactUnitFrame profile
-struct CUFProfile
-{
- CUFProfile() : ProfileName(), BoolOptions() // might want to change default value for options
- {
- FrameHeight = 0;
- FrameWidth = 0;
- SortBy = 0;
- HealthText = 0;
- TopPoint = 0;
- BottomPoint = 0;
- LeftPoint = 0;
- TopOffset = 0;
- BottomOffset = 0;
- LeftOffset = 0;
- }
-
- CUFProfile(const std::string& name, uint16 frameHeight, uint16 frameWidth, uint8 sortBy, uint8 healthText, uint32 boolOptions,
- uint8 topPoint, uint8 bottomPoint, uint8 leftPoint, uint16 topOffset, uint16 bottomOffset, uint16 leftOffset)
- : ProfileName(name), BoolOptions(int(boolOptions))
- {
- FrameHeight = frameHeight;
- FrameWidth = frameWidth;
- SortBy = sortBy;
- HealthText = healthText;
- TopPoint = topPoint;
- BottomPoint = bottomPoint;
- LeftPoint = leftPoint;
- TopOffset = topOffset;
- BottomOffset = bottomOffset;
- LeftOffset = leftOffset;
- }
-
- std::string ProfileName;
- uint16 FrameHeight;
- uint16 FrameWidth;
- uint8 SortBy;
- uint8 HealthText;
-
- // LeftAlign, TopAlight, BottomAlign
- uint8 TopPoint;
- uint8 BottomPoint;
- uint8 LeftPoint;
-
- // LeftOffset, TopOffset and BottomOffset
- uint16 TopOffset;
- uint16 BottomOffset;
- uint16 LeftOffset;
-
- std::bitset<CUF_BOOL_OPTIONS_COUNT> BoolOptions;
-
- // More fields can be added to BoolOptions without changing DB schema (up to 32, currently 27)
-};
-
typedef std::unordered_map<uint32 /*instanceId*/, time_t/*releaseTime*/> InstanceTimeMap;
enum TrainerSpellState
@@ -364,61 +275,6 @@ struct ActionButton
typedef std::map<uint8, ActionButton> ActionButtonList;
-struct PlayerCreateInfoItem
-{
- PlayerCreateInfoItem(uint32 id, uint32 amount) : item_id(id), item_amount(amount) { }
-
- uint32 item_id;
- uint32 item_amount;
-};
-
-typedef std::list<PlayerCreateInfoItem> PlayerCreateInfoItems;
-
-struct PlayerLevelInfo
-{
- PlayerLevelInfo() { for (uint8 i=0; i < MAX_STATS; ++i) stats[i] = 0; }
-
- uint16 stats[MAX_STATS];
-};
-
-typedef std::list<uint32> PlayerCreateInfoSpells;
-
-struct PlayerCreateInfoAction
-{
- PlayerCreateInfoAction() : button(0), type(0), action(0) { }
- PlayerCreateInfoAction(uint8 _button, uint32 _action, uint8 _type) : button(_button), type(_type), action(_action) { }
-
- uint8 button;
- uint8 type;
- uint32 action;
-};
-
-typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions;
-
-typedef std::list<SkillRaceClassInfoEntry const*> PlayerCreateInfoSkills;
-
-struct PlayerInfo
-{
- // existence checked by displayId != 0
- PlayerInfo() : mapId(0), areaId(0), positionX(0.0f), positionY(0.0f), positionZ(0.0f), orientation(0.0f), displayId_m(0), displayId_f(0), levelInfo(nullptr) { }
-
- uint32 mapId;
- uint32 areaId;
- float positionX;
- float positionY;
- float positionZ;
- float orientation;
- uint16 displayId_m;
- uint16 displayId_f;
- PlayerCreateInfoItems item;
- PlayerCreateInfoSpells customSpells;
- PlayerCreateInfoSpells castSpells;
- PlayerCreateInfoActions action;
- PlayerCreateInfoSkills skills;
-
- PlayerLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1
-};
-
struct PvPInfo
{
PvPInfo() : IsHostile(false), IsInHostileArea(false), IsInNoPvPArea(false), IsInFFAPvPArea(false), EndTimer(0) { }
@@ -1047,18 +903,6 @@ struct InstancePlayerBind
InstancePlayerBind() : save(NULL), perm(false), extendState(EXTEND_STATE_NORMAL) { }
};
-struct AccessRequirement
-{
- uint8 levelMin;
- uint8 levelMax;
- uint32 item;
- uint32 item2;
- uint32 quest_A;
- uint32 quest_H;
- uint32 achievement;
- std::string questFailedText;
-};
-
enum CharDeleteMethod
{
CHAR_DELETE_REMOVE = 0, // Completely remove from the database
diff --git a/src/server/game/Entities/Player/PlayerTaxi.cpp b/src/server/game/Entities/Player/PlayerTaxi.cpp
index 478b2dbc89d..f3ebb891062 100644
--- a/src/server/game/Entities/Player/PlayerTaxi.cpp
+++ b/src/server/game/Entities/Player/PlayerTaxi.cpp
@@ -1,8 +1,26 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include "Player.h"
#include "TaxiPackets.h"
#include "ObjectMgr.h"
#include <limits>
#include <math.h>
+#include <sstream>
void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level)
{
diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp
index cf28735b1dc..2ee30f7d6ff 100644
--- a/src/server/game/Entities/Player/SocialMgr.cpp
+++ b/src/server/game/Entities/Player/SocialMgr.cpp
@@ -18,11 +18,12 @@
#include "SocialMgr.h"
#include "DatabaseEnv.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "RBAC.h"
#include "SocialPackets.h"
#include "World.h"
#include "WorldSession.h"
-#include "ObjectAccessor.h"
uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag)
{
diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h
index 2a59844b89b..68fd95411bf 100644
--- a/src/server/game/Entities/Player/SocialMgr.h
+++ b/src/server/game/Entities/Player/SocialMgr.h
@@ -19,9 +19,10 @@
#ifndef __TRINITY_SOCIALMGR_H
#define __TRINITY_SOCIALMGR_H
-#include "DatabaseEnv.h"
+#include "DatabaseEnvFwd.h"
#include "Common.h"
#include "ObjectGuid.h"
+#include <map>
class Player;
class WorldPacket;
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index f7461a5355e..672903f8dea 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -16,19 +16,20 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
#include "Transport.h"
+#include "Cell.h"
+#include "CellImpl.h"
+#include "Common.h"
+#include "GameObjectAI.h"
+#include "Log.h"
#include "MapManager.h"
#include "ObjectMgr.h"
+#include "Player.h"
#include "ScriptMgr.h"
-#include "GameObjectAI.h"
#include "Spline.h"
-#include "Vehicle.h"
-#include "Player.h"
-#include "Cell.h"
-#include "CellImpl.h"
#include "Totem.h"
#include "UpdateData.h"
+#include "Vehicle.h"
#include <G3D/Vector3.h>
Transport::Transport() : GameObject(),
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 6259225b2f9..70811186cee 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -21,6 +21,7 @@
#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "Battleground.h"
+#include "BattlegroundPackets.h"
#include "BattlegroundScore.h"
#include "CellImpl.h"
#include "ChatTextBuilder.h"
@@ -35,6 +36,7 @@
#include "InstanceSaveMgr.h"
#include "InstanceScript.h"
#include "Log.h"
+#include "LootMgr.h"
#include "MoveSpline.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index e05d2020a31..6ca7b8d9bf4 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -19,6 +19,7 @@
#ifndef __UNIT_H
#define __UNIT_H
+#include "UnitDefines.h"
#include "EventProcessor.h"
#include "FollowerReference.h"
#include "FollowerRefManager.h"
@@ -202,69 +203,6 @@ enum SpellFacingFlags
SPELL_FACING_FLAG_INFRONT = 0x0001
};
-#define BASE_MINDAMAGE 1.0f
-#define BASE_MAXDAMAGE 2.0f
-#define BASE_ATTACK_TIME 2000
-
-// byte value (UNIT_FIELD_BYTES_1, 0)
-enum UnitStandStateType
-{
- UNIT_STAND_STATE_STAND = 0,
- UNIT_STAND_STATE_SIT = 1,
- UNIT_STAND_STATE_SIT_CHAIR = 2,
- UNIT_STAND_STATE_SLEEP = 3,
- UNIT_STAND_STATE_SIT_LOW_CHAIR = 4,
- UNIT_STAND_STATE_SIT_MEDIUM_CHAIR = 5,
- UNIT_STAND_STATE_SIT_HIGH_CHAIR = 6,
- UNIT_STAND_STATE_DEAD = 7,
- UNIT_STAND_STATE_KNEEL = 8,
- UNIT_STAND_STATE_SUBMERGED = 9
-};
-
-// byte flag value (UNIT_FIELD_BYTES_1, 2)
-enum UnitStandFlags
-{
- UNIT_STAND_FLAGS_UNK1 = 0x01,
- UNIT_STAND_FLAGS_CREEP = 0x02,
- UNIT_STAND_FLAGS_UNTRACKABLE = 0x04,
- UNIT_STAND_FLAGS_UNK4 = 0x08,
- UNIT_STAND_FLAGS_UNK5 = 0x10,
- UNIT_STAND_FLAGS_ALL = 0xFF
-};
-
-enum UnitBytes0Offsets
-{
- UNIT_BYTES_0_OFFSET_RACE = 0,
- UNIT_BYTES_0_OFFSET_CLASS = 1,
- UNIT_BYTES_0_OFFSET_PLAYER_CLASS = 2,
- UNIT_BYTES_0_OFFSET_GENDER = 3
-};
-
-enum UnitBytes1Offsets
-{
- UNIT_BYTES_1_OFFSET_STAND_STATE = 0,
- UNIT_BYTES_1_OFFSET_PET_TALENTS = 1, // unused
- UNIT_BYTES_1_OFFSET_VIS_FLAG = 2,
- UNIT_BYTES_1_OFFSET_ANIM_TIER = 3
-};
-
-enum UnitBytes2Offsets
-{
- UNIT_BYTES_2_OFFSET_SHEATH_STATE = 0,
- UNIT_BYTES_2_OFFSET_PVP_FLAG = 1,
- UNIT_BYTES_2_OFFSET_PET_FLAGS = 2,
- UNIT_BYTES_2_OFFSET_SHAPESHIFT_FORM = 3
-};
-
-// byte flags value (UNIT_FIELD_BYTES_1, 3)
-enum UnitBytes1_Flags
-{
- UNIT_BYTE1_FLAG_ALWAYS_STAND = 0x01,
- UNIT_BYTE1_FLAG_HOVER = 0x02,
- UNIT_BYTE1_FLAG_UNK_3 = 0x04,
- UNIT_BYTE1_FLAG_ALL = 0xFF
-};
-
// high byte (3 from 0..3) of UNIT_FIELD_BYTES_2
enum ShapeshiftForm
{
@@ -304,36 +242,6 @@ enum ShapeshiftForm
FORM_GLADIATOR_STANCE = 33
};
-// low byte (0 from 0..3) of UNIT_FIELD_BYTES_2
-enum SheathState : uint8
-{
- SHEATH_STATE_UNARMED = 0, // non prepared weapon
- SHEATH_STATE_MELEE = 1, // prepared melee weapon
- SHEATH_STATE_RANGED = 2 // prepared ranged weapon
-};
-
-#define MAX_SHEATH_STATE 3
-
-// byte (1 from 0..3) of UNIT_FIELD_BYTES_2
-enum UnitPVPStateFlags
-{
- UNIT_BYTE2_FLAG_PVP = 0x01,
- UNIT_BYTE2_FLAG_UNK1 = 0x02,
- UNIT_BYTE2_FLAG_FFA_PVP = 0x04,
- UNIT_BYTE2_FLAG_SANCTUARY = 0x08,
- UNIT_BYTE2_FLAG_UNK4 = 0x10,
- UNIT_BYTE2_FLAG_UNK5 = 0x20,
- UNIT_BYTE2_FLAG_UNK6 = 0x40,
- UNIT_BYTE2_FLAG_UNK7 = 0x80
-};
-
-// byte (2 from 0..3) of UNIT_FIELD_BYTES_2
-enum UnitRename
-{
- UNIT_CAN_BE_RENAMED = 0x01,
- UNIT_CAN_BE_ABANDONED = 0x02
-};
-
#define MAX_SPELL_CHARM 4
#define MAX_SPELL_VEHICLE 6
#define MAX_SPELL_POSSESS 8
@@ -689,200 +597,6 @@ enum DamageEffectType
SELF_DAMAGE = 5
};
-// Value masks for UNIT_FIELD_FLAGS
-enum UnitFlags : uint32
-{
- UNIT_FLAG_SERVER_CONTROLLED = 0x00000001, // set only when unit movement is controlled by server - by SPLINE/MONSTER_MOVE packets, together with UNIT_FLAG_STUNNED; only set to units controlled by client; client function CGUnit_C::IsClientControlled returns false when set for owner
- UNIT_FLAG_NON_ATTACKABLE = 0x00000002, // not attackable
- UNIT_FLAG_REMOVE_CLIENT_CONTROL = 0x00000004, // This is a legacy flag used to disable movement player's movement while controlling other units, SMSG_CLIENT_CONTROL replaces this functionality clientside now. CONFUSED and FLEEING flags have the same effect on client movement asDISABLE_MOVE_CONTROL in addition to preventing spell casts/autoattack (they all allow climbing steeper hills and emotes while moving)
- UNIT_FLAG_PVP_ATTACKABLE = 0x00000008, // allow apply pvp rules to attackable state in addition to faction dependent state
- UNIT_FLAG_RENAME = 0x00000010,
- UNIT_FLAG_PREPARATION = 0x00000020, // don't take reagents for spells with SPELL_ATTR5_NO_REAGENT_WHILE_PREP
- UNIT_FLAG_UNK_6 = 0x00000040,
- UNIT_FLAG_NOT_ATTACKABLE_1 = 0x00000080, // ?? (UNIT_FLAG_PVP_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE
- UNIT_FLAG_IMMUNE_TO_PC = 0x00000100, // disables combat/assistance with PlayerCharacters (PC) - see Unit::_IsValidAttackTarget, Unit::_IsValidAssistTarget
- UNIT_FLAG_IMMUNE_TO_NPC = 0x00000200, // disables combat/assistance with NonPlayerCharacters (NPC) - see Unit::_IsValidAttackTarget, Unit::_IsValidAssistTarget
- UNIT_FLAG_LOOTING = 0x00000400, // loot animation
- UNIT_FLAG_PET_IN_COMBAT = 0x00000800, // in combat?, 2.0.8
- UNIT_FLAG_PVP = 0x00001000, // changed in 3.0.3
- UNIT_FLAG_SILENCED = 0x00002000, // silenced, 2.1.1
- UNIT_FLAG_CANNOT_SWIM = 0x00004000, // 2.0.8
- UNIT_FLAG_UNK_15 = 0x00008000,
- UNIT_FLAG_UNK_16 = 0x00010000,
- UNIT_FLAG_PACIFIED = 0x00020000, // 3.0.3 ok
- UNIT_FLAG_STUNNED = 0x00040000, // 3.0.3 ok
- UNIT_FLAG_IN_COMBAT = 0x00080000,
- UNIT_FLAG_TAXI_FLIGHT = 0x00100000, // disable casting at client side spell not allowed by taxi flight (mounted?), probably used with 0x4 flag
- UNIT_FLAG_DISARMED = 0x00200000, // 3.0.3, disable melee spells casting..., "Required melee weapon" added to melee spells tooltip.
- UNIT_FLAG_CONFUSED = 0x00400000,
- UNIT_FLAG_FLEEING = 0x00800000,
- UNIT_FLAG_PLAYER_CONTROLLED = 0x01000000, // used in spell Eyes of the Beast for pet... let attack by controlled creature
- UNIT_FLAG_NOT_SELECTABLE = 0x02000000,
- UNIT_FLAG_SKINNABLE = 0x04000000,
- UNIT_FLAG_MOUNT = 0x08000000,
- UNIT_FLAG_UNK_28 = 0x10000000,
- UNIT_FLAG_UNK_29 = 0x20000000, // used in Feing Death spell
- UNIT_FLAG_SHEATHE = 0x40000000,
- UNIT_FLAG_UNK_31 = 0x80000000,
- MAX_UNIT_FLAGS = 33
-};
-
-// Value masks for UNIT_FIELD_FLAGS_2
-enum UnitFlags2
-{
- UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
- UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
- UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
- UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
- UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
- UNIT_FLAG2_INSTANTLY_APPEAR_MODEL = 0x00000020, // Unit model instantly appears when summoned (does not fade in)
- UNIT_FLAG2_FORCE_MOVEMENT = 0x00000040,
- UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
- UNIT_FLAG2_DISABLE_PRED_STATS = 0x00000100, // Player has disabled predicted stats (Used by raid frames)
- UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
- UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
- UNIT_FLAG2_RESTRICT_PARTY_INTERACTION = 0x00001000, // Restrict interaction to party or raid
- UNIT_FLAG2_PREVENT_SPELL_CLICK = 0x00002000, // Prevent spellclick
- UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
- UNIT_FLAG2_DISABLE_TURN = 0x00008000,
- UNIT_FLAG2_UNK2 = 0x00010000,
- UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death
- UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
- UNIT_FLAG2_NO_ACTIONS = 0x00800000
-};
-
-/// Non Player Character flags
-enum NPCFlags : uint64
-{
- UNIT_NPC_FLAG_NONE = 0x0000000000,
- UNIT_NPC_FLAG_GOSSIP = 0x0000000001, // 100%
- UNIT_NPC_FLAG_QUESTGIVER = 0x0000000002, // 100%
- UNIT_NPC_FLAG_UNK1 = 0x0000000004,
- UNIT_NPC_FLAG_UNK2 = 0x0000000008,
- UNIT_NPC_FLAG_TRAINER = 0x0000000010, // 100%
- UNIT_NPC_FLAG_TRAINER_CLASS = 0x0000000020, // 100%
- UNIT_NPC_FLAG_TRAINER_PROFESSION = 0x0000000040, // 100%
- UNIT_NPC_FLAG_VENDOR = 0x0000000080, // 100%
- UNIT_NPC_FLAG_VENDOR_AMMO = 0x0000000100, // 100%, general goods vendor
- UNIT_NPC_FLAG_VENDOR_FOOD = 0x0000000200, // 100%
- UNIT_NPC_FLAG_VENDOR_POISON = 0x0000000400, // guessed
- UNIT_NPC_FLAG_VENDOR_REAGENT = 0x0000000800, // 100%
- UNIT_NPC_FLAG_REPAIR = 0x0000001000, // 100%
- UNIT_NPC_FLAG_FLIGHTMASTER = 0x0000002000, // 100%
- UNIT_NPC_FLAG_SPIRITHEALER = 0x0000004000, // guessed
- UNIT_NPC_FLAG_SPIRITGUIDE = 0x0000008000, // guessed
- UNIT_NPC_FLAG_INNKEEPER = 0x0000010000, // 100%
- UNIT_NPC_FLAG_BANKER = 0x0000020000, // 100%
- UNIT_NPC_FLAG_PETITIONER = 0x0000040000, // 100% 0xC0000 = guild petitions, 0x40000 = arena team petitions
- UNIT_NPC_FLAG_TABARDDESIGNER = 0x0000080000, // 100%
- UNIT_NPC_FLAG_BATTLEMASTER = 0x0000100000, // 100%
- UNIT_NPC_FLAG_AUCTIONEER = 0x0000200000, // 100%
- UNIT_NPC_FLAG_STABLEMASTER = 0x0000400000, // 100%
- UNIT_NPC_FLAG_GUILD_BANKER = 0x0000800000, // cause client to send 997 opcode
- UNIT_NPC_FLAG_SPELLCLICK = 0x0001000000, // cause client to send 1015 opcode (spell click)
- UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x0002000000, // players with mounts that have vehicle data should have it set
- UNIT_NPC_FLAG_MAILBOX = 0x0004000000, // mailbox
- UNIT_NPC_FLAG_ARTIFACT_POWER_RESPEC = 0x0008000000, // artifact powers reset
- UNIT_NPC_FLAG_TRANSMOGRIFIER = 0x0010000000, // transmogrification
- UNIT_NPC_FLAG_VAULTKEEPER = 0x0020000000, // void storage
- UNIT_NPC_FLAG_BLACK_MARKET = 0x0080000000, // black market
- UNIT_NPC_FLAG_ITEM_UPGRADE_MASTER = 0x0100000000,
- UNIT_NPC_FLAG_GARRISON_ARCHITECT = 0x0200000000,
- UNIT_NPC_FLAG_STEERING = 0x0400000000,
- UNIT_NPC_FLAG_SHIPMENT_CRAFTER = 0x1000000000,
- UNIT_NPC_FLAG_GARRISON_MISSION_NPC = 0x2000000000,
- UNIT_NPC_FLAG_TRADESKILL_NPC = 0x4000000000,
- UNIT_NPC_FLAG_BLACK_MARKET_VIEW = 0x8000000000
-};
-
-enum MovementFlags
-{
- MOVEMENTFLAG_NONE = 0x00000000,
- MOVEMENTFLAG_FORWARD = 0x00000001,
- MOVEMENTFLAG_BACKWARD = 0x00000002,
- MOVEMENTFLAG_STRAFE_LEFT = 0x00000004,
- MOVEMENTFLAG_STRAFE_RIGHT = 0x00000008,
- MOVEMENTFLAG_LEFT = 0x00000010,
- MOVEMENTFLAG_RIGHT = 0x00000020,
- MOVEMENTFLAG_PITCH_UP = 0x00000040,
- MOVEMENTFLAG_PITCH_DOWN = 0x00000080,
- MOVEMENTFLAG_WALKING = 0x00000100, // Walking
- MOVEMENTFLAG_DISABLE_GRAVITY = 0x00000200, // Former MOVEMENTFLAG_LEVITATING. This is used when walking is not possible.
- MOVEMENTFLAG_ROOT = 0x00000400, // Must not be set along with MOVEMENTFLAG_MASK_MOVING
- MOVEMENTFLAG_FALLING = 0x00000800, // damage dealt on that type of falling
- MOVEMENTFLAG_FALLING_FAR = 0x00001000,
- MOVEMENTFLAG_PENDING_STOP = 0x00002000,
- MOVEMENTFLAG_PENDING_STRAFE_STOP = 0x00004000,
- MOVEMENTFLAG_PENDING_FORWARD = 0x00008000,
- MOVEMENTFLAG_PENDING_BACKWARD = 0x00010000,
- MOVEMENTFLAG_PENDING_STRAFE_LEFT = 0x00020000,
- MOVEMENTFLAG_PENDING_STRAFE_RIGHT = 0x00040000,
- MOVEMENTFLAG_PENDING_ROOT = 0x00080000,
- MOVEMENTFLAG_SWIMMING = 0x00100000, // appears with fly flag also
- MOVEMENTFLAG_ASCENDING = 0x00200000, // press "space" when flying
- MOVEMENTFLAG_DESCENDING = 0x00400000,
- MOVEMENTFLAG_CAN_FLY = 0x00800000, // Appears when unit can fly AND also walk
- MOVEMENTFLAG_FLYING = 0x01000000, // unit is actually flying. pretty sure this is only used for players. creatures use disable_gravity
- MOVEMENTFLAG_SPLINE_ELEVATION = 0x02000000, // used for flight paths
- MOVEMENTFLAG_WATERWALKING = 0x04000000, // prevent unit from falling through water
- MOVEMENTFLAG_FALLING_SLOW = 0x08000000, // active rogue safe fall spell (passive)
- MOVEMENTFLAG_HOVER = 0x10000000, // hover, cannot jump
- MOVEMENTFLAG_DISABLE_COLLISION = 0x20000000,
-
- MOVEMENTFLAG_MASK_MOVING =
- MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_BACKWARD | MOVEMENTFLAG_STRAFE_LEFT | MOVEMENTFLAG_STRAFE_RIGHT |
- MOVEMENTFLAG_FALLING | MOVEMENTFLAG_ASCENDING | MOVEMENTFLAG_DESCENDING,
-
- MOVEMENTFLAG_MASK_TURNING =
- MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT | MOVEMENTFLAG_PITCH_UP | MOVEMENTFLAG_PITCH_DOWN,
-
- MOVEMENTFLAG_MASK_MOVING_FLY =
- MOVEMENTFLAG_FLYING | MOVEMENTFLAG_ASCENDING | MOVEMENTFLAG_DESCENDING,
-
- // Movement flags allowed for creature in CreateObject - we need to keep all other enabled serverside
- // to properly calculate all movement
- MOVEMENTFLAG_MASK_CREATURE_ALLOWED =
- MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_DISABLE_GRAVITY | MOVEMENTFLAG_ROOT | MOVEMENTFLAG_SWIMMING |
- MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_WATERWALKING | MOVEMENTFLAG_FALLING_SLOW | MOVEMENTFLAG_HOVER | MOVEMENTFLAG_DISABLE_COLLISION,
-
- /// @todo if needed: add more flags to this masks that are exclusive to players
- MOVEMENTFLAG_MASK_PLAYER_ONLY =
- MOVEMENTFLAG_FLYING,
-
- /// Movement flags that have change status opcodes associated for players
- MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE = MOVEMENTFLAG_DISABLE_GRAVITY | MOVEMENTFLAG_ROOT |
- MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_WATERWALKING | MOVEMENTFLAG_FALLING_SLOW | MOVEMENTFLAG_HOVER | MOVEMENTFLAG_DISABLE_COLLISION
-};
-
-enum MovementFlags2
-{
- MOVEMENTFLAG2_NONE = 0x00000000,
- MOVEMENTFLAG2_NO_STRAFE = 0x00000001,
- MOVEMENTFLAG2_NO_JUMPING = 0x00000002,
- MOVEMENTFLAG2_FULL_SPEED_TURNING = 0x00000004,
- MOVEMENTFLAG2_FULL_SPEED_PITCHING = 0x00000008,
- MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING = 0x00000010,
- MOVEMENTFLAG2_IS_VEHICLE_EXIT_VOLUNTARY = 0x00000020,
- MOVEMENTFLAG2_JUMP_SPLINE_IN_AIR = 0x00000040,
- MOVEMENTFLAG2_ANIM_TIER_IN_TRANS = 0x00000080,
- MOVEMENTFLAG2_WATERWALKING_FULL_PITCH = 0x00000100, // will always waterwalk, even if facing the camera directly down
- MOVEMENTFLAG2_VEHICLE_PASSENGER_IS_TRANSITION_ALLOWED = 0x00000200,
- MOVEMENTFLAG2_CAN_SWIM_TO_FLY_TRANS = 0x00000400,
- MOVEMENTFLAG2_UNK11 = 0x00000800, // terrain normal calculation is disabled if this flag is not present, client automatically handles setting this flag
- MOVEMENTFLAG2_CAN_TURN_WHILE_FALLING = 0x00001000,
- MOVEMENTFLAG2_UNK13 = 0x00002000, // set automatically by the client for aura 373
- MOVEMENTFLAG2_IGNORE_MOVEMENT_FORCES = 0x00004000,
- MOVEMENTFLAG2_UNK15 = 0x00008000,
- MOVEMENTFLAG2_CAN_DOUBLE_JUMP = 0x00010000,
- MOVEMENTFLAG2_DOUBLE_JUMP = 0x00020000,
- // these flags cannot be sent (18 bits in packet)
- MOVEMENTFLAG2_UNK18 = 0x00040000,
- MOVEMENTFLAG2_UNK19 = 0x00080000,
- MOVEMENTFLAG2_INTERPOLATED_MOVEMENT = 0x00100000,
- MOVEMENTFLAG2_INTERPOLATED_TURNING = 0x00200000,
- MOVEMENTFLAG2_INTERPOLATED_PITCHING = 0x00400000
-};
-
enum UnitTypeMask
{
UNIT_MASK_NONE = 0x00000000,
@@ -1134,13 +848,6 @@ struct RedirectThreatInfo
}
};
-#define MAX_DECLINED_NAME_CASES 5
-
-struct DeclinedName
-{
- std::string name[MAX_DECLINED_NAME_CASES];
-};
-
enum CurrentSpellTypes
{
CURRENT_MELEE_SPELL = 0,
diff --git a/src/server/game/Entities/Unit/UnitDefines.h b/src/server/game/Entities/Unit/UnitDefines.h
new file mode 100644
index 00000000000..03bff121ebf
--- /dev/null
+++ b/src/server/game/Entities/Unit/UnitDefines.h
@@ -0,0 +1,322 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * 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 UnitDefines_h__
+#define UnitDefines_h__
+
+#include "Define.h"
+#include <string>
+
+#define DEFAULT_COMBAT_REACH 1.5f
+#define MIN_MELEE_REACH 2.0f
+#define NOMINAL_MELEE_RANGE 5.0f
+#define MELEE_RANGE (NOMINAL_MELEE_RANGE - MIN_MELEE_REACH * 2) //center to center for players
+#define BASE_MINDAMAGE 1.0f
+#define BASE_MAXDAMAGE 2.0f
+#define BASE_ATTACK_TIME 2000
+
+// byte value (UNIT_FIELD_BYTES_1, 0)
+enum UnitStandStateType : uint8
+{
+ UNIT_STAND_STATE_STAND = 0,
+ UNIT_STAND_STATE_SIT = 1,
+ UNIT_STAND_STATE_SIT_CHAIR = 2,
+ UNIT_STAND_STATE_SLEEP = 3,
+ UNIT_STAND_STATE_SIT_LOW_CHAIR = 4,
+ UNIT_STAND_STATE_SIT_MEDIUM_CHAIR = 5,
+ UNIT_STAND_STATE_SIT_HIGH_CHAIR = 6,
+ UNIT_STAND_STATE_DEAD = 7,
+ UNIT_STAND_STATE_KNEEL = 8,
+ UNIT_STAND_STATE_SUBMERGED = 9
+};
+
+// byte flag value (UNIT_FIELD_BYTES_1, 2)
+enum UnitStandFlags : uint8
+{
+ UNIT_STAND_FLAGS_UNK1 = 0x01,
+ UNIT_STAND_FLAGS_CREEP = 0x02,
+ UNIT_STAND_FLAGS_UNTRACKABLE = 0x04,
+ UNIT_STAND_FLAGS_UNK4 = 0x08,
+ UNIT_STAND_FLAGS_UNK5 = 0x10,
+ UNIT_STAND_FLAGS_ALL = 0xFF
+};
+
+enum UnitBytes0Offsets : uint8
+{
+ UNIT_BYTES_0_OFFSET_RACE = 0,
+ UNIT_BYTES_0_OFFSET_CLASS = 1,
+ UNIT_BYTES_0_OFFSET_PLAYER_CLASS = 2,
+ UNIT_BYTES_0_OFFSET_GENDER = 3
+};
+
+enum UnitBytes1Offsets : uint8
+{
+ UNIT_BYTES_1_OFFSET_STAND_STATE = 0,
+ UNIT_BYTES_1_OFFSET_PET_TALENTS = 1, // unused
+ UNIT_BYTES_1_OFFSET_VIS_FLAG = 2,
+ UNIT_BYTES_1_OFFSET_ANIM_TIER = 3
+};
+
+enum UnitBytes2Offsets : uint8
+{
+ UNIT_BYTES_2_OFFSET_SHEATH_STATE = 0,
+ UNIT_BYTES_2_OFFSET_PVP_FLAG = 1,
+ UNIT_BYTES_2_OFFSET_PET_FLAGS = 2,
+ UNIT_BYTES_2_OFFSET_SHAPESHIFT_FORM = 3
+};
+
+// byte flags value (UNIT_FIELD_BYTES_1, 3)
+enum UnitBytes1_Flags : uint8
+{
+ UNIT_BYTE1_FLAG_ALWAYS_STAND = 0x01,
+ UNIT_BYTE1_FLAG_HOVER = 0x02,
+ UNIT_BYTE1_FLAG_UNK_3 = 0x04,
+ UNIT_BYTE1_FLAG_ALL = 0xFF
+};
+
+// low byte (0 from 0..3) of UNIT_FIELD_BYTES_2
+enum SheathState : uint8
+{
+ SHEATH_STATE_UNARMED = 0, // non prepared weapon
+ SHEATH_STATE_MELEE = 1, // prepared melee weapon
+ SHEATH_STATE_RANGED = 2 // prepared ranged weapon
+};
+
+#define MAX_SHEATH_STATE 3
+
+// byte (1 from 0..3) of UNIT_FIELD_BYTES_2
+enum UnitPVPStateFlags : uint8
+{
+ UNIT_BYTE2_FLAG_PVP = 0x01,
+ UNIT_BYTE2_FLAG_UNK1 = 0x02,
+ UNIT_BYTE2_FLAG_FFA_PVP = 0x04,
+ UNIT_BYTE2_FLAG_SANCTUARY = 0x08,
+ UNIT_BYTE2_FLAG_UNK4 = 0x10,
+ UNIT_BYTE2_FLAG_UNK5 = 0x20,
+ UNIT_BYTE2_FLAG_UNK6 = 0x40,
+ UNIT_BYTE2_FLAG_UNK7 = 0x80
+};
+
+// byte (2 from 0..3) of UNIT_FIELD_BYTES_2
+enum UnitRename : uint8
+{
+ UNIT_CAN_BE_RENAMED = 0x01,
+ UNIT_CAN_BE_ABANDONED = 0x02
+};
+
+// Value masks for UNIT_FIELD_FLAGS
+enum UnitFlags : uint32
+{
+ UNIT_FLAG_SERVER_CONTROLLED = 0x00000001, // set only when unit movement is controlled by server - by SPLINE/MONSTER_MOVE packets, together with UNIT_FLAG_STUNNED; only set to units controlled by client; client function CGUnit_C::IsClientControlled returns false when set for owner
+ UNIT_FLAG_NON_ATTACKABLE = 0x00000002, // not attackable
+ UNIT_FLAG_REMOVE_CLIENT_CONTROL = 0x00000004, // This is a legacy flag used to disable movement player's movement while controlling other units, SMSG_CLIENT_CONTROL replaces this functionality clientside now. CONFUSED and FLEEING flags have the same effect on client movement asDISABLE_MOVE_CONTROL in addition to preventing spell casts/autoattack (they all allow climbing steeper hills and emotes while moving)
+ UNIT_FLAG_PVP_ATTACKABLE = 0x00000008, // allow apply pvp rules to attackable state in addition to faction dependent state
+ UNIT_FLAG_RENAME = 0x00000010,
+ UNIT_FLAG_PREPARATION = 0x00000020, // don't take reagents for spells with SPELL_ATTR5_NO_REAGENT_WHILE_PREP
+ UNIT_FLAG_UNK_6 = 0x00000040,
+ UNIT_FLAG_NOT_ATTACKABLE_1 = 0x00000080, // ?? (UNIT_FLAG_PVP_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE
+ UNIT_FLAG_IMMUNE_TO_PC = 0x00000100, // disables combat/assistance with PlayerCharacters (PC) - see Unit::_IsValidAttackTarget, Unit::_IsValidAssistTarget
+ UNIT_FLAG_IMMUNE_TO_NPC = 0x00000200, // disables combat/assistance with NonPlayerCharacters (NPC) - see Unit::_IsValidAttackTarget, Unit::_IsValidAssistTarget
+ UNIT_FLAG_LOOTING = 0x00000400, // loot animation
+ UNIT_FLAG_PET_IN_COMBAT = 0x00000800, // in combat?, 2.0.8
+ UNIT_FLAG_PVP = 0x00001000, // changed in 3.0.3
+ UNIT_FLAG_SILENCED = 0x00002000, // silenced, 2.1.1
+ UNIT_FLAG_CANNOT_SWIM = 0x00004000, // 2.0.8
+ UNIT_FLAG_UNK_15 = 0x00008000,
+ UNIT_FLAG_UNK_16 = 0x00010000,
+ UNIT_FLAG_PACIFIED = 0x00020000, // 3.0.3 ok
+ UNIT_FLAG_STUNNED = 0x00040000, // 3.0.3 ok
+ UNIT_FLAG_IN_COMBAT = 0x00080000,
+ UNIT_FLAG_TAXI_FLIGHT = 0x00100000, // disable casting at client side spell not allowed by taxi flight (mounted?), probably used with 0x4 flag
+ UNIT_FLAG_DISARMED = 0x00200000, // 3.0.3, disable melee spells casting..., "Required melee weapon" added to melee spells tooltip.
+ UNIT_FLAG_CONFUSED = 0x00400000,
+ UNIT_FLAG_FLEEING = 0x00800000,
+ UNIT_FLAG_PLAYER_CONTROLLED = 0x01000000, // used in spell Eyes of the Beast for pet... let attack by controlled creature
+ UNIT_FLAG_NOT_SELECTABLE = 0x02000000,
+ UNIT_FLAG_SKINNABLE = 0x04000000,
+ UNIT_FLAG_MOUNT = 0x08000000,
+ UNIT_FLAG_UNK_28 = 0x10000000,
+ UNIT_FLAG_UNK_29 = 0x20000000, // used in Feing Death spell
+ UNIT_FLAG_SHEATHE = 0x40000000,
+ UNIT_FLAG_UNK_31 = 0x80000000,
+ MAX_UNIT_FLAGS = 33
+};
+
+// Value masks for UNIT_FIELD_FLAGS_2
+enum UnitFlags2 : uint32
+{
+ UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
+ UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
+ UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
+ UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
+ UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
+ UNIT_FLAG2_INSTANTLY_APPEAR_MODEL = 0x00000020, // Unit model instantly appears when summoned (does not fade in)
+ UNIT_FLAG2_FORCE_MOVEMENT = 0x00000040,
+ UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
+ UNIT_FLAG2_DISABLE_PRED_STATS = 0x00000100, // Player has disabled predicted stats (Used by raid frames)
+ UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
+ UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
+ UNIT_FLAG2_RESTRICT_PARTY_INTERACTION = 0x00001000, // Restrict interaction to party or raid
+ UNIT_FLAG2_PREVENT_SPELL_CLICK = 0x00002000, // Prevent spellclick
+ UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
+ UNIT_FLAG2_DISABLE_TURN = 0x00008000,
+ UNIT_FLAG2_UNK2 = 0x00010000,
+ UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death
+ UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
+ UNIT_FLAG2_NO_ACTIONS = 0x00800000
+};
+
+/// Non Player Character flags
+enum NPCFlags : uint64
+{
+ UNIT_NPC_FLAG_NONE = 0x0000000000,
+ UNIT_NPC_FLAG_GOSSIP = 0x0000000001, // 100%
+ UNIT_NPC_FLAG_QUESTGIVER = 0x0000000002, // 100%
+ UNIT_NPC_FLAG_UNK1 = 0x0000000004,
+ UNIT_NPC_FLAG_UNK2 = 0x0000000008,
+ UNIT_NPC_FLAG_TRAINER = 0x0000000010, // 100%
+ UNIT_NPC_FLAG_TRAINER_CLASS = 0x0000000020, // 100%
+ UNIT_NPC_FLAG_TRAINER_PROFESSION = 0x0000000040, // 100%
+ UNIT_NPC_FLAG_VENDOR = 0x0000000080, // 100%
+ UNIT_NPC_FLAG_VENDOR_AMMO = 0x0000000100, // 100%, general goods vendor
+ UNIT_NPC_FLAG_VENDOR_FOOD = 0x0000000200, // 100%
+ UNIT_NPC_FLAG_VENDOR_POISON = 0x0000000400, // guessed
+ UNIT_NPC_FLAG_VENDOR_REAGENT = 0x0000000800, // 100%
+ UNIT_NPC_FLAG_REPAIR = 0x0000001000, // 100%
+ UNIT_NPC_FLAG_FLIGHTMASTER = 0x0000002000, // 100%
+ UNIT_NPC_FLAG_SPIRITHEALER = 0x0000004000, // guessed
+ UNIT_NPC_FLAG_SPIRITGUIDE = 0x0000008000, // guessed
+ UNIT_NPC_FLAG_INNKEEPER = 0x0000010000, // 100%
+ UNIT_NPC_FLAG_BANKER = 0x0000020000, // 100%
+ UNIT_NPC_FLAG_PETITIONER = 0x0000040000, // 100% 0xC0000 = guild petitions, 0x40000 = arena team petitions
+ UNIT_NPC_FLAG_TABARDDESIGNER = 0x0000080000, // 100%
+ UNIT_NPC_FLAG_BATTLEMASTER = 0x0000100000, // 100%
+ UNIT_NPC_FLAG_AUCTIONEER = 0x0000200000, // 100%
+ UNIT_NPC_FLAG_STABLEMASTER = 0x0000400000, // 100%
+ UNIT_NPC_FLAG_GUILD_BANKER = 0x0000800000, // cause client to send 997 opcode
+ UNIT_NPC_FLAG_SPELLCLICK = 0x0001000000, // cause client to send 1015 opcode (spell click)
+ UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x0002000000, // players with mounts that have vehicle data should have it set
+ UNIT_NPC_FLAG_MAILBOX = 0x0004000000, // mailbox
+ UNIT_NPC_FLAG_ARTIFACT_POWER_RESPEC = 0x0008000000, // artifact powers reset
+ UNIT_NPC_FLAG_TRANSMOGRIFIER = 0x0010000000, // transmogrification
+ UNIT_NPC_FLAG_VAULTKEEPER = 0x0020000000, // void storage
+ UNIT_NPC_FLAG_BLACK_MARKET = 0x0080000000, // black market
+ UNIT_NPC_FLAG_ITEM_UPGRADE_MASTER = 0x0100000000,
+ UNIT_NPC_FLAG_GARRISON_ARCHITECT = 0x0200000000,
+ UNIT_NPC_FLAG_STEERING = 0x0400000000,
+ UNIT_NPC_FLAG_SHIPMENT_CRAFTER = 0x1000000000,
+ UNIT_NPC_FLAG_GARRISON_MISSION_NPC = 0x2000000000,
+ UNIT_NPC_FLAG_TRADESKILL_NPC = 0x4000000000,
+ UNIT_NPC_FLAG_BLACK_MARKET_VIEW = 0x8000000000
+};
+
+enum MovementFlags : uint32
+{
+ MOVEMENTFLAG_NONE = 0x00000000,
+ MOVEMENTFLAG_FORWARD = 0x00000001,
+ MOVEMENTFLAG_BACKWARD = 0x00000002,
+ MOVEMENTFLAG_STRAFE_LEFT = 0x00000004,
+ MOVEMENTFLAG_STRAFE_RIGHT = 0x00000008,
+ MOVEMENTFLAG_LEFT = 0x00000010,
+ MOVEMENTFLAG_RIGHT = 0x00000020,
+ MOVEMENTFLAG_PITCH_UP = 0x00000040,
+ MOVEMENTFLAG_PITCH_DOWN = 0x00000080,
+ MOVEMENTFLAG_WALKING = 0x00000100, // Walking
+ MOVEMENTFLAG_DISABLE_GRAVITY = 0x00000200, // Former MOVEMENTFLAG_LEVITATING. This is used when walking is not possible.
+ MOVEMENTFLAG_ROOT = 0x00000400, // Must not be set along with MOVEMENTFLAG_MASK_MOVING
+ MOVEMENTFLAG_FALLING = 0x00000800, // damage dealt on that type of falling
+ MOVEMENTFLAG_FALLING_FAR = 0x00001000,
+ MOVEMENTFLAG_PENDING_STOP = 0x00002000,
+ MOVEMENTFLAG_PENDING_STRAFE_STOP = 0x00004000,
+ MOVEMENTFLAG_PENDING_FORWARD = 0x00008000,
+ MOVEMENTFLAG_PENDING_BACKWARD = 0x00010000,
+ MOVEMENTFLAG_PENDING_STRAFE_LEFT = 0x00020000,
+ MOVEMENTFLAG_PENDING_STRAFE_RIGHT = 0x00040000,
+ MOVEMENTFLAG_PENDING_ROOT = 0x00080000,
+ MOVEMENTFLAG_SWIMMING = 0x00100000, // appears with fly flag also
+ MOVEMENTFLAG_ASCENDING = 0x00200000, // press "space" when flying
+ MOVEMENTFLAG_DESCENDING = 0x00400000,
+ MOVEMENTFLAG_CAN_FLY = 0x00800000, // Appears when unit can fly AND also walk
+ MOVEMENTFLAG_FLYING = 0x01000000, // unit is actually flying. pretty sure this is only used for players. creatures use disable_gravity
+ MOVEMENTFLAG_SPLINE_ELEVATION = 0x02000000, // used for flight paths
+ MOVEMENTFLAG_WATERWALKING = 0x04000000, // prevent unit from falling through water
+ MOVEMENTFLAG_FALLING_SLOW = 0x08000000, // active rogue safe fall spell (passive)
+ MOVEMENTFLAG_HOVER = 0x10000000, // hover, cannot jump
+ MOVEMENTFLAG_DISABLE_COLLISION = 0x20000000,
+
+ MOVEMENTFLAG_MASK_MOVING =
+ MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_BACKWARD | MOVEMENTFLAG_STRAFE_LEFT | MOVEMENTFLAG_STRAFE_RIGHT |
+ MOVEMENTFLAG_FALLING | MOVEMENTFLAG_ASCENDING | MOVEMENTFLAG_DESCENDING,
+
+ MOVEMENTFLAG_MASK_TURNING =
+ MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT | MOVEMENTFLAG_PITCH_UP | MOVEMENTFLAG_PITCH_DOWN,
+
+ MOVEMENTFLAG_MASK_MOVING_FLY =
+ MOVEMENTFLAG_FLYING | MOVEMENTFLAG_ASCENDING | MOVEMENTFLAG_DESCENDING,
+
+ // Movement flags allowed for creature in CreateObject - we need to keep all other enabled serverside
+ // to properly calculate all movement
+ MOVEMENTFLAG_MASK_CREATURE_ALLOWED =
+ MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_DISABLE_GRAVITY | MOVEMENTFLAG_ROOT | MOVEMENTFLAG_SWIMMING |
+ MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_WATERWALKING | MOVEMENTFLAG_FALLING_SLOW | MOVEMENTFLAG_HOVER | MOVEMENTFLAG_DISABLE_COLLISION,
+
+ /// @todo if needed: add more flags to this masks that are exclusive to players
+ MOVEMENTFLAG_MASK_PLAYER_ONLY =
+ MOVEMENTFLAG_FLYING,
+
+ /// Movement flags that have change status opcodes associated for players
+ MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE = MOVEMENTFLAG_DISABLE_GRAVITY | MOVEMENTFLAG_ROOT |
+ MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_WATERWALKING | MOVEMENTFLAG_FALLING_SLOW | MOVEMENTFLAG_HOVER | MOVEMENTFLAG_DISABLE_COLLISION
+};
+
+enum MovementFlags2 : uint32
+{
+ MOVEMENTFLAG2_NONE = 0x00000000,
+ MOVEMENTFLAG2_NO_STRAFE = 0x00000001,
+ MOVEMENTFLAG2_NO_JUMPING = 0x00000002,
+ MOVEMENTFLAG2_FULL_SPEED_TURNING = 0x00000004,
+ MOVEMENTFLAG2_FULL_SPEED_PITCHING = 0x00000008,
+ MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING = 0x00000010,
+ MOVEMENTFLAG2_IS_VEHICLE_EXIT_VOLUNTARY = 0x00000020,
+ MOVEMENTFLAG2_JUMP_SPLINE_IN_AIR = 0x00000040,
+ MOVEMENTFLAG2_ANIM_TIER_IN_TRANS = 0x00000080,
+ MOVEMENTFLAG2_WATERWALKING_FULL_PITCH = 0x00000100, // will always waterwalk, even if facing the camera directly down
+ MOVEMENTFLAG2_VEHICLE_PASSENGER_IS_TRANSITION_ALLOWED = 0x00000200,
+ MOVEMENTFLAG2_CAN_SWIM_TO_FLY_TRANS = 0x00000400,
+ MOVEMENTFLAG2_UNK11 = 0x00000800, // terrain normal calculation is disabled if this flag is not present, client automatically handles setting this flag
+ MOVEMENTFLAG2_CAN_TURN_WHILE_FALLING = 0x00001000,
+ MOVEMENTFLAG2_UNK13 = 0x00002000, // set automatically by the client for aura 373
+ MOVEMENTFLAG2_IGNORE_MOVEMENT_FORCES = 0x00004000,
+ MOVEMENTFLAG2_UNK15 = 0x00008000,
+ MOVEMENTFLAG2_CAN_DOUBLE_JUMP = 0x00010000,
+ MOVEMENTFLAG2_DOUBLE_JUMP = 0x00020000,
+ // these flags cannot be sent (18 bits in packet)
+ MOVEMENTFLAG2_UNK18 = 0x00040000,
+ MOVEMENTFLAG2_UNK19 = 0x00080000,
+ MOVEMENTFLAG2_INTERPOLATED_MOVEMENT = 0x00100000,
+ MOVEMENTFLAG2_INTERPOLATED_TURNING = 0x00200000,
+ MOVEMENTFLAG2_INTERPOLATED_PITCHING = 0x00400000
+};
+
+#define MAX_DECLINED_NAME_CASES 5
+
+struct DeclinedName
+{
+ std::string name[MAX_DECLINED_NAME_CASES];
+};
+
+#endif // UnitDefines_h__
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index a3ef39313d2..7091166b7b8 100644
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -25,9 +25,10 @@
#include "MapManager.h"
#include "Player.h"
#include "BattlegroundMgr.h"
-#include "UnitAI.h"
+#include "CreatureAI.h"
#include "GameObjectAI.h"
#include "WorldStatePackets.h"
+#include "DatabaseEnv.h"
GameEventMgr* GameEventMgr::instance()
{
diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h
index 22e9ee717f4..81fa6f02e81 100644
--- a/src/server/game/Events/GameEventMgr.h
+++ b/src/server/game/Events/GameEventMgr.h
@@ -23,8 +23,11 @@
#include "SharedDefines.h"
#include "Define.h"
#include "ObjectGuid.h"
+#include <list>
#include <map>
+#include <set>
#include <unordered_map>
+#include <vector>
#define max_ge_check_delay DAY // 1 day in seconds
diff --git a/src/server/game/Garrison/Garrison.cpp b/src/server/game/Garrison/Garrison.cpp
index f3a43abe3e0..b0fb39d3a94 100644
--- a/src/server/game/Garrison/Garrison.cpp
+++ b/src/server/game/Garrison/Garrison.cpp
@@ -17,10 +17,15 @@
#include "Garrison.h"
#include "Creature.h"
+#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "GameObject.h"
#include "GarrisonMgr.h"
+#include "Log.h"
+#include "Map.h"
#include "MapManager.h"
#include "ObjectMgr.h"
+#include "Player.h"
#include "VehicleDefines.h"
Garrison::Garrison(Player* owner) : _owner(owner), _siteLevel(nullptr), _followerActivationsRemainingToday(1)
diff --git a/src/server/game/Garrison/Garrison.h b/src/server/game/Garrison/Garrison.h
index edf23c1ceaf..dca1c5222d3 100644
--- a/src/server/game/Garrison/Garrison.h
+++ b/src/server/game/Garrison/Garrison.h
@@ -18,8 +18,16 @@
#ifndef Garrison_h__
#define Garrison_h__
-#include "Player.h"
+#include "Define.h"
+#include "DatabaseEnvFwd.h"
#include "GarrisonPackets.h"
+#include "Optional.h"
+#include <unordered_map>
+
+class GameObject;
+class Map;
+class Player;
+struct GarrSiteLevelEntry;
enum GarrisonType
{
@@ -166,9 +174,6 @@ enum GarrisonFollowerStatus
FOLLOWER_STATUS_NO_XP_GAIN = 0x10
};
-class GameObject;
-class Map;
-
class TC_GAME_API Garrison
{
public:
diff --git a/src/server/game/Garrison/GarrisonMap.cpp b/src/server/game/Garrison/GarrisonMap.cpp
index 0c93d764ba7..a83cfc6bcba 100644
--- a/src/server/game/Garrison/GarrisonMap.cpp
+++ b/src/server/game/Garrison/GarrisonMap.cpp
@@ -16,11 +16,14 @@
*/
#include "GarrisonMap.h"
+#include "DBCEnums.h"
#include "GameObject.h"
#include "Garrison.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "ObjectGridLoader.h"
+#include "Player.h"
+#include "World.h"
class GarrisonGridLoader
{
diff --git a/src/server/game/Garrison/GarrisonMgr.cpp b/src/server/game/Garrison/GarrisonMgr.cpp
index 9006dc4bfed..943fdc21858 100644
--- a/src/server/game/Garrison/GarrisonMgr.cpp
+++ b/src/server/game/Garrison/GarrisonMgr.cpp
@@ -18,11 +18,13 @@
#include "GarrisonMgr.h"
#include "Containers.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "Garrison.h"
-#include "ObjectDefines.h"
-#include "World.h"
-#include "GameObject.h"
+#include "Log.h"
#include "ObjectMgr.h"
+#include "Random.h"
+#include "Timer.h"
+#include "World.h"
GarrisonMgr& GarrisonMgr::Instance()
{
@@ -43,7 +45,7 @@ void GarrisonMgr::Initialize()
_garrisonBuildingsByPlot[plotBuilding->GarrPlotID].insert(plotBuilding->GarrBuildingID);
for (GarrBuildingPlotInstEntry const* buildingPlotInst : sGarrBuildingPlotInstStore)
- _garrisonBuildingPlotInstances[MAKE_PAIR64(buildingPlotInst->GarrBuildingID, buildingPlotInst->GarrSiteLevelPlotInstID)] = buildingPlotInst->ID;
+ _garrisonBuildingPlotInstances[std::make_pair(buildingPlotInst->GarrBuildingID, buildingPlotInst->GarrSiteLevelPlotInstID)] = buildingPlotInst->ID;
for (GarrBuildingEntry const* building : sGarrBuildingStore)
_garrisonBuildingsByType[building->Type].push_back(building->ID);
@@ -115,7 +117,7 @@ bool GarrisonMgr::IsPlotMatchingBuilding(uint32 garrPlotId, uint32 garrBuildingI
uint32 GarrisonMgr::GetGarrBuildingPlotInst(uint32 garrBuildingId, uint32 garrSiteLevelPlotInstId) const
{
- auto itr = _garrisonBuildingPlotInstances.find(MAKE_PAIR64(garrBuildingId, garrSiteLevelPlotInstId));
+ auto itr = _garrisonBuildingPlotInstances.find(std::make_pair(garrBuildingId, garrSiteLevelPlotInstId));
if (itr != _garrisonBuildingPlotInstances.end())
return itr->second;
diff --git a/src/server/game/Garrison/GarrisonMgr.h b/src/server/game/Garrison/GarrisonMgr.h
index 29f9d4187be..c7a0ec4af7b 100644
--- a/src/server/game/Garrison/GarrisonMgr.h
+++ b/src/server/game/Garrison/GarrisonMgr.h
@@ -18,7 +18,8 @@
#ifndef GarrisonMgr_h__
#define GarrisonMgr_h__
-#include "DB2Stores.h"
+#include "Define.h"
+#include "Hash.h"
#include "Position.h"
#include <list>
#include <set>
@@ -26,6 +27,12 @@
#include <unordered_set>
#include <vector>
+struct GameObjectsEntry;
+struct GarrAbilityEntry;
+struct GarrFollowerEntry;
+struct GarrSiteLevelEntry;
+struct GarrSiteLevelPlotInstEntry;
+
struct FinalizeGarrisonPlotGOInfo
{
struct
@@ -68,7 +75,7 @@ private:
std::unordered_map<uint32 /*garrSiteId*/, std::vector<GarrSiteLevelPlotInstEntry const*>> _garrisonPlotInstBySiteLevel;
std::unordered_map<uint32 /*mapId*/, std::unordered_map<uint32 /*garrPlotId*/, GameObjectsEntry const*>> _garrisonPlots;
std::unordered_map<uint32 /*garrPlotId*/, std::unordered_set<uint32/*garrBuildingId*/>> _garrisonBuildingsByPlot;
- std::unordered_map<uint64 /*garrBuildingId | garrSiteLevelPlotInstId << 32*/, uint32 /*garrBuildingPlotInstId*/> _garrisonBuildingPlotInstances;
+ std::unordered_map<std::pair<uint32 /*garrBuildingId*/, uint32 /*garrSiteLevelPlotInstId*/>, uint32 /*garrBuildingPlotInstId*/> _garrisonBuildingPlotInstances;
std::unordered_map<uint32 /*buildingType*/, std::vector<uint32>> _garrisonBuildingsByType;
std::unordered_map<uint32 /*garrPlotInstanceId*/, FinalizeGarrisonPlotGOInfo> _finalizePlotGOInfo;
std::unordered_map<uint32 /*garrFollowerId*/, GarrAbilities> _garrisonFollowerAbilities[2];
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 77696912612..f6a29f9b10f 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -17,37 +17,39 @@
*/
#include "ObjectMgr.h"
-#include "AccountMgr.h"
-#include "AchievementMgr.h"
-#include "ArenaTeam.h"
#include "ArenaTeamMgr.h"
-#include "BattlegroundMgr.h"
#include "Chat.h"
-#include "Common.h"
#include "DatabaseEnv.h"
#include "DB2Stores.h"
#include "DisableMgr.h"
#include "GameTables.h"
+#include "GridDefines.h"
#include "GossipDef.h"
#include "GroupMgr.h"
#include "GuildMgr.h"
-#include "InstanceSaveMgr.h"
-#include "Language.h"
+#include "Item.h"
#include "LFGMgr.h"
#include "Log.h"
+#include "LootMgr.h"
+#include "Mail.h"
#include "MapManager.h"
#include "Object.h"
+#include "ObjectAccessor.h"
+#include "ObjectDefines.h"
+#include "Player.h"
#include "PoolMgr.h"
+#include "QuestDef.h"
#include "Random.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
-#include "SpellAuras.h"
+#include "SpellInfo.h"
#include "SpellMgr.h"
#include "SpellScript.h"
-#include "Util.h"
+#include "TemporarySummon.h"
+#include "Timer.h"
#include "Vehicle.h"
-#include "World.h"
#include "VMapFactory.h"
+#include "World.h"
ScriptMapMap sSpellScripts;
ScriptMapMap sEventScripts;
@@ -2415,11 +2417,6 @@ void ObjectMgr::RemoveGameobjectFromGrid(ObjectGuid::LowType guid, GameObjectDat
}
}
-Player* ObjectMgr::GetPlayerByLowGUID(ObjectGuid::LowType lowguid) const
-{
- return ObjectAccessor::FindPlayer(ObjectGuid::Create<HighGuid::Player>(lowguid));
-}
-
// name must be checked to correctness (if received) before call this function
ObjectGuid ObjectMgr::GetPlayerGUIDByName(std::string const& name)
{
@@ -2434,12 +2431,6 @@ ObjectGuid ObjectMgr::GetPlayerGUIDByName(std::string const& name)
bool ObjectMgr::GetPlayerNameByGUID(ObjectGuid const& guid, std::string& name)
{
- if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
- {
- name = player->GetName();
- return true;
- }
-
CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid);
if (!characterInfo)
return false;
@@ -2450,13 +2441,6 @@ bool ObjectMgr::GetPlayerNameByGUID(ObjectGuid const& guid, std::string& name)
bool ObjectMgr::GetPlayerNameAndClassByGUID(ObjectGuid const& guid, std::string& name, uint8& _class)
{
- if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
- {
- name = player->GetName();
- _class = player->getClass();
- return true;
- }
-
if (CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid))
{
name = characterInfo->Name;
@@ -4717,6 +4701,18 @@ void ObjectMgr::LoadQuests()
TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " quests definitions in %u ms", _questTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
}
+void ObjectMgr::LoadQuestStartersAndEnders()
+{
+ TC_LOG_INFO("server.loading", "Loading GO Start Quest Data...");
+ LoadGameobjectQuestStarters();
+ TC_LOG_INFO("server.loading", "Loading GO End Quest Data...");
+ LoadGameobjectQuestEnders();
+ TC_LOG_INFO("server.loading", "Loading Creature Start Quest Data...");
+ LoadCreatureQuestStarters();
+ TC_LOG_INFO("server.loading", "Loading Creature End Quest Data...");
+ LoadCreatureQuestEnders();
+}
+
void ObjectMgr::LoadQuestTemplateLocale()
{
uint32 oldMSTime = getMSTime();
@@ -5485,7 +5481,7 @@ void ObjectMgr::LoadPageTextLocales()
if (locale == LOCALE_enUS)
continue;
- AddLocaleString(text, locale, data.Text);
+ data.Text[locale] = text;
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u PageText locale strings in %u ms", uint32(_pageTextLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
@@ -6350,6 +6346,22 @@ GraveYardData const* ObjectMgr::FindGraveYardData(uint32 id, uint32 zoneId) cons
return nullptr;
}
+AreaTriggerStruct const* ObjectMgr::GetAreaTrigger(uint32 trigger) const
+{
+ AreaTriggerContainer::const_iterator itr = _areaTriggerStore.find(trigger);
+ if (itr != _areaTriggerStore.end())
+ return &itr->second;
+ return nullptr;
+}
+
+AccessRequirement const* ObjectMgr::GetAccessRequirement(uint32 mapid, Difficulty difficulty) const
+{
+ AccessRequirementContainer::const_iterator itr = _accessRequirementStore.find(MAKE_PAIR64(mapid, difficulty));
+ if (itr != _accessRequirementStore.end())
+ return itr->second;
+ return nullptr;
+}
+
bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool persist /*= true*/)
{
if (FindGraveYardData(id, zoneId))
@@ -9498,6 +9510,14 @@ VehicleAccessoryList const* ObjectMgr::GetVehicleAccessoryList(Vehicle* veh) con
return nullptr;
}
+DungeonEncounterList const* ObjectMgr::GetDungeonEncounterList(uint32 mapId, Difficulty difficulty) const
+{
+ DungeonEncounterContainer::const_iterator itr = _dungeonEncounterStore.find(MAKE_PAIR64(mapId, difficulty));
+ if (itr != _dungeonEncounterStore.end())
+ return &itr->second;
+ return nullptr;
+}
+
PlayerInfo const* ObjectMgr::GetPlayerInfo(uint32 race, uint32 class_) const
{
if (race >= MAX_RACES)
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 621e5647753..6b76a98b425 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -19,7 +19,6 @@
#ifndef _OBJECTMGR_H
#define _OBJECTMGR_H
-#include "Log.h"
#include "Object.h"
#include "Bag.h"
#include "Creature.h"
@@ -31,11 +30,13 @@
#include "QuestDef.h"
#include "ItemTemplate.h"
#include "NPCHandler.h"
-#include "DatabaseEnv.h"
+#include "DatabaseEnvFwd.h"
#include "Mail.h"
#include "Map.h"
#include "ObjectAccessor.h"
#include "ObjectDefines.h"
+#include "ConditionMgr.h"
+#include "ItemTemplate.h"
#include "VehicleDefines.h"
#include "ConditionMgr.h"
#include "DB2Stores.h"
@@ -47,7 +48,9 @@
#include <memory>
class Item;
+class Vehicle;
struct AccessRequirement;
+struct DeclinedName;
struct PlayerInfo;
struct PlayerLevelInfo;
@@ -120,7 +123,18 @@ enum ScriptCommands
SCRIPT_COMMAND_PLAY_ANIMKIT = 36 // source = Creature, datalong = AnimKit id
};
-// Benchmarked: Faster than std::unordered_map (insert/find)
+enum ChatType
+{
+ CHAT_TYPE_SAY = 0,
+ CHAT_TYPE_YELL = 1,
+ CHAT_TYPE_TEXT_EMOTE = 2,
+ CHAT_TYPE_BOSS_EMOTE = 3,
+ CHAT_TYPE_WHISPER = 4,
+ CHAT_TYPE_BOSS_WHISPER = 5,
+ CHAT_TYPE_ZONE_YELL = 6,
+ CHAT_TYPE_END = 255
+};
+
typedef std::map<uint32, PageText> PageTextContainer;
// Benchmarked: Faster than std::map (insert/find)
@@ -417,6 +431,18 @@ struct AreaTriggerStruct
float target_Orientation;
};
+struct AccessRequirement
+{
+ uint8 levelMin;
+ uint8 levelMax;
+ uint32 item;
+ uint32 item2;
+ uint32 quest_A;
+ uint32 quest_H;
+ uint32 achievement;
+ std::string questFailedText;
+};
+
typedef std::set<ObjectGuid::LowType> CellGuidSet;
struct CellObjectGuids
{
@@ -445,7 +471,20 @@ typedef std::unordered_map<uint32, QuestObjectivesLocale> QuestObjectivesLocaleC
typedef std::unordered_map<uint32, QuestOfferRewardLocale> QuestOfferRewardLocaleContainer;
typedef std::unordered_map<uint32, QuestRequestItemsLocale> QuestRequestItemsLocaleContainer;
typedef std::unordered_map<uint32, PageTextLocale> PageTextLocaleContainer;
+
+struct GossipMenuItemsLocale
+{
+ std::vector<std::string> OptionText;
+ std::vector<std::string> BoxText;
+};
+
typedef std::unordered_map<uint32, GossipMenuItemsLocale> GossipMenuItemsLocaleContainer;
+
+struct PointOfInterestLocale
+{
+ std::vector<std::string> Name;
+};
+
typedef std::unordered_map<uint32, PointOfInterestLocale> PointOfInterestLocaleContainer;
typedef std::unordered_map<uint32, TrinityString> TrinityStringContainer;
@@ -455,6 +494,62 @@ typedef std::multimap<uint32, uint32> QuestRelationsReverse; // quest -> unit/go
typedef std::pair<QuestRelations::const_iterator, QuestRelations::const_iterator> QuestRelationBounds;
typedef std::pair<QuestRelationsReverse::const_iterator, QuestRelationsReverse::const_iterator> QuestRelationReverseBounds;
+
+struct PlayerCreateInfoItem
+{
+ PlayerCreateInfoItem(uint32 id, uint32 amount) : item_id(id), item_amount(amount) { }
+
+ uint32 item_id;
+ uint32 item_amount;
+};
+
+typedef std::list<PlayerCreateInfoItem> PlayerCreateInfoItems;
+
+struct PlayerLevelInfo
+{
+ PlayerLevelInfo() { for (uint8 i = 0; i < MAX_STATS; ++i) stats[i] = 0; }
+
+ uint16 stats[MAX_STATS];
+};
+
+typedef std::list<uint32> PlayerCreateInfoSpells;
+
+struct PlayerCreateInfoAction
+{
+ PlayerCreateInfoAction() : button(0), type(0), action(0) { }
+ PlayerCreateInfoAction(uint8 _button, uint32 _action, uint8 _type) : button(_button), type(_type), action(_action) { }
+
+ uint8 button;
+ uint8 type;
+ uint32 action;
+};
+
+typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions;
+
+typedef std::list<SkillRaceClassInfoEntry const*> PlayerCreateInfoSkills;
+
+struct PlayerInfo
+{
+ // existence checked by displayId != 0
+ PlayerInfo() : mapId(0), areaId(0), positionX(0.0f), positionY(0.0f), positionZ(0.0f), orientation(0.0f), displayId_m(0), displayId_f(0), levelInfo(nullptr) { }
+
+ uint32 mapId;
+ uint32 areaId;
+ float positionX;
+ float positionY;
+ float positionZ;
+ float orientation;
+ uint16 displayId_m;
+ uint16 displayId_f;
+ PlayerCreateInfoItems item;
+ PlayerCreateInfoSpells customSpells;
+ PlayerCreateInfoSpells castSpells;
+ PlayerCreateInfoActions action;
+ PlayerCreateInfoSkills skills;
+
+ PlayerLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1
+};
+
struct PetLevelInfo
{
PetLevelInfo() : health(0), mana(0), armor(0) { memset(stats, 0, sizeof(stats)); }
@@ -612,7 +707,6 @@ typedef std::pair<GraveYardContainer::iterator, GraveYardContainer::iterator> Gr
typedef std::unordered_map<uint32, VendorItemData> CacheVendorItemContainer;
typedef std::unordered_map<uint32, TrainerSpellData> CacheTrainerSpellContainer;
-typedef std::unordered_map<uint8, uint8> ExpansionRequirementContainer;
typedef std::unordered_map<uint32, std::string> RealmNameContainer;
struct SceneTemplate
@@ -719,8 +813,6 @@ class TC_GAME_API ObjectMgr
static ObjectMgr* instance();
- typedef std::unordered_map<uint32, Item*> ItemMap;
-
typedef std::unordered_map<uint32, Quest*> QuestMap;
typedef std::unordered_map<uint32 /*questObjectiveId*/, QuestObjective const*> QuestObjectivesByIdContainer;
@@ -740,8 +832,6 @@ class TC_GAME_API ObjectMgr
typedef std::map<uint32, uint32> CharacterConversionMap;
- Player* GetPlayerByLowGUID(ObjectGuid::LowType lowguid) const;
-
GameObjectTemplate const* GetGameObjectTemplate(uint32 entry) const;
GameObjectTemplateContainer const* GetGameObjectTemplates() const { return &_gameObjectTemplateStore; }
int LoadReferenceVendor(int32 vendor, int32 item, uint8 type, std::set<uint32> *skip_vendors);
@@ -859,22 +949,8 @@ class TC_GAME_API ObjectMgr
void LoadGraveyardZones();
GraveYardData const* FindGraveYardData(uint32 id, uint32 zone) const;
- AreaTriggerStruct const* GetAreaTrigger(uint32 trigger) const
- {
- AreaTriggerContainer::const_iterator itr = _areaTriggerStore.find(trigger);
- if (itr != _areaTriggerStore.end())
- return &itr->second;
- return nullptr;
- }
-
- AccessRequirement const* GetAccessRequirement(uint32 mapid, Difficulty difficulty) const
- {
- AccessRequirementContainer::const_iterator itr = _accessRequirementStore.find(MAKE_PAIR64(mapid, difficulty));
- if (itr != _accessRequirementStore.end())
- return itr->second;
- return nullptr;
- }
-
+ AreaTriggerStruct const* GetAreaTrigger(uint32 trigger) const;
+ AccessRequirement const* GetAccessRequirement(uint32 mapid, Difficulty difficulty) const;
AreaTriggerStruct const* GetGoBackTrigger(uint32 Map) const;
AreaTriggerStruct const* GetMapEntranceTrigger(uint32 Map) const;
@@ -927,26 +1003,10 @@ class TC_GAME_API ObjectMgr
VehicleAccessoryList const* GetVehicleAccessoryList(Vehicle* veh) const;
- DungeonEncounterList const* GetDungeonEncounterList(uint32 mapId, Difficulty difficulty) const
- {
- DungeonEncounterContainer::const_iterator itr = _dungeonEncounterStore.find(MAKE_PAIR64(mapId, difficulty));
- if (itr != _dungeonEncounterStore.end())
- return &itr->second;
- return nullptr;
- }
+ DungeonEncounterList const* GetDungeonEncounterList(uint32 mapId, Difficulty difficulty) const;
void LoadQuests();
- void LoadQuestStartersAndEnders()
- {
- TC_LOG_INFO("server.loading", "Loading GO Start Quest Data...");
- LoadGameobjectQuestStarters();
- TC_LOG_INFO("server.loading", "Loading GO End Quest Data...");
- LoadGameobjectQuestEnders();
- TC_LOG_INFO("server.loading", "Loading Creature Start Quest Data...");
- LoadCreatureQuestStarters();
- TC_LOG_INFO("server.loading", "Loading Creature End Quest Data...");
- LoadCreatureQuestEnders();
- }
+ void LoadQuestStartersAndEnders();
void LoadGameobjectQuestStarters();
void LoadGameobjectQuestEnders();
void LoadCreatureQuestStarters();
@@ -1399,7 +1459,7 @@ class TC_GAME_API ObjectMgr
std::string GetNormalizedRealmName(uint32 realm) const;
bool GetRealmName(uint32 realmId, std::string& name, std::string& normalizedName) const;
- ExpansionRequirementContainer const& GetRaceExpansionRequirements() const { return _raceExpansionRequirementStore; }
+ std::unordered_map<uint8, uint8> const& GetRaceExpansionRequirements() const { return _raceExpansionRequirementStore; }
uint8 GetRaceExpansionRequirement(uint8 race) const
{
auto itr = _raceExpansionRequirementStore.find(race);
@@ -1408,7 +1468,7 @@ class TC_GAME_API ObjectMgr
return EXPANSION_CLASSIC;
}
- ExpansionRequirementContainer const& GetClassExpansionRequirements() const { return _classExpansionRequirementStore; }
+ std::unordered_map<uint8, uint8> const& GetClassExpansionRequirements() const { return _classExpansionRequirementStore; }
uint8 GetClassExpansionRequirement(uint8 class_) const
{
auto itr = _classExpansionRequirementStore.find(class_);
@@ -1577,8 +1637,8 @@ class TC_GAME_API ObjectMgr
std::set<uint32> _difficultyEntries[MAX_CREATURE_DIFFICULTIES]; // already loaded difficulty 1 value in creatures, used in CheckCreatureTemplate
std::set<uint32> _hasDifficultyEntries[MAX_CREATURE_DIFFICULTIES]; // already loaded creatures with difficulty 1 values, used in CheckCreatureTemplate
- ExpansionRequirementContainer _raceExpansionRequirementStore;
- ExpansionRequirementContainer _classExpansionRequirementStore;
+ std::unordered_map<uint8, uint8> _raceExpansionRequirementStore;
+ std::unordered_map<uint8, uint8> _classExpansionRequirementStore;
RealmNameContainer _realmNameStore;
SceneTemplateContainer _sceneTemplateStore;
@@ -1591,7 +1651,6 @@ class TC_GAME_API ObjectMgr
GO_TO_CREATURE // GO is dependant on creature
};
- HotfixData _hotfixData;
std::set<uint32> _transportMaps; // Helper container storing map ids that are for transports only, loaded from gameobject_template
};
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp
index 5534dff3e38..91034942cd3 100644
--- a/src/server/game/Grids/ObjectGridLoader.cpp
+++ b/src/server/game/Grids/ObjectGridLoader.cpp
@@ -28,6 +28,7 @@
#include "World.h"
#include "CellImpl.h"
#include "CreatureAI.h"
+#include "Log.h"
void ObjectGridEvacuator::Visit(CreatureMapType &m)
{
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 788feed0193..51e72590afa 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -16,30 +16,33 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "Opcodes.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "Player.h"
-#include "Pet.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "GroupMgr.h"
#include "Group.h"
-#include "Formulas.h"
-#include "ObjectAccessor.h"
#include "Battleground.h"
#include "BattlegroundMgr.h"
-#include "MapManager.h"
+#include "Common.h"
+#include "DatabaseEnv.h"
+#include "Formulas.h"
+#include "GroupMgr.h"
#include "InstanceSaveMgr.h"
-#include "Util.h"
-#include "Random.h"
#include "LFGMgr.h"
-#include "UpdateFieldFlags.h"
-#include "SpellAuras.h"
-#include "PartyPackets.h"
+#include "Log.h"
+#include "LootMgr.h"
#include "LootPackets.h"
+#include "MapManager.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
+#include "PartyPackets.h"
+#include "Pet.h"
+#include "Player.h"
+#include "Random.h"
+#include "SpellAuras.h"
#include "UpdateData.h"
+#include "UpdateFieldFlags.h"
+#include "Util.h"
+#include "World.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
Roll::Roll(LootItem const& li) : itemid(li.itemid),
itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
@@ -76,9 +79,12 @@ Group::~Group()
if (m_bgGroup)
{
TC_LOG_DEBUG("bg.battleground", "Group::~Group: battleground group being deleted.");
- if (m_bgGroup->GetBgRaid(ALLIANCE) == this) m_bgGroup->SetBgRaid(ALLIANCE, NULL);
- else if (m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL);
- else TC_LOG_ERROR("misc", "Group::~Group: battleground group is not linked to the correct battleground.");
+ if (m_bgGroup->GetBgRaid(ALLIANCE) == this)
+ m_bgGroup->SetBgRaid(ALLIANCE, NULL);
+ else if (m_bgGroup->GetBgRaid(HORDE) == this)
+ m_bgGroup->SetBgRaid(HORDE, NULL);
+ else
+ TC_LOG_ERROR("misc", "Group::~Group: battleground group is not linked to the correct battleground.");
}
Rolls::iterator itr;
while (!RollId.empty())
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index 6fe7fda3c74..69d64e7754e 100644
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -21,10 +21,11 @@
#include "DBCEnums.h"
#include "GroupRefManager.h"
-#include "LootMgr.h"
+#include "Loot.h"
#include "QueryResult.h"
#include "SharedDefines.h"
#include "Object.h"
+#include <map>
class Battlefield;
class Battleground;
diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp
index 022f02346e7..f97115768c8 100644
--- a/src/server/game/Groups/GroupMgr.cpp
+++ b/src/server/game/Groups/GroupMgr.cpp
@@ -15,8 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
#include "GroupMgr.h"
+#include "Common.h"
+#include "DatabaseEnv.h"
#include "DB2Stores.h"
#include "InstanceSaveMgr.h"
#include "Log.h"
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 792a757493b..fdfb062104b 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -16,22 +16,24 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Guild.h"
#include "AccountMgr.h"
+#include "Bag.h"
#include "CalendarMgr.h"
+#include "CalendarPackets.h"
#include "Chat.h"
+#include "ChatPackets.h"
#include "Config.h"
#include "DatabaseEnv.h"
-#include "Guild.h"
#include "GuildFinderMgr.h"
#include "GuildMgr.h"
#include "GuildPackets.h"
#include "Language.h"
#include "Log.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
#include "ScriptMgr.h"
#include "SocialMgr.h"
-#include "Opcodes.h"
-#include "ChatPackets.h"
-#include "CalendarPackets.h"
#define MAX_GUILD_BANK_TAB_TEXT_LEN 500
#define EMBLEM_PRICE 10 * GOLD
@@ -656,6 +658,16 @@ void Guild::Member::ResetValues(bool weekly /* = false*/)
}
}
+Player* Guild::Member::FindPlayer() const
+{
+ return ObjectAccessor::FindPlayer(m_guid);
+}
+
+Player* Guild::Member::FindConnectedPlayer() const
+{
+ return ObjectAccessor::FindConnectedPlayer(m_guid);
+}
+
// Get amount of money/slots left for today.
// If (tabId == GUILD_BANK_MAX_TABS) return money amount.
// Otherwise return remaining items amount for specified tab.
@@ -2761,6 +2773,13 @@ void Guild::SetBankTabText(uint8 tabId, std::string const& text)
}
}
+void Guild::_DeleteMemberFromDB(ObjectGuid::LowType lowguid)
+{
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_MEMBER);
+ stmt->setUInt64(0, lowguid);
+ CharacterDatabase.Execute(stmt);
+}
+
// Private methods
void Guild::_CreateLogHolders()
{
diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h
index 238052fa943..99bad731a09 100644
--- a/src/server/game/Guilds/Guild.h
+++ b/src/server/game/Guilds/Guild.h
@@ -23,7 +23,6 @@
#include "World.h"
#include "Item.h"
#include "WorldPacket.h"
-#include "ObjectMgr.h"
#include "Player.h"
class Item;
@@ -396,8 +395,8 @@ private:
int32 GetBankWithdrawValue(uint8 tabId) const;
void ResetValues(bool weekly = false);
- inline Player* FindPlayer() const { return ObjectAccessor::FindPlayer(m_guid); }
- inline Player* FindConnectedPlayer() const { return ObjectAccessor::FindConnectedPlayer(m_guid); }
+ Player* FindPlayer() const;
+ Player* FindConnectedPlayer() const;
private:
ObjectGuid::LowType m_guildId;
@@ -937,12 +936,7 @@ private:
return nullptr;
}
- static inline void _DeleteMemberFromDB(ObjectGuid::LowType lowguid)
- {
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_MEMBER);
- stmt->setUInt64(0, lowguid);
- CharacterDatabase.Execute(stmt);
- }
+ static void _DeleteMemberFromDB(ObjectGuid::LowType lowguid);
// Creates log holders (either when loading or when creating guild)
void _CreateLogHolders();
diff --git a/src/server/game/Guilds/GuildFinderMgr.cpp b/src/server/game/Guilds/GuildFinderMgr.cpp
index 8182bc848dd..c057324e2c5 100644
--- a/src/server/game/Guilds/GuildFinderMgr.cpp
+++ b/src/server/game/Guilds/GuildFinderMgr.cpp
@@ -15,12 +15,24 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "GuildFinderMgr.h"
+#include "DatabaseEnv.h"
+#include "Guild.h"
#include "GuildMgr.h"
#include "GuildFinderPackets.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "World.h"
+MembershipRequest::MembershipRequest() : _availability(0), _classRoles(0), _interests(0), _time(time(NULL))
+{
+}
+
+MembershipRequest::MembershipRequest(ObjectGuid const& playerGUID, ObjectGuid const& guildId, uint32 availability, uint32 classRoles, uint32 interests, std::string comment, time_t submitTime) :
+ _comment(std::move(comment)), _guildId(guildId), _playerGUID(playerGUID), _availability(availability), _classRoles(classRoles), _interests(interests), _time(submitTime)
+{
+}
+
GuildFinderMgr::GuildFinderMgr()
{
}
@@ -102,7 +114,7 @@ void GuildFinderMgr::LoadMembershipRequests()
std::string comment = fields[5].GetString();
uint32 submitTime = fields[6].GetUInt32();
- MembershipRequest request(playerId, guildId, availability, classRoles, interests, comment, time_t(submitTime));
+ MembershipRequest request(playerId, guildId, availability, classRoles, interests, std::move(comment), time_t(submitTime));
_membershipRequestsByGuild[guildId][playerId] = request;
_membershipRequestsByPlayer[playerId][guildId] = request;
diff --git a/src/server/game/Guilds/GuildFinderMgr.h b/src/server/game/Guilds/GuildFinderMgr.h
index 5a08a1bead2..9e9f9ffb905 100644
--- a/src/server/game/Guilds/GuildFinderMgr.h
+++ b/src/server/game/Guilds/GuildFinderMgr.h
@@ -20,7 +20,11 @@
#include "Common.h"
#include "ObjectGuid.h"
-#include "GuildMgr.h"
+#include "SharedDefines.h"
+#include <unordered_map>
+
+class Guild;
+class Player;
enum GuildFinderOptionsInterest
{
@@ -58,22 +62,9 @@ enum GuildFinderOptionsLevel
struct MembershipRequest
{
public:
- MembershipRequest(MembershipRequest const& settings) : _comment(settings.GetComment())
- {
- _availability = settings.GetAvailability();
- _classRoles = settings.GetClassRoles();
- _interests = settings.GetInterests();
- _guildId = settings.GetGuildGuid();
- _playerGUID = settings.GetPlayerGUID();
- _time = settings.GetSubmitTime();
- }
-
- MembershipRequest(ObjectGuid const& playerGUID, ObjectGuid const& guildId, uint32 availability, uint32 classRoles, uint32 interests, std::string& comment, time_t submitTime) :
- _comment(comment), _guildId(guildId), _playerGUID(playerGUID), _availability(availability),
- _classRoles(classRoles), _interests(interests), _time(submitTime) {}
+ MembershipRequest();
- MembershipRequest() : _availability(0), _classRoles(0),
- _interests(0), _time(time(NULL)) {}
+ MembershipRequest(ObjectGuid const& playerGUID, ObjectGuid const& guildId, uint32 availability, uint32 classRoles, uint32 interests, std::string comment, time_t submitTime);
ObjectGuid const& GetGuildGuid() const { return _guildId; }
ObjectGuid const& GetPlayerGUID() const { return _playerGUID; }
diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp
index 3ddd511fe61..c7811b0b9ab 100644
--- a/src/server/game/Guilds/GuildMgr.cpp
+++ b/src/server/game/Guilds/GuildMgr.cpp
@@ -15,11 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
#include "GuildMgr.h"
+#include "DatabaseEnv.h"
+#include "Guild.h"
+#include "Log.h"
+#include "ObjectMgr.h"
GuildMgr::GuildMgr() : NextGuildId(UI64LIT(1))
-{ }
+{
+}
GuildMgr::~GuildMgr()
{
diff --git a/src/server/game/Guilds/GuildMgr.h b/src/server/game/Guilds/GuildMgr.h
index fda7a0c6271..4833c840e10 100644
--- a/src/server/game/Guilds/GuildMgr.h
+++ b/src/server/game/Guilds/GuildMgr.h
@@ -18,13 +18,21 @@
#ifndef _GUILDMGR_H
#define _GUILDMGR_H
-#include "Guild.h"
+#include "Define.h"
+#include "ObjectGuid.h"
+#include <unordered_map>
+#include <vector>
+
+class Guild;
+struct GuildReward;
class TC_GAME_API GuildMgr
{
private:
GuildMgr();
~GuildMgr();
+ GuildMgr(GuildMgr const&) = delete;
+ GuildMgr& operator=(GuildMgr const&) = delete;
public:
static GuildMgr* instance();
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index d9602987ace..e3edfe0f138 100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -16,17 +16,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
-#include "Player.h"
-#include "World.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
+#include "AccountMgr.h"
#include "AuctionHouseMgr.h"
-#include "Log.h"
+#include "AuctionHousePackets.h"
+#include "DatabaseEnv.h"
#include "Language.h"
+#include "Log.h"
+#include "ObjectMgr.h"
+#include "Player.h"
#include "Util.h"
-#include "AccountMgr.h"
-#include "AuctionHousePackets.h"
+#include "World.h"
+#include "WorldPacket.h"
//void called when player click on auctioneer npc
void WorldSession::HandleAuctionHelloOpcode(WorldPackets::AuctionHouse::AuctionHelloRequest& packet)
diff --git a/src/server/game/Handlers/AuthHandler.cpp b/src/server/game/Handlers/AuthHandler.cpp
index 016c324b232..ec0c536dbb5 100644
--- a/src/server/game/Handlers/AuthHandler.cpp
+++ b/src/server/game/Handlers/AuthHandler.cpp
@@ -21,7 +21,10 @@
#include "CharacterTemplateDataStore.h"
#include "ClientConfigPackets.h"
#include "ObjectMgr.h"
+#include "RBAC.h"
+#include "Realm.h"
#include "SystemPackets.h"
+#include "World.h"
void WorldSession::SendAuthResponse(uint32 code, bool queued, uint32 queuePos)
{
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index eccb616a4e4..03684097ed2 100644
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -26,6 +26,7 @@
#include "ArenaTeam.h"
#include "BattlegroundMgr.h"
#include "Battleground.h"
+#include "BattlegroundPackets.h"
#include "Chat.h"
#include "Language.h"
#include "Log.h"
diff --git a/src/server/game/Handlers/BlackMarketHandler.cpp b/src/server/game/Handlers/BlackMarketHandler.cpp
index e40618e84fd..7e8226fe5bb 100644
--- a/src/server/game/Handlers/BlackMarketHandler.cpp
+++ b/src/server/game/Handlers/BlackMarketHandler.cpp
@@ -15,12 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
+#include "BlackMarketMgr.h"
#include "BlackMarketPackets.h"
+#include "DatabaseEnv.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "BlackMarketMgr.h"
void WorldSession::HandleBlackMarketOpen(WorldPackets::BlackMarket::BlackMarketOpen& blackMarketOpen)
{
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index 470f5a18cc7..364ed390a61 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -35,18 +35,19 @@ Copied events should probably have a new owner
*/
+#include "WorldSession.h"
+#include "CalendarMgr.h"
+#include "CalendarPackets.h"
+#include "DatabaseEnv.h"
+#include "Guild.h"
+#include "GuildMgr.h"
#include "InstanceSaveMgr.h"
#include "Log.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "SocialMgr.h"
-#include "CalendarMgr.h"
-#include "ObjectMgr.h"
-#include "ObjectAccessor.h"
-#include "DatabaseEnv.h"
-#include "GuildMgr.h"
-#include "WorldSession.h"
-#include "CalendarPackets.h"
void WorldSession::HandleCalendarGetCalendar(WorldPackets::Calendar::CalendarGetCalendar& /*calendarGetCalendar*/)
{
diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp
index c86595a9314..8555099d033 100644
--- a/src/server/game/Handlers/ChannelHandler.cpp
+++ b/src/server/game/Handlers/ChannelHandler.cpp
@@ -16,12 +16,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h" // for normalizePlayerName
+#include "WorldSession.h"
+#include "Channel.h"
#include "ChannelMgr.h"
#include "ChannelPackets.h"
+#include "Log.h"
+#include "ObjectMgr.h" // for normalizePlayerName
#include "Player.h"
-#include "WorldSession.h"
-
#include <cctype>
static size_t const MAX_CHANNEL_NAME_STR = 0x31;
@@ -85,17 +86,34 @@ void WorldSession::HandleLeaveChannel(WorldPackets::Channel::LeaveChannel& packe
}
}
-template<void(Channel::*CommandFunction)(Player const*)>
-void WorldSession::HandleChannelCommand(WorldPackets::Channel::ChannelPlayerCommand& packet)
+void WorldSession::HandleChannelCommand(WorldPackets::Channel::ChannelCommand& packet)
{
TC_LOG_DEBUG("chat.system", "%s %s ChannelName: %s",
GetOpcodeNameForLogging(packet.GetOpcode()).c_str(), GetPlayerInfo().c_str(), packet.ChannelName.c_str());
if (Channel* channel = ChannelMgr::GetChannelForPlayerByNamePart(packet.ChannelName, GetPlayer()))
- (channel->*CommandFunction)(GetPlayer());
+ {
+ switch (packet.GetOpcode())
+ {
+ case CMSG_CHAT_CHANNEL_ANNOUNCEMENTS:
+ channel->Announce(GetPlayer());
+ break;
+ case CMSG_CHAT_CHANNEL_DECLINE_INVITE:
+ channel->DeclineInvite(GetPlayer());
+ break;
+ case CMSG_CHAT_CHANNEL_DISPLAY_LIST:
+ case CMSG_CHAT_CHANNEL_LIST:
+ channel->List(GetPlayer());
+ break;
+ case CMSG_CHAT_CHANNEL_OWNER:
+ channel->SendWhoOwner(GetPlayer());
+ break;
+ default:
+ break;
+ }
+ }
}
-template<void(Channel::*CommandFunction)(Player const*, std::string const&)>
void WorldSession::HandleChannelPlayerCommand(WorldPackets::Channel::ChannelPlayerCommand& packet)
{
if (packet.Name.length() >= MAX_CHANNEL_NAME_STR)
@@ -112,38 +130,60 @@ void WorldSession::HandleChannelPlayerCommand(WorldPackets::Channel::ChannelPlay
return;
if (Channel* channel = ChannelMgr::GetChannelForPlayerByNamePart(packet.ChannelName, GetPlayer()))
- (channel->*CommandFunction)(GetPlayer(), packet.Name);
+ {
+ switch (packet.GetOpcode())
+ {
+ case CMSG_CHAT_CHANNEL_BAN:
+ channel->Ban(GetPlayer(), packet.Name);
+ break;
+ case CMSG_CHAT_CHANNEL_INVITE:
+ channel->Invite(GetPlayer(), packet.Name);
+ break;
+ case CMSG_CHAT_CHANNEL_KICK:
+ channel->Kick(GetPlayer(), packet.Name);
+ break;
+ case CMSG_CHAT_CHANNEL_MODERATOR:
+ channel->SetModerator(GetPlayer(), packet.Name);
+ break;
+ case CMSG_CHAT_CHANNEL_MUTE:
+ channel->SetMute(GetPlayer(), packet.Name);
+ break;
+ case CMSG_CHAT_CHANNEL_SET_OWNER:
+ channel->SetOwner(GetPlayer(), packet.Name);
+ break;
+ case CMSG_CHAT_CHANNEL_SILENCE_ALL:
+ channel->SilenceAll(GetPlayer(), packet.Name);
+ break;
+ case CMSG_CHAT_CHANNEL_UNBAN:
+ channel->UnBan(GetPlayer(), packet.Name);
+ break;
+ case CMSG_CHAT_CHANNEL_UNMODERATOR:
+ channel->UnsetModerator(GetPlayer(), packet.Name);
+ break;
+ case CMSG_CHAT_CHANNEL_UNMUTE:
+ channel->UnsetMute(GetPlayer(), packet.Name);
+ break;
+ case CMSG_CHAT_CHANNEL_UNSILENCE_ALL:
+ channel->UnsilenceAll(GetPlayer(), packet.Name);
+ break;
+ default:
+ break;
+ }
+ }
}
-template<>
-void WorldSession::HandleChannelPlayerCommand<&Channel::Password>(WorldPackets::Channel::ChannelPlayerCommand& packet)
+void WorldSession::HandleChannelPassword(WorldPackets::Channel::ChannelPassword& packet)
{
- if (packet.Name.length() > MAX_CHANNEL_PASS_STR)
+ if (packet.Password.length() > MAX_CHANNEL_PASS_STR)
{
TC_LOG_DEBUG("chat.system", "%s %s ChannelName: %s, Password: %s, Password too long.",
- GetOpcodeNameForLogging(packet.GetOpcode()).c_str(), GetPlayerInfo().c_str(), packet.ChannelName.c_str(), packet.Name.c_str());
+ GetOpcodeNameForLogging(packet.GetOpcode()).c_str(), GetPlayerInfo().c_str(), packet.ChannelName.c_str(), packet.Password.c_str());
return;
}
TC_LOG_DEBUG("chat.system", "%s %s ChannelName: %s, Password: %s",
- GetOpcodeNameForLogging(packet.GetOpcode()).c_str(), GetPlayerInfo().c_str(), packet.ChannelName.c_str(), packet.Name.c_str());
+ GetOpcodeNameForLogging(packet.GetOpcode()).c_str(), GetPlayerInfo().c_str(), packet.ChannelName.c_str(), packet.Password.c_str());
if (Channel* channel = ChannelMgr::GetChannelForPlayerByNamePart(packet.ChannelName, GetPlayer()))
- channel->Password(GetPlayer(), packet.Name);
+ channel->Password(GetPlayer(), packet.Password);
}
-
-template void WorldSession::HandleChannelCommand<&Channel::Announce>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelPlayerCommand<&Channel::Ban>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelCommand<&Channel::DeclineInvite>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelPlayerCommand<&Channel::Invite>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelPlayerCommand<&Channel::Kick>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelCommand<&Channel::List>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelPlayerCommand<&Channel::SetModerator>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelPlayerCommand<&Channel::SetMute>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelCommand<&Channel::SendWhoOwner>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelPlayerCommand<&Channel::SetOwner>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelPlayerCommand<&Channel::SilenceAll>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelPlayerCommand<&Channel::UnBan>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelPlayerCommand<&Channel::UnsetModerator>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelPlayerCommand<&Channel::UnsetMute>(WorldPackets::Channel::ChannelPlayerCommand&);
-template void WorldSession::HandleChannelPlayerCommand<&Channel::UnsilenceAll>(WorldPackets::Channel::ChannelPlayerCommand&);
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index c9569c85e51..3df0c716189 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -16,11 +16,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
#include "AccountMgr.h"
#include "ArenaTeam.h"
#include "ArenaTeamMgr.h"
#include "AuthenticationPackets.h"
#include "Battleground.h"
+#include "BattlegroundPackets.h"
#include "BattlePetPackets.h"
#include "CalendarMgr.h"
#include "CharacterPackets.h"
@@ -29,24 +31,25 @@
#include "Common.h"
#include "DatabaseEnv.h"
#include "EquipmentSetPackets.h"
+#include "GitRevision.h"
#include "Group.h"
#include "Guild.h"
#include "GuildFinderMgr.h"
#include "GuildMgr.h"
#include "Language.h"
#include "Log.h"
+#include "Metric.h"
#include "MiscPackets.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Pet.h"
-#include "PlayerDump.h"
#include "Player.h"
-#include "QueryCallback.h"
+#include "PlayerDump.h"
#include "QueryHolder.h"
#include "QueryPackets.h"
+#include "Realm.h"
#include "ReputationMgr.h"
-#include "GitRevision.h"
#include "ScriptMgr.h"
#include "SharedDefines.h"
#include "SocialMgr.h"
@@ -54,8 +57,6 @@
#include "Util.h"
#include "World.h"
#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "Metric.h"
class LoginQueryHolder : public SQLQueryHolder
{
diff --git a/src/server/game/Handlers/GarrisonHandler.cpp b/src/server/game/Handlers/GarrisonHandler.cpp
index 3b7b71a1286..33f57a85175 100644
--- a/src/server/game/Handlers/GarrisonHandler.cpp
+++ b/src/server/game/Handlers/GarrisonHandler.cpp
@@ -18,6 +18,7 @@
#include "WorldSession.h"
#include "Garrison.h"
#include "GarrisonPackets.h"
+#include "Player.h"
void WorldSession::HandleGetGarrisonInfo(WorldPackets::Garrison::GetGarrisonInfo& /*getGarrisonInfo*/)
{
diff --git a/src/server/game/Handlers/GuildFinderHandler.cpp b/src/server/game/Handlers/GuildFinderHandler.cpp
index 4d42e67b275..80cc0082e28 100644
--- a/src/server/game/Handlers/GuildFinderHandler.cpp
+++ b/src/server/game/Handlers/GuildFinderHandler.cpp
@@ -16,13 +16,15 @@
*/
#include "WorldSession.h"
-#include "WorldPacket.h"
-#include "Object.h"
-#include "SharedDefines.h"
+#include "Guild.h"
#include "GuildFinderMgr.h"
-#include "GuildMgr.h"
#include "GuildFinderPackets.h"
+#include "GuildMgr.h"
+#include "Object.h"
+#include "Player.h"
+#include "SharedDefines.h"
#include "World.h"
+#include "WorldPacket.h"
void WorldSession::HandleGuildFinderAddRecruit(WorldPackets::GuildFinder::LFGuildAddRecruit& lfGuildAddRecruit)
{
diff --git a/src/server/game/Handlers/HotfixHandler.cpp b/src/server/game/Handlers/HotfixHandler.cpp
index 656afb6858f..7278252275c 100644
--- a/src/server/game/Handlers/HotfixHandler.cpp
+++ b/src/server/game/Handlers/HotfixHandler.cpp
@@ -20,6 +20,7 @@
#include "DB2Stores.h"
#include "HotfixPackets.h"
#include "Log.h"
+#include "World.h"
void WorldSession::HandleDBQueryBulk(WorldPackets::Hotfix::DBQueryBulk& dbQuery)
{
diff --git a/src/server/game/Handlers/InspectHandler.cpp b/src/server/game/Handlers/InspectHandler.cpp
index df660266a55..d4e94a26d89 100644
--- a/src/server/game/Handlers/InspectHandler.cpp
+++ b/src/server/game/Handlers/InspectHandler.cpp
@@ -17,9 +17,13 @@
*/
#include "WorldSession.h"
+#include "Guild.h"
#include "GuildMgr.h"
#include "InspectPackets.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "World.h"
void WorldSession::HandleInspectOpcode(WorldPackets::Inspect::Inspect& inspect)
{
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 4a69c2501b4..2421d30a6f6 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -16,18 +16,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "Opcodes.h"
+#include "BattlePetMgr.h"
+#include "Common.h"
+#include "DatabaseEnv.h"
+#include "DB2Stores.h"
+#include "Item.h"
+#include "ItemPackets.h"
#include "Log.h"
+#include "NPCPackets.h"
#include "ObjectMgr.h"
+#include "Opcodes.h"
#include "Player.h"
-#include "Item.h"
-#include "DB2Stores.h"
-#include "NPCPackets.h"
-#include "ItemPackets.h"
-#include "BattlePetMgr.h"
+#include "WorldSession.h"
void WorldSession::HandleSplitItemOpcode(WorldPackets::Item::SplitItem& splitItem)
{
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index 2a74219e299..c743ec8cec6 100644
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -15,13 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
+#include "Group.h"
#include "LFGMgr.h"
+#include "Log.h"
#include "ObjectMgr.h"
-#include "Group.h"
-#include "Player.h"
#include "Opcodes.h"
+#include "Player.h"
#include "WorldPacket.h"
-#include "WorldSession.h"
void BuildPlayerLockDungeonBlock(WorldPacket& data, lfg::LfgLockMap const& lock)
{
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index b674180f9b7..a383dd7f660 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -16,22 +16,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
+#include "CellImpl.h"
#include "Common.h"
-#include "Log.h"
#include "Corpse.h"
#include "Creature.h"
#include "GameObject.h"
-#include "CellImpl.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
+#include "Guild.h"
#include "GuildMgr.h"
+#include "Log.h"
#include "LootMgr.h"
-#include "ObjectAccessor.h"
+#include "LootPackets.h"
#include "Object.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "WorldPacket.h"
-#include "LootPackets.h"
-#include "WorldSession.h"
class AELootCreatureCheck
{
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index abaa191cd48..6685c693f83 100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -15,21 +15,22 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "DatabaseEnv.h"
-#include "Mail.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
-#include "Opcodes.h"
-#include "Log.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "Player.h"
-#include "MailPackets.h"
-#include "Language.h"
-#include "Item.h"
#include "AccountMgr.h"
#include "BattlenetAccountMgr.h"
+#include "DatabaseEnv.h"
+#include "Guild.h"
#include "GuildMgr.h"
+#include "Item.h"
+#include "Language.h"
+#include "Log.h"
+#include "Mail.h"
+#include "MailPackets.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
+#include "Player.h"
+#include "World.h"
+#include "WorldPacket.h"
bool WorldSession::CanOpenMailBox(ObjectGuid guid)
{
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index e99e1dc2879..59a7266e80e 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -16,41 +16,42 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
+#include "AccountMgr.h"
+#include "AchievementPackets.h"
+#include "AreaTriggerPackets.h"
+#include "Battleground.h"
+#include "CharacterPackets.h"
+#include "Chat.h"
+#include "ClientConfigPackets.h"
#include "Common.h"
-#include "Language.h"
#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "Opcodes.h"
-#include "Log.h"
-#include "Player.h"
+#include "DBCEnums.h"
#include "GossipDef.h"
-#include "World.h"
-#include "ObjectMgr.h"
+#include "Group.h"
+#include "Guild.h"
#include "GuildMgr.h"
-#include "WorldSession.h"
-#include "Chat.h"
-#include "zlib.h"
-#include "ObjectAccessor.h"
+#include "InstancePackets.h"
+#include "InstanceScript.h"
+#include "Language.h"
+#include "Log.h"
+#include "MapManager.h"
+#include "MiscPackets.h"
#include "Object.h"
-#include "Battleground.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
#include "OutdoorPvP.h"
-#include "AccountMgr.h"
-#include "DBCEnums.h"
+#include "Player.h"
#include "ScriptMgr.h"
-#include "MapManager.h"
-#include "Group.h"
#include "Spell.h"
#include "SpellPackets.h"
-#include "CharacterPackets.h"
-#include "ClientConfigPackets.h"
-#include "MiscPackets.h"
-#include "AchievementPackets.h"
#include "WhoPackets.h"
-#include "InstancePackets.h"
-#include "InstanceScript.h"
-#include "AreaTriggerPackets.h"
+#include "World.h"
+#include "WorldPacket.h"
#include <boost/thread/shared_mutex.hpp>
#include <boost/thread/locks.hpp>
+#include <zlib.h>
void WorldSession::HandleRepopRequest(WorldPackets::Misc::RepopRequest& /*packet*/)
{
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index ce0275f3d19..726992fd872 100644
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -19,7 +19,6 @@
#include "Common.h"
#include "Language.h"
#include "DatabaseEnv.h"
-#include "QueryCallback.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Opcodes.h"
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index 1e32d27022b..9df8373cf9a 100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -16,27 +16,28 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
-#include "ObjectMgr.h"
-#include "SpellMgr.h"
+#include "Common.h"
+#include "CreatureAI.h"
+#include "DatabaseEnv.h"
+#include "Group.h"
#include "Log.h"
-#include "Opcodes.h"
-#include "Spell.h"
#include "ObjectAccessor.h"
-#include "CreatureAI.h"
-#include "Util.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
#include "Pet.h"
#include "PetPackets.h"
-#include "World.h"
-#include "Group.h"
+#include "PetPackets.h"
+#include "Player.h"
+#include "QueryPackets.h"
+#include "Spell.h"
#include "SpellHistory.h"
#include "SpellInfo.h"
-#include "Player.h"
-#include "PetPackets.h"
+#include "SpellMgr.h"
#include "SpellPackets.h"
-#include "QueryPackets.h"
+#include "Util.h"
+#include "World.h"
+#include "WorldPacket.h"
void WorldSession::HandleDismissCritter(WorldPackets::Pet::DismissCritter& packet)
{
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index a0b220b893e..3d3d782b225 100644
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -16,16 +16,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
-#include "World.h"
-#include "ObjectMgr.h"
+#include "Common.h"
+#include "DatabaseEnv.h"
+#include "Guild.h"
#include "GuildMgr.h"
#include "Log.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
-#include "Guild.h"
#include "PetitionPackets.h"
+#include "World.h"
+#include "WorldPacket.h"
+#include <sstream>
#define CHARTER_DISPLAY_ID 16161
#define GUILD_CHARTER_ITEM_ID 5863
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index 2e1b52a4001..cce3923a8aa 100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -16,17 +16,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
#include "Common.h"
#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
#include "Log.h"
-#include "World.h"
+#include "MapManager.h"
+#include "NPCHandler.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "NPCHandler.h"
-#include "MapManager.h"
#include "QueryPackets.h"
+#include "Realm.h"
+#include "World.h"
+#include "WorldPacket.h"
void WorldSession::SendNameQueryOpcode(ObjectGuid guid)
{
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index 72170f61d2b..42fddac2ac4 100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -16,21 +16,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
+#include "Battleground.h"
#include "Common.h"
+#include "DatabaseEnv.h"
+#include "GameObjectAI.h"
+#include "GossipDef.h"
+#include "Group.h"
#include "Log.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "World.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "GossipDef.h"
#include "QuestDef.h"
-#include "ObjectAccessor.h"
-#include "Group.h"
-#include "Battleground.h"
-#include "ScriptMgr.h"
-#include "GameObjectAI.h"
#include "QuestPackets.h"
+#include "ScriptMgr.h"
+#include "UnitAI.h"
+#include "World.h"
+#include "WorldPacket.h"
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPackets::Quest::QuestGiverStatusQuery& packet)
{
@@ -91,7 +93,7 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPackets::Quest::QuestGiverHe
_player->PrepareGossipMenu(creature, creature->GetCreatureTemplate()->GossipMenuId, true);
_player->SendPreparedGossip(creature);
- creature->AI()->sGossipHello(_player);
+ creature->GetAI()->sGossipHello(_player);
}
void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPackets::Quest::QuestGiverAcceptQuest& packet)
@@ -361,7 +363,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPackets::Quest::Quest
}
if (creatureQGiver)
- creatureQGiver->AI()->sQuestReward(_player, quest, packet.ItemChoiceID);
+ creatureQGiver->GetAI()->sQuestReward(_player, quest, packet.ItemChoiceID);
}
break;
}
diff --git a/src/server/game/Handlers/ReferAFriendHandler.cpp b/src/server/game/Handlers/ReferAFriendHandler.cpp
index 688eb96b1f5..e002e19f901 100644
--- a/src/server/game/Handlers/ReferAFriendHandler.cpp
+++ b/src/server/game/Handlers/ReferAFriendHandler.cpp
@@ -16,10 +16,11 @@
*/
#include "WorldSession.h"
-#include "Player.h"
-#include "ObjectMgr.h"
#include "Log.h"
+#include "ObjectMgr.h"
+#include "Player.h"
#include "ReferAFriendPackets.h"
+#include "World.h"
inline uint32 GetMaxLevelForExpansion(uint32 expansion)
{
diff --git a/src/server/game/Handlers/SocialHandler.cpp b/src/server/game/Handlers/SocialHandler.cpp
index 3989e76e56a..e15584b771b 100644
--- a/src/server/game/Handlers/SocialHandler.cpp
+++ b/src/server/game/Handlers/SocialHandler.cpp
@@ -17,11 +17,16 @@
*/
#include "WorldSession.h"
+#include "AccountMgr.h"
+#include "DatabaseEnv.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "Player.h"
-#include "QueryCallback.h"
+#include "RBAC.h"
+#include "Realm.h"
#include "SocialMgr.h"
#include "SocialPackets.h"
-#include "ObjectMgr.h"
+#include "World.h"
void WorldSession::HandleContactListOpcode(WorldPackets::Social::SendContactList& packet)
{
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index a65b79daa40..8336e448157 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -19,9 +19,10 @@
#include "WorldSession.h"
#include "CollectionMgr.h"
#include "Common.h"
-#include "Config.h"
+#include "DatabaseEnv.h"
#include "GameObjectAI.h"
#include "GameObjectPackets.h"
+#include "Guild.h"
#include "GuildMgr.h"
#include "Log.h"
#include "Player.h"
@@ -33,6 +34,7 @@
#include "SpellPackets.h"
#include "Totem.h"
#include "TotemPackets.h"
+#include "World.h"
void WorldSession::HandleUseItemOpcode(WorldPackets::Spells::UseItem& packet)
{
diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp
index e5afc68e4b5..99d1cd6e886 100644
--- a/src/server/game/Handlers/TicketHandler.cpp
+++ b/src/server/game/Handlers/TicketHandler.cpp
@@ -17,6 +17,7 @@
*/
#include "Common.h"
+#include "DatabaseEnv.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
diff --git a/src/server/game/Handlers/ToyHandler.cpp b/src/server/game/Handlers/ToyHandler.cpp
index bc6880a6db0..39d322be0d5 100644
--- a/src/server/game/Handlers/ToyHandler.cpp
+++ b/src/server/game/Handlers/ToyHandler.cpp
@@ -15,9 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
#include "Item.h"
+#include "Log.h"
#include "ToyPackets.h"
-#include "WorldSession.h"
void WorldSession::HandleAddToy(WorldPackets::Toy::AddToy& packet)
{
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index 5a03f812cd6..d14d07c886a 100644
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -16,20 +16,21 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
-#include "World.h"
-#include "ObjectAccessor.h"
+#include "AccountMgr.h"
+#include "Common.h"
+#include "DatabaseEnv.h"
+#include "Item.h"
+#include "Language.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "Item.h"
-#include "Spell.h"
#include "SocialMgr.h"
-#include "Language.h"
-#include "AccountMgr.h"
-#include "TradePackets.h"
+#include "Spell.h"
#include "TradeData.h"
+#include "TradePackets.h"
+#include "World.h"
+#include "WorldPacket.h"
void WorldSession::SendTradeStatus(WorldPackets::Trade::TradeStatus& info)
{
diff --git a/src/server/game/Handlers/TransmogrificationHandler.cpp b/src/server/game/Handlers/TransmogrificationHandler.cpp
index a128f83d19a..3e3f779b4d6 100644
--- a/src/server/game/Handlers/TransmogrificationHandler.cpp
+++ b/src/server/game/Handlers/TransmogrificationHandler.cpp
@@ -17,6 +17,7 @@
#include "WorldSession.h"
#include "CollectionMgr.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "TransmogrificationPackets.h"
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index 1347b823711..d3f3d4c1ea9 100644
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -16,22 +16,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "InstanceSaveMgr.h"
#include "Common.h"
-#include "Player.h"
+#include "Config.h"
+#include "DatabaseEnv.h"
#include "GridNotifiers.h"
-#include "Log.h"
#include "GridStates.h"
+#include "Group.h"
+#include "InstanceScenario.h"
+#include "InstanceScript.h"
+#include "Log.h"
#include "Map.h"
-#include "MapManager.h"
#include "MapInstanced.h"
-#include "InstanceSaveMgr.h"
-#include "Timer.h"
-#include "Config.h"
+#include "MapManager.h"
#include "ObjectMgr.h"
+#include "Player.h"
+#include "Timer.h"
#include "World.h"
-#include "Group.h"
-#include "InstanceScript.h"
-#include "InstanceScenario.h"
uint16 InstanceSaveManager::ResetTimeDelay[] = {3600, 900, 300, 60};
diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h
index 63a2864d20b..1836970a7a8 100644
--- a/src/server/game/Instances/InstanceSaveMgr.h
+++ b/src/server/game/Instances/InstanceSaveMgr.h
@@ -25,7 +25,7 @@
#include <unordered_map>
#include "Define.h"
-#include "DatabaseEnv.h"
+#include "DatabaseEnvFwd.h"
#include "DBCEnums.h"
#include "ObjectDefines.h"
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index c554bac3aee..7b0cd9305da 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -16,23 +16,25 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "InstanceScript.h"
#include "Creature.h"
#include "CreatureAI.h"
#include "DatabaseEnv.h"
#include "GameObject.h"
#include "Group.h"
-#include "InstanceScript.h"
#include "InstancePackets.h"
+#include "InstanceScenario.h"
#include "LFGMgr.h"
#include "Log.h"
#include "Map.h"
-#include "Player.h"
-#include "Pet.h"
-#include "WorldSession.h"
#include "Opcodes.h"
-#include "ScriptReloadMgr.h"
+#include "Pet.h"
+#include "Player.h"
+#include "RBAC.h"
#include "ScriptMgr.h"
-#include "InstanceScenario.h"
+#include "ScriptReloadMgr.h"
+#include "WorldSession.h"
+#include <sstream>
BossBoundaryData::~BossBoundaryData()
{
diff --git a/src/server/game/Loot/Loot.cpp b/src/server/game/Loot/Loot.cpp
new file mode 100644
index 00000000000..406c616ccc0
--- /dev/null
+++ b/src/server/game/Loot/Loot.cpp
@@ -0,0 +1,828 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Loot.h"
+#include "DatabaseEnv.h"
+#include "DB2Stores.h"
+#include "Group.h"
+#include "ItemTemplate.h"
+#include "Log.h"
+#include "LootMgr.h"
+#include "LootPackets.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "Random.h"
+#include "World.h"
+
+//
+// --------- LootItem ---------
+//
+
+// Constructor, copies most fields from LootStoreItem and generates random count
+LootItem::LootItem(LootStoreItem const& li)
+{
+ itemid = li.itemid;
+ conditions = li.conditions;
+
+ ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid);
+ freeforall = proto && (proto->GetFlags() & ITEM_FLAG_MULTI_DROP);
+ follow_loot_rules = proto && (proto->FlagsCu & ITEM_FLAGS_CU_FOLLOW_LOOT_RULES);
+
+ needs_quest = li.needs_quest;
+
+ randomSuffix = GenerateEnchSuffixFactor(itemid);
+ randomPropertyId = GenerateItemRandomPropertyId(itemid);
+ upgradeId = sDB2Manager.GetRulesetItemUpgrade(itemid);
+ context = 0;
+ count = 0;
+ is_looted = 0;
+ 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
+bool LootItem::AllowedForPlayer(Player const* player) const
+{
+ // DB conditions check
+ if (!sConditionMgr->IsObjectMeetToConditions(const_cast<Player*>(player), conditions))
+ return false;
+
+ ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid);
+ if (!pProto)
+ return false;
+
+ // not show loot for players without profession or those who already know the recipe
+ if ((pProto->GetFlags() & ITEM_FLAG_HIDE_UNUSABLE_RECIPE) && (!player->HasSkill(pProto->GetRequiredSkill()) || player->HasSpell(pProto->Effects[1]->SpellID)))
+ return false;
+
+ // not show loot for not own team
+ if ((pProto->GetFlags2() & ITEM_FLAG2_FACTION_HORDE) && player->GetTeam() != HORDE)
+ return false;
+
+ if ((pProto->GetFlags2() & ITEM_FLAG2_FACTION_ALLIANCE) && player->GetTeam() != ALLIANCE)
+ return false;
+
+ // check quest requirements
+ if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->GetStartQuest() && player->GetQuestStatus(pProto->GetStartQuest()) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid)))
+ return false;
+
+ // Don't show bind-when-picked-up unique items if player already has the maximum allowed quantity.
+ if (pProto->GetBonding() == BIND_ON_ACQUIRE && pProto->GetMaxCount() && player->GetItemCount(itemid, true) >= pProto->GetMaxCount())
+ return false;
+
+ return true;
+}
+
+void LootItem::AddAllowedLooter(const Player* player)
+{
+ allowedGUIDs.insert(player->GetGUID());
+}
+
+//
+// --------- Loot ---------
+//
+
+Loot::Loot(uint32 _gold /*= 0*/) : gold(_gold), unlootedCount(0), roundRobinPlayer(), loot_type(LOOT_CORPSE), maxDuplicates(1), _difficultyBonusTreeMod(0)
+{
+}
+
+Loot::~Loot()
+{
+ clear();
+}
+
+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->setUInt64(0, containerID.GetCounter());
+ 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 = false;
+ break;
+ }
+}
+
+void Loot::DeleteLootMoneyFromContainerItemDB()
+{
+ // Deletes money loot associated with an openable item from the DB
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY);
+ stmt->setUInt64(0, containerID.GetCounter());
+ CharacterDatabase.Execute(stmt);
+}
+
+void Loot::clear()
+{
+ for (QuestItemMap::const_iterator itr = PlayerQuestItems.begin(); itr != PlayerQuestItems.end(); ++itr)
+ delete itr->second;
+ PlayerQuestItems.clear();
+
+ for (QuestItemMap::const_iterator itr = PlayerFFAItems.begin(); itr != PlayerFFAItems.end(); ++itr)
+ delete itr->second;
+ PlayerFFAItems.clear();
+
+ for (QuestItemMap::const_iterator itr = PlayerNonQuestNonFFAConditionalItems.begin(); itr != PlayerNonQuestNonFFAConditionalItems.end(); ++itr)
+ delete itr->second;
+ PlayerNonQuestNonFFAConditionalItems.clear();
+
+ PlayersLooting.clear();
+ items.clear();
+ quest_items.clear();
+ gold = 0;
+ unlootedCount = 0;
+ roundRobinPlayer.Clear();
+ loot_type = LOOT_NONE;
+ i_LootValidatorRefManager.clearReferences();
+ _difficultyBonusTreeMod = 0;
+}
+
+void Loot::NotifyItemRemoved(uint8 lootIndex)
+{
+ // notify all players that are looting this that the item was removed
+ // convert the index to the slot the player sees
+ GuidSet::iterator i_next;
+ for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
+ {
+ i_next = i;
+ ++i_next;
+ if (Player* player = ObjectAccessor::FindPlayer(*i))
+ player->SendNotifyLootItemRemoved(GetGUID(), lootIndex);
+ else
+ PlayersLooting.erase(i);
+ }
+}
+
+void Loot::NotifyQuestItemRemoved(uint8 questIndex)
+{
+ // when a free for all questitem is looted
+ // all players will get notified of it being removed
+ // (other questitems can be looted by each group member)
+ // bit inefficient but isn't called often
+
+ GuidSet::iterator i_next;
+ for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
+ {
+ i_next = i;
+ ++i_next;
+ if (Player* player = ObjectAccessor::FindPlayer(*i))
+ {
+ QuestItemMap::const_iterator pq = PlayerQuestItems.find(player->GetGUID());
+ if (pq != PlayerQuestItems.end() && pq->second)
+ {
+ // find where/if the player has the given item in it's vector
+ QuestItemList& pql = *pq->second;
+
+ uint8 j;
+ for (j = 0; j < pql.size(); ++j)
+ if (pql[j].index == questIndex)
+ break;
+
+ if (j < pql.size())
+ player->SendNotifyLootItemRemoved(GetGUID(), items.size() + j);
+ }
+ }
+ else
+ PlayersLooting.erase(i);
+ }
+}
+
+void Loot::NotifyMoneyRemoved()
+{
+ // notify all players that are looting this that the money was removed
+ GuidSet::iterator i_next;
+ for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
+ {
+ i_next = i;
+ ++i_next;
+ if (Player* player = ObjectAccessor::FindPlayer(*i))
+ player->SendNotifyLootMoneyRemoved(GetGUID());
+ else
+ PlayersLooting.erase(i);
+ }
+}
+
+void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
+{
+ if (maxAmount > 0)
+ {
+ if (maxAmount <= minAmount)
+ gold = uint32(maxAmount * sWorld->getRate(RATE_DROP_MONEY));
+ else if ((maxAmount - minAmount) < 32700)
+ gold = uint32(urand(minAmount, maxAmount) * sWorld->getRate(RATE_DROP_MONEY));
+ else
+ gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld->getRate(RATE_DROP_MONEY)) << 8;
+ }
+}
+
+// Calls processor of corresponding LootTemplate (which handles everything including references)
+bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bool personal, bool noEmptyError, uint16 lootMode /*= LOOT_MODE_DEFAULT*/)
+{
+ // Must be provided
+ if (!lootOwner)
+ return false;
+
+ LootTemplate const* tab = store.GetLootFor(lootId);
+
+ if (!tab)
+ {
+ if (!noEmptyError)
+ TC_LOG_ERROR("sql.sql", "Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId);
+ return false;
+ }
+
+ _difficultyBonusTreeMod = lootOwner->GetMap()->GetDifficultyLootBonusTreeMod();
+
+ items.reserve(MAX_NR_LOOT_ITEMS);
+ quest_items.reserve(MAX_NR_QUEST_ITEMS);
+
+ tab->Process(*this, store.IsRatesAllowed(), lootMode); // Processing is done there, callback via Loot::AddItem()
+
+ // Setting access rights for group loot case
+ Group* group = lootOwner->GetGroup();
+ if (!personal && group)
+ {
+ roundRobinPlayer = lootOwner->GetGUID();
+
+ for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ if (Player* player = itr->GetSource()) // should actually be looted object instead of lootOwner but looter has to be really close so doesnt really matter
+ FillNotNormalLootFor(player, player->IsAtGroupRewardDistance(lootOwner));
+
+ for (uint8 i = 0; i < items.size(); ++i)
+ {
+ if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(items[i].itemid))
+ if (proto->GetQuality() < uint32(group->GetLootThreshold()))
+ items[i].is_underthreshold = true;
+ }
+ }
+ // ... for personal loot
+ else
+ FillNotNormalLootFor(lootOwner, true);
+
+ return true;
+}
+
+// Inserts the item into the loot (called by LootTemplate processors)
+void Loot::AddItem(LootStoreItem const& item)
+{
+ ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item.itemid);
+ if (!proto)
+ return;
+
+ uint32 count = urand(item.mincount, item.maxcount);
+ uint32 stacks = count / proto->GetMaxStackSize() + ((count % proto->GetMaxStackSize()) ? 1 : 0);
+
+ std::vector<LootItem>& lootItems = item.needs_quest ? quest_items : items;
+ uint32 limit = item.needs_quest ? MAX_NR_QUEST_ITEMS : MAX_NR_LOOT_ITEMS;
+
+ for (uint32 i = 0; i < stacks && lootItems.size() < limit; ++i)
+ {
+ LootItem generatedLoot(item);
+ generatedLoot.context = _difficultyBonusTreeMod;
+ generatedLoot.count = std::min(count, proto->GetMaxStackSize());
+ if (_difficultyBonusTreeMod)
+ {
+ std::set<uint32> bonusListIDs = sDB2Manager.GetItemBonusTree(generatedLoot.itemid, _difficultyBonusTreeMod);
+ generatedLoot.BonusListIDs.insert(generatedLoot.BonusListIDs.end(), bonusListIDs.begin(), bonusListIDs.end());
+ }
+
+ lootItems.push_back(generatedLoot);
+ count -= proto->GetMaxStackSize();
+
+ // non-conditional one-player only items are counted here,
+ // free for all items are counted in FillFFALoot(),
+ // non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot()
+ if (!item.needs_quest && item.conditions.empty() && !(proto->GetFlags() & ITEM_FLAG_MULTI_DROP))
+ ++unlootedCount;
+ }
+}
+
+LootItem const* Loot::GetItemInSlot(uint32 lootSlot) const
+{
+ if (lootSlot < items.size())
+ return &items[lootSlot];
+
+ lootSlot -= uint32(items.size());
+ if (lootSlot < quest_items.size())
+ return &quest_items[lootSlot];
+
+ return nullptr;
+}
+
+LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem* *qitem, QuestItem* *ffaitem, QuestItem* *conditem)
+{
+ LootItem* item = NULL;
+ bool is_looted = true;
+ if (lootSlot >= items.size())
+ {
+ uint32 questSlot = lootSlot - items.size();
+ QuestItemMap::const_iterator itr = PlayerQuestItems.find(player->GetGUID());
+ if (itr != PlayerQuestItems.end() && questSlot < itr->second->size())
+ {
+ QuestItem* qitem2 = &itr->second->at(questSlot);
+ if (qitem)
+ *qitem = qitem2;
+ item = &quest_items[qitem2->index];
+ is_looted = qitem2->is_looted;
+ }
+ }
+ else
+ {
+ item = &items[lootSlot];
+ is_looted = item->is_looted;
+ if (item->freeforall)
+ {
+ QuestItemMap::const_iterator itr = PlayerFFAItems.find(player->GetGUID());
+ if (itr != PlayerFFAItems.end())
+ {
+ for (QuestItemList::const_iterator iter = itr->second->begin(); iter != itr->second->end(); ++iter)
+ if (iter->index == lootSlot)
+ {
+ QuestItem* ffaitem2 = (QuestItem*)&(*iter);
+ if (ffaitem)
+ *ffaitem = ffaitem2;
+ is_looted = ffaitem2->is_looted;
+ break;
+ }
+ }
+ }
+ else if (!item->conditions.empty())
+ {
+ QuestItemMap::const_iterator itr = PlayerNonQuestNonFFAConditionalItems.find(player->GetGUID());
+ if (itr != PlayerNonQuestNonFFAConditionalItems.end())
+ {
+ for (QuestItemList::const_iterator iter = itr->second->begin(); iter != itr->second->end(); ++iter)
+ {
+ if (iter->index == lootSlot)
+ {
+ QuestItem* conditem2 = (QuestItem*)&(*iter);
+ if (conditem)
+ *conditem = conditem2;
+ is_looted = conditem2->is_looted;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (is_looted)
+ return NULL;
+
+ return item;
+}
+
+uint32 Loot::GetMaxSlotInLootFor(Player* player) const
+{
+ QuestItemMap::const_iterator itr = PlayerQuestItems.find(player->GetGUID());
+ return items.size() + (itr != PlayerQuestItems.end() ? itr->second->size() : 0);
+}
+
+// return true if there is any item that is lootable for any player (not quest item, FFA or conditional)
+bool Loot::hasItemForAll() const
+{
+ // Gold is always lootable
+ if (gold)
+ return true;
+
+ for (LootItem const& item : items)
+ if (!item.is_looted && !item.freeforall && item.conditions.empty())
+ return true;
+ return false;
+}
+
+// return true if there is any FFA, quest or conditional item for the player.
+bool Loot::hasItemFor(Player* player) const
+{
+ QuestItemMap const& lootPlayerQuestItems = GetPlayerQuestItems();
+ QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(player->GetGUID());
+ if (q_itr != lootPlayerQuestItems.end())
+ {
+ QuestItemList* q_list = q_itr->second;
+ for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi)
+ {
+ const LootItem &item = quest_items[qi->index];
+ if (!qi->is_looted && !item.is_looted)
+ return true;
+ }
+ }
+
+ QuestItemMap const& lootPlayerFFAItems = GetPlayerFFAItems();
+ QuestItemMap::const_iterator ffa_itr = lootPlayerFFAItems.find(player->GetGUID());
+ if (ffa_itr != lootPlayerFFAItems.end())
+ {
+ QuestItemList* ffa_list = ffa_itr->second;
+ for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi)
+ {
+ const LootItem &item = items[fi->index];
+ if (!fi->is_looted && !item.is_looted)
+ return true;
+ }
+ }
+
+ QuestItemMap const& lootPlayerNonQuestNonFFAConditionalItems = GetPlayerNonQuestNonFFAConditionalItems();
+ QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(player->GetGUID());
+ if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
+ {
+ QuestItemList* conditional_list = nn_itr->second;
+ for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci)
+ {
+ const LootItem &item = items[ci->index];
+ if (!ci->is_looted && !item.is_looted)
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// return true if there is any item over the group threshold (i.e. not underthreshold).
+bool Loot::hasOverThresholdItem() const
+{
+ for (uint8 i = 0; i < items.size(); ++i)
+ {
+ if (!items[i].is_looted && !items[i].is_underthreshold && !items[i].freeforall)
+ return true;
+ }
+
+ return false;
+}
+
+void Loot::BuildLootResponse(WorldPackets::Loot::LootResponse& packet, Player* viewer, PermissionTypes permission) const
+{
+ if (permission == NONE_PERMISSION)
+ return;
+
+ packet.Coins = gold;
+
+ switch (permission)
+ {
+ case GROUP_PERMISSION:
+ case MASTER_PERMISSION:
+ case RESTRICTED_PERMISSION:
+ {
+ // if you are not the round-robin group looter, you can only see
+ // blocked rolled items and quest items, and !ffa items
+ for (uint8 i = 0; i < items.size(); ++i)
+ {
+ if (!items[i].is_looted && !items[i].freeforall && items[i].conditions.empty() && items[i].AllowedForPlayer(viewer))
+ {
+ uint8 slot_type;
+
+ if (items[i].is_blocked) // for ML & restricted is_blocked = !is_underthreshold
+ {
+ switch (permission)
+ {
+ case GROUP_PERMISSION:
+ slot_type = LOOT_SLOT_TYPE_ROLL_ONGOING;
+ break;
+ case MASTER_PERMISSION:
+ {
+ if (viewer->GetGroup() && viewer->GetGroup()->GetMasterLooterGuid() == viewer->GetGUID())
+ slot_type = LOOT_SLOT_TYPE_MASTER;
+ else
+ slot_type = LOOT_SLOT_TYPE_LOCKED;
+ break;
+ }
+ case RESTRICTED_PERMISSION:
+ slot_type = LOOT_SLOT_TYPE_LOCKED;
+ break;
+ default:
+ continue;
+ }
+ }
+ else if (roundRobinPlayer.IsEmpty() || viewer->GetGUID() == roundRobinPlayer || !items[i].is_underthreshold)
+ {
+ // no round robin owner or he has released the loot
+ // or it IS the round robin group owner
+ // => item is lootable
+ slot_type = LOOT_SLOT_TYPE_ALLOW_LOOT;
+ }
+ else
+ // item shall not be displayed.
+ continue;
+
+ WorldPackets::Loot::LootItemData lootItem;
+ lootItem.LootListID = i + 1;
+ lootItem.UIType = slot_type;
+ lootItem.Quantity = items[i].count;
+ lootItem.Loot.Initialize(items[i]);
+ packet.Items.push_back(lootItem);
+ }
+ }
+ break;
+ }
+ case ALL_PERMISSION:
+ case OWNER_PERMISSION:
+ {
+ for (uint8 i = 0; i < items.size(); ++i)
+ {
+ if (!items[i].is_looted && !items[i].freeforall && items[i].conditions.empty() && items[i].AllowedForPlayer(viewer))
+ {
+ WorldPackets::Loot::LootItemData lootItem;
+ lootItem.LootListID = i + 1;
+ lootItem.UIType = permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT;
+ lootItem.Quantity = items[i].count;
+ lootItem.Loot.Initialize(items[i]);
+ packet.Items.push_back(lootItem);
+ }
+ }
+ break;
+ }
+ default:
+ return;
+ }
+
+ LootSlotType slotType = permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT;
+ QuestItemMap const& lootPlayerQuestItems = GetPlayerQuestItems();
+ QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(viewer->GetGUID());
+ if (q_itr != lootPlayerQuestItems.end())
+ {
+ QuestItemList* q_list = q_itr->second;
+ for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi)
+ {
+ LootItem const& item = quest_items[qi->index];
+ if (!qi->is_looted && !item.is_looted)
+ {
+ WorldPackets::Loot::LootItemData lootItem;
+ lootItem.LootListID = items.size() + qi->index + 1;
+ lootItem.Quantity = item.count;
+ lootItem.Loot.Initialize(item);
+
+ if (item.follow_loot_rules)
+ {
+ switch (permission)
+ {
+ case MASTER_PERMISSION:
+ lootItem.UIType = LOOT_SLOT_TYPE_MASTER;
+ break;
+ case RESTRICTED_PERMISSION:
+ lootItem.UIType = item.is_blocked ? LOOT_SLOT_TYPE_LOCKED : LOOT_SLOT_TYPE_ALLOW_LOOT;
+ break;
+ case GROUP_PERMISSION:
+ if (!item.is_blocked)
+ lootItem.UIType = LOOT_SLOT_TYPE_ALLOW_LOOT;
+ else
+ lootItem.UIType = LOOT_SLOT_TYPE_ROLL_ONGOING;
+ break;
+ default:
+ lootItem.UIType = slotType;
+ break;
+ }
+ }
+ else
+ lootItem.UIType = slotType;
+
+ packet.Items.push_back(lootItem);
+ }
+ }
+ }
+
+ QuestItemMap const& lootPlayerFFAItems = GetPlayerFFAItems();
+ QuestItemMap::const_iterator ffa_itr = lootPlayerFFAItems.find(viewer->GetGUID());
+ if (ffa_itr != lootPlayerFFAItems.end())
+ {
+ QuestItemList* ffa_list = ffa_itr->second;
+ for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi)
+ {
+ LootItem const& item = items[fi->index];
+ if (!fi->is_looted && !item.is_looted)
+ {
+ WorldPackets::Loot::LootItemData lootItem;
+ lootItem.LootListID = items.size() + fi->index + 1;
+ lootItem.UIType = slotType;
+ lootItem.Quantity = item.count;
+ lootItem.Loot.Initialize(item);
+ packet.Items.push_back(lootItem);
+ }
+ }
+ }
+
+ QuestItemMap const& lootPlayerNonQuestNonFFAConditionalItems = GetPlayerNonQuestNonFFAConditionalItems();
+ QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(viewer->GetGUID());
+ if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
+ {
+ QuestItemList* conditional_list = nn_itr->second;
+ for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci)
+ {
+ LootItem const& item = items[ci->index];
+ if (!ci->is_looted && !item.is_looted)
+ {
+ WorldPackets::Loot::LootItemData lootItem;
+ lootItem.LootListID = items.size() + ci->index + 1;
+ lootItem.Quantity = item.count;
+ lootItem.Loot.Initialize(item);
+
+ if (item.follow_loot_rules)
+ {
+ switch (permission)
+ {
+ case MASTER_PERMISSION:
+ lootItem.UIType = LOOT_SLOT_TYPE_MASTER;
+ break;
+ case RESTRICTED_PERMISSION:
+ lootItem.UIType = item.is_blocked ? LOOT_SLOT_TYPE_LOCKED : LOOT_SLOT_TYPE_ALLOW_LOOT;
+ break;
+ case GROUP_PERMISSION:
+ if (!item.is_blocked)
+ lootItem.UIType = LOOT_SLOT_TYPE_ALLOW_LOOT;
+ else
+ lootItem.UIType = LOOT_SLOT_TYPE_ROLL_ONGOING;
+ break;
+ default:
+ lootItem.UIType = slotType;
+ break;
+ }
+ }
+ else
+ lootItem.UIType = slotType;
+
+ packet.Items.push_back(lootItem);
+ }
+ }
+ }
+}
+
+void Loot::FillNotNormalLootFor(Player* player, bool presentAtLooting)
+{
+ ObjectGuid plguid = player->GetGUID();
+
+ QuestItemMap::const_iterator qmapitr = PlayerQuestItems.find(plguid);
+ if (qmapitr == PlayerQuestItems.end())
+ FillQuestLoot(player);
+
+ qmapitr = PlayerFFAItems.find(plguid);
+ if (qmapitr == PlayerFFAItems.end())
+ FillFFALoot(player);
+
+ qmapitr = PlayerNonQuestNonFFAConditionalItems.find(plguid);
+ if (qmapitr == PlayerNonQuestNonFFAConditionalItems.end())
+ FillNonQuestNonFFAConditionalLoot(player, presentAtLooting);
+
+ // if not auto-processed player will have to come and pick it up manually
+ if (!presentAtLooting)
+ return;
+
+ // Process currency items
+ uint32 max_slot = GetMaxSlotInLootFor(player);
+ LootItem const* item = NULL;
+ uint32 itemsSize = uint32(items.size());
+ for (uint32 i = 0; i < max_slot; ++i)
+ {
+ if (i < items.size())
+ item = &items[i];
+ else
+ item = &quest_items[i - itemsSize];
+
+ if (!item->is_looted && item->freeforall && item->AllowedForPlayer(player))
+ if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid))
+ if (proto->IsCurrencyToken())
+ player->StoreLootItem(i, this);
+ }
+}
+
+QuestItemList* Loot::FillFFALoot(Player* player)
+{
+ QuestItemList* ql = new QuestItemList();
+
+ for (uint8 i = 0; i < items.size(); ++i)
+ {
+ LootItem &item = items[i];
+ if (!item.is_looted && item.freeforall && item.AllowedForPlayer(player))
+ {
+ ql->push_back(QuestItem(i));
+ ++unlootedCount;
+ }
+ }
+ if (ql->empty())
+ {
+ delete ql;
+ return NULL;
+ }
+
+ PlayerFFAItems[player->GetGUID()] = ql;
+ return ql;
+}
+
+QuestItemList* Loot::FillQuestLoot(Player* player)
+{
+ if (items.size() == MAX_NR_LOOT_ITEMS)
+ return NULL;
+
+ QuestItemList* ql = new QuestItemList();
+
+ for (uint8 i = 0; i < quest_items.size(); ++i)
+ {
+ LootItem &item = quest_items[i];
+
+ if (!item.is_looted && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && ((player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetMasterLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT))))
+ {
+ ql->push_back(QuestItem(i));
+
+ // quest items get blocked when they first appear in a
+ // player's quest vector
+ //
+ // increase once if one looter only, looter-times if free for all
+ if (item.freeforall || !item.is_blocked)
+ ++unlootedCount;
+ if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT))
+ item.is_blocked = true;
+
+ if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS)
+ break;
+ }
+ }
+ if (ql->empty())
+ {
+ delete ql;
+ return NULL;
+ }
+
+ PlayerQuestItems[player->GetGUID()] = ql;
+ return ql;
+}
+
+QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player, bool presentAtLooting)
+{
+ QuestItemList* ql = new QuestItemList();
+
+ for (uint8 i = 0; i < items.size(); ++i)
+ {
+ LootItem &item = items[i];
+ if (!item.is_looted && !item.freeforall && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && ((player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetMasterLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT))))
+ {
+ if (presentAtLooting)
+ item.AddAllowedLooter(player);
+ if (!item.conditions.empty())
+ {
+ ql->push_back(QuestItem(i));
+ if (!item.is_counted)
+ {
+ ++unlootedCount;
+ item.is_counted = true;
+ }
+ }
+ }
+ }
+ if (ql->empty())
+ {
+ delete ql;
+ return NULL;
+ }
+
+ PlayerNonQuestNonFFAConditionalItems[player->GetGUID()] = ql;
+ return ql;
+}
+
+//
+// --------- AELootResult ---------
+//
+
+void AELootResult::Add(Item* item, uint8 count, LootType lootType)
+{
+ auto itr = _byItem.find(item);
+ if (itr != _byItem.end())
+ _byOrder[itr->second].count += count;
+ else
+ {
+ _byItem[item] = _byOrder.size();
+ ResultValue value;
+ value.item = item;
+ value.count = count;
+ value.lootType = lootType;
+ _byOrder.push_back(value);
+ }
+}
+
+AELootResult::OrderedStorage::const_iterator AELootResult::begin() const
+{
+ return _byOrder.begin();
+}
+
+AELootResult::OrderedStorage::const_iterator AELootResult::end() const
+{
+ return _byOrder.end();
+}
diff --git a/src/server/game/Loot/Loot.h b/src/server/game/Loot/Loot.h
new file mode 100644
index 00000000000..64268ff64b8
--- /dev/null
+++ b/src/server/game/Loot/Loot.h
@@ -0,0 +1,314 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * 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 Loot_h__
+#define Loot_h__
+
+#include "Define.h"
+#include "ConditionMgr.h"
+#include "ItemEnchantmentMgr.h"
+#include "ObjectGuid.h"
+#include "RefManager.h"
+#include "SharedDefines.h"
+#include <unordered_map>
+#include <vector>
+
+class Item;
+class LootStore;
+class Player;
+struct Loot;
+struct LootStoreItem;
+
+namespace WorldPackets
+{
+ namespace Loot
+ {
+ class LootResponse;
+ }
+}
+
+enum RollType
+{
+ ROLL_PASS = 0,
+ ROLL_NEED = 1,
+ ROLL_GREED = 2,
+ ROLL_DISENCHANT = 3,
+ MAX_ROLL_TYPE = 4
+};
+
+enum RollMask
+{
+ ROLL_FLAG_TYPE_PASS = 0x01,
+ ROLL_FLAG_TYPE_NEED = 0x02,
+ ROLL_FLAG_TYPE_GREED = 0x04,
+ ROLL_FLAG_TYPE_DISENCHANT = 0x08,
+
+ ROLL_ALL_TYPE_NO_DISENCHANT = 0x07,
+ ROLL_ALL_TYPE_MASK = 0x0F
+};
+
+#define MAX_NR_LOOT_ITEMS 16
+// note: the client cannot show more than 16 items total
+#define MAX_NR_QUEST_ITEMS 32
+// unrelated to the number of quest items shown, just for reserve
+
+enum LootMethod : uint8
+{
+ FREE_FOR_ALL = 0,
+ MASTER_LOOT = 2,
+ GROUP_LOOT = 3,
+ PERSONAL_LOOT = 5
+};
+
+enum PermissionTypes
+{
+ ALL_PERMISSION = 0,
+ GROUP_PERMISSION = 1,
+ MASTER_PERMISSION = 2,
+ RESTRICTED_PERMISSION = 3,
+ OWNER_PERMISSION = 5,
+ NONE_PERMISSION = 6
+};
+
+enum LootType : uint8
+{
+ LOOT_NONE = 0,
+
+ LOOT_CORPSE = 1,
+ LOOT_PICKPOCKETING = 2,
+ LOOT_FISHING = 3,
+ LOOT_DISENCHANTING = 4,
+ // ignored always by client
+ LOOT_SKINNING = 6,
+ LOOT_PROSPECTING = 7,
+ LOOT_MILLING = 8,
+
+ LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead
+ LOOT_INSIGNIA = 21, // unsupported by client, sending LOOT_CORPSE instead
+ LOOT_FISHING_JUNK = 22 // unsupported by client, sending LOOT_FISHING instead
+};
+
+enum LootError
+{
+ LOOT_ERROR_DIDNT_KILL = 0, // You don't have permission to loot that corpse.
+ LOOT_ERROR_TOO_FAR = 4, // You are too far away to loot that corpse.
+ LOOT_ERROR_BAD_FACING = 5, // You must be facing the corpse to loot it.
+ LOOT_ERROR_LOCKED = 6, // Someone is already looting that corpse.
+ LOOT_ERROR_NOTSTANDING = 8, // You need to be standing up to loot something!
+ LOOT_ERROR_STUNNED = 9, // You can't loot anything while stunned!
+ LOOT_ERROR_PLAYER_NOT_FOUND = 10, // Player not found
+ LOOT_ERROR_PLAY_TIME_EXCEEDED = 11, // Maximum play time exceeded
+ LOOT_ERROR_MASTER_INV_FULL = 12, // That player's inventory is full
+ LOOT_ERROR_MASTER_UNIQUE_ITEM = 13, // Player has too many of that item already
+ LOOT_ERROR_MASTER_OTHER = 14, // Can't assign item to that player
+ LOOT_ERROR_ALREADY_PICKPOCKETED = 15, // Your target has already had its pockets picked
+ LOOT_ERROR_NOT_WHILE_SHAPESHIFTED = 16, // You can't do that while shapeshifted.
+ LOOT_ERROR_NO_LOOT = 17 // There is no loot.
+};
+
+// type of Loot Item in Loot View
+enum LootSlotType
+{
+ LOOT_SLOT_TYPE_ALLOW_LOOT = 0, // player can loot the item.
+ LOOT_SLOT_TYPE_ROLL_ONGOING = 1, // roll is ongoing. player cannot loot.
+ LOOT_SLOT_TYPE_MASTER = 3, // item can only be distributed by group loot master.
+ LOOT_SLOT_TYPE_LOCKED = 2, // item is shown in red. player cannot loot.
+ LOOT_SLOT_TYPE_OWNER = 4 // ignore binding confirmation and etc, for single player looting
+};
+
+struct TC_GAME_API LootItem
+{
+ uint32 itemid;
+ uint32 randomSuffix;
+ ItemRandomEnchantmentId randomPropertyId;
+ int32 upgradeId;
+ std::vector<int32> BonusListIDs;
+ uint8 context;
+ ConditionContainer conditions; // additional loot condition
+ GuidSet allowedGUIDs;
+ uint8 count : 8;
+ bool is_looted : 1;
+ bool is_blocked : 1;
+ bool freeforall : 1; // free for all
+ bool is_underthreshold : 1;
+ 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 (reference = 0)
+ explicit LootItem(LootStoreItem const& li);
+
+ // Empty constructor for creating an empty LootItem to be filled in with DB data
+ LootItem() : itemid(0), randomSuffix(0), randomPropertyId(), upgradeId(0), context(0), count(0), is_looted(false), is_blocked(false),
+ freeforall(false), is_underthreshold(false), is_counted(false), needs_quest(false), follow_loot_rules(false),
+ 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);
+ GuidSet const& GetAllowedLooters() const { return allowedGUIDs; }
+};
+
+struct QuestItem
+{
+ uint8 index; // position in quest_items;
+ bool is_looted;
+
+ QuestItem()
+ : index(0), is_looted(false) { }
+
+ QuestItem(uint8 _index, bool _islooted = false)
+ : index(_index), is_looted(_islooted) { }
+};
+
+typedef std::vector<QuestItem> QuestItemList;
+typedef std::vector<LootItem> LootItemList;
+typedef std::unordered_map<ObjectGuid, QuestItemList*> QuestItemMap;
+
+//=====================================================
+
+class LootValidatorRef : public Reference<Loot, LootValidatorRef>
+{
+public:
+ LootValidatorRef() { }
+ void targetObjectDestroyLink() override { }
+ void sourceObjectDestroyLink() override { }
+};
+
+//=====================================================
+
+class LootValidatorRefManager : public RefManager<Loot, LootValidatorRef>
+{
+public:
+ typedef LinkedListHead::Iterator<LootValidatorRef> iterator;
+
+ LootValidatorRef* getFirst() { return (LootValidatorRef*)RefManager<Loot, LootValidatorRef>::getFirst(); }
+ LootValidatorRef* getLast() { return (LootValidatorRef*)RefManager<Loot, LootValidatorRef>::getLast(); }
+
+ iterator begin() { return iterator(getFirst()); }
+ iterator end() { return iterator(NULL); }
+ iterator rbegin() { return iterator(getLast()); }
+ iterator rend() { return iterator(NULL); }
+};
+
+//=====================================================
+
+struct TC_GAME_API Loot
+{
+ QuestItemMap const& GetPlayerQuestItems() const { return PlayerQuestItems; }
+ QuestItemMap const& GetPlayerFFAItems() const { return PlayerFFAItems; }
+ QuestItemMap const& GetPlayerNonQuestNonFFAConditionalItems() const { return PlayerNonQuestNonFFAConditionalItems; }
+
+ std::vector<LootItem> items;
+ std::vector<LootItem> quest_items;
+ uint32 gold;
+ uint8 unlootedCount;
+ ObjectGuid 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
+ uint8 maxDuplicates; // Max amount of items with the same entry that can drop (default is 1; on 25 man raid mode 3)
+
+ // GUID of container that holds this loot (item_instance.entry)
+ // Only set for inventory items that can be right-click looted
+ ObjectGuid containerID;
+
+ Loot(uint32 _gold = 0);
+ ~Loot();
+
+ ObjectGuid const& GetGUID() const { return _GUID; }
+ void SetGUID(ObjectGuid const& guid) { _GUID = guid; }
+
+ // 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)
+ {
+ i_LootValidatorRefManager.insertFirst(pLootValidatorRef);
+ }
+
+ void clear();
+
+ bool empty() const { return items.empty() && gold == 0; }
+ bool isLooted() const { return gold == 0 && unlootedCount == 0; }
+
+ void NotifyItemRemoved(uint8 lootIndex);
+ void NotifyQuestItemRemoved(uint8 questIndex);
+ void NotifyMoneyRemoved();
+ void AddLooter(ObjectGuid GUID) { PlayersLooting.insert(GUID); }
+ void RemoveLooter(ObjectGuid GUID) { PlayersLooting.erase(GUID); }
+
+ void generateMoneyLoot(uint32 minAmount, uint32 maxAmount);
+ bool FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bool personal, bool noEmptyError = false, uint16 lootMode = LOOT_MODE_DEFAULT);
+
+ // Inserts the item into the loot (called by LootTemplate processors)
+ void AddItem(LootStoreItem const & item);
+
+ LootItem const* GetItemInSlot(uint32 lootSlot) const;
+ LootItem* LootItemInSlot(uint32 lootslot, Player* player, QuestItem** qitem = NULL, QuestItem** ffaitem = NULL, QuestItem** conditem = NULL);
+ uint32 GetMaxSlotInLootFor(Player* player) const;
+ bool hasItemForAll() const;
+ bool hasItemFor(Player* player) const;
+ bool hasOverThresholdItem() const;
+
+ // Builds data for SMSG_LOOT_RESPONSE
+ void BuildLootResponse(WorldPackets::Loot::LootResponse& packet, Player* viewer, PermissionTypes permission = ALL_PERMISSION) const;
+
+private:
+
+ void FillNotNormalLootFor(Player* player, bool presentAtLooting);
+ QuestItemList* FillFFALoot(Player* player);
+ QuestItemList* FillQuestLoot(Player* player);
+ QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player, bool presentAtLooting);
+
+ GuidSet PlayersLooting;
+ QuestItemMap PlayerQuestItems;
+ QuestItemMap PlayerFFAItems;
+ QuestItemMap PlayerNonQuestNonFFAConditionalItems;
+
+ // All rolls are registered here. They need to know, when the loot is not valid anymore
+ LootValidatorRefManager i_LootValidatorRefManager;
+
+ // Loot GUID
+ ObjectGuid _GUID;
+ uint8 _difficultyBonusTreeMod;
+};
+
+class TC_GAME_API AELootResult
+{
+public:
+ struct ResultValue
+ {
+ Item* item;
+ uint8 count;
+ LootType lootType;
+ };
+
+ typedef std::vector<ResultValue> OrderedStorage;
+
+ void Add(Item* item, uint8 count, LootType lootType);
+
+ OrderedStorage::const_iterator begin() const;
+ OrderedStorage::const_iterator end() const;
+
+ OrderedStorage _byOrder;
+ std::unordered_map<Item*, OrderedStorage::size_type> _byItem;
+};
+
+#endif // Loot_h__
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 6b984054fb2..eab712e7ed6 100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -17,17 +17,18 @@
*/
#include "LootMgr.h"
+#include "Containers.h"
+#include "DatabaseEnv.h"
+#include "DB2Stores.h"
+#include "ItemTemplate.h"
#include "Log.h"
+#include "Loot.h"
#include "ObjectMgr.h"
-#include "World.h"
-#include "Util.h"
-#include "SharedDefines.h"
-#include "SpellMgr.h"
-#include "SpellInfo.h"
-#include "Group.h"
#include "Player.h"
-#include "Containers.h"
-#include "LootPackets.h"
+#include "Random.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "World.h"
static Rates const qualityToRate[MAX_ITEM_QUALITY] =
{
@@ -92,7 +93,6 @@ class LootTemplate::LootGroup // A set of loot def
float TotalChance() const; // Overall chance for the group
void Verify(LootStore const& lootstore, uint32 id, uint8 group_id) const;
- void CollectLootIds(LootIdSet& set) const;
void CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const;
LootStoreItemList* GetExplicitlyChancedItemList() { return &ExplicitlyChanced; }
LootStoreItemList* GetEqualChancedItemList() { return &EqualChanced; }
@@ -349,742 +349,6 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
}
//
-// --------- LootItem ---------
-//
-
-// Constructor, copies most fields from LootStoreItem and generates random count
-LootItem::LootItem(LootStoreItem const& li)
-{
- itemid = li.itemid;
- conditions = li.conditions;
-
- ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid);
- freeforall = proto && (proto->GetFlags() & ITEM_FLAG_MULTI_DROP);
- follow_loot_rules = proto && (proto->FlagsCu & ITEM_FLAGS_CU_FOLLOW_LOOT_RULES);
-
- needs_quest = li.needs_quest;
-
- randomSuffix = GenerateEnchSuffixFactor(itemid);
- randomPropertyId = Item::GenerateItemRandomPropertyId(itemid);
- upgradeId = sDB2Manager.GetRulesetItemUpgrade(itemid);
- context = 0;
- count = 0;
- is_looted = 0;
- 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
-bool LootItem::AllowedForPlayer(Player const* player) const
-{
- // DB conditions check
- if (!sConditionMgr->IsObjectMeetToConditions(const_cast<Player*>(player), conditions))
- return false;
-
- ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid);
- if (!pProto)
- return false;
-
- // not show loot for players without profession or those who already know the recipe
- if ((pProto->GetFlags() & ITEM_FLAG_HIDE_UNUSABLE_RECIPE) && (!player->HasSkill(pProto->GetRequiredSkill()) || player->HasSpell(pProto->Effects[1]->SpellID)))
- return false;
-
- // not show loot for not own team
- if ((pProto->GetFlags2() & ITEM_FLAG2_FACTION_HORDE) && player->GetTeam() != HORDE)
- return false;
-
- if ((pProto->GetFlags2() & ITEM_FLAG2_FACTION_ALLIANCE) && player->GetTeam() != ALLIANCE)
- return false;
-
- // check quest requirements
- if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->GetStartQuest() && player->GetQuestStatus(pProto->GetStartQuest()) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid)))
- return false;
-
- // Don't show bind-when-picked-up unique items if player already has the maximum allowed quantity.
- if (pProto->GetBonding() == BIND_ON_ACQUIRE && pProto->GetMaxCount() && player->GetItemCount(itemid, true) >= pProto->GetMaxCount())
- return false;
-
- return true;
-}
-
-void LootItem::AddAllowedLooter(const Player* player)
-{
- allowedGUIDs.insert(player->GetGUID());
-}
-
-//
-// --------- Loot ---------
-//
-
-// Inserts the item into the loot (called by LootTemplate processors)
-void Loot::AddItem(LootStoreItem const& item)
-{
- ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item.itemid);
- if (!proto)
- return;
-
- uint32 count = urand(item.mincount, item.maxcount);
- uint32 stacks = count / proto->GetMaxStackSize() + ((count % proto->GetMaxStackSize()) ? 1 : 0);
-
- std::vector<LootItem>& lootItems = item.needs_quest ? quest_items : items;
- uint32 limit = item.needs_quest ? MAX_NR_QUEST_ITEMS : MAX_NR_LOOT_ITEMS;
-
- for (uint32 i = 0; i < stacks && lootItems.size() < limit; ++i)
- {
- LootItem generatedLoot(item);
- generatedLoot.context = _difficultyBonusTreeMod;
- generatedLoot.count = std::min(count, proto->GetMaxStackSize());
- if (_difficultyBonusTreeMod)
- {
- std::set<uint32> bonusListIDs = sDB2Manager.GetItemBonusTree(generatedLoot.itemid, _difficultyBonusTreeMod);
- generatedLoot.BonusListIDs.insert(generatedLoot.BonusListIDs.end(), bonusListIDs.begin(), bonusListIDs.end());
- }
-
- lootItems.push_back(generatedLoot);
- count -= proto->GetMaxStackSize();
-
- // non-conditional one-player only items are counted here,
- // free for all items are counted in FillFFALoot(),
- // non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot()
- if (!item.needs_quest && item.conditions.empty() && !(proto->GetFlags() & ITEM_FLAG_MULTI_DROP))
- ++unlootedCount;
- }
-}
-
-LootItem const* Loot::GetItemInSlot(uint32 lootSlot) const
-{
- if (lootSlot < items.size())
- return &items[lootSlot];
-
- lootSlot -= uint32(items.size());
- if (lootSlot < quest_items.size())
- return &quest_items[lootSlot];
-
- return nullptr;
-}
-
-// Calls processor of corresponding LootTemplate (which handles everything including references)
-bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bool personal, bool noEmptyError, uint16 lootMode /*= LOOT_MODE_DEFAULT*/)
-{
- // Must be provided
- if (!lootOwner)
- return false;
-
- LootTemplate const* tab = store.GetLootFor(lootId);
-
- if (!tab)
- {
- if (!noEmptyError)
- TC_LOG_ERROR("sql.sql", "Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId);
- return false;
- }
-
- _difficultyBonusTreeMod = lootOwner->GetMap()->GetDifficultyLootBonusTreeMod();
-
- items.reserve(MAX_NR_LOOT_ITEMS);
- quest_items.reserve(MAX_NR_QUEST_ITEMS);
-
- tab->Process(*this, store.IsRatesAllowed(), lootMode); // Processing is done there, callback via Loot::AddItem()
-
- // Setting access rights for group loot case
- Group* group = lootOwner->GetGroup();
- if (!personal && group)
- {
- roundRobinPlayer = lootOwner->GetGUID();
-
- for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
- if (Player* player = itr->GetSource()) // should actually be looted object instead of lootOwner but looter has to be really close so doesnt really matter
- FillNotNormalLootFor(player, player->IsAtGroupRewardDistance(lootOwner));
-
- for (uint8 i = 0; i < items.size(); ++i)
- {
- if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(items[i].itemid))
- if (proto->GetQuality() < uint32(group->GetLootThreshold()))
- items[i].is_underthreshold = true;
- }
- }
- // ... for personal loot
- else
- FillNotNormalLootFor(lootOwner, true);
-
- return true;
-}
-
-void Loot::FillNotNormalLootFor(Player* player, bool presentAtLooting)
-{
- ObjectGuid::LowType plguid = player->GetGUID().GetCounter();
-
- QuestItemMap::const_iterator qmapitr = PlayerQuestItems.find(plguid);
- if (qmapitr == PlayerQuestItems.end())
- FillQuestLoot(player);
-
- qmapitr = PlayerFFAItems.find(plguid);
- if (qmapitr == PlayerFFAItems.end())
- FillFFALoot(player);
-
- qmapitr = PlayerNonQuestNonFFAConditionalItems.find(plguid);
- if (qmapitr == PlayerNonQuestNonFFAConditionalItems.end())
- FillNonQuestNonFFAConditionalLoot(player, presentAtLooting);
-
- // if not auto-processed player will have to come and pick it up manually
- if (!presentAtLooting)
- return;
-
- // Process currency items
- uint32 max_slot = GetMaxSlotInLootFor(player);
- LootItem const* item = NULL;
- uint32 itemsSize = uint32(items.size());
- for (uint32 i = 0; i < max_slot; ++i)
- {
- if (i < items.size())
- item = &items[i];
- else
- item = &quest_items[i-itemsSize];
-
- if (!item->is_looted && item->freeforall && item->AllowedForPlayer(player))
- if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid))
- if (proto->IsCurrencyToken())
- player->StoreLootItem(i, this);
- }
-}
-
-QuestItemList* Loot::FillFFALoot(Player* player)
-{
- QuestItemList* ql = new QuestItemList();
-
- for (uint8 i = 0; i < items.size(); ++i)
- {
- LootItem &item = items[i];
- if (!item.is_looted && item.freeforall && item.AllowedForPlayer(player))
- {
- ql->push_back(QuestItem(i));
- ++unlootedCount;
- }
- }
- if (ql->empty())
- {
- delete ql;
- return NULL;
- }
-
- PlayerFFAItems[player->GetGUID().GetCounter()] = ql;
- return ql;
-}
-
-QuestItemList* Loot::FillQuestLoot(Player* player)
-{
- if (items.size() == MAX_NR_LOOT_ITEMS)
- return NULL;
-
- QuestItemList* ql = new QuestItemList();
-
- for (uint8 i = 0; i < quest_items.size(); ++i)
- {
- LootItem &item = quest_items[i];
-
- if (!item.is_looted && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && ((player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetMasterLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT))))
- {
- ql->push_back(QuestItem(i));
-
- // quest items get blocked when they first appear in a
- // player's quest vector
- //
- // increase once if one looter only, looter-times if free for all
- if (item.freeforall || !item.is_blocked)
- ++unlootedCount;
- if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT))
- item.is_blocked = true;
-
- if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS)
- break;
- }
- }
- if (ql->empty())
- {
- delete ql;
- return NULL;
- }
-
- PlayerQuestItems[player->GetGUID().GetCounter()] = ql;
- return ql;
-}
-
-QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player, bool presentAtLooting)
-{
- QuestItemList* ql = new QuestItemList();
-
- for (uint8 i = 0; i < items.size(); ++i)
- {
- LootItem &item = items[i];
- if (!item.is_looted && !item.freeforall && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && ((player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetMasterLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT))))
- {
- if (presentAtLooting)
- item.AddAllowedLooter(player);
- if (!item.conditions.empty())
- {
- ql->push_back(QuestItem(i));
- if (!item.is_counted)
- {
- ++unlootedCount;
- item.is_counted = true;
- }
- }
- }
- }
- if (ql->empty())
- {
- delete ql;
- return NULL;
- }
-
- PlayerNonQuestNonFFAConditionalItems[player->GetGUID().GetCounter()] = ql;
- return ql;
-}
-
-//===================================================
-
-void Loot::NotifyItemRemoved(uint8 lootIndex)
-{
- // notify all players that are looting this that the item was removed
- // convert the index to the slot the player sees
- GuidSet::iterator i_next;
- for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
- {
- i_next = i;
- ++i_next;
- if (Player* player = ObjectAccessor::FindPlayer(*i))
- player->SendNotifyLootItemRemoved(GetGUID(), lootIndex);
- else
- PlayersLooting.erase(i);
- }
-}
-
-void Loot::NotifyMoneyRemoved()
-{
- // notify all players that are looting this that the money was removed
- GuidSet::iterator i_next;
- for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
- {
- i_next = i;
- ++i_next;
- if (Player* player = ObjectAccessor::FindPlayer(*i))
- player->SendNotifyLootMoneyRemoved(GetGUID());
- else
- PlayersLooting.erase(i);
- }
-}
-
-void Loot::NotifyQuestItemRemoved(uint8 questIndex)
-{
- // when a free for all questitem is looted
- // all players will get notified of it being removed
- // (other questitems can be looted by each group member)
- // bit inefficient but isn't called often
-
- GuidSet::iterator i_next;
- for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
- {
- i_next = i;
- ++i_next;
- if (Player* player = ObjectAccessor::FindPlayer(*i))
- {
- QuestItemMap::const_iterator pq = PlayerQuestItems.find(player->GetGUID().GetCounter());
- if (pq != PlayerQuestItems.end() && pq->second)
- {
- // find where/if the player has the given item in it's vector
- QuestItemList& pql = *pq->second;
-
- uint8 j;
- for (j = 0; j < pql.size(); ++j)
- if (pql[j].index == questIndex)
- break;
-
- if (j < pql.size())
- player->SendNotifyLootItemRemoved(GetGUID(), items.size()+j);
- }
- }
- else
- PlayersLooting.erase(i);
- }
-}
-
-void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
-{
- if (maxAmount > 0)
- {
- if (maxAmount <= minAmount)
- gold = uint32(maxAmount * sWorld->getRate(RATE_DROP_MONEY));
- else if ((maxAmount - minAmount) < 32700)
- gold = uint32(urand(minAmount, maxAmount) * sWorld->getRate(RATE_DROP_MONEY));
- else
- gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld->getRate(RATE_DROP_MONEY)) << 8;
- }
-}
-
-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->setUInt64(0, containerID.GetCounter());
- 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 = false;
- break;
- }
-}
-
-void Loot::DeleteLootMoneyFromContainerItemDB()
-{
- // Deletes money loot associated with an openable item from the DB
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY);
- stmt->setUInt64(0, containerID.GetCounter());
- CharacterDatabase.Execute(stmt);
-}
-
-LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem* *qitem, QuestItem* *ffaitem, QuestItem* *conditem)
-{
- LootItem* item = NULL;
- bool is_looted = true;
- if (lootSlot >= items.size())
- {
- uint32 questSlot = lootSlot - items.size();
- QuestItemMap::const_iterator itr = PlayerQuestItems.find(player->GetGUID().GetCounter());
- if (itr != PlayerQuestItems.end() && questSlot < itr->second->size())
- {
- QuestItem* qitem2 = &itr->second->at(questSlot);
- if (qitem)
- *qitem = qitem2;
- item = &quest_items[qitem2->index];
- is_looted = qitem2->is_looted;
- }
- }
- else
- {
- item = &items[lootSlot];
- is_looted = item->is_looted;
- if (item->freeforall)
- {
- QuestItemMap::const_iterator itr = PlayerFFAItems.find(player->GetGUID().GetCounter());
- if (itr != PlayerFFAItems.end())
- {
- for (QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter)
- if (iter->index == lootSlot)
- {
- QuestItem* ffaitem2 = (QuestItem*)&(*iter);
- if (ffaitem)
- *ffaitem = ffaitem2;
- is_looted = ffaitem2->is_looted;
- break;
- }
- }
- }
- else if (!item->conditions.empty())
- {
- QuestItemMap::const_iterator itr = PlayerNonQuestNonFFAConditionalItems.find(player->GetGUID().GetCounter());
- if (itr != PlayerNonQuestNonFFAConditionalItems.end())
- {
- for (QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter)
- {
- if (iter->index == lootSlot)
- {
- QuestItem* conditem2 = (QuestItem*)&(*iter);
- if (conditem)
- *conditem = conditem2;
- is_looted = conditem2->is_looted;
- break;
- }
- }
- }
- }
- }
-
- if (is_looted)
- return NULL;
-
- return item;
-}
-
-uint32 Loot::GetMaxSlotInLootFor(Player* player) const
-{
- QuestItemMap::const_iterator itr = PlayerQuestItems.find(player->GetGUID().GetCounter());
- return items.size() + (itr != PlayerQuestItems.end() ? itr->second->size() : 0);
-}
-
-// return true if there is any item that is lootable for any player (not quest item, FFA or conditional)
-bool Loot::hasItemForAll() const
-{
- // Gold is always lootable
- if (gold)
- return true;
-
- for (LootItem const& item : items)
- if (!item.is_looted && !item.freeforall && item.conditions.empty())
- return true;
- return false;
-}
-
-// return true if there is any FFA, quest or conditional item for the player.
-bool Loot::hasItemFor(Player* player) const
-{
- QuestItemMap const& lootPlayerQuestItems = GetPlayerQuestItems();
- QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(player->GetGUID().GetCounter());
- if (q_itr != lootPlayerQuestItems.end())
- {
- QuestItemList* q_list = q_itr->second;
- for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi)
- {
- const LootItem &item = quest_items[qi->index];
- if (!qi->is_looted && !item.is_looted)
- return true;
- }
- }
-
- QuestItemMap const& lootPlayerFFAItems = GetPlayerFFAItems();
- QuestItemMap::const_iterator ffa_itr = lootPlayerFFAItems.find(player->GetGUID().GetCounter());
- if (ffa_itr != lootPlayerFFAItems.end())
- {
- QuestItemList* ffa_list = ffa_itr->second;
- for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi)
- {
- const LootItem &item = items[fi->index];
- if (!fi->is_looted && !item.is_looted)
- return true;
- }
- }
-
- QuestItemMap const& lootPlayerNonQuestNonFFAConditionalItems = GetPlayerNonQuestNonFFAConditionalItems();
- QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(player->GetGUID().GetCounter());
- if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
- {
- QuestItemList* conditional_list = nn_itr->second;
- for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci)
- {
- const LootItem &item = items[ci->index];
- if (!ci->is_looted && !item.is_looted)
- return true;
- }
- }
-
- return false;
-}
-
-// return true if there is any item over the group threshold (i.e. not underthreshold).
-bool Loot::hasOverThresholdItem() const
-{
- for (uint8 i = 0; i < items.size(); ++i)
- {
- if (!items[i].is_looted && !items[i].is_underthreshold && !items[i].freeforall)
- return true;
- }
-
- return false;
-}
-
-void Loot::BuildLootResponse(WorldPackets::Loot::LootResponse& packet, Player* viewer, PermissionTypes permission) const
-{
- if (permission == NONE_PERMISSION)
- return;
-
- packet.Coins = gold;
-
- switch (permission)
- {
- case GROUP_PERMISSION:
- case MASTER_PERMISSION:
- case RESTRICTED_PERMISSION:
- {
- // if you are not the round-robin group looter, you can only see
- // blocked rolled items and quest items, and !ffa items
- for (uint8 i = 0; i < items.size(); ++i)
- {
- if (!items[i].is_looted && !items[i].freeforall && items[i].conditions.empty() && items[i].AllowedForPlayer(viewer))
- {
- uint8 slot_type;
-
- if (items[i].is_blocked) // for ML & restricted is_blocked = !is_underthreshold
- {
- switch (permission)
- {
- case GROUP_PERMISSION:
- slot_type = LOOT_SLOT_TYPE_ROLL_ONGOING;
- break;
- case MASTER_PERMISSION:
- {
- if (viewer->GetGroup() && viewer->GetGroup()->GetMasterLooterGuid() == viewer->GetGUID())
- slot_type = LOOT_SLOT_TYPE_MASTER;
- else
- slot_type = LOOT_SLOT_TYPE_LOCKED;
- break;
- }
- case RESTRICTED_PERMISSION:
- slot_type = LOOT_SLOT_TYPE_LOCKED;
- break;
- default:
- continue;
- }
- }
- else if (roundRobinPlayer.IsEmpty() || viewer->GetGUID() == roundRobinPlayer || !items[i].is_underthreshold)
- {
- // no round robin owner or he has released the loot
- // or it IS the round robin group owner
- // => item is lootable
- slot_type = LOOT_SLOT_TYPE_ALLOW_LOOT;
- }
- else
- // item shall not be displayed.
- continue;
-
- WorldPackets::Loot::LootItemData lootItem;
- lootItem.LootListID = i + 1;
- lootItem.UIType = slot_type;
- lootItem.Quantity = items[i].count;
- lootItem.Loot.Initialize(items[i]);
- packet.Items.push_back(lootItem);
- }
- }
- break;
- }
- case ALL_PERMISSION:
- case OWNER_PERMISSION:
- {
- for (uint8 i = 0; i < items.size(); ++i)
- {
- if (!items[i].is_looted && !items[i].freeforall && items[i].conditions.empty() && items[i].AllowedForPlayer(viewer))
- {
- WorldPackets::Loot::LootItemData lootItem;
- lootItem.LootListID = i + 1;
- lootItem.UIType = permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT;
- lootItem.Quantity = items[i].count;
- lootItem.Loot.Initialize(items[i]);
- packet.Items.push_back(lootItem);
- }
- }
- break;
- }
- default:
- return;
- }
-
- LootSlotType slotType = permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT;
- QuestItemMap const& lootPlayerQuestItems = GetPlayerQuestItems();
- QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(viewer->GetGUID().GetCounter());
- if (q_itr != lootPlayerQuestItems.end())
- {
- QuestItemList* q_list = q_itr->second;
- for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi)
- {
- LootItem const& item = quest_items[qi->index];
- if (!qi->is_looted && !item.is_looted)
- {
- WorldPackets::Loot::LootItemData lootItem;
- lootItem.LootListID = items.size() + qi->index + 1;
- lootItem.Quantity = item.count;
- lootItem.Loot.Initialize(item);
-
- if (item.follow_loot_rules)
- {
- switch (permission)
- {
- case MASTER_PERMISSION:
- lootItem.UIType = LOOT_SLOT_TYPE_MASTER;
- break;
- case RESTRICTED_PERMISSION:
- lootItem.UIType = item.is_blocked ? LOOT_SLOT_TYPE_LOCKED : LOOT_SLOT_TYPE_ALLOW_LOOT;
- break;
- case GROUP_PERMISSION:
- if (!item.is_blocked)
- lootItem.UIType = LOOT_SLOT_TYPE_ALLOW_LOOT;
- else
- lootItem.UIType = LOOT_SLOT_TYPE_ROLL_ONGOING;
- break;
- default:
- lootItem.UIType = slotType;
- break;
- }
- }
- else
- lootItem.UIType = slotType;
-
- packet.Items.push_back(lootItem);
- }
- }
- }
-
- QuestItemMap const& lootPlayerFFAItems = GetPlayerFFAItems();
- QuestItemMap::const_iterator ffa_itr = lootPlayerFFAItems.find(viewer->GetGUID().GetCounter());
- if (ffa_itr != lootPlayerFFAItems.end())
- {
- QuestItemList* ffa_list = ffa_itr->second;
- for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi)
- {
- LootItem const& item = items[fi->index];
- if (!fi->is_looted && !item.is_looted)
- {
- WorldPackets::Loot::LootItemData lootItem;
- lootItem.LootListID = items.size() + fi->index + 1;
- lootItem.UIType = slotType;
- lootItem.Quantity = item.count;
- lootItem.Loot.Initialize(item);
- packet.Items.push_back(lootItem);
- }
- }
- }
-
- QuestItemMap const& lootPlayerNonQuestNonFFAConditionalItems = GetPlayerNonQuestNonFFAConditionalItems();
- QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(viewer->GetGUID().GetCounter());
- if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
- {
- QuestItemList* conditional_list = nn_itr->second;
- for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci)
- {
- LootItem const& item = items[ci->index];
- if (!ci->is_looted && !item.is_looted)
- {
- WorldPackets::Loot::LootItemData lootItem;
- lootItem.LootListID = items.size() + ci->index + 1;
- lootItem.Quantity = item.count;
- lootItem.Loot.Initialize(item);
-
- if (item.follow_loot_rules)
- {
- switch (permission)
- {
- case MASTER_PERMISSION:
- lootItem.UIType = LOOT_SLOT_TYPE_MASTER;
- break;
- case RESTRICTED_PERMISSION:
- lootItem.UIType = item.is_blocked ? LOOT_SLOT_TYPE_LOCKED : LOOT_SLOT_TYPE_ALLOW_LOOT;
- break;
- case GROUP_PERMISSION:
- if (!item.is_blocked)
- lootItem.UIType = LOOT_SLOT_TYPE_ALLOW_LOOT;
- else
- lootItem.UIType = LOOT_SLOT_TYPE_ROLL_ONGOING;
- break;
- default:
- lootItem.UIType = slotType;
- break;
- }
- }
- else
- lootItem.UIType = slotType;
-
- packet.Items.push_back(lootItem);
- }
- }
- }
-}
-
-//
// --------- LootTemplate::LootGroup ---------
//
@@ -1843,9 +1107,7 @@ void LoadLootTemplates_Spell()
// not report about not trainable spells (optionally supported by DB)
// ignore 61756 (Northrend Inscription Research (FAST QA VERSION) for example
if (!spellInfo->HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT) || (spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL)))
- {
LootTemplates_Spell.ReportNonExistingId(spell_id, "Spell", spellInfo->Id);
- }
}
else
lootIdSet.erase(spell_id);
@@ -1904,29 +1166,3 @@ void LoadLootTables()
LoadLootTemplates_Reference();
}
-
-void AELootResult::Add(Item* item, uint8 count, LootType lootType)
-{
- auto itr = _byItem.find(item);
- if (itr != _byItem.end())
- _byOrder[itr->second].count += count;
- else
- {
- _byItem[item] = _byOrder.size();
- ResultValue value;
- value.item = item;
- value.count = count;
- value.lootType = lootType;
- _byOrder.push_back(value);
- }
-}
-
-AELootResult::OrderedStorage::const_iterator AELootResult::begin() const
-{
- return _byOrder.begin();
-}
-
-AELootResult::OrderedStorage::const_iterator AELootResult::end() const
-{
- return _byOrder.end();
-}
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index eeecb40440c..d3356d4a629 100644
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -19,117 +19,20 @@
#ifndef TRINITY_LOOTMGR_H
#define TRINITY_LOOTMGR_H
-#include "ItemEnchantmentMgr.h"
-#include "ByteBuffer.h"
-#include "RefManager.h"
-#include "SharedDefines.h"
+#include "Define.h"
#include "ConditionMgr.h"
#include "ObjectGuid.h"
-#include <map>
-#include <vector>
+#include "SharedDefines.h"
#include <list>
+#include <set>
+#include <unordered_map>
+#include <vector>
-class Item;
-
-namespace WorldPackets
-{
- namespace Loot
- {
- class LootResponse;
- }
-}
-
-enum RollType
-{
- ROLL_PASS = 0,
- ROLL_NEED = 1,
- ROLL_GREED = 2,
- ROLL_DISENCHANT = 3,
- MAX_ROLL_TYPE = 4
-};
-
-enum RollMask
-{
- ROLL_FLAG_TYPE_PASS = 0x01,
- ROLL_FLAG_TYPE_NEED = 0x02,
- ROLL_FLAG_TYPE_GREED = 0x04,
- ROLL_FLAG_TYPE_DISENCHANT = 0x08,
-
- ROLL_ALL_TYPE_NO_DISENCHANT = 0x07,
- ROLL_ALL_TYPE_MASK = 0x0F
-};
-
-#define MAX_NR_LOOT_ITEMS 16
-// note: the client cannot show more than 16 items total
-#define MAX_NR_QUEST_ITEMS 32
-// unrelated to the number of quest items shown, just for reserve
-
-enum LootMethod : uint8
-{
- FREE_FOR_ALL = 0,
- MASTER_LOOT = 2,
- GROUP_LOOT = 3,
- PERSONAL_LOOT = 5
-};
-
-enum PermissionTypes
-{
- ALL_PERMISSION = 0,
- GROUP_PERMISSION = 1,
- MASTER_PERMISSION = 2,
- RESTRICTED_PERMISSION = 3,
- OWNER_PERMISSION = 5,
- NONE_PERMISSION = 6
-};
-
-enum LootType : uint8
-{
- LOOT_NONE = 0,
-
- LOOT_CORPSE = 1,
- LOOT_PICKPOCKETING = 2,
- LOOT_FISHING = 3,
- LOOT_DISENCHANTING = 4,
- // ignored always by client
- LOOT_SKINNING = 6,
- LOOT_PROSPECTING = 7,
- LOOT_MILLING = 8,
-
- LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead
- LOOT_INSIGNIA = 21, // unsupported by client, sending LOOT_CORPSE instead
- LOOT_FISHING_JUNK = 22 // unsupported by client, sending LOOT_FISHING instead
-};
-
-enum LootError
-{
- LOOT_ERROR_DIDNT_KILL = 0, // You don't have permission to loot that corpse.
- LOOT_ERROR_TOO_FAR = 4, // You are too far away to loot that corpse.
- LOOT_ERROR_BAD_FACING = 5, // You must be facing the corpse to loot it.
- LOOT_ERROR_LOCKED = 6, // Someone is already looting that corpse.
- LOOT_ERROR_NOTSTANDING = 8, // You need to be standing up to loot something!
- LOOT_ERROR_STUNNED = 9, // You can't loot anything while stunned!
- LOOT_ERROR_PLAYER_NOT_FOUND = 10, // Player not found
- LOOT_ERROR_PLAY_TIME_EXCEEDED = 11, // Maximum play time exceeded
- LOOT_ERROR_MASTER_INV_FULL = 12, // That player's inventory is full
- LOOT_ERROR_MASTER_UNIQUE_ITEM = 13, // Player has too many of that item already
- LOOT_ERROR_MASTER_OTHER = 14, // Can't assign item to that player
- LOOT_ERROR_ALREADY_PICKPOCKETED = 15, // Your target has already had its pockets picked
- LOOT_ERROR_NOT_WHILE_SHAPESHIFTED = 16, // You can't do that while shapeshifted.
- LOOT_ERROR_NO_LOOT = 17 // There is no loot.
-};
-
-// type of Loot Item in Loot View
-enum LootSlotType
-{
- LOOT_SLOT_TYPE_ALLOW_LOOT = 0, // player can loot the item.
- LOOT_SLOT_TYPE_ROLL_ONGOING = 1, // roll is ongoing. player cannot loot.
- LOOT_SLOT_TYPE_MASTER = 3, // item can only be distributed by group loot master.
- LOOT_SLOT_TYPE_LOCKED = 2, // item is shown in red. player cannot loot.
- LOOT_SLOT_TYPE_OWNER = 4 // ignore binding confirmation and etc, for single player looting
-};
-
-class Player;
class LootStore;
+class LootTemplate;
+class Player;
+struct Loot;
+struct LootItem;
struct TC_GAME_API LootStoreItem
{
@@ -137,8 +40,8 @@ struct TC_GAME_API LootStoreItem
uint32 reference; // referenced TemplateleId
float chance; // chance to drop for both quest and non-quest items, chance to be used for refs
uint16 lootmode;
- bool needs_quest : 1; // quest drop (quest is required for item to drop)
- uint8 groupid : 7;
+ bool needs_quest; // quest drop (quest is required for item to drop)
+ uint8 groupid;
uint8 mincount; // mincount for drop items
uint8 maxcount; // max drop count for the item mincount or Ref multiplicator
ConditionContainer conditions; // additional loot condition
@@ -154,59 +57,6 @@ struct TC_GAME_API LootStoreItem
bool IsValid(LootStore const& store, uint32 entry) const; // Checks correctness of values
};
-struct TC_GAME_API LootItem
-{
- uint32 itemid;
- uint32 randomSuffix;
- ItemRandomEnchantmentId randomPropertyId;
- int32 upgradeId;
- std::vector<int32> BonusListIDs;
- uint8 context;
- ConditionContainer conditions; // additional loot condition
- GuidSet allowedGUIDs;
- uint8 count : 8;
- bool is_looted : 1;
- bool is_blocked : 1;
- bool freeforall : 1; // free for all
- bool is_underthreshold : 1;
- 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 (reference = 0)
- explicit LootItem(LootStoreItem const& li);
-
- // Empty constructor for creating an empty LootItem to be filled in with DB data
- LootItem() : itemid(0), randomSuffix(0), randomPropertyId(), upgradeId(0), context(0), count(0), is_looted(false), is_blocked(false),
- freeforall(false), is_underthreshold(false), is_counted(false), needs_quest(false), follow_loot_rules(false),
- 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);
- GuidSet const& GetAllowedLooters() const { return allowedGUIDs; }
-};
-
-struct QuestItem
-{
- uint8 index; // position in quest_items;
- bool is_looted;
-
- QuestItem()
- : index(0), is_looted(false) { }
-
- QuestItem(uint8 _index, bool _islooted = false)
- : index(_index), is_looted(_islooted) { }
-};
-
-struct Loot;
-class LootTemplate;
-
-typedef std::vector<QuestItem> QuestItemList;
-typedef std::vector<LootItem> LootItemList;
-typedef std::map<ObjectGuid::LowType, QuestItemList*> QuestItemMap;
typedef std::list<LootStoreItem*> LootStoreItemList;
typedef std::unordered_map<uint32, LootTemplate*> LootTemplateMap;
@@ -287,158 +137,6 @@ class TC_GAME_API LootTemplate
//=====================================================
-class LootValidatorRef : public Reference<Loot, LootValidatorRef>
-{
- public:
- LootValidatorRef() { }
- void targetObjectDestroyLink() override { }
- void sourceObjectDestroyLink() override { }
-};
-
-//=====================================================
-
-class LootValidatorRefManager : public RefManager<Loot, LootValidatorRef>
-{
- public:
- typedef LinkedListHead::Iterator< LootValidatorRef > iterator;
-
- LootValidatorRef* getFirst() { return (LootValidatorRef*)RefManager<Loot, LootValidatorRef>::getFirst(); }
- LootValidatorRef* getLast() { return (LootValidatorRef*)RefManager<Loot, LootValidatorRef>::getLast(); }
-
- iterator begin() { return iterator(getFirst()); }
- iterator end() { return iterator(NULL); }
- iterator rbegin() { return iterator(getLast()); }
- iterator rend() { return iterator(NULL); }
-};
-
-//=====================================================
-
-struct TC_GAME_API Loot
-{
- QuestItemMap const& GetPlayerQuestItems() const { return PlayerQuestItems; }
- QuestItemMap const& GetPlayerFFAItems() const { return PlayerFFAItems; }
- QuestItemMap const& GetPlayerNonQuestNonFFAConditionalItems() const { return PlayerNonQuestNonFFAConditionalItems; }
-
- std::vector<LootItem> items;
- std::vector<LootItem> quest_items;
- uint32 gold;
- uint8 unlootedCount;
- ObjectGuid 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
- uint8 maxDuplicates; // Max amount of items with the same entry that can drop (default is 1; on 25 man raid mode 3)
-
- // GUID of container that holds this loot (item_instance.entry)
- // Only set for inventory items that can be right-click looted
- ObjectGuid containerID;
-
- Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), roundRobinPlayer(), loot_type(LOOT_CORPSE), maxDuplicates(1), _difficultyBonusTreeMod(0){ }
- ~Loot() { clear(); }
-
- ObjectGuid const& GetGUID() const { return _GUID; }
- void SetGUID(ObjectGuid const& guid) { _GUID = guid; }
-
- // 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)
- {
- i_LootValidatorRefManager.insertFirst(pLootValidatorRef);
- }
-
- // void clear();
- void clear()
- {
- for (QuestItemMap::const_iterator itr = PlayerQuestItems.begin(); itr != PlayerQuestItems.end(); ++itr)
- delete itr->second;
- PlayerQuestItems.clear();
-
- for (QuestItemMap::const_iterator itr = PlayerFFAItems.begin(); itr != PlayerFFAItems.end(); ++itr)
- delete itr->second;
- PlayerFFAItems.clear();
-
- for (QuestItemMap::const_iterator itr = PlayerNonQuestNonFFAConditionalItems.begin(); itr != PlayerNonQuestNonFFAConditionalItems.end(); ++itr)
- delete itr->second;
- PlayerNonQuestNonFFAConditionalItems.clear();
-
- PlayersLooting.clear();
- items.clear();
- quest_items.clear();
- gold = 0;
- unlootedCount = 0;
- roundRobinPlayer.Clear();
- loot_type = LOOT_NONE;
- i_LootValidatorRefManager.clearReferences();
- _difficultyBonusTreeMod = 0;
- }
-
- bool empty() const { return items.empty() && gold == 0; }
- bool isLooted() const { return gold == 0 && unlootedCount == 0; }
-
- void NotifyItemRemoved(uint8 lootIndex);
- void NotifyQuestItemRemoved(uint8 questIndex);
- void NotifyMoneyRemoved();
- void AddLooter(ObjectGuid GUID) { PlayersLooting.insert(GUID); }
- void RemoveLooter(ObjectGuid GUID) { PlayersLooting.erase(GUID); }
-
- void generateMoneyLoot(uint32 minAmount, uint32 maxAmount);
- bool FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bool personal, bool noEmptyError = false, uint16 lootMode = LOOT_MODE_DEFAULT);
-
- // Inserts the item into the loot (called by LootTemplate processors)
- void AddItem(LootStoreItem const & item);
-
- LootItem const* GetItemInSlot(uint32 lootSlot) const;
- LootItem* LootItemInSlot(uint32 lootslot, Player* player, QuestItem** qitem = NULL, QuestItem** ffaitem = NULL, QuestItem** conditem = NULL);
- uint32 GetMaxSlotInLootFor(Player* player) const;
- bool hasItemForAll() const;
- bool hasItemFor(Player* player) const;
- bool hasOverThresholdItem() const;
-
- // Builds data for SMSG_LOOT_RESPONSE
- void BuildLootResponse(WorldPackets::Loot::LootResponse& packet, Player* viewer, PermissionTypes permission = ALL_PERMISSION) const;
-
-private:
-
- void FillNotNormalLootFor(Player* player, bool presentAtLooting);
- QuestItemList* FillFFALoot(Player* player);
- QuestItemList* FillQuestLoot(Player* player);
- QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player, bool presentAtLooting);
-
- GuidSet PlayersLooting;
- QuestItemMap PlayerQuestItems;
- QuestItemMap PlayerFFAItems;
- QuestItemMap PlayerNonQuestNonFFAConditionalItems;
-
- // All rolls are registered here. They need to know, when the loot is not valid anymore
- LootValidatorRefManager i_LootValidatorRefManager;
-
- // Loot GUID
- ObjectGuid _GUID;
- uint8 _difficultyBonusTreeMod;
-};
-
-class TC_GAME_API AELootResult
-{
-public:
- struct ResultValue
- {
- Item* item;
- uint8 count;
- LootType lootType;
- };
-
- typedef std::vector<ResultValue> OrderedStorage;
-
- void Add(Item* item, uint8 count, LootType lootType);
-
- OrderedStorage::const_iterator begin() const;
- OrderedStorage::const_iterator end() const;
-
- OrderedStorage _byOrder;
- std::unordered_map<Item*, OrderedStorage::size_type> _byItem;
-};
-
TC_GAME_API extern LootStore LootTemplates_Creature;
TC_GAME_API extern LootStore LootTemplates_Fishing;
TC_GAME_API extern LootStore LootTemplates_Gameobject;
diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp
index 5b796042369..322ae79aa0e 100644
--- a/src/server/game/Mails/Mail.cpp
+++ b/src/server/game/Mails/Mail.cpp
@@ -16,16 +16,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "DatabaseEnv.h"
#include "Mail.h"
-#include "Log.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "Player.h"
-#include "Item.h"
#include "AuctionHouseMgr.h"
#include "BlackMarketMgr.h"
#include "CalendarMgr.h"
+#include "DatabaseEnv.h"
+#include "Item.h"
+#include "Log.h"
+#include "LootMgr.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "World.h"
MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery(stationery)
{
@@ -184,7 +185,7 @@ void MailDraft::SendReturnToSender(uint32 sender_acc, ObjectGuid::LowType sender
void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver, MailSender const& sender, MailCheckMask checked, uint32 deliver_delay)
{
Player* pReceiver = receiver.GetPlayer(); // can be NULL
- Player* pSender = sObjectMgr->GetPlayerByLowGUID(sender.GetSenderId());
+ Player* pSender = ObjectAccessor::FindPlayer(ObjectGuid::Create<HighGuid::Player>(sender.GetSenderId()));
if (pReceiver)
prepareItems(pReceiver, trans); // generate mail template items
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 9faf6961f45..f4e088ce729 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -17,11 +17,10 @@
*/
#include "Map.h"
-#include "MapManager.h"
#include "Battleground.h"
-#include "MMapFactory.h"
#include "CellImpl.h"
#include "Conversation.h"
+#include "DatabaseEnv.h"
#include "DisableMgr.h"
#include "DynamicTree.h"
#include "GridNotifiers.h"
@@ -31,8 +30,11 @@
#include "InstancePackets.h"
#include "InstanceScenario.h"
#include "InstanceScript.h"
+#include "Log.h"
#include "MapInstanced.h"
+#include "MapManager.h"
#include "MiscPackets.h"
+#include "MMapFactory.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Pet.h"
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 0e614a89454..4ff78d3c537 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -35,6 +35,8 @@
#include <list>
#include <memory>
#include <mutex>
+#include <set>
+#include <unordered_set>
class Battleground;
class BattlegroundMap;
diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp
index eca2e69ee41..6ea46eb63ee 100644
--- a/src/server/game/Maps/MapInstanced.cpp
+++ b/src/server/game/Maps/MapInstanced.cpp
@@ -17,17 +17,18 @@
*/
#include "MapInstanced.h"
-#include "ObjectMgr.h"
-#include "MapManager.h"
#include "Battleground.h"
-#include "VMapFactory.h"
-#include "MMapFactory.h"
-#include "InstanceSaveMgr.h"
-#include "World.h"
+#include "GarrisonMap.h"
#include "Group.h"
+#include "InstanceSaveMgr.h"
+#include "Log.h"
+#include "MapManager.h"
+#include "MMapFactory.h"
+#include "ObjectMgr.h"
#include "Player.h"
-#include "GarrisonMap.h"
#include "ScenarioMgr.h"
+#include "VMapFactory.h"
+#include "World.h"
MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DIFFICULTY_NORMAL)
{
diff --git a/src/server/game/Maps/MapScripts.cpp b/src/server/game/Maps/MapScripts.cpp
index c6eb2068165..cc82334faa9 100644
--- a/src/server/game/Maps/MapScripts.cpp
+++ b/src/server/game/Maps/MapScripts.cpp
@@ -16,14 +16,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Map.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GossipDef.h"
-#include "Map.h"
+#include "GridNotifiers.h"
+#include "Item.h"
+#include "Log.h"
#include "MapManager.h"
#include "ObjectMgr.h"
#include "Pet.h"
-#include "Item.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "Transport.h"
@@ -887,7 +888,7 @@ void Map::ScriptsProcess()
break;
case SCRIPT_COMMAND_MOVEMENT:
- // Source must be Creature.
+ // Source must be Creature.
if (Creature* cSource = _GetScriptCreature(source, true, step.script))
{
if (!cSource->IsAlive())
diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp
index 21f03aa78ca..d402b93b899 100644
--- a/src/server/game/Maps/TransportMgr.cpp
+++ b/src/server/game/Maps/TransportMgr.cpp
@@ -16,10 +16,12 @@
*/
#include "TransportMgr.h"
-#include "Transport.h"
+#include "DatabaseEnv.h"
#include "InstanceScript.h"
+#include "Log.h"
#include "MapManager.h"
#include "Spline.h"
+#include "Transport.h"
TransportTemplate::~TransportTemplate()
{
diff --git a/src/server/game/Maps/ZoneScript.cpp b/src/server/game/Maps/ZoneScript.cpp
new file mode 100644
index 00000000000..e16007a34f3
--- /dev/null
+++ b/src/server/game/Maps/ZoneScript.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ZoneScript.h"
+#include "Creature.h"
+
+uint32 ZoneScript::GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data)
+{
+ return data->id;
+}
diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h
index 841099664bb..08b939f1c50 100644
--- a/src/server/game/Maps/ZoneScript.h
+++ b/src/server/game/Maps/ZoneScript.h
@@ -18,18 +18,22 @@
#ifndef ZONE_SCRIPT_H_
#define ZONE_SCRIPT_H_
-#include "Common.h"
-#include "Creature.h"
+#include "Define.h"
+#include "ObjectGuid.h"
+class Creature;
class GameObject;
+class Unit;
+class WorldObject;
+struct CreatureData;
-class ZoneScript
+class TC_GAME_API ZoneScript
{
public:
ZoneScript() { }
virtual ~ZoneScript() { }
- virtual uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) { return data->id; }
+ virtual uint32 GetCreatureEntry(ObjectGuid::LowType /*spawnId*/, CreatureData const* data);
virtual uint32 GetGameObjectEntry(ObjectGuid::LowType /*spawnId*/, uint32 entry) { return entry; }
virtual void OnCreatureCreate(Creature* ) { }
@@ -40,10 +44,11 @@ class ZoneScript
virtual void OnUnitDeath(Unit*) { }
- //All-purpose data storage 64 bit
+ //All-purpose data storage ObjectGuid
virtual ObjectGuid GetGuidData(uint32 /*DataId*/) const { return ObjectGuid::Empty; }
virtual void SetGuidData(uint32 /*DataId*/, ObjectGuid /*Value*/) { }
+ //All-purpose data storage 64 bit
virtual uint64 GetData64(uint32 /*DataId*/) const { return 0; }
virtual void SetData64(uint32 /*DataId*/, uint64 /*Value*/) { }
diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h
index 27fdab395bb..dd3cc5ff685 100644
--- a/src/server/game/Miscellaneous/Formulas.h
+++ b/src/server/game/Miscellaneous/Formulas.h
@@ -24,6 +24,7 @@
#include "ScriptMgr.h"
#include "Player.h"
#include "GameTables.h"
+#include "Creature.h"
namespace Trinity
{
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index f29f71b43f2..fc40b0d238b 100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -21,7 +21,6 @@
#include "Define.h"
#include "DetourNavMesh.h"
-#include <cassert>
enum SpellEffIndex : uint8
{
@@ -74,6 +73,8 @@ enum LootModes
LOOT_MODE_JUNK_FISH = 0x8000
};
+#define MAX_CHARACTERS_PER_REALM 12
+
enum Expansions
{
EXPANSION_LEVEL_CURRENT = -1,
@@ -4742,7 +4743,7 @@ enum BattlegroundTeamId : uint8
#define BG_TEAMS_COUNT 2
// indexes of BattlemasterList.dbc (7.1.5.23360)
-enum BattlegroundTypeId
+enum BattlegroundTypeId : uint32
{
BATTLEGROUND_TYPE_NONE = 0, // None
BATTLEGROUND_AV = 1, // Alterac Valley
@@ -4863,7 +4864,7 @@ enum TradeStatus
TRADE_STATUS_NOT_ENOUGH_CURRENCY = 25,
};
-enum XPColorChar
+enum XPColorChar : uint8
{
XP_RED,
XP_ORANGE,
@@ -4872,7 +4873,7 @@ enum XPColorChar
XP_GRAY
};
-enum RemoveMethod
+enum RemoveMethod : uint8
{
GROUP_REMOVEMETHOD_DEFAULT = 0,
GROUP_REMOVEMETHOD_KICK = 1,
@@ -4911,7 +4912,7 @@ enum ProfessionUI
MAX_SECONDARY_SKILLS = 5
};
-enum DuelCompleteType
+enum DuelCompleteType : uint8
{
DUEL_INTERRUPTED = 0,
DUEL_WON = 1,
@@ -5084,6 +5085,41 @@ enum TokenResult
TOKEN_RESULT_ERROR_TRIAL_RESTRICTED = 8
};
+enum TutorialAction : uint8
+{
+ TUTORIAL_ACTION_UPDATE = 0,
+ TUTORIAL_ACTION_CLEAR = 1,
+ TUTORIAL_ACTION_RESET = 2
+};
+
+/*
+enum Tutorials : uint8
+{
+ TUTORIAL_TALENT = 0,
+ TUTORIAL_SPEC = 1,
+ TUTORIAL_GLYPH = 2,
+ TUTORIAL_SPELLBOOK = 3,
+ TUTORIAL_PROFESSIONS = 4,
+ TUTORIAL_CORE_ABILITITES = 5,
+ TUTORIAL_PET_JOURNAL = 6,
+ TUTORIAL_WHAT_HAS_CHANGED = 7,
+ TUTORIAL_GARRISON_BUILDING = 8,
+ TUTORIAL_GARRISON_MISSION_LIST = 9,
+ TUTORIAL_GARRISON_MISSION_PAGE = 10,
+ TUTORIAL_GARRISON_LANDING = 11,
+ TUTORIAL_GARRISON_ZONE_ABILITY = 12,
+ TUTORIAL_WORLD_MAP_FRAME = 13,
+ TUTORIAL_CLEAN_UP_BAGS = 14,
+ TUTORIAL_BAG_SETTINGS = 15,
+ TUTORIAL_REAGENT_BANK_UNLOCK = 16,
+ TUTORIAL_TOYBOX_FAVORITE = 17,
+ TUTORIAL_TOYBOX_MOUSEWHEEL_PAGING = 18,
+ TUTORIAL_LFG_LIST = 19
+};
+*/
+
+#define MAX_ACCOUNT_TUTORIAL_VALUES 8
+
enum RaidGroupReason
{
RAID_GROUP_ERR_NONE = 0,
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index 34b8d312662..920a44b3a55 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -15,21 +15,18 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-//Basic headers
+
#include "WaypointMovementGenerator.h"
-//Extended headers
-#include "ObjectMgr.h"
-#include "Transport.h"
-//Flightmaster grid preloading
-#include "MapManager.h"
-//Creature-specific headers
#include "Creature.h"
#include "CreatureAI.h"
#include "CreatureGroups.h"
-//Player-specific
-#include "Player.h"
-#include "MoveSplineInit.h"
+#include "Log.h"
+#include "MapManager.h"
#include "MoveSpline.h"
+#include "MoveSplineInit.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "Transport.h"
void WaypointMovementGenerator<Creature>::LoadPath(Creature* creature)
{
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index 53c468b5df4..8b021d9d8a5 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -16,17 +16,19 @@
*/
#include "OutdoorPvP.h"
-#include "OutdoorPvPMgr.h"
-#include "ObjectAccessor.h"
-#include "ObjectMgr.h"
+#include "CellImpl.h"
+#include "ChatPackets.h"
+#include "DatabaseEnv.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Group.h"
+#include "Log.h"
#include "Map.h"
#include "MapManager.h"
-#include "Group.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "OutdoorPvPMgr.h"
#include "WorldPacket.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "CellImpl.h"
-#include "Packets/ChatPackets.h"
class DefenseMessageBuilder
{
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h
index d517a6a8b1d..2d06cc7238b 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.h
@@ -18,10 +18,9 @@
#ifndef OUTDOOR_PVP_H_
#define OUTDOOR_PVP_H_
-#include "Util.h"
#include "SharedDefines.h"
#include "ZoneScript.h"
-#include "Packets/WorldStatePackets.h"
+#include <map>
class GameObject;
@@ -76,13 +75,22 @@ struct creature_type
};
// some class predefs
-class Player;
-class GameObject;
-class WorldPacket;
class Creature;
+class GameObject;
+class Map;
+class OutdoorPvP;
+class Player;
class Unit;
+class WorldPacket;
struct GossipMenuItems;
-class OutdoorPvP;
+
+namespace WorldPackets
+{
+ namespace WorldState
+ {
+ class InitWorldStates;
+ }
+}
class TC_GAME_API OPvPCapturePoint
{
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
index 35337682fc1..4a8ffe68e16 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
@@ -16,9 +16,11 @@
*/
#include "OutdoorPvPMgr.h"
+#include "DatabaseEnv.h"
+#include "DisableMgr.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "DisableMgr.h"
#include "ScriptMgr.h"
OutdoorPvPMgr::OutdoorPvPMgr()
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
index 25d21b27bae..9708a2c41c6 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
@@ -27,6 +27,7 @@ class GameObject;
class Creature;
class ZoneScript;
struct GossipMenuItems;
+enum LocaleConstant : uint8;
struct OutdoorPvPData
{
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 3118d0e00d1..ba614cfb4b6 100644
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -18,9 +18,15 @@
#include "PoolMgr.h"
#include "Containers.h"
-#include "ObjectMgr.h"
+#include "DatabaseEnv.h"
#include "Log.h"
#include "MapManager.h"
+#include "ObjectMgr.h"
+#include <sstream>
+
+PoolObject::PoolObject(uint64 _guid, float _chance) : guid(_guid), chance(std::fabs(_chance))
+{
+}
////////////////////////////////////////////////////////////
// template class ActivePoolData
diff --git a/src/server/game/Pools/PoolMgr.h b/src/server/game/Pools/PoolMgr.h
index 74d5b0c269e..255d2890ee7 100644
--- a/src/server/game/Pools/PoolMgr.h
+++ b/src/server/game/Pools/PoolMgr.h
@@ -20,9 +20,13 @@
#define TRINITY_POOLHANDLER_H
#include "Define.h"
-#include "Creature.h"
-#include "GameObject.h"
-#include "QuestDef.h"
+#include <map>
+#include <set>
+#include <vector>
+
+class Creature;
+class GameObject;
+class Quest;
struct PoolTemplateData
{
@@ -33,7 +37,7 @@ struct PoolObject
{
uint64 guid;
float chance;
- PoolObject(uint64 _guid, float _chance) : guid(_guid), chance(std::fabs(_chance)) { }
+ PoolObject(uint64 _guid, float _chance);
};
class Pool // for Pool of Pool case
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index 91d290c073d..9baea76bd03 100644
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -17,6 +17,7 @@
*/
#include "QuestDef.h"
+#include "Field.h"
#include "GameTables.h"
#include "Log.h"
#include "Player.h"
diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h
index 15eb95280b9..43b416e78d8 100644
--- a/src/server/game/Quests/QuestDef.h
+++ b/src/server/game/Quests/QuestDef.h
@@ -20,9 +20,8 @@
#define TRINITYCORE_QUEST_H
#include "Define.h"
-#include "DatabaseEnv.h"
+#include "DatabaseEnvFwd.h"
#include "SharedDefines.h"
-#include "WorldPacket.h"
#include "DBCEnums.h"
#include <string>
@@ -106,7 +105,7 @@ enum QuestTradeSkill
QUEST_TRSKILL_JEWELCRAFTING = 14
};
-enum QuestStatus
+enum QuestStatus : uint8
{
QUEST_STATUS_NONE = 0,
QUEST_STATUS_COMPLETE = 1,
diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp
index 23d958315ff..038e05f1b3c 100644
--- a/src/server/game/Reputation/ReputationMgr.cpp
+++ b/src/server/game/Reputation/ReputationMgr.cpp
@@ -16,17 +16,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "DatabaseEnv.h"
#include "ReputationMgr.h"
-#include "ReputationPackets.h"
-#include "Player.h"
-#include "WorldPacket.h"
-#include "World.h"
+#include "CharacterPackets.h"
+#include "DatabaseEnv.h"
+#include "Log.h"
#include "ObjectMgr.h"
-#include "ScriptMgr.h"
#include "Opcodes.h"
+#include "Player.h"
+#include "ReputationPackets.h"
+#include "ScriptMgr.h"
+#include "World.h"
+#include "WorldPacket.h"
#include "WorldSession.h"
-#include "CharacterPackets.h"
const int32 ReputationMgr::PointsInRank[MAX_REPUTATION_RANK] = {36000, 3000, 3000, 3000, 6000, 12000, 21000, 1000};
diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h
index e0a775afeb1..7614bea5c62 100644
--- a/src/server/game/Reputation/ReputationMgr.h
+++ b/src/server/game/Reputation/ReputationMgr.h
@@ -22,7 +22,7 @@
#include "Common.h"
#include "SharedDefines.h"
#include "Language.h"
-#include "QueryResult.h"
+#include "DatabaseEnvFwd.h"
#include <map>
struct FactionEntry;
diff --git a/src/server/game/Scenarios/InstanceScenario.cpp b/src/server/game/Scenarios/InstanceScenario.cpp
index 1029b5222f3..72d20c245ab 100644
--- a/src/server/game/Scenarios/InstanceScenario.cpp
+++ b/src/server/game/Scenarios/InstanceScenario.cpp
@@ -16,9 +16,11 @@
*/
#include "InstanceScenario.h"
-#include "Player.h"
+#include "DatabaseEnv.h"
#include "InstanceSaveMgr.h"
+#include "Log.h"
#include "ObjectMgr.h"
+#include "Player.h"
InstanceScenario::InstanceScenario(Map const* map, ScenarioData const* scenarioData) : Scenario(scenarioData), _map(map)
{
diff --git a/src/server/game/Scenarios/Scenario.cpp b/src/server/game/Scenarios/Scenario.cpp
index e496c18c5e4..a59bb366ff2 100644
--- a/src/server/game/Scenarios/Scenario.cpp
+++ b/src/server/game/Scenarios/Scenario.cpp
@@ -16,10 +16,11 @@
*/
#include "Scenario.h"
-#include "Player.h"
-#include "ScenarioMgr.h"
#include "InstanceSaveMgr.h"
+#include "Log.h"
#include "ObjectMgr.h"
+#include "Player.h"
+#include "ScenarioMgr.h"
#include "ScenarioPackets.h"
Scenario::Scenario(ScenarioData const* scenarioData) : _data(scenarioData), _currentstep(nullptr)
diff --git a/src/server/game/Scenarios/Scenario.h b/src/server/game/Scenarios/Scenario.h
index 97f8592b4c4..c92b37b6522 100644
--- a/src/server/game/Scenarios/Scenario.h
+++ b/src/server/game/Scenarios/Scenario.h
@@ -19,6 +19,7 @@
#define Scenario_h__
#include "CriteriaHandler.h"
+#include <unordered_set>
struct ScenarioData;
struct ScenarioStepEntry;
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 8b9312c84f2..cf9cb50b3be 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -17,27 +17,34 @@
*/
#include "ScriptMgr.h"
-#include "ScriptReloadMgr.h"
-#include "Config.h"
-#include "DatabaseEnv.h"
+#include "AreaTrigger.h"
+#include "AreaTriggerAI.h"
+#include "Chat.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "CreatureAIImpl.h"
+#include "Errors.h"
+#include "GameObject.h"
+#include "GossipDef.h"
+#include "LFGScripts.h"
+#include "Log.h"
+#include "Map.h"
+#include "MapManager.h"
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
+#include "Player.h"
+#include "ScriptReloadMgr.h"
#include "ScriptSystem.h"
-#include "Transport.h"
-#include "Vehicle.h"
#include "SmartAI.h"
#include "SpellInfo.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
-#include "GossipDef.h"
-#include "CreatureAIImpl.h"
-#include "Player.h"
+#include "Timer.h"
+#include "Transport.h"
+#include "Vehicle.h"
+#include "Weather.h"
#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "Chat.h"
-#include "MapManager.h"
-#include "LFGScripts.h"
-#include "InstanceScript.h"
-#include "AreaTriggerAI.h"
+#include <unordered_map>
// Trait which indicates whether this script type
// must be assigned in the database.
@@ -2518,12 +2525,22 @@ CreatureScript::CreatureScript(const char* name)
ScriptRegistry<CreatureScript>::Instance()->AddScript(this);
}
+uint32 CreatureScript::GetDialogStatus(Player* /*player*/, Creature* /*creature*/)
+{
+ return DIALOG_STATUS_SCRIPTED_NO_STATUS;
+}
+
GameObjectScript::GameObjectScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<GameObjectScript>::Instance()->AddScript(this);
}
+uint32 GameObjectScript::GetDialogStatus(Player* /*player*/, GameObject* /*go*/)
+{
+ return DIALOG_STATUS_SCRIPTED_NO_STATUS;
+}
+
AreaTriggerScript::AreaTriggerScript(const char* name)
: ScriptObject(name)
{
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index a42c3fd1f89..020df6d54ac 100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -20,12 +20,8 @@
#define SC_SCRIPTMGR_H
#include "Common.h"
-#include <atomic>
-#include "DB2Stores.h"
-#include "QuestDef.h"
-#include "SharedDefines.h"
-#include "World.h"
-#include "Weather.h"
+#include "ObjectGuid.h"
+#include <vector>
class AccountMgr;
class AreaTrigger;
@@ -60,6 +56,7 @@ class SpellCastTargets;
class Transport;
class Unit;
class Vehicle;
+class Weather;
class WorldPacket;
class WorldSocket;
class WorldObject;
@@ -76,6 +73,17 @@ struct MapEntry;
struct OutdoorPvPData;
struct SceneTemplate;
+enum BattlegroundTypeId : uint32;
+enum Difficulty : uint8;
+enum DuelCompleteType : uint8;
+enum QuestStatus : uint8;
+enum RemoveMethod : uint8;
+enum ShutdownExitCode : uint32;
+enum ShutdownMask : uint32;
+enum SpellEffIndex : uint8;
+enum WeatherState : uint32;
+enum XPColorChar : uint8;
+
#define VISIBLE_RANGE 166.0f //MAX visible range (size of grid)
@@ -296,7 +304,8 @@ class TC_GAME_API FormulaScript : public ScriptObject
virtual void OnGroupRateCalculation(float& /*rate*/, uint32 /*count*/, bool /*isRaid*/) { }
};
-template<class TMap> class MapScript : public UpdatableScript<TMap>
+template<class TMap>
+class MapScript : public UpdatableScript<TMap>
{
MapEntry const* _mapEntry;
@@ -432,7 +441,7 @@ class TC_GAME_API CreatureScript : public UnitScript, public UpdatableScript<Cre
virtual bool OnQuestReward(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
// Called when the dialog status between a player and the creature is requested.
- virtual uint32 GetDialogStatus(Player* /*player*/, Creature* /*creature*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
+ virtual uint32 GetDialogStatus(Player* /*player*/, Creature* /*creature*/);
// Called when the creature tries to spawn. Return false to block spawn and re-evaluate on next tick.
virtual bool CanSpawn(ObjectGuid::LowType /*spawnId*/, uint32 /*entry*/, CreatureTemplate const* /*baseTemplate*/, CreatureTemplate const* /*actTemplate*/, CreatureData const* /*cData*/, Map const* /*map*/) const { return true; }
@@ -468,7 +477,7 @@ class TC_GAME_API GameObjectScript : public ScriptObject, public UpdatableScript
virtual bool OnQuestReward(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
// Called when the dialog status between a player and the gameobject is requested.
- virtual uint32 GetDialogStatus(Player* /*player*/, GameObject* /*go*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
+ virtual uint32 GetDialogStatus(Player* /*player*/, GameObject* /*go*/);
// Called when the game object is destroyed (destructible buildings only).
virtual void OnDestroyed(GameObject* /*go*/, Player* /*player*/) { }
diff --git a/src/server/game/Scripting/ScriptReloadMgr.cpp b/src/server/game/Scripting/ScriptReloadMgr.cpp
index e4f15c66431..d6547b60d3a 100644
--- a/src/server/game/Scripting/ScriptReloadMgr.cpp
+++ b/src/server/game/Scripting/ScriptReloadMgr.cpp
@@ -37,30 +37,30 @@ ScriptReloadMgr* ScriptReloadMgr::instance()
#else
+#include "BuiltInConfig.h"
+#include "Config.h"
+#include "GitRevision.h"
+#include "Log.h"
+#include "MPSCQueue.h"
+#include "Regex.h"
+#include "ScriptMgr.h"
+#include "SHA1.h"
+#include "StartProcess.h"
+#include "Timer.h"
+#include "World.h"
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/system/system_error.hpp>
+#include <efsw/efsw.hpp>
#include <algorithm>
-#include <regex>
-#include <vector>
+#include <fstream>
#include <future>
#include <memory>
-#include <fstream>
+#include <sstream>
#include <type_traits>
-#include <unordered_set>
#include <unordered_map>
-
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/system/system_error.hpp>
-
-#include "efsw/efsw.hpp"
-
-#include "Log.h"
-#include "Config.h"
-#include "BuiltInConfig.h"
-#include "ScriptMgr.h"
-#include "SHA1.h"
-#include "StartProcess.h"
-#include "MPSCQueue.h"
-#include "GitRevision.h"
+#include <unordered_set>
+#include <vector>
namespace fs = boost::filesystem;
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index bbacce7ce26..f205fa138af 100644
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -17,10 +17,11 @@
*/
#include "ScriptSystem.h"
-#include "ObjectMgr.h"
+#include "Creature.h"
#include "DatabaseEnv.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "Creature.h"
SystemMgr* SystemMgr::instance()
{
@@ -109,7 +110,7 @@ void SystemMgr::LoadScriptSplineChains()
uint16 chainId = fieldsMeta[1].GetUInt16();
uint8 splineId = fieldsMeta[2].GetUInt8();
SplineChain& chain = m_mSplineChainsMap[{entry,chainId}];
-
+
if (splineId != chain.size())
{
TC_LOG_WARN("server.loading", "Creature #%u: Chain %u has orphaned spline %u, skipped.", entry, chainId, splineId);
diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h
index baa23d09684..304275e87c7 100644
--- a/src/server/game/Scripting/ScriptSystem.h
+++ b/src/server/game/Scripting/ScriptSystem.h
@@ -19,8 +19,11 @@
#ifndef SC_SYSTEM_H
#define SC_SYSTEM_H
-#include "ScriptMgr.h"
+#include "Define.h"
+#include "Hash.h"
#include "SplineChain.h"
+#include <unordered_map>
+#include <vector>
class Creature;
diff --git a/src/server/game/Server/Packet.cpp b/src/server/game/Server/Packet.cpp
index 09fdb85571f..b68d8d74382 100644
--- a/src/server/game/Server/Packet.cpp
+++ b/src/server/game/Server/Packet.cpp
@@ -18,8 +18,7 @@
#include "Packet.h"
#include "Errors.h"
-WorldPackets::Packet::Packet(WorldPacket&& worldPacket)
- : _worldPacket(std::move(worldPacket))
+WorldPackets::Packet::Packet(WorldPacket&& worldPacket) : _worldPacket(std::move(worldPacket))
{
}
@@ -33,14 +32,12 @@ void WorldPackets::ServerPacket::Read()
ASSERT(!"Read not implemented for server packets.");
}
-WorldPackets::ClientPacket::ClientPacket(OpcodeClient expectedOpcode, WorldPacket&& packet)
- : Packet(std::move(packet))
+WorldPackets::ClientPacket::ClientPacket(OpcodeClient expectedOpcode, WorldPacket&& packet) : Packet(std::move(packet))
{
ASSERT(GetOpcode() == expectedOpcode);
}
-WorldPackets::ClientPacket::ClientPacket(WorldPacket&& packet)
- : Packet(std::move(packet))
+WorldPackets::ClientPacket::ClientPacket(WorldPacket&& packet) : Packet(std::move(packet))
{
}
diff --git a/src/server/game/Server/Packets/AchievementPackets.h b/src/server/game/Server/Packets/AchievementPackets.h
index 5a8841e0180..0ce2b11b1fa 100644
--- a/src/server/game/Server/Packets/AchievementPackets.h
+++ b/src/server/game/Server/Packets/AchievementPackets.h
@@ -18,8 +18,8 @@
#ifndef game_AchievementPackets_h__
#define game_AchievementPackets_h__
-#include "ObjectGuid.h"
#include "Packet.h"
+#include "ObjectGuid.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/ArtifactPackets.h b/src/server/game/Server/Packets/ArtifactPackets.h
index 30336cdbf50..3bc70b92c04 100644
--- a/src/server/game/Server/Packets/ArtifactPackets.h
+++ b/src/server/game/Server/Packets/ArtifactPackets.h
@@ -19,8 +19,8 @@
#define ArtifactPackets_h__
#include "Packet.h"
-#include "PacketUtilities.h"
#include "ObjectGuid.h"
+#include "PacketUtilities.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/AuctionHousePackets.cpp b/src/server/game/Server/Packets/AuctionHousePackets.cpp
index 56c38d5d18e..aa18575a2f6 100644
--- a/src/server/game/Server/Packets/AuctionHousePackets.cpp
+++ b/src/server/game/Server/Packets/AuctionHousePackets.cpp
@@ -18,6 +18,7 @@
#include "AuctionHousePackets.h"
#include "AuctionHouseMgr.h"
#include "ObjectGuid.h"
+#include "MailPackets.h"
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::AuctionHouse::AuctionItem const& auctionItem)
{
@@ -268,6 +269,14 @@ void WorldPackets::AuctionHouse::AuctionListOwnerItems::Read()
_worldPacket >> Offset;
}
+WorldPackets::AuctionHouse::AuctionListPendingSalesResult::AuctionListPendingSalesResult() : ServerPacket(SMSG_AUCTION_LIST_PENDING_SALES_RESULT, 140)
+{
+}
+
+WorldPackets::AuctionHouse::AuctionListPendingSalesResult::~AuctionListPendingSalesResult()
+{
+}
+
WorldPacket const* WorldPackets::AuctionHouse::AuctionListPendingSalesResult::Write()
{
_worldPacket << uint32(Mails.size());
diff --git a/src/server/game/Server/Packets/AuctionHousePackets.h b/src/server/game/Server/Packets/AuctionHousePackets.h
index 17d7ee89e56..9e358e94107 100644
--- a/src/server/game/Server/Packets/AuctionHousePackets.h
+++ b/src/server/game/Server/Packets/AuctionHousePackets.h
@@ -19,14 +19,19 @@
#define AuctionHousePackets_h__
#include "Packet.h"
+#include "DBCEnums.h"
+#include "ItemPacketsCommon.h"
#include "ObjectGuid.h"
-#include "ItemPackets.h"
-#include "MailPackets.h"
struct AuctionEntry;
namespace WorldPackets
{
+ namespace Mail
+ {
+ struct MailListEntry;
+ }
+
namespace AuctionHouse
{
struct AuctionItem
@@ -284,7 +289,8 @@ namespace WorldPackets
class AuctionListPendingSalesResult final : public ServerPacket
{
public:
- AuctionListPendingSalesResult() : ServerPacket(SMSG_AUCTION_LIST_PENDING_SALES_RESULT, 140) { }
+ AuctionListPendingSalesResult();
+ ~AuctionListPendingSalesResult();
WorldPacket const* Write() override;
diff --git a/src/server/game/Server/Packets/AuthenticationPackets.cpp b/src/server/game/Server/Packets/AuthenticationPackets.cpp
index 9ed123f4872..c13608bb429 100644
--- a/src/server/game/Server/Packets/AuthenticationPackets.cpp
+++ b/src/server/game/Server/Packets/AuthenticationPackets.cpp
@@ -16,8 +16,11 @@
*/
#include "AuthenticationPackets.h"
+#include "BigNumber.h"
#include "CharacterTemplateDataStore.h"
#include "HmacHash.h"
+#include "ObjectMgr.h"
+#include "Util.h"
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Auth::VirtualRealmNameInfo const& virtualRealmInfo)
{
@@ -339,11 +342,6 @@ WorldPackets::Auth::ConnectTo::ConnectTo() : ServerPacket(SMSG_CONNECT_TO, 8 + 4
HexStrToByteArray("F41DCB2D728CF3337A4FF338FA89DB01BBBE9C3B65E9DA96268687353E48B94C", Payload.PanamaKey);
Payload.Adler32 = 0xA0A66C10;
- p.SetBinary(P, 128);
- q.SetBinary(Q, 128);
- dmp1.SetBinary(DP, 128);
- dmq1.SetBinary(DQ, 128);
- iqmp.SetBinary(InverseQ, 128);
}
WorldPacket const* WorldPackets::Auth::ConnectTo::Write()
@@ -372,6 +370,18 @@ WorldPacket const* WorldPackets::Auth::ConnectTo::Write()
BigNumber bnData;
bnData.SetBinary(payload.contents(), payload.size());
+ BigNumber p;
+ BigNumber q;
+ BigNumber dmp1;
+ BigNumber dmq1;
+ BigNumber iqmp;
+
+ p.SetBinary(P, 128);
+ q.SetBinary(Q, 128);
+ dmp1.SetBinary(DP, 128);
+ dmq1.SetBinary(DQ, 128);
+ iqmp.SetBinary(InverseQ, 128);
+
BigNumber m1 = (bnData % p).ModExp(dmp1, p);
BigNumber m2 = (bnData % q).ModExp(dmq1, q);
BigNumber h = (iqmp * (m1 - m2)) % p;
diff --git a/src/server/game/Server/Packets/AuthenticationPackets.h b/src/server/game/Server/Packets/AuthenticationPackets.h
index 2c7a17d217d..27e7a4c08ae 100644
--- a/src/server/game/Server/Packets/AuthenticationPackets.h
+++ b/src/server/game/Server/Packets/AuthenticationPackets.h
@@ -19,16 +19,13 @@
#define AuthenticationPacketsWorld_h__
#include "Packet.h"
-#include "ObjectMgr.h"
-#include "Common.h"
-#include "BigNumber.h"
-#include "SHA1.h"
-#include <boost/asio/ip/tcp.hpp>
+#include "Define.h"
+#include "Optional.h"
+#include <array>
+#include <unordered_map>
struct CharacterTemplate;
-using boost::asio::ip::tcp;
-
namespace WorldPackets
{
namespace Auth
@@ -155,8 +152,8 @@ namespace WorldPackets
std::vector<VirtualRealmInfo> VirtualRealms; ///< list of realms connected to this one (inclusive) @todo implement
std::vector<CharacterTemplate const*> Templates; ///< list of pre-made character templates.
- ExpansionRequirementContainer const* AvailableClasses = nullptr; ///< the minimum AccountExpansion required to select the classes
- ExpansionRequirementContainer const* AvailableRaces = nullptr; ///< the minimum AccountExpansion required to select the races
+ std::unordered_map<uint8, uint8> const* AvailableClasses = nullptr; ///< the minimum AccountExpansion required to select the classes
+ std::unordered_map<uint8, uint8> const* AvailableRaces = nullptr; ///< the minimum AccountExpansion required to select the races
bool IsExpansionTrial = false;
bool ForceCharacterTemplate = false; ///< forces the client to always use a character template when creating a new character. @see Templates. @todo implement
@@ -233,13 +230,6 @@ namespace WorldPackets
ConnectToSerial Serial = ConnectToSerial::None;
ConnectPayload Payload;
uint8 Con = 0;
-
- private:
- BigNumber p;
- BigNumber q;
- BigNumber dmp1;
- BigNumber dmq1;
- BigNumber iqmp;
};
class AuthContinuedSession final : public EarlyProcessClientPacket
diff --git a/src/server/game/Server/Packets/BankPackets.cpp b/src/server/game/Server/Packets/BankPackets.cpp
index 4def6d9f9e3..880fc7e2bbc 100644
--- a/src/server/game/Server/Packets/BankPackets.cpp
+++ b/src/server/game/Server/Packets/BankPackets.cpp
@@ -16,7 +16,6 @@
*/
#include "BankPackets.h"
-#include "ItemPackets.h"
void WorldPackets::Bank::AutoBankItem::Read()
{
diff --git a/src/server/game/Server/Packets/BankPackets.h b/src/server/game/Server/Packets/BankPackets.h
index b2083364f6d..df12753f2a4 100644
--- a/src/server/game/Server/Packets/BankPackets.h
+++ b/src/server/game/Server/Packets/BankPackets.h
@@ -18,10 +18,9 @@
#ifndef BankPackets_h__
#define BankPackets_h__
-#include "ItemPackets.h"
#include "Packet.h"
+#include "ItemPacketsCommon.h"
#include "ObjectGuid.h"
-#include "WorldSession.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/BattlePetPackets.cpp b/src/server/game/Server/Packets/BattlePetPackets.cpp
index 8b7141b3a22..0f724c8d15f 100644
--- a/src/server/game/Server/Packets/BattlePetPackets.cpp
+++ b/src/server/game/Server/Packets/BattlePetPackets.cpp
@@ -16,7 +16,6 @@
*/
#include "BattlePetPackets.h"
-#include "World.h"
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::BattlePet::BattlePetSlot const& slot)
{
@@ -45,17 +44,17 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::BattlePet::BattlePet cons
data << uint32(pet.Speed);
data << uint8(pet.Quality);
data.WriteBits(pet.Name.size(), 7);
- data.WriteBit(!pet.Owner.IsEmpty()); // HasOwnerInfo
+ data.WriteBit(pet.OwnerInfo.is_initialized());
data.WriteBit(pet.Name.empty()); // NoRename
data.FlushBits();
data.WriteString(pet.Name);
- if (!pet.Owner.IsEmpty())
+ if (pet.OwnerInfo)
{
- data << pet.Owner;
- data << uint32(GetVirtualRealmAddress()); // Virtual
- data << uint32(GetVirtualRealmAddress()); // Native
+ data << pet.OwnerInfo->Guid;
+ data << uint32(pet.OwnerInfo->PlayerVirtualRealm);
+ data << uint32(pet.OwnerInfo->PlayerNativeRealm);
}
return data;
diff --git a/src/server/game/Server/Packets/BattlePetPackets.h b/src/server/game/Server/Packets/BattlePetPackets.h
index 745c7723c2c..bbaa1d95617 100644
--- a/src/server/game/Server/Packets/BattlePetPackets.h
+++ b/src/server/game/Server/Packets/BattlePetPackets.h
@@ -20,12 +20,20 @@
#include "Packet.h"
#include "ObjectGuid.h"
-#include "Unit.h"
+#include "Optional.h"
+#include "UnitDefines.h"
namespace WorldPackets
{
namespace BattlePet
{
+ struct BattlePetOwnerInfo
+ {
+ ObjectGuid Guid;
+ uint32 PlayerVirtualRealm = 0;
+ uint32 PlayerNativeRealm = 0;
+ };
+
struct BattlePet
{
ObjectGuid Guid;
@@ -41,7 +49,7 @@ namespace WorldPackets
uint32 MaxHealth = 0;
uint32 Speed = 0;
uint8 Quality = 0;
- ObjectGuid Owner; // for non-account wide pets only? (Guild Page, Guild Herald)
+ Optional<BattlePetOwnerInfo> OwnerInfo;
std::string Name;
};
diff --git a/src/server/game/Server/Packets/BattlegroundPackets.h b/src/server/game/Server/Packets/BattlegroundPackets.h
index 90dd5ccf529..ff38b48e00d 100644
--- a/src/server/game/Server/Packets/BattlegroundPackets.h
+++ b/src/server/game/Server/Packets/BattlegroundPackets.h
@@ -18,12 +18,11 @@
#ifndef BattlegroundPackets_h__
#define BattlegroundPackets_h__
-#include "Common.h"
-#include "ObjectGuid.h"
-#include "LFGPackets.h"
-#include "Position.h"
#include "Packet.h"
+#include "LFGPacketsCommon.h"
+#include "ObjectGuid.h"
#include "Optional.h"
+#include "Position.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/BattlenetPackets.h b/src/server/game/Server/Packets/BattlenetPackets.h
index ba3f4299ab9..6d89ba8a170 100644
--- a/src/server/game/Server/Packets/BattlenetPackets.h
+++ b/src/server/game/Server/Packets/BattlenetPackets.h
@@ -19,8 +19,8 @@
#define BattlenetPackets_h__
#include "Packet.h"
-#include "MessageBuffer.h"
#include "BattlenetRpcErrorCodes.h"
+#include "MessageBuffer.h"
#include <array>
namespace WorldPackets
diff --git a/src/server/game/Server/Packets/BlackMarketPackets.cpp b/src/server/game/Server/Packets/BlackMarketPackets.cpp
index 9f95582b4ae..74e3b9411c2 100644
--- a/src/server/game/Server/Packets/BlackMarketPackets.cpp
+++ b/src/server/game/Server/Packets/BlackMarketPackets.cpp
@@ -16,35 +16,6 @@
*/
#include "BlackMarketPackets.h"
-#include "BlackMarketMgr.h"
-#include "Player.h"
-
-void WorldPackets::BlackMarket::BlackMarketItem::Initialize(BlackMarketEntry *const entry, Player* player)
-{
- BlackMarketTemplate const* templ = entry->GetTemplate();
-
- MarketID = entry->GetMarketId();
- SellerNPC = templ->SellerNPC;
- Item = templ->Item;
- Quantity = templ->Quantity;
-
- // No bids yet
- if (!entry->GetNumBids())
- {
- MinBid = templ->MinBid;
- MinIncrement = 1;
- }
- else
- {
- MinIncrement = entry->GetMinIncrement(); // 5% increment minimum
- MinBid = entry->GetCurrentBid() + MinIncrement;
- }
-
- CurrentBid = entry->GetCurrentBid();
- SecondsRemaining = entry->GetSecondsRemaining();
- HighBid = (entry->GetBidder() == player->GetGUID().GetCounter());
- NumBids = entry->GetNumBids();
-}
void WorldPackets::BlackMarket::BlackMarketOpen::Read()
{
diff --git a/src/server/game/Server/Packets/BlackMarketPackets.h b/src/server/game/Server/Packets/BlackMarketPackets.h
index ed67800cd8b..61d28a3d18e 100644
--- a/src/server/game/Server/Packets/BlackMarketPackets.h
+++ b/src/server/game/Server/Packets/BlackMarketPackets.h
@@ -19,11 +19,8 @@
#define BlackMarketPackets_h__
#include "Packet.h"
+#include "ItemPacketsCommon.h"
#include "ObjectGuid.h"
-#include "ItemPackets.h"
-
-class Player;
-class BlackMarketEntry;
namespace WorldPackets
{
@@ -31,8 +28,6 @@ namespace WorldPackets
{
struct BlackMarketItem
{
- void Initialize(BlackMarketEntry *const entry, Player* player);
-
int32 MarketID = 0;
int32 SellerNPC = 0;
Item::ItemInstance Item;
diff --git a/src/server/game/Server/Packets/CalendarPackets.cpp b/src/server/game/Server/Packets/CalendarPackets.cpp
index d045d3434fc..2c0e6a72bf9 100644
--- a/src/server/game/Server/Packets/CalendarPackets.cpp
+++ b/src/server/game/Server/Packets/CalendarPackets.cpp
@@ -16,7 +16,6 @@
*/
#include "CalendarPackets.h"
-#include "CalendarMgr.h"
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Calendar::CalendarSendCalendarEventInfo const& eventInfo)
{
diff --git a/src/server/game/Server/Packets/CalendarPackets.h b/src/server/game/Server/Packets/CalendarPackets.h
index 7c417b123ef..61791b551f2 100644
--- a/src/server/game/Server/Packets/CalendarPackets.h
+++ b/src/server/game/Server/Packets/CalendarPackets.h
@@ -18,10 +18,10 @@
#ifndef CalendarPackets_h__
#define CalendarPackets_h__
-#include "ObjectGuid.h"
#include "Packet.h"
-#include "PacketUtilities.h"
#include "CalendarMgr.h"
+#include "ObjectGuid.h"
+#include "PacketUtilities.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/ChannelPackets.cpp b/src/server/game/Server/Packets/ChannelPackets.cpp
index 7ddcf009a99..31464337e74 100644
--- a/src/server/game/Server/Packets/ChannelPackets.cpp
+++ b/src/server/game/Server/Packets/ChannelPackets.cpp
@@ -16,6 +16,7 @@
*/
#include "ChannelPackets.h"
+#include "Channel.h"
#include "Errors.h"
WorldPacket const* WorldPackets::Channel::ChannelListResponse::Write()
@@ -119,35 +120,29 @@ WorldPacket const* WorldPackets::Channel::UserlistUpdate::Write()
return &_worldPacket;
}
-WorldPackets::Channel::ChannelPlayerCommand::ChannelPlayerCommand(WorldPacket&& packet) : ClientPacket(std::move(packet))
+WorldPackets::Channel::ChannelCommand::ChannelCommand(WorldPacket&& packet) : ClientPacket(std::move(packet))
{
- switch (GetOpcode())
+ switch (packet.GetOpcode())
{
- default:
- ABORT();
case CMSG_CHAT_CHANNEL_ANNOUNCEMENTS:
- case CMSG_CHAT_CHANNEL_BAN:
case CMSG_CHAT_CHANNEL_DECLINE_INVITE:
case CMSG_CHAT_CHANNEL_DISPLAY_LIST:
- case CMSG_CHAT_CHANNEL_INVITE:
- case CMSG_CHAT_CHANNEL_KICK:
case CMSG_CHAT_CHANNEL_LIST:
case CMSG_CHAT_CHANNEL_MODERATE:
- case CMSG_CHAT_CHANNEL_MODERATOR:
- case CMSG_CHAT_CHANNEL_MUTE:
case CMSG_CHAT_CHANNEL_OWNER:
- case CMSG_CHAT_CHANNEL_PASSWORD:
- case CMSG_CHAT_CHANNEL_SET_OWNER:
- case CMSG_CHAT_CHANNEL_SILENCE_ALL:
- case CMSG_CHAT_CHANNEL_UNBAN:
- case CMSG_CHAT_CHANNEL_UNMODERATOR:
- case CMSG_CHAT_CHANNEL_UNMUTE:
- case CMSG_CHAT_CHANNEL_UNSILENCE_ALL:
+ break;
+ default:
+ ABORT();
break;
}
}
-void WorldPackets::Channel::ChannelPlayerCommand::Read()
+void WorldPackets::Channel::ChannelCommand::Read()
+{
+ ChannelName = _worldPacket.ReadString(_worldPacket.ReadBits(7));
+}
+
+WorldPackets::Channel::ChannelPlayerCommand::ChannelPlayerCommand(WorldPacket&& packet) : ClientPacket(std::move(packet))
{
switch (GetOpcode())
{
@@ -162,36 +157,29 @@ void WorldPackets::Channel::ChannelPlayerCommand::Read()
case CMSG_CHAT_CHANNEL_UNMODERATOR:
case CMSG_CHAT_CHANNEL_UNMUTE:
case CMSG_CHAT_CHANNEL_UNSILENCE_ALL:
- {
- uint32 channelNameLength = _worldPacket.ReadBits(7);
- uint32 nameLength = _worldPacket.ReadBits(9);
- ChannelName = _worldPacket.ReadString(channelNameLength);
- Name = _worldPacket.ReadString(nameLength);
- break;
- }
- case CMSG_CHAT_CHANNEL_ANNOUNCEMENTS:
- case CMSG_CHAT_CHANNEL_DECLINE_INVITE:
- case CMSG_CHAT_CHANNEL_DISPLAY_LIST:
- case CMSG_CHAT_CHANNEL_LIST:
- case CMSG_CHAT_CHANNEL_MODERATE:
- case CMSG_CHAT_CHANNEL_OWNER:
- {
- ChannelName = _worldPacket.ReadString(_worldPacket.ReadBits(7));
- break;
- }
- case CMSG_CHAT_CHANNEL_PASSWORD:
- {
- uint32 channelNameLength = _worldPacket.ReadBits(7);
- uint32 nameLength = _worldPacket.ReadBits(7);
- ChannelName = _worldPacket.ReadString(channelNameLength);
- Name = _worldPacket.ReadString(nameLength);
break;
- }
default:
+ ABORT();
break;
}
}
+void WorldPackets::Channel::ChannelPlayerCommand::Read()
+{
+ uint32 channelNameLength = _worldPacket.ReadBits(7);
+ uint32 nameLength = _worldPacket.ReadBits(9);
+ ChannelName = _worldPacket.ReadString(channelNameLength);
+ Name = _worldPacket.ReadString(nameLength);
+}
+
+void WorldPackets::Channel::ChannelPassword::Read()
+{
+ uint32 channelNameLength = _worldPacket.ReadBits(7);
+ uint32 passwordLength = _worldPacket.ReadBits(7);
+ ChannelName = _worldPacket.ReadString(channelNameLength);
+ Password = _worldPacket.ReadString(passwordLength);
+}
+
void WorldPackets::Channel::JoinChannel::Read()
{
_worldPacket >> ChatChannelId;
diff --git a/src/server/game/Server/Packets/ChannelPackets.h b/src/server/game/Server/Packets/ChannelPackets.h
index e0ecf8f82f9..85a11ec36f3 100644
--- a/src/server/game/Server/Packets/ChannelPackets.h
+++ b/src/server/game/Server/Packets/ChannelPackets.h
@@ -19,7 +19,6 @@
#define ChannelPackets_h__
#include "Packet.h"
-#include "Channel.h"
#include "ObjectGuid.h"
namespace WorldPackets
@@ -103,8 +102,8 @@ namespace WorldPackets
WorldPacket const* Write() override;
ObjectGuid AddedUserGUID;
- uint32 _ChannelFlags = CHANNEL_FLAG_NONE; ///< @see enum ChannelFlags
- uint8 UserFlags = MEMBER_FLAG_NONE;
+ uint32 _ChannelFlags = 0; ///< @see enum ChannelFlags
+ uint8 UserFlags = 0; ///< @see enum ChannelMemberFlags
int32 ChannelID = 0;
std::string ChannelName;
};
@@ -117,7 +116,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
ObjectGuid RemovedUserGUID;
- uint32 _ChannelFlags = CHANNEL_FLAG_NONE; ///< @see enum ChannelFlags
+ uint32 _ChannelFlags = 0; ///< @see enum ChannelFlags
uint32 ChannelID = 0;
std::string ChannelName;
};
@@ -130,12 +129,22 @@ namespace WorldPackets
WorldPacket const* Write() override;
ObjectGuid UpdatedUserGUID;
- uint32 _ChannelFlags = CHANNEL_FLAG_NONE; ///< @see enum ChannelFlags
- uint8 UserFlags = MEMBER_FLAG_NONE;
+ uint32 _ChannelFlags = 0; ///< @see enum ChannelFlags
+ uint8 UserFlags = 0; ///< @see enum ChannelMemberFlags
int32 ChannelID = 0;
std::string ChannelName;
};
+ class ChannelCommand final : public ClientPacket
+ {
+ public:
+ ChannelCommand(WorldPacket&& packet);
+
+ void Read() override;
+
+ std::string ChannelName;
+ };
+
class ChannelPlayerCommand final : public ClientPacket
{
public:
@@ -147,6 +156,17 @@ namespace WorldPackets
std::string Name;
};
+ class ChannelPassword final : public ClientPacket
+ {
+ public:
+ ChannelPassword(WorldPacket&& packet) : ClientPacket(CMSG_CHAT_CHANNEL_PASSWORD, std::move(packet)) { }
+
+ void Read() override;
+
+ std::string ChannelName;
+ std::string Password;
+ };
+
class JoinChannel final : public ClientPacket
{
public:
diff --git a/src/server/game/Server/Packets/CharacterPackets.cpp b/src/server/game/Server/Packets/CharacterPackets.cpp
index 095f14c3783..f65626179fa 100644
--- a/src/server/game/Server/Packets/CharacterPackets.cpp
+++ b/src/server/game/Server/Packets/CharacterPackets.cpp
@@ -16,6 +16,7 @@
*/
#include "CharacterPackets.h"
+#include "Field.h"
#include "ObjectMgr.h"
#include "PacketUtilities.h"
#include "World.h"
diff --git a/src/server/game/Server/Packets/CharacterPackets.h b/src/server/game/Server/Packets/CharacterPackets.h
index 79f35e4b8ad..70767bea1f0 100644
--- a/src/server/game/Server/Packets/CharacterPackets.h
+++ b/src/server/game/Server/Packets/CharacterPackets.h
@@ -19,6 +19,7 @@
#define CharacterPackets_h__
#include "Packet.h"
+#include "Optional.h"
#include "Player.h"
#include "PacketUtilities.h"
diff --git a/src/server/game/Server/Packets/ChatPackets.h b/src/server/game/Server/Packets/ChatPackets.h
index e79ae8978ae..4723c7561c4 100644
--- a/src/server/game/Server/Packets/ChatPackets.h
+++ b/src/server/game/Server/Packets/ChatPackets.h
@@ -19,9 +19,10 @@
#define ChatPackets_h__
#include "Packet.h"
-#include "SharedDefines.h"
+#include "Common.h"
#include "ObjectGuid.h"
#include "PacketUtilities.h"
+#include "SharedDefines.h"
class WorldObject;
diff --git a/src/server/game/Server/Packets/GarrisonPackets.h b/src/server/game/Server/Packets/GarrisonPackets.h
index cf01534348c..0ddbad174d6 100644
--- a/src/server/game/Server/Packets/GarrisonPackets.h
+++ b/src/server/game/Server/Packets/GarrisonPackets.h
@@ -22,6 +22,9 @@
#include "ObjectGuid.h"
#include "Position.h"
#include "PacketUtilities.h"
+#include <list>
+#include <unordered_set>
+#include <vector>
struct GarrAbilityEntry;
diff --git a/src/server/game/Server/Packets/ItemPackets.cpp b/src/server/game/Server/Packets/ItemPackets.cpp
index 501732d3d4e..2470dca41c9 100644
--- a/src/server/game/Server/Packets/ItemPackets.cpp
+++ b/src/server/game/Server/Packets/ItemPackets.cpp
@@ -18,17 +18,6 @@
#include "ItemPackets.h"
#include "Player.h"
-bool WorldPackets::Item::ItemBonusInstanceData::operator==(ItemBonusInstanceData const& r) const
-{
- if (Context != r.Context)
- return false;
-
- if (BonusListIDs.size() != r.BonusListIDs.size())
- return false;
-
- return std::is_permutation(BonusListIDs.begin(), BonusListIDs.end(), r.BonusListIDs.begin());
-}
-
void WorldPackets::Item::BuyBackItem::Read()
{
_worldPacket >> VendorGUID;
@@ -162,213 +151,6 @@ WorldPacket const* WorldPackets::Item::SetProficiency::Write()
return &_worldPacket;
}
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemBonusInstanceData const& itemBonusInstanceData)
-{
- data << uint8(itemBonusInstanceData.Context);
- data << uint32(itemBonusInstanceData.BonusListIDs.size());
- for (uint32 bonusID : itemBonusInstanceData.BonusListIDs)
- data << uint32(bonusID);
-
- return data;
-}
-
-ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemBonusInstanceData& itemBonusInstanceData)
-{
- uint32 bonusListIdSize;
-
- data >> itemBonusInstanceData.Context;
- data >> bonusListIdSize;
-
- for (uint32 i = 0u; i < bonusListIdSize; ++i)
- {
- uint32 bonusId;
- data >> bonusId;
- itemBonusInstanceData.BonusListIDs.push_back(bonusId);
- }
-
- return data;
-}
-
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemInstance const& itemInstance)
-{
- data << int32(itemInstance.ItemID);
- data << int32(itemInstance.RandomPropertiesSeed);
- data << int32(itemInstance.RandomPropertiesID);
-
- data.WriteBit(itemInstance.ItemBonus.is_initialized());
- data.WriteBit(itemInstance.Modifications.is_initialized());
- data.FlushBits();
-
- if (itemInstance.ItemBonus)
- data << *itemInstance.ItemBonus;
-
- if (itemInstance.Modifications)
- data << *itemInstance.Modifications;
-
- return data;
-}
-
-ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemInstance& itemInstance)
-{
- data >> itemInstance.ItemID;
- data >> itemInstance.RandomPropertiesSeed;
- data >> itemInstance.RandomPropertiesID;
-
- bool hasItemBonus = data.ReadBit();
- bool hasModifications = data.ReadBit();
- data.ResetBitPos();
-
- if (hasItemBonus)
- {
- itemInstance.ItemBonus = boost::in_place();
- data >> *itemInstance.ItemBonus;
- }
-
- if (hasModifications)
- {
- itemInstance.Modifications = boost::in_place();
- data >> *itemInstance.Modifications;
- }
-
- return data;
-}
-
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemEnchantData const& itemEnchantData)
-{
- data << int32(itemEnchantData.ID);
- data << uint32(itemEnchantData.Expiration);
- data << int32(itemEnchantData.Charges);
- data << uint8(itemEnchantData.Slot);
- return data;
-}
-
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemGemData const& itemGemData)
-{
- data << uint8(itemGemData.Slot);
- data << itemGemData.Item;
- return data;
-}
-
-ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemGemData& itemGemData)
-{
- data >> itemGemData.Slot;
- data >> itemGemData.Item;
- return data;
-}
-
-ByteBuffer& WorldPackets::Item::operator>>(ByteBuffer& data, InvUpdate& invUpdate)
-{
- invUpdate.Items.resize(data.ReadBits(2));
- for (size_t i = 0; i < invUpdate.Items.size(); ++i)
- {
- data >> invUpdate.Items[i].ContainerSlot;
- data >> invUpdate.Items[i].Slot;
- }
-
- return data;
-}
-
-void WorldPackets::Item::ItemInstance::Initialize(::Item const* item)
-{
- ItemID = item->GetEntry();
- RandomPropertiesSeed = item->GetItemSuffixFactor();
- RandomPropertiesID = item->GetItemRandomPropertyId();
- std::vector<uint32> const& bonusListIds = item->GetDynamicValues(ITEM_DYNAMIC_FIELD_BONUSLIST_IDS);
- if (!bonusListIds.empty())
- {
- ItemBonus = boost::in_place();
- ItemBonus->BonusListIDs.insert(ItemBonus->BonusListIDs.end(), bonusListIds.begin(), bonusListIds.end());
- ItemBonus->Context = item->GetUInt32Value(ITEM_FIELD_CONTEXT);
- }
-
- if (uint32 mask = item->GetUInt32Value(ITEM_FIELD_MODIFIERS_MASK))
- {
- Modifications = boost::in_place();
-
- for (size_t i = 0; mask != 0; mask >>= 1, ++i)
- if ((mask & 1) != 0)
- Modifications->Insert(i, item->GetModifier(ItemModifier(i)));
- }
-}
-
-void WorldPackets::Item::ItemInstance::Initialize(::ItemDynamicFieldGems const* gem)
-{
- ItemID = gem->ItemId;
-
- ItemBonusInstanceData bonus;
- bonus.Context = gem->Context;
- for (uint16 bonusListId : gem->BonusListIDs)
- if (bonusListId)
- bonus.BonusListIDs.push_back(bonusListId);
-
- if (bonus.Context || !bonus.BonusListIDs.empty())
- ItemBonus = bonus;
-}
-
-void WorldPackets::Item::ItemInstance::Initialize(::LootItem const& lootItem)
-{
- ItemID = lootItem.itemid;
- RandomPropertiesSeed = lootItem.randomSuffix;
- if (lootItem.randomPropertyId.Type != ItemRandomEnchantmentType::BonusList)
- RandomPropertiesID = lootItem.randomPropertyId.Id;
-
- if (!lootItem.BonusListIDs.empty())
- {
- ItemBonus = boost::in_place();
- ItemBonus->BonusListIDs = lootItem.BonusListIDs;
- ItemBonus->Context = lootItem.context;
- }
-
- if (lootItem.upgradeId)
- {
- Modifications = boost::in_place();
- Modifications->Insert(ITEM_MODIFIER_UPGRADE_ID, lootItem.upgradeId);
- }
-}
-
-void WorldPackets::Item::ItemInstance::Initialize(::VoidStorageItem const* voidItem)
-{
- ItemID = voidItem->ItemEntry;
- RandomPropertiesSeed = voidItem->ItemSuffixFactor;
- if (voidItem->ItemRandomPropertyId.Type != ItemRandomEnchantmentType::BonusList)
- RandomPropertiesID = voidItem->ItemRandomPropertyId.Id;
-
- if (voidItem->ItemUpgradeId || voidItem->FixedScalingLevel || voidItem->ArtifactKnowledgeLevel)
- {
- Modifications = boost::in_place();
- if (voidItem->ItemUpgradeId)
- Modifications->Insert(ITEM_MODIFIER_UPGRADE_ID, voidItem->ItemUpgradeId);
- if (voidItem->FixedScalingLevel)
- Modifications->Insert(ITEM_MODIFIER_SCALING_STAT_DISTRIBUTION_FIXED_LEVEL, voidItem->FixedScalingLevel);
- if (voidItem->ArtifactKnowledgeLevel)
- Modifications->Insert(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL, voidItem->ArtifactKnowledgeLevel);
- }
-
- if (!voidItem->BonusListIDs.empty())
- {
- ItemBonus = boost::in_place();
- ItemBonus->Context = voidItem->Context;
- ItemBonus->BonusListIDs = voidItem->BonusListIDs;
- }
-}
-
-bool WorldPackets::Item::ItemInstance::operator==(ItemInstance const& r) const
-{
- if (ItemID != r.ItemID || RandomPropertiesID != r.RandomPropertiesID || RandomPropertiesSeed != r.RandomPropertiesSeed)
- return false;
-
- if (ItemBonus.is_initialized() != r.ItemBonus.is_initialized() || Modifications.is_initialized() != r.Modifications.is_initialized())
- return false;
-
- if (Modifications.is_initialized() && *Modifications != *r.Modifications)
- return false;
-
- if (ItemBonus.is_initialized() && *ItemBonus != *r.ItemBonus)
- return false;
-
- return true;
-}
-
WorldPacket const* WorldPackets::Item::InventoryChangeFailure::Write()
{
_worldPacket << int8(BagResult);
diff --git a/src/server/game/Server/Packets/ItemPackets.h b/src/server/game/Server/Packets/ItemPackets.h
index 012e6800174..4e677814083 100644
--- a/src/server/game/Server/Packets/ItemPackets.h
+++ b/src/server/game/Server/Packets/ItemPackets.h
@@ -20,6 +20,7 @@
#include "Packet.h"
#include "Item.h"
+#include "ItemPacketsCommon.h"
#include "PacketUtilities.h"
#include "Optional.h"
@@ -29,47 +30,6 @@ namespace WorldPackets
{
namespace Item
{
- struct ItemBonusInstanceData
- {
- uint8 Context = 0;
- std::vector<int32> BonusListIDs;
-
- bool operator==(ItemBonusInstanceData const& r) const;
- bool operator!=(ItemBonusInstanceData const& r) const { return !(*this == r); }
- };
-
- struct ItemInstance
- {
- void Initialize(::Item const* item);
- void Initialize(::ItemDynamicFieldGems const* gem);
- void Initialize(::LootItem const& lootItem);
- void Initialize(::VoidStorageItem const* voidItem);
-
- uint32 ItemID = 0;
- uint32 RandomPropertiesSeed = 0;
- uint32 RandomPropertiesID = 0;
- Optional<ItemBonusInstanceData> ItemBonus;
- Optional<CompactArray<int32>> Modifications;
-
- bool operator==(ItemInstance const& r) const;
- bool operator!=(ItemInstance const& r) const { return !(*this == r); }
- };
-
- struct ItemEnchantData
- {
- ItemEnchantData(int32 id, uint32 expiration, int32 charges, uint8 slot) : ID(id), Expiration(expiration), Charges(charges), Slot(slot) { }
- int32 ID = 0;
- uint32 Expiration = 0;
- int32 Charges = 0;
- uint8 Slot = 0;
- };
-
- struct ItemGemData
- {
- uint8 Slot;
- ItemInstance Item;
- };
-
class BuyBackItem final : public ClientPacket
{
public:
@@ -242,17 +202,6 @@ namespace WorldPackets
uint8 ProficiencyClass = 0;
};
- struct InvUpdate
- {
- struct InvItem
- {
- uint8 ContainerSlot = 0;
- uint8 Slot = 0;
- };
-
- std::vector<InvItem> Items;
- };
-
class InventoryChangeFailure final : public ServerPacket
{
public:
@@ -539,17 +488,7 @@ namespace WorldPackets
ObjectGuid Item;
};
-
- ByteBuffer& operator>>(ByteBuffer& data, InvUpdate& invUpdate);
}
}
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemBonusInstanceData const& itemBonusInstanceData);
-ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemBonusInstanceData& itemBonusInstanceData);
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemInstance const& itemInstance);
-ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemInstance& itemInstance);
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemEnchantData const& itemEnchantData);
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemGemData const& itemGemInstanceData);
-ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemGemData& itemGemInstanceData);
-
#endif // ItemPackets_h__
diff --git a/src/server/game/Server/Packets/ItemPacketsCommon.cpp b/src/server/game/Server/Packets/ItemPacketsCommon.cpp
new file mode 100644
index 00000000000..dc2a6dad65e
--- /dev/null
+++ b/src/server/game/Server/Packets/ItemPacketsCommon.cpp
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ItemPacketsCommon.h"
+#include "Item.h"
+#include "Player.h"
+
+bool WorldPackets::Item::ItemBonusInstanceData::operator==(ItemBonusInstanceData const& r) const
+{
+ if (Context != r.Context)
+ return false;
+
+ if (BonusListIDs.size() != r.BonusListIDs.size())
+ return false;
+
+ return std::is_permutation(BonusListIDs.begin(), BonusListIDs.end(), r.BonusListIDs.begin());
+}
+
+void WorldPackets::Item::ItemInstance::Initialize(::Item const* item)
+{
+ ItemID = item->GetEntry();
+ RandomPropertiesSeed = item->GetItemSuffixFactor();
+ RandomPropertiesID = item->GetItemRandomPropertyId();
+ std::vector<uint32> const& bonusListIds = item->GetDynamicValues(ITEM_DYNAMIC_FIELD_BONUSLIST_IDS);
+ if (!bonusListIds.empty())
+ {
+ ItemBonus = boost::in_place();
+ ItemBonus->BonusListIDs.insert(ItemBonus->BonusListIDs.end(), bonusListIds.begin(), bonusListIds.end());
+ ItemBonus->Context = item->GetUInt32Value(ITEM_FIELD_CONTEXT);
+ }
+
+ if (uint32 mask = item->GetUInt32Value(ITEM_FIELD_MODIFIERS_MASK))
+ {
+ Modifications = boost::in_place();
+
+ for (size_t i = 0; mask != 0; mask >>= 1, ++i)
+ if ((mask & 1) != 0)
+ Modifications->Insert(i, item->GetModifier(ItemModifier(i)));
+ }
+}
+
+void WorldPackets::Item::ItemInstance::Initialize(::ItemDynamicFieldGems const* gem)
+{
+ ItemID = gem->ItemId;
+
+ ItemBonusInstanceData bonus;
+ bonus.Context = gem->Context;
+ for (uint16 bonusListId : gem->BonusListIDs)
+ if (bonusListId)
+ bonus.BonusListIDs.push_back(bonusListId);
+
+ if (bonus.Context || !bonus.BonusListIDs.empty())
+ ItemBonus = bonus;
+}
+
+void WorldPackets::Item::ItemInstance::Initialize(::LootItem const& lootItem)
+{
+ ItemID = lootItem.itemid;
+ RandomPropertiesSeed = lootItem.randomSuffix;
+ if (lootItem.randomPropertyId.Type != ItemRandomEnchantmentType::BonusList)
+ RandomPropertiesID = lootItem.randomPropertyId.Id;
+
+ if (!lootItem.BonusListIDs.empty())
+ {
+ ItemBonus = boost::in_place();
+ ItemBonus->BonusListIDs = lootItem.BonusListIDs;
+ ItemBonus->Context = lootItem.context;
+ }
+
+ if (lootItem.upgradeId)
+ {
+ Modifications = boost::in_place();
+ Modifications->Insert(ITEM_MODIFIER_UPGRADE_ID, lootItem.upgradeId);
+ }
+}
+
+void WorldPackets::Item::ItemInstance::Initialize(::VoidStorageItem const* voidItem)
+{
+ ItemID = voidItem->ItemEntry;
+ RandomPropertiesSeed = voidItem->ItemSuffixFactor;
+ if (voidItem->ItemRandomPropertyId.Type != ItemRandomEnchantmentType::BonusList)
+ RandomPropertiesID = voidItem->ItemRandomPropertyId.Id;
+
+ if (voidItem->ItemUpgradeId || voidItem->FixedScalingLevel || voidItem->ArtifactKnowledgeLevel)
+ {
+ Modifications = boost::in_place();
+ if (voidItem->ItemUpgradeId)
+ Modifications->Insert(ITEM_MODIFIER_UPGRADE_ID, voidItem->ItemUpgradeId);
+ if (voidItem->FixedScalingLevel)
+ Modifications->Insert(ITEM_MODIFIER_SCALING_STAT_DISTRIBUTION_FIXED_LEVEL, voidItem->FixedScalingLevel);
+ if (voidItem->ArtifactKnowledgeLevel)
+ Modifications->Insert(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL, voidItem->ArtifactKnowledgeLevel);
+ }
+
+ if (!voidItem->BonusListIDs.empty())
+ {
+ ItemBonus = boost::in_place();
+ ItemBonus->Context = voidItem->Context;
+ ItemBonus->BonusListIDs = voidItem->BonusListIDs;
+ }
+}
+
+bool WorldPackets::Item::ItemInstance::operator==(ItemInstance const& r) const
+{
+ if (ItemID != r.ItemID || RandomPropertiesID != r.RandomPropertiesID || RandomPropertiesSeed != r.RandomPropertiesSeed)
+ return false;
+
+ if (ItemBonus.is_initialized() != r.ItemBonus.is_initialized() || Modifications.is_initialized() != r.Modifications.is_initialized())
+ return false;
+
+ if (Modifications.is_initialized() && *Modifications != *r.Modifications)
+ return false;
+
+ if (ItemBonus.is_initialized() && *ItemBonus != *r.ItemBonus)
+ return false;
+
+ return true;
+}
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemBonusInstanceData const& itemBonusInstanceData)
+{
+ data << uint8(itemBonusInstanceData.Context);
+ data << uint32(itemBonusInstanceData.BonusListIDs.size());
+ for (uint32 bonusID : itemBonusInstanceData.BonusListIDs)
+ data << uint32(bonusID);
+
+ return data;
+}
+
+ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemBonusInstanceData& itemBonusInstanceData)
+{
+ uint32 bonusListIdSize;
+
+ data >> itemBonusInstanceData.Context;
+ data >> bonusListIdSize;
+
+ for (uint32 i = 0u; i < bonusListIdSize; ++i)
+ {
+ uint32 bonusId;
+ data >> bonusId;
+ itemBonusInstanceData.BonusListIDs.push_back(bonusId);
+ }
+
+ return data;
+}
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemInstance const& itemInstance)
+{
+ data << int32(itemInstance.ItemID);
+ data << int32(itemInstance.RandomPropertiesSeed);
+ data << int32(itemInstance.RandomPropertiesID);
+
+ data.WriteBit(itemInstance.ItemBonus.is_initialized());
+ data.WriteBit(itemInstance.Modifications.is_initialized());
+ data.FlushBits();
+
+ if (itemInstance.ItemBonus)
+ data << *itemInstance.ItemBonus;
+
+ if (itemInstance.Modifications)
+ data << *itemInstance.Modifications;
+
+ return data;
+}
+
+ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemInstance& itemInstance)
+{
+ data >> itemInstance.ItemID;
+ data >> itemInstance.RandomPropertiesSeed;
+ data >> itemInstance.RandomPropertiesID;
+
+ bool hasItemBonus = data.ReadBit();
+ bool hasModifications = data.ReadBit();
+
+ if (hasItemBonus)
+ {
+ itemInstance.ItemBonus = boost::in_place();
+ data >> *itemInstance.ItemBonus;
+ }
+
+ if (hasModifications)
+ {
+ itemInstance.Modifications = boost::in_place();
+ data >> *itemInstance.Modifications;
+ }
+
+ return data;
+}
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemEnchantData const& itemEnchantData)
+{
+ data << int32(itemEnchantData.ID);
+ data << uint32(itemEnchantData.Expiration);
+ data << int32(itemEnchantData.Charges);
+ data << uint8(itemEnchantData.Slot);
+ return data;
+}
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemGemData const& itemGemData)
+{
+ data << uint8(itemGemData.Slot);
+ data << itemGemData.Item;
+ return data;
+}
+
+ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemGemData& itemGemData)
+{
+ data >> itemGemData.Slot;
+ data >> itemGemData.Item;
+ return data;
+}
+
+ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::InvUpdate& invUpdate)
+{
+ invUpdate.Items.resize(data.ReadBits(2));
+ for (size_t i = 0; i < invUpdate.Items.size(); ++i)
+ {
+ data >> invUpdate.Items[i].ContainerSlot;
+ data >> invUpdate.Items[i].Slot;
+ }
+
+ return data;
+}
diff --git a/src/server/game/Server/Packets/ItemPacketsCommon.h b/src/server/game/Server/Packets/ItemPacketsCommon.h
new file mode 100644
index 00000000000..172e9d3e25d
--- /dev/null
+++ b/src/server/game/Server/Packets/ItemPacketsCommon.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * 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 ItemPacketsCommon_h__
+#define ItemPacketsCommon_h__
+
+#include "Define.h"
+#include "PacketUtilities.h"
+#include "Optional.h"
+#include <vector>
+
+class ByteBuffer;
+class Item;
+struct ItemDynamicFieldGems;
+struct LootItem;
+struct VoidStorageItem;
+
+namespace WorldPackets
+{
+ namespace Item
+ {
+ struct ItemBonusInstanceData
+ {
+ uint8 Context = 0;
+ std::vector<int32> BonusListIDs;
+
+ bool operator==(ItemBonusInstanceData const& r) const;
+ bool operator!=(ItemBonusInstanceData const& r) const { return !(*this == r); }
+ };
+
+ struct ItemInstance
+ {
+ void Initialize(::Item const* item);
+ void Initialize(::ItemDynamicFieldGems const* gem);
+ void Initialize(::LootItem const& lootItem);
+ void Initialize(::VoidStorageItem const* voidItem);
+
+ uint32 ItemID = 0;
+ uint32 RandomPropertiesSeed = 0;
+ uint32 RandomPropertiesID = 0;
+ Optional<ItemBonusInstanceData> ItemBonus;
+ Optional<CompactArray<int32>> Modifications;
+
+ bool operator==(ItemInstance const& r) const;
+ bool operator!=(ItemInstance const& r) const { return !(*this == r); }
+ };
+
+ struct ItemEnchantData
+ {
+ ItemEnchantData(int32 id, uint32 expiration, int32 charges, uint8 slot) : ID(id), Expiration(expiration), Charges(charges), Slot(slot) { }
+ int32 ID = 0;
+ uint32 Expiration = 0;
+ int32 Charges = 0;
+ uint8 Slot = 0;
+ };
+
+ struct ItemGemData
+ {
+ uint8 Slot;
+ ItemInstance Item;
+ };
+
+ struct InvUpdate
+ {
+ struct InvItem
+ {
+ uint8 ContainerSlot = 0;
+ uint8 Slot = 0;
+ };
+
+ std::vector<InvItem> Items;
+ };
+ }
+}
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemBonusInstanceData const& itemBonusInstanceData);
+ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemBonusInstanceData& itemBonusInstanceData);
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemInstance const& itemInstance);
+ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemInstance& itemInstance);
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemEnchantData const& itemEnchantData);
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemGemData const& itemGemInstanceData);
+ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::ItemGemData& itemGemInstanceData);
+
+ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Item::InvUpdate& invUpdate);
+
+#endif // ItemPacketsCommon_h__
diff --git a/src/server/game/Server/Packets/LFGPackets.cpp b/src/server/game/Server/Packets/LFGPackets.cpp
index a5078efdf5a..4ec8178035c 100644
--- a/src/server/game/Server/Packets/LFGPackets.cpp
+++ b/src/server/game/Server/Packets/LFGPackets.cpp
@@ -16,23 +16,3 @@
*/
#include "LFGPackets.h"
-
-ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::LFG::RideTicket& ticket)
-{
- data >> ticket.RequesterGuid;
- data >> ticket.Id;
- data >> ticket.Type;
- data >> ticket.Time;
-
- return data;
-}
-
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::RideTicket const& ticket)
-{
- data << ticket.RequesterGuid;
- data << int32(ticket.Id);
- data << int32(ticket.Type);
- data << uint32(ticket.Time);
-
- return data;
-}
diff --git a/src/server/game/Server/Packets/LFGPackets.h b/src/server/game/Server/Packets/LFGPackets.h
index 009018a43a0..18b8ef8620a 100644
--- a/src/server/game/Server/Packets/LFGPackets.h
+++ b/src/server/game/Server/Packets/LFGPackets.h
@@ -18,23 +18,14 @@
#ifndef LFGPackets_h__
#define LFGPackets_h__
-#include "ObjectGuid.h"
+#include "Packet.h"
+#include "LFGPacketsCommon.h"
namespace WorldPackets
{
namespace LFG
{
- struct RideTicket
- {
- ObjectGuid RequesterGuid;
- int32 Id = 0;
- int32 Type = 0;
- uint32 Time = 0;
- };
}
}
-ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::LFG::RideTicket& ticket);
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::RideTicket const& ticket);
-
#endif // LFGPackets_h__
diff --git a/src/server/game/Server/Packets/LFGPacketsCommon.cpp b/src/server/game/Server/Packets/LFGPacketsCommon.cpp
new file mode 100644
index 00000000000..71af239d5aa
--- /dev/null
+++ b/src/server/game/Server/Packets/LFGPacketsCommon.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "LFGPacketsCommon.h"
+
+ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::LFG::RideTicket& ticket)
+{
+ data >> ticket.RequesterGuid;
+ data >> ticket.Id;
+ data >> ticket.Type;
+ data >> ticket.Time;
+
+ return data;
+}
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::RideTicket const& ticket)
+{
+ data << ticket.RequesterGuid;
+ data << int32(ticket.Id);
+ data << int32(ticket.Type);
+ data << uint32(ticket.Time);
+
+ return data;
+}
diff --git a/src/server/game/Server/Packets/LFGPacketsCommon.h b/src/server/game/Server/Packets/LFGPacketsCommon.h
new file mode 100644
index 00000000000..957ed07f161
--- /dev/null
+++ b/src/server/game/Server/Packets/LFGPacketsCommon.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * 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 LFGPacketsCommon_h__
+#define LFGPacketsCommon_h__
+
+#include "Packet.h"
+#include "ObjectGuid.h"
+
+namespace WorldPackets
+{
+ namespace LFG
+ {
+ struct RideTicket
+ {
+ ObjectGuid RequesterGuid;
+ int32 Id = 0;
+ int32 Type = 0;
+ uint32 Time = 0;
+ };
+ }
+}
+
+ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::LFG::RideTicket& ticket);
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::RideTicket const& ticket);
+
+#endif // LFGPacketsCommon_h__
diff --git a/src/server/game/Server/Packets/MiscPackets.cpp b/src/server/game/Server/Packets/MiscPackets.cpp
index 4880b750319..f3c5b1467d8 100644
--- a/src/server/game/Server/Packets/MiscPackets.cpp
+++ b/src/server/game/Server/Packets/MiscPackets.cpp
@@ -16,7 +16,7 @@
*/
#include "MiscPackets.h"
-#include "PacketUtilities.h"
+#include "Common.h"
WorldPacket const* WorldPackets::Misc::BindPointUpdate::Write()
{
@@ -467,12 +467,10 @@ WorldPacket const* WorldPackets::Misc::Dismount::Write()
void WorldPackets::Misc::SaveCUFProfiles::Read()
{
- uint32 count;
- _worldPacket >> count;
-
- for (uint8 i = 0; i < count && i < MAX_CUF_PROFILES; i++)
+ CUFProfiles.resize(_worldPacket.read<uint32>());
+ for (std::unique_ptr<CUFProfile>& cufProfile : CUFProfiles)
{
- std::unique_ptr<CUFProfile> cufProfile = Trinity::make_unique<CUFProfile>();
+ cufProfile = Trinity::make_unique<CUFProfile>();
uint8 strLen = _worldPacket.ReadBits(7);
@@ -496,8 +494,6 @@ void WorldPackets::Misc::SaveCUFProfiles::Read()
_worldPacket >> cufProfile->LeftOffset;
cufProfile->ProfileName = _worldPacket.ReadString(strLen);
-
- CUFProfiles.push_back(std::move(cufProfile));
}
}
diff --git a/src/server/game/Server/Packets/MiscPackets.h b/src/server/game/Server/Packets/MiscPackets.h
index 9617cc4b1e1..c4f05ff3b89 100644
--- a/src/server/game/Server/Packets/MiscPackets.h
+++ b/src/server/game/Server/Packets/MiscPackets.h
@@ -19,14 +19,20 @@
#define MiscPackets_h__
#include "Packet.h"
-#include "ObjectGuid.h"
-#include "WorldSession.h"
-#include "Object.h"
-#include "Unit.h"
-#include "Player.h"
-#include "Weather.h"
#include "CollectionMgr.h"
+#include "CUFProfile.h"
+#include "ObjectGuid.h"
+#include "Optional.h"
#include "PacketUtilities.h"
+#include "Position.h"
+#include "SharedDefines.h"
+#include <array>
+#include <map>
+#include <set>
+
+enum MountStatusFlags : uint8;
+enum UnitStandStateType : uint8;
+enum WeatherState : uint32;
namespace WorldPackets
{
@@ -39,7 +45,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
- uint32 BindMapID = MAPID_INVALID;
+ uint32 BindMapID = 0;
TaggedPosition<Position::XYZ> BindPosition;
uint32 BindAreaID = 0;
};
@@ -387,7 +393,7 @@ namespace WorldPackets
bool Abrupt = false;
float Intensity = 0.0f;
- WeatherState WeatherID = WEATHER_STATE_FINE;
+ WeatherState WeatherID = WeatherState(0);
};
class StandStateChange final : public ClientPacket
@@ -397,7 +403,7 @@ namespace WorldPackets
void Read() override;
- UnitStandStateType StandState = UNIT_STAND_STATE_STAND;
+ UnitStandStateType StandState = UnitStandStateType(0);
};
class StandStateUpdate final : public ServerPacket
@@ -409,7 +415,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
uint32 AnimKitID = 0;
- UnitStandStateType State = UNIT_STAND_STATE_STAND;
+ UnitStandStateType State = UnitStandStateType(0);
};
class StartMirrorTimer final : public ServerPacket
@@ -783,7 +789,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
bool IsFullUpdate = false;
- HeirloomContainer const* Heirlooms = nullptr;
+ std::map<uint32, HeirloomData> const* Heirlooms = nullptr;
int32 Unk = 0;
};
diff --git a/src/server/game/Server/Packets/PacketUtilities.h b/src/server/game/Server/Packets/PacketUtilities.h
index a7e73465949..44a4e22a74e 100644
--- a/src/server/game/Server/Packets/PacketUtilities.h
+++ b/src/server/game/Server/Packets/PacketUtilities.h
@@ -122,7 +122,7 @@ namespace WorldPackets
}
uint32 GetMask() const { return _mask; }
- T const& operator[](std::size_t index) const { return _contents.at(index); }
+ T const& operator[](std::size_t index) const { return _contents[index]; }
std::size_t GetSize() const { return _contents.size(); }
void Insert(std::size_t index, T const& value)
diff --git a/src/server/game/Server/Packets/PartyPackets.cpp b/src/server/game/Server/Packets/PartyPackets.cpp
index 6d5657d80b6..c4974e77f6e 100644
--- a/src/server/game/Server/Packets/PartyPackets.cpp
+++ b/src/server/game/Server/Packets/PartyPackets.cpp
@@ -16,12 +16,13 @@
*/
#include "PartyPackets.h"
-
-#include "Player.h"
#include "Pet.h"
-#include "Vehicle.h"
-#include "SpellAuras.h"
+#include "Player.h"
+#include "Realm.h"
#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
+#include "Vehicle.h"
+#include "World.h"
WorldPacket const* WorldPackets::Party::PartyCommandResult::Write()
{
diff --git a/src/server/game/Server/Packets/PetPackets.h b/src/server/game/Server/Packets/PetPackets.h
index 6e5787f1a7f..0a8fb5e7c06 100644
--- a/src/server/game/Server/Packets/PetPackets.h
+++ b/src/server/game/Server/Packets/PetPackets.h
@@ -21,6 +21,7 @@
#include "Packet.h"
#include "PacketUtilities.h"
#include "ObjectGuid.h"
+#include "Optional.h"
#include "Unit.h"
#include "WorldSession.h"
diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp
index e57864f077b..88e9a24b030 100644
--- a/src/server/game/Server/Packets/QueryPackets.cpp
+++ b/src/server/game/Server/Packets/QueryPackets.cpp
@@ -18,7 +18,6 @@
#include "QueryPackets.h"
#include "BattlenetAccountMgr.h"
#include "Player.h"
-#include "PacketUtilities.h"
#include "World.h"
#include "ObjectMgr.h"
diff --git a/src/server/game/Server/Packets/SpellPackets.h b/src/server/game/Server/Packets/SpellPackets.h
index d0af1e0043d..3d2aeca3610 100644
--- a/src/server/game/Server/Packets/SpellPackets.h
+++ b/src/server/game/Server/Packets/SpellPackets.h
@@ -23,6 +23,7 @@
#include "Player.h"
#include "SpellAuras.h"
#include "Spell.h"
+#include "Optional.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/TaxiPackets.h b/src/server/game/Server/Packets/TaxiPackets.h
index c9d7ba8e061..0acba3d2f73 100644
--- a/src/server/game/Server/Packets/TaxiPackets.h
+++ b/src/server/game/Server/Packets/TaxiPackets.h
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License as published by the
-* Free Software Foundation; either version 2 of the License, or (at your
-* option) any later version.
-*
-* This program is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-* more details.
-*
-* You should have received a copy of the GNU General Public License along
-* with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * 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 TaxiPackets_h__
#define TaxiPackets_h__
diff --git a/src/server/game/Server/Packets/TicketPackets.cpp b/src/server/game/Server/Packets/TicketPackets.cpp
index 9f1197b97df..cc60c57e908 100644
--- a/src/server/game/Server/Packets/TicketPackets.cpp
+++ b/src/server/game/Server/Packets/TicketPackets.cpp
@@ -15,13 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "LFGPackets.h"
#include "TicketPackets.h"
#include "PacketUtilities.h"
#include "SupportMgr.h"
-using namespace WorldPackets;
-
ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketHeader& header)
{
data >> header.MapID;
diff --git a/src/server/game/Server/Packets/TicketPackets.h b/src/server/game/Server/Packets/TicketPackets.h
index 048e387c046..b8c02a555b0 100644
--- a/src/server/game/Server/Packets/TicketPackets.h
+++ b/src/server/game/Server/Packets/TicketPackets.h
@@ -19,7 +19,7 @@
#define TicketPackets_h__
#include "Packet.h"
-#include "LFGPackets.h"
+#include "LFGPacketsCommon.h"
#include "Optional.h"
#include "Position.h"
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index 5d8a6a7c14c..b9ac5fa4020 100644
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
@@ -280,24 +280,24 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_CHAT_ADDON_MESSAGE_PARTY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChatAddonMessageOpcode);
DEFINE_HANDLER(CMSG_CHAT_ADDON_MESSAGE_RAID, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChatAddonMessageOpcode);
DEFINE_HANDLER(CMSG_CHAT_ADDON_MESSAGE_WHISPER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChatAddonMessageWhisperOpcode);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_ANNOUNCEMENTS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelCommand<&Channel::Announce>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_BAN, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::Ban>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_DECLINE_INVITE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelCommand<&Channel::DeclineInvite>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_DISPLAY_LIST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelCommand<&Channel::List>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_INVITE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::Invite>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_KICK, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::Kick>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_LIST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelCommand<&Channel::List>);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_ANNOUNCEMENTS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_BAN, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_DECLINE_INVITE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_DISPLAY_LIST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_INVITE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_KICK, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_LIST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelCommand);
DEFINE_HANDLER(CMSG_CHAT_CHANNEL_MODERATE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_MODERATOR, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::SetModerator>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_MUTE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::SetMute>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_OWNER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelCommand<&Channel::SendWhoOwner>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_PASSWORD, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::Password>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_SET_OWNER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::SetOwner>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_SILENCE_ALL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::SilenceAll>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNBAN, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::UnBan>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNMODERATOR, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::UnsetModerator>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNMUTE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::UnsetMute>);
- DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNSILENCE_ALL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand<&Channel::UnsilenceAll>);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_MODERATOR, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_MUTE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_OWNER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_PASSWORD, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPassword);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_SET_OWNER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_SILENCE_ALL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNBAN, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNMODERATOR, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNMUTE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand);
+ DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNSILENCE_ALL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChannelPlayerCommand);
DEFINE_HANDLER(CMSG_CHAT_JOIN_CHANNEL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleJoinChannel);
DEFINE_HANDLER(CMSG_CHAT_LEAVE_CHANNEL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLeaveChannel);
DEFINE_HANDLER(CMSG_CHAT_MESSAGE_AFK, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChatMessageAFKOpcode);
diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp
index d32ea43bfc2..7f0ffed44f2 100644
--- a/src/server/game/Server/Protocol/PacketLog.cpp
+++ b/src/server/game/Server/Protocol/PacketLog.cpp
@@ -17,9 +17,11 @@
#include "PacketLog.h"
#include "Config.h"
-#include "WorldPacket.h"
+#include "Realm.h"
#include "Timer.h"
#include "World.h"
+#include "WorldPacket.h"
+#include <boost/asio/ip/address.hpp>
#pragma pack(push, 1)
@@ -89,19 +91,21 @@ void PacketLog::Initialize()
{
_file = fopen((logsDir + logname).c_str(), "wb");
- LogHeader header;
- header.Signature[0] = 'P'; header.Signature[1] = 'K'; header.Signature[2] = 'T';
- header.FormatVersion = 0x0301;
- header.SnifferId = 'T';
- header.Build = realm.Build;
- header.Locale[0] = 'e'; header.Locale[1] = 'n'; header.Locale[2] = 'U'; header.Locale[3] = 'S';
- std::memset(header.SessionKey, 0, sizeof(header.SessionKey));
- header.SniffStartUnixtime = time(NULL);
- header.SniffStartTicks = getMSTime();
- header.OptionalDataSize = 0;
-
if (CanLogPacket())
+ {
+ LogHeader header;
+ header.Signature[0] = 'P'; header.Signature[1] = 'K'; header.Signature[2] = 'T';
+ header.FormatVersion = 0x0301;
+ header.SnifferId = 'T';
+ header.Build = realm.Build;
+ header.Locale[0] = 'e'; header.Locale[1] = 'n'; header.Locale[2] = 'U'; header.Locale[3] = 'S';
+ std::memset(header.SessionKey, 0, sizeof(header.SessionKey));
+ header.SniffStartUnixtime = time(NULL);
+ header.SniffStartTicks = getMSTime();
+ header.OptionalDataSize = 0;
+
fwrite(&header, sizeof(header), 1, _file);
+ }
}
}
diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h
index acf5efe0ee5..2d7b1c1b1bc 100644
--- a/src/server/game/Server/Protocol/PacketLog.h
+++ b/src/server/game/Server/Protocol/PacketLog.h
@@ -19,9 +19,6 @@
#define TRINITY_PACKETLOG_H
#include "Common.h"
-#include "Opcodes.h"
-
-#include <boost/asio/ip/address.hpp>
#include <mutex>
enum Direction
@@ -31,6 +28,18 @@ enum Direction
};
class WorldPacket;
+enum ConnectionType : int8;
+
+namespace boost
+{
+ namespace asio
+ {
+ namespace ip
+ {
+ class address;
+ }
+ }
+}
class TC_GAME_API PacketLog
{
diff --git a/src/server/game/Server/WorldPacket.h b/src/server/game/Server/WorldPacket.h
index 11f72160067..a6c9ffe2ba0 100644
--- a/src/server/game/Server/WorldPacket.h
+++ b/src/server/game/Server/WorldPacket.h
@@ -19,9 +19,8 @@
#ifndef TRINITYCORE_WORLDPACKET_H
#define TRINITYCORE_WORLDPACKET_H
-#include "Common.h"
-#include "Opcodes.h"
#include "ByteBuffer.h"
+#include "Opcodes.h"
class WorldPacket : public ByteBuffer
{
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 8f1f87bcf18..2bcb75f4b4f 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -20,43 +20,34 @@
\ingroup u2w
*/
-#include "WorldSocket.h"
-#include "Config.h"
-#include "Common.h"
-#include "DatabaseEnv.h"
-#include "QueryCallback.h"
+#include "WorldSession.h"
#include "QueryHolder.h"
#include "AccountMgr.h"
-#include "Log.h"
-#include "Opcodes.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "Player.h"
-#include "Vehicle.h"
-#include "ObjectMgr.h"
-#include "GuildMgr.h"
-#include "Group.h"
-#include "Guild.h"
-#include "World.h"
-#include "ObjectAccessor.h"
-#include "BattlegroundMgr.h"
-#include "OutdoorPvPMgr.h"
-#include "SocialMgr.h"
-#include "ScriptMgr.h"
-#include "WardenWin.h"
#include "AuthenticationPackets.h"
+#include "BattlePetMgr.h"
+#include "BattlegroundMgr.h"
#include "BattlenetPackets.h"
#include "CharacterPackets.h"
-#include "ClientConfigPackets.h"
-#include "MiscPackets.h"
#include "ChatPackets.h"
-#include "BattlePetMgr.h"
-#include "PacketUtilities.h"
-#include "CollectionMgr.h"
+#include "DatabaseEnv.h"
+#include "Group.h"
+#include "Guild.h"
+#include "GuildMgr.h"
#include "Metric.h"
+#include "MiscPackets.h"
+#include "ObjectMgr.h"
+#include "OutdoorPvPMgr.h"
+#include "PacketUtilities.h"
+#include "Player.h"
+#include "QueryHolder.h"
#include "Random.h"
-
-#include <zlib.h>
+#include "RBAC.h"
+#include "Realm.h"
+#include "ScriptMgr.h"
+#include "SocialMgr.h"
+#include "WardenWin.h"
+#include "World.h"
+#include "WorldSocket.h"
namespace {
@@ -697,6 +688,11 @@ char const* WorldSession::GetTrinityString(uint32 entry) const
return sObjectMgr->GetTrinityString(entry, GetSessionDbLocaleIndex());
}
+void WorldSession::ResetTimeOutTime()
+{
+ m_timeOutTime = int32(sWorld->getIntConfig(CONFIG_SOCKET_TIMEOUTTIME));
+}
+
void WorldSession::Handle_NULL(WorldPackets::Null& null)
{
TC_LOG_ERROR("network.opcode", "Received unhandled opcode %s from %s", GetOpcodeNameForLogging(null.GetOpcode()).c_str(), GetPlayerInfo().c_str());
@@ -1387,3 +1383,7 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
return maxPacketCounterAllowed;
}
+
+WorldSession::DosProtection::DosProtection(WorldSession* s) : Session(s), _policy((Policy)sWorld->getIntConfig(CONFIG_PACKET_SPOOF_POLICY))
+{
+}
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 20999763fcb..8b4c5e99743 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -24,39 +24,36 @@
#define __WORLDSESSION_H
#include "Common.h"
-#include "SharedDefines.h"
-#include "DatabaseEnv.h"
-#include "World.h"
+#include "DatabaseEnvFwd.h"
+#include "LockedQueue.h"
+#include "ObjectGuid.h"
#include "Packet.h"
-#include "Cryptography/BigNumber.h"
-#include "AccountMgr.h"
+#include "QueryCallbackProcessor.h"
+#include "SharedDefines.h"
+#include <array>
+#include <set>
+#include <unordered_map>
#include <unordered_set>
class BattlePetMgr;
-class Channel;
+class BigNumber;
+class BlackMarketEntry;
class CollectionMgr;
class Creature;
-class BlackMarketEntry;
-class GameObject;
class InstanceSave;
class Item;
class LoginQueryHolder;
-class Object;
class Player;
-class Quest;
-class SpellCastTargets;
class Unit;
class Warden;
-class WorldPacket;
class WorldSession;
class WorldSocket;
-struct AreaTableEntry;
struct AuctionEntry;
+struct BlackMarketTemplate;
struct DeclinedName;
struct ItemTemplate;
struct MovementInfo;
struct Position;
-struct BlackMarketTemplate;
namespace lfg
{
@@ -233,7 +230,9 @@ namespace WorldPackets
namespace Channel
{
+ class ChannelCommand;
class ChannelPlayerCommand;
+ class ChannelPassword;
class JoinChannel;
class LeaveChannel;
}
@@ -771,41 +770,6 @@ enum AccountDataType
#define GLOBAL_CACHE_MASK 0x15
#define PER_CHARACTER_CACHE_MASK 0xEA
-enum TutorialAction : uint8
-{
- TUTORIAL_ACTION_UPDATE = 0,
- TUTORIAL_ACTION_CLEAR = 1,
- TUTORIAL_ACTION_RESET = 2
-};
-
-/*
-enum Tutorials
-{
- TUTORIAL_TALENT = 0,
- TUTORIAL_SPEC = 1,
- TUTORIAL_GLYPH = 2,
- TUTORIAL_SPELLBOOK = 3,
- TUTORIAL_PROFESSIONS = 4,
- TUTORIAL_CORE_ABILITITES = 5,
- TUTORIAL_PET_JOURNAL = 6,
- TUTORIAL_WHAT_HAS_CHANGED = 7,
- TUTORIAL_GARRISON_BUILDING = 8,
- TUTORIAL_GARRISON_MISSION_LIST = 9,
- TUTORIAL_GARRISON_MISSION_PAGE = 10,
- TUTORIAL_GARRISON_LANDING = 11,
- TUTORIAL_GARRISON_ZONE_ABILITY = 12,
- TUTORIAL_WORLD_MAP_FRAME = 13,
- TUTORIAL_CLEAN_UP_BAGS = 14,
- TUTORIAL_BAG_SETTINGS = 15,
- TUTORIAL_REAGENT_BANK_UNLOCK = 16,
- TUTORIAL_TOYBOX_FAVORITE = 17,
- TUTORIAL_TOYBOX_MOUSEWHEEL_PAGING = 18,
- TUTORIAL_LFG_LIST = 19
-};
-*/
-
-#define MAX_ACCOUNT_TUTORIAL_VALUES 8
-
struct AccountData
{
time_t Time = 0;
@@ -862,9 +826,6 @@ enum DeclinedNameResult
DECLINED_NAMES_RESULT_ERROR = 1
};
-#define DB2_REPLY_SPARSE 2442913102
-#define DB2_REPLY_ITEM 1344507586
-
//class to deal with packet processing
//allows to determine if next packet is safe to be processed
class PacketFilter
@@ -1108,10 +1069,7 @@ class TC_GAME_API WorldSession
m_timeOutTime -= int32(diff);
}
- void ResetTimeOutTime()
- {
- m_timeOutTime = int32(sWorld->getIntConfig(CONFIG_SOCKET_TIMEOUTTIME));
- }
+ void ResetTimeOutTime();
bool IsConnectionIdle() const
{
@@ -1516,12 +1474,9 @@ class TC_GAME_API WorldSession
void HandleJoinChannel(WorldPackets::Channel::JoinChannel& packet);
void HandleLeaveChannel(WorldPackets::Channel::LeaveChannel& packet);
-
- template<void(Channel::*CommandFunction)(Player const*)>
- void HandleChannelCommand(WorldPackets::Channel::ChannelPlayerCommand& packet);
-
- template<void(Channel::*CommandFunction)(Player const*, std::string const&)>
+ void HandleChannelCommand(WorldPackets::Channel::ChannelCommand& packet);
void HandleChannelPlayerCommand(WorldPackets::Channel::ChannelPlayerCommand& packet);
+ void HandleChannelPassword(WorldPackets::Channel::ChannelPassword& channelPassword);
void HandleCompleteCinematic(WorldPackets::Misc::CompleteCinematic& packet);
void HandleNextCinematicCamera(WorldPackets::Misc::NextCinematicCamera& packet);
@@ -1787,7 +1742,7 @@ class TC_GAME_API WorldSession
{
friend class World;
public:
- DosProtection(WorldSession* s) : Session(s), _policy((Policy)sWorld->getIntConfig(CONFIG_PACKET_SPOOF_POLICY)) { }
+ DosProtection(WorldSession* s);
bool EvaluateOpcode(WorldPacket& p, time_t time) const;
protected:
enum Policy
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 8069220d270..1b0d7b7174a 100644
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -19,19 +19,20 @@
#include "WorldSocket.h"
#include "AuthenticationPackets.h"
#include "BattlenetRpcErrorCodes.h"
-#include "BigNumber.h"
#include "CharacterPackets.h"
+#include "DatabaseEnv.h"
+#include "Errors.h"
#include "HmacHash.h"
-#include "Opcodes.h"
#include "PacketLog.h"
-#include "QueryCallback.h"
+#include "Realm.h"
+#include "RBAC.h"
#include "ScriptMgr.h"
#include "SessionKeyGeneration.h"
#include "SHA256.h"
#include "World.h"
-
+#include "WorldPacket.h"
+#include "WorldSession.h"
#include <zlib.h>
-#include <memory>
#pragma pack(push, 1)
@@ -42,6 +43,8 @@ struct CompressedWorldPacket
uint32 CompressedAdler;
};
+#pragma pack(pop)
+
class EncryptablePacket : public WorldPacket
{
public:
@@ -53,8 +56,6 @@ private:
bool _encrypt;
};
-#pragma pack(pop)
-
using boost::asio::ip::tcp;
std::string const WorldSocket::ServerConnectionInitialize("WORLD OF WARCRAFT CONNECTION - SERVER TO CLIENT");
@@ -995,3 +996,8 @@ bool WorldSocket::HandlePing(WorldPackets::Auth::Ping& ping)
SendPacketAndLogOpcode(*WorldPackets::Auth::Pong(ping.Serial).Write());
return true;
}
+
+bool PacketHeader::IsValidOpcode()
+{
+ return Command < NUM_OPCODE_HANDLERS;
+}
diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h
index 337ef055e2a..57a1f05142b 100644
--- a/src/server/game/Server/WorldSocket.h
+++ b/src/server/game/Server/WorldSocket.h
@@ -20,19 +20,23 @@
#define __WORLDSOCKET_H__
#include "Common.h"
+#include "BigNumber.h"
+#include "DatabaseEnvFwd.h"
+#include "MessageBuffer.h"
#include "QueryCallbackProcessor.h"
-#include "WorldPacketCrypt.h"
#include "Socket.h"
-#include "Util.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
+#include "WorldPacketCrypt.h"
#include "MPSCQueue.h"
#include <chrono>
-#include <boost/asio/ip/tcp.hpp>
+#include <functional>
+#include <mutex>
-using boost::asio::ip::tcp;
-struct z_stream_s;
+typedef struct z_stream_s z_stream;
class EncryptablePacket;
+class WorldPacket;
+class WorldSession;
+enum ConnectionType : int8;
+enum OpcodeClient : uint32;
namespace WorldPackets
{
@@ -54,7 +58,7 @@ struct PacketHeader
uint16 Command;
bool IsValidSize() { return Size < 0x10000; }
- bool IsValidOpcode() { return Command < NUM_OPCODE_HANDLERS; }
+ bool IsValidOpcode();
};
#pragma pack(pop)
@@ -72,7 +76,7 @@ class TC_GAME_API WorldSocket : public Socket<WorldSocket>
typedef Socket<WorldSocket> BaseSocket;
public:
- WorldSocket(tcp::socket&& socket);
+ WorldSocket(boost::asio::ip::tcp::socket&& socket);
~WorldSocket();
WorldSocket(WorldSocket const& right) = delete;
@@ -145,7 +149,7 @@ private:
MPSCQueue<EncryptablePacket> _bufferQueue;
std::size_t _sendBufferSize;
- z_stream_s* _compressionStream;
+ z_stream* _compressionStream;
QueryCallbackProcessor _queryProcessor;
std::string _ipCountry;
diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp
index 42f34245adc..1fda984f969 100644
--- a/src/server/game/Server/WorldSocketMgr.cpp
+++ b/src/server/game/Server/WorldSocketMgr.cpp
@@ -16,12 +16,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSocketMgr.h"
#include "Config.h"
#include "NetworkThread.h"
#include "ScriptMgr.h"
#include "WorldSocket.h"
-#include "WorldSocketMgr.h"
-
+#include "World.h"
#include <boost/system/error_code.hpp>
static void OnSocketAccept(tcp::socket&& sock, uint32 threadIndex)
diff --git a/src/server/game/Services/WorldserverService.cpp b/src/server/game/Services/WorldserverService.cpp
index 8dabf131e68..779bb10adac 100644
--- a/src/server/game/Services/WorldserverService.cpp
+++ b/src/server/game/Services/WorldserverService.cpp
@@ -16,11 +16,13 @@
*/
#include "WorldserverService.h"
+#include "BattlenetRpcErrorCodes.h"
#include "Log.h"
+#include "ProtobufJSON.h"
+#include "Realm.h"
#include "RealmList.h"
#include "RealmList.pb.h"
-#include "BattlenetRpcErrorCodes.h"
-#include "ProtobufJSON.h"
+#include "World.h"
#include <boost/asio/ip/address.hpp>
#include <zlib.h>
diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp
index 6b4ce80e1f2..e24c2b8f89d 100644
--- a/src/server/game/Skills/SkillDiscovery.cpp
+++ b/src/server/game/Skills/SkillDiscovery.cpp
@@ -26,6 +26,7 @@
#include "Random.h"
#include "SpellInfo.h"
#include <map>
+#include <sstream>
struct SkillDiscoveryEntry
{
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 65891e5d53e..d53558df96e 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -16,32 +16,34 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "SpellAuraEffects.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "Battleground.h"
+#include "CellImpl.h"
#include "Common.h"
-#include "WorldPacket.h"
-#include "Opcodes.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
#include "Log.h"
+#include "LootMgr.h"
+#include "MiscPackets.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "SpellMgr.h"
+#include "Opcodes.h"
+#include "OutdoorPvPMgr.h"
+#include "Pet.h"
#include "Player.h"
+#include "ReputationMgr.h"
+#include "ScriptMgr.h"
+#include "Spell.h"
+#include "SpellHistory.h"
+#include "SpellMgr.h"
#include "Unit.h"
-#include "ObjectAccessor.h"
-#include "CellImpl.h"
#include "Util.h"
-#include "Spell.h"
-#include "SpellAuraEffects.h"
-#include "Battleground.h"
-#include "OutdoorPvPMgr.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "ScriptMgr.h"
#include "Vehicle.h"
-#include "Battlefield.h"
-#include "BattlefieldMgr.h"
+#include "Weather.h"
#include "WeatherMgr.h"
-#include "Pet.h"
-#include "ReputationMgr.h"
-#include "MiscPackets.h"
-#include "SpellHistory.h"
+#include "WorldPacket.h"
class Aura;
//
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 8371220280c..91ac7806010 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -38,6 +38,7 @@
#include "SpellScript.h"
#include "Vehicle.h"
#include "Config.h"
+#include "World.h"
AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint32 effMask):
_target(target), _base(aura), _removeMode(AURA_REMOVE_NONE), _slot(MAX_AURAS),
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h
index ea284707308..dc7b5c946f7 100644
--- a/src/server/game/Spells/Auras/SpellAuras.h
+++ b/src/server/game/Spells/Auras/SpellAuras.h
@@ -22,7 +22,6 @@
#include "SpellAuraDefines.h"
#include "SpellInfo.h"
#include "Unit.h"
-#include <boost/any.hpp>
class SpellInfo;
struct SpellModifier;
@@ -295,16 +294,6 @@ class TC_GAME_API Aura
SpellEffectInfoVector GetSpellEffectInfos() const { return _spelEffectInfos; }
SpellEffectInfo const* GetSpellEffectInfo(uint32 index) const;
- template<typename T>
- T const* GetCastExtraParam(std::string const& key) const
- {
- auto itr = m_castExtraParams.find(key);
- if (itr != m_castExtraParams.end())
- return boost::any_cast<T>(&itr->second);
- return nullptr;
- }
- void SetCastExtraParam(std::string const& keyVal, boost::any&& value) { m_castExtraParams[keyVal] = std::move(value); }
-
private:
void _DeleteRemovedApplications();
@@ -340,9 +329,6 @@ class TC_GAME_API Aura
std::chrono::steady_clock::time_point m_lastProcAttemptTime;
std::chrono::steady_clock::time_point m_lastProcSuccessTime;
- // Used to store extra parameters for an aura, eg. data across different auras
- std::unordered_map<std::string, boost::any> m_castExtraParams;
-
private:
Unit::AuraApplicationList m_removedApplications;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index a1eb05d1da9..1eeb35f43ba 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -63,6 +63,7 @@
#include "SpellPackets.h"
#include "TalentPackets.h"
#include "Conversation.h"
+#include "LootMgr.h"
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
{
@@ -1442,7 +1443,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype, uint8 context /*= 0*/, s
if (num_to_add)
{
// create the new item and store it
- Item* pItem = player->StoreNewItem(dest, newitemid, true, Item::GenerateItemRandomPropertyId(newitemid), GuidSet(), context, bonusListIDs);
+ Item* pItem = player->StoreNewItem(dest, newitemid, true, GenerateItemRandomPropertyId(newitemid), GuidSet(), context, bonusListIDs);
// was it successful? return error if not
if (!pItem)
diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp
index 1ce3e577e52..dee766daff3 100644
--- a/src/server/game/Spells/SpellHistory.cpp
+++ b/src/server/game/Spells/SpellHistory.cpp
@@ -16,6 +16,7 @@
*/
#include "SpellHistory.h"
+#include "DatabaseEnv.h"
#include "Pet.h"
#include "PetPackets.h"
#include "Player.h"
diff --git a/src/server/game/Spells/SpellHistory.h b/src/server/game/Spells/SpellHistory.h
index bb3c7a64586..be689e8c07f 100644
--- a/src/server/game/Spells/SpellHistory.h
+++ b/src/server/game/Spells/SpellHistory.h
@@ -19,8 +19,7 @@
#define SpellHistory_h__
#include "SharedDefines.h"
-#include "QueryResult.h"
-#include "Transaction.h"
+#include "DatabaseEnvFwd.h"
#include <chrono>
#include <deque>
#include <unordered_map>
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 04947bdf365..4a3aa150bdb 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -16,6 +16,7 @@
*/
#include "SpellInfo.h"
+#include "Log.h"
#include "SpellAuraDefines.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index f321dd51d2d..a739e974563 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -17,15 +17,17 @@
*/
#include "SpellMgr.h"
-#include "SpellInfo.h"
-#include "ObjectMgr.h"
-#include "SpellAuraDefines.h"
-#include "SharedDefines.h"
-#include "Chat.h"
-#include "BattlegroundMgr.h"
-#include "BattlefieldWG.h"
#include "BattlefieldMgr.h"
+#include "BattlefieldWG.h"
+#include "BattlegroundMgr.h"
+#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "Player.h"
+#include "SharedDefines.h"
+#include "SpellAuraDefines.h"
+#include "SpellInfo.h"
PetFamilySpellsStore sPetFamilySpellsStore;
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index eb4c6691ee3..a450751df2d 100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -15,12 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "SpellScript.h"
+#include "Log.h"
#include "Spell.h"
#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellMgr.h"
-#include "SpellScript.h"
-
+#include <sstream>
#include <string>
bool _SpellScript::_Validate(SpellInfo const* entry)
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index ad1556ae57c..50e98dfc40a 100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -22,7 +22,6 @@
#include "SharedDefines.h"
#include "SpellAuraDefines.h"
#include "Spell.h"
-#include "ScriptReloadMgr.h"
#include <stack>
class Unit;
@@ -39,6 +38,7 @@ class Player;
class Item;
class WorldLocation;
class WorldObject;
+class ModuleReference;
#define SPELL_EFFECT_ANY (uint16)-1
#define SPELL_AURA_ANY (uint16)-1
diff --git a/src/server/game/Support/SupportMgr.cpp b/src/server/game/Support/SupportMgr.cpp
index cc358436bec..2d213fe61e5 100644
--- a/src/server/game/Support/SupportMgr.cpp
+++ b/src/server/game/Support/SupportMgr.cpp
@@ -15,9 +15,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "SupportMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
-#include "SupportMgr.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "Timer.h"
+#include "World.h"
+#include <sstream>
inline time_t GetAge(uint64 t) { return (time(nullptr) - t) / DAY; }
@@ -30,6 +38,34 @@ Ticket::Ticket(Player* player) : _id(0), _mapId(0), _createTime(time(nullptr))
Ticket::~Ticket() { }
+Player* Ticket::GetPlayer() const
+{
+ return ObjectAccessor::FindConnectedPlayer(_playerGuid);
+}
+
+std::string Ticket::GetPlayerName() const
+{
+ std::string name;
+ if (!_playerGuid.IsEmpty())
+ ObjectMgr::GetPlayerNameByGUID(_playerGuid, name);
+
+ return name;
+}
+
+Player* Ticket::GetAssignedPlayer() const
+{
+ return ObjectAccessor::FindConnectedPlayer(_assignedTo);
+}
+
+std::string Ticket::GetAssignedToName() const
+{
+ std::string name;
+ if (!_assignedTo.IsEmpty())
+ ObjectMgr::GetPlayerNameByGUID(_assignedTo, name);
+
+ return name;
+}
+
void Ticket::TeleportTo(Player* player) const
{
player->TeleportTo(_mapId, _pos.GetPositionX(), _pos.GetPositionY(), _pos.GetPositionZ(), 0.0f, 0);
@@ -368,15 +404,6 @@ SupportMgr* SupportMgr::instance()
return &instance;
}
-void SupportMgr::Initialize()
-{
- SetSupportSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_ENABLED));
- SetTicketSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_TICKETS_ENABLED));
- SetBugSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_BUGS_ENABLED));
- SetComplaintSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_COMPLAINTS_ENABLED));
- SetSuggestionSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_SUGGESTIONS_ENABLED));
-}
-
template<>
BugTicket* SupportMgr::GetTicket<BugTicket>(uint32 bugId)
{
@@ -413,6 +440,25 @@ template TC_GAME_API BugTicket* SupportMgr::GetTicket<BugTicket>(uint32);
template TC_GAME_API ComplaintTicket* SupportMgr::GetTicket<ComplaintTicket>(uint32);
template TC_GAME_API SuggestionTicket* SupportMgr::GetTicket<SuggestionTicket>(uint32);
+ComplaintTicketList SupportMgr::GetComplaintsByPlayerGuid(ObjectGuid playerGuid) const
+{
+ ComplaintTicketList ret;
+ for (auto const& c : _complaintTicketList)
+ if (c.second->GetPlayerGuid() == playerGuid)
+ ret.insert(c);
+
+ return ret;
+}
+
+void SupportMgr::Initialize()
+{
+ SetSupportSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_ENABLED));
+ SetTicketSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_TICKETS_ENABLED));
+ SetBugSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_BUGS_ENABLED));
+ SetComplaintSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_COMPLAINTS_ENABLED));
+ SetSuggestionSystemStatus(sWorld->getBoolConfig(CONFIG_SUPPORT_SUGGESTIONS_ENABLED));
+}
+
template<>
uint32 SupportMgr::GetOpenTicketCount<BugTicket>() const { return _openBugTicketCount; }
@@ -771,3 +817,8 @@ void SupportMgr::ShowClosedList<SuggestionTicket>(ChatHandler& handler) const
template TC_GAME_API void SupportMgr::ShowClosedList<BugTicket>(ChatHandler&) const;
template TC_GAME_API void SupportMgr::ShowClosedList<ComplaintTicket>(ChatHandler&) const;
template TC_GAME_API void SupportMgr::ShowClosedList<SuggestionTicket>(ChatHandler&) const;
+
+void SupportMgr::UpdateLastChange()
+{
+ _lastChange = uint64(time(nullptr));
+}
diff --git a/src/server/game/Support/SupportMgr.h b/src/server/game/Support/SupportMgr.h
index 9c1f9b39fd4..52b08087e05 100644
--- a/src/server/game/Support/SupportMgr.h
+++ b/src/server/game/Support/SupportMgr.h
@@ -18,11 +18,12 @@
#ifndef SupportMgr_h__
#define SupportMgr_h__
-#include "ObjectMgr.h"
-#include "Player.h"
#include "TicketPackets.h"
+#include <map>
class ChatHandler;
+class Field;
+class Player;
// from blizzard lua
enum GMTicketSystemStatus
@@ -65,25 +66,11 @@ public:
uint32 GetId() const { return _id; }
ObjectGuid GetPlayerGuid() const { return _playerGuid; }
- Player* GetPlayer() const { return ObjectAccessor::FindConnectedPlayer(_playerGuid); }
- std::string GetPlayerName() const
- {
- std::string name;
- if (!_playerGuid.IsEmpty())
- ObjectMgr::GetPlayerNameByGUID(_playerGuid, name);
-
- return name;
- }
- Player* GetAssignedPlayer() const { return ObjectAccessor::FindConnectedPlayer(_assignedTo); }
+ Player* GetPlayer() const;
+ std::string GetPlayerName() const;
+ Player* GetAssignedPlayer() const;
ObjectGuid GetAssignedToGUID() const { return _assignedTo; }
- std::string GetAssignedToName() const
- {
- std::string name;
- if (!_assignedTo.IsEmpty())
- ObjectMgr::GetPlayerNameByGUID(_assignedTo, name);
-
- return name;
- }
+ std::string GetAssignedToName() const;
std::string const& GetComment() const { return _comment; }
virtual void SetAssignedTo(ObjectGuid guid, bool /*isAdmin*/ = false) { _assignedTo = guid; }
@@ -210,15 +197,7 @@ public:
template<typename T>
T* GetTicket(uint32 ticketId);
- ComplaintTicketList GetComplaintsByPlayerGuid(ObjectGuid playerGuid) const
- {
- ComplaintTicketList ret;
- for (auto const& c : _complaintTicketList)
- if (c.second->GetPlayerGuid() == playerGuid)
- ret.insert(c);
-
- return ret;
- }
+ ComplaintTicketList GetComplaintsByPlayerGuid(ObjectGuid playerGuid) const;
void Initialize();
@@ -263,7 +242,7 @@ public:
template<typename T>
void ShowClosedList(ChatHandler& handler) const;
- void UpdateLastChange() { _lastChange = uint64(time(nullptr)); }
+ void UpdateLastChange();
uint32 GenerateBugId() { return ++_lastBugId; }
uint32 GenerateComplaintId() { return ++_lastComplaintId; }
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index 829df1fdf77..7a1e726ca03 100644
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -15,17 +15,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "DatabaseEnv.h"
-#include "ObjectMgr.h"
+#include "CreatureTextMgr.h"
#include "Cell.h"
#include "CellImpl.h"
#include "Chat.h"
+#include "ChatPackets.h"
+#include "Common.h"
+#include "DatabaseEnv.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "CreatureTextMgr.h"
-#include "ChatPackets.h"
+#include "Log.h"
#include "MiscPackets.h"
+#include "ObjectMgr.h"
class CreatureTextBuilder
{
diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h
index 7b4854de0ad..ea891e6a78d 100644
--- a/src/server/game/Texts/CreatureTextMgr.h
+++ b/src/server/game/Texts/CreatureTextMgr.h
@@ -25,6 +25,7 @@
#include "Opcodes.h"
#include "Group.h"
#include "Packets/ChatPackets.h"
+#include "World.h"
enum CreatureTextRange
{
diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
index 97d909e8645..6bca94741c3 100644
--- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp
+++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
@@ -25,6 +25,7 @@
#include "Database/DatabaseEnv.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
+#include <sstream>
void CharacterDatabaseCleaner::CleanDatabase()
{
diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp
index f5c1508fc9c..2945883d803 100644
--- a/src/server/game/Tools/PlayerDump.cpp
+++ b/src/server/game/Tools/PlayerDump.cpp
@@ -16,13 +16,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
#include "PlayerDump.h"
+#include "AccountMgr.h"
+#include "Common.h"
#include "DatabaseEnv.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "AccountMgr.h"
#include "World.h"
+#include <sstream>
#define DUMP_TABLE_COUNT 35
struct DumpTable
diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp
index bd0746ea207..ca40cc22d08 100644
--- a/src/server/game/Warden/WardenCheckMgr.cpp
+++ b/src/server/game/Warden/WardenCheckMgr.cpp
@@ -23,8 +23,13 @@
#include "Database/DatabaseEnv.h"
#include "WardenCheckMgr.h"
#include "Warden.h"
+#include "World.h"
+#include <boost/thread/locks.hpp>
+#include <boost/thread/shared_mutex.hpp>
-WardenCheckMgr::WardenCheckMgr() { }
+WardenCheckMgr::WardenCheckMgr() : _checkStoreLock(new boost::shared_mutex())
+{
+}
WardenCheckMgr::~WardenCheckMgr()
{
@@ -33,6 +38,8 @@ WardenCheckMgr::~WardenCheckMgr()
for (CheckResultContainer::iterator itr = CheckResultStore.begin(); itr != CheckResultStore.end(); ++itr)
delete itr->second;
+
+ delete _checkStoreLock;
}
void WardenCheckMgr::LoadWardenChecks()
@@ -163,7 +170,7 @@ void WardenCheckMgr::LoadWardenOverrides()
uint32 count = 0;
- boost::unique_lock<boost::shared_mutex> lock(sWardenCheckMgr->_checkStoreLock);
+ boost::unique_lock<boost::shared_mutex> lock(*sWardenCheckMgr->_checkStoreLock);
do
{
diff --git a/src/server/game/Warden/WardenCheckMgr.h b/src/server/game/Warden/WardenCheckMgr.h
index 4aac649cfa5..aac4488ddf6 100644
--- a/src/server/game/Warden/WardenCheckMgr.h
+++ b/src/server/game/Warden/WardenCheckMgr.h
@@ -19,10 +19,8 @@
#ifndef _WARDENCHECKMGR_H
#define _WARDENCHECKMGR_H
-#include <map>
-#include <boost/thread/locks.hpp>
-#include <boost/thread/shared_mutex.hpp>
#include "Cryptography/BigNumber.h"
+#include <map>
enum WardenActions
{
@@ -31,6 +29,11 @@ enum WardenActions
WARDEN_ACTION_BAN
};
+namespace boost
+{
+ class shared_mutex;
+}
+
struct WardenCheck
{
uint8 Type;
@@ -70,7 +73,7 @@ class TC_GAME_API WardenCheckMgr
void LoadWardenChecks();
void LoadWardenOverrides();
- boost::shared_mutex _checkStoreLock;
+ boost::shared_mutex* _checkStoreLock;
private:
CheckContainer CheckStore;
diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp
index 6c7fdce98aa..1049f63e028 100644
--- a/src/server/game/Warden/WardenWin.cpp
+++ b/src/server/game/Warden/WardenWin.cpp
@@ -33,7 +33,8 @@
#include "WardenCheckMgr.h"
#include "SHA1.h"
#include "Random.h"
-
+#include <boost/thread/locks.hpp>
+#include <boost/thread/shared_mutex.hpp>
#include <openssl/md5.h>
WardenWin::WardenWin() : Warden(), _serverTicks(0) {}
@@ -208,7 +209,7 @@ void WardenWin::RequestData()
ByteBuffer buff;
buff << uint8(WARDEN_SMSG_CHEAT_CHECKS_REQUEST);
- boost::shared_lock<boost::shared_mutex> lock(sWardenCheckMgr->_checkStoreLock);
+ boost::shared_lock<boost::shared_mutex> lock(*sWardenCheckMgr->_checkStoreLock);
for (uint32 i = 0; i < sWorld->getIntConfig(CONFIG_WARDEN_NUM_OTHER_CHECKS); ++i)
{
@@ -371,7 +372,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
uint8 type;
uint16 checkFailed = 0;
- boost::shared_lock<boost::shared_mutex> lock(sWardenCheckMgr->_checkStoreLock);
+ boost::shared_lock<boost::shared_mutex> lock(*sWardenCheckMgr->_checkStoreLock);
for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr)
{
diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp
index 5c64fffe6cd..fcda5662560 100644
--- a/src/server/game/Weather/WeatherMgr.cpp
+++ b/src/server/game/Weather/WeatherMgr.cpp
@@ -21,12 +21,13 @@
*/
#include "WeatherMgr.h"
-#include "Weather.h"
+#include "DatabaseEnv.h"
#include "Log.h"
+#include "MiscPackets.h"
#include "ObjectMgr.h"
#include "Player.h"
+#include "Weather.h"
#include "WorldSession.h"
-#include "MiscPackets.h"
namespace WeatherMgr
{
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index c6c2ddba890..207cad78266 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -21,6 +21,7 @@
*/
#include "World.h"
+#include "AccountMgr.h"
#include "AchievementMgr.h"
#include "AreaTriggerDataStore.h"
#include "ArenaTeamMgr.h"
@@ -36,6 +37,7 @@
#include "CharacterDatabaseCleaner.h"
#include "CharacterTemplateDataStore.h"
#include "Chat.h"
+#include "ChatPackets.h"
#include "Config.h"
#include "ConversationDataStore.h"
#include "CreatureAIRegistry.h"
@@ -44,44 +46,47 @@
#include "DatabaseEnv.h"
#include "DisableMgr.h"
#include "GameEventMgr.h"
+#include "GameObjectModel.h"
#include "GameTables.h"
#include "GarrisonMgr.h"
#include "GitRevision.h"
#include "GridNotifiersImpl.h"
#include "GroupMgr.h"
#include "GuildFinderMgr.h"
-#include "GameObjectModel.h"
+#include "GuildMgr.h"
#include "InstanceSaveMgr.h"
#include "Language.h"
#include "LFGMgr.h"
+#include "LootMgr.h"
+#include "M2Stores.h"
#include "MapManager.h"
#include "Memory.h"
+#include "Metric.h"
#include "MiscPackets.h"
#include "MMapFactory.h"
+#include "Object.h"
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
#include "Player.h"
#include "PoolMgr.h"
-#include "QueryCallback.h"
+#include "Realm.h"
#include "ScenarioMgr.h"
#include "ScriptMgr.h"
#include "ScriptReloadMgr.h"
#include "SkillDiscovery.h"
#include "SkillExtraItems.h"
-#include "SmartAI.h"
-#include "Metric.h"
+#include "SmartScriptMgr.h"
#include "SupportMgr.h"
#include "TaxiPathGraph.h"
#include "TransportMgr.h"
#include "Unit.h"
#include "VMapFactory.h"
+#include "VMapManager2.h"
#include "WardenCheckMgr.h"
#include "WaypointMovementGenerator.h"
#include "WeatherMgr.h"
#include "WorldSession.h"
-#include "ChatPackets.h"
#include "WorldSocket.h"
-#include "M2Stores.h"
#include <boost/algorithm/string.hpp>
@@ -3025,9 +3030,9 @@ void World::UpdateSessions(uint32 diff)
// This handles the issued and queued CLI commands
void World::ProcessCliCommands()
{
- CliCommandHolder::Print* zprint = NULL;
- void* callbackArg = NULL;
- CliCommandHolder* command = NULL;
+ CliCommandHolder::Print zprint = nullptr;
+ void* callbackArg = nullptr;
+ CliCommandHolder* command = nullptr;
while (cliCmdQueue.next(command))
{
TC_LOG_INFO("misc", "CLI command under processing...");
@@ -3445,6 +3450,16 @@ void World::LoadWorldStates()
}
+bool World::IsPvPRealm() const
+{
+ return (getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP || getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP);
+}
+
+bool World::IsFFAPvPRealm() const
+{
+ return getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP;
+}
+
// Setting a worldstate will save it to DB
void World::setWorldState(uint32 index, uint32 value)
{
@@ -3610,3 +3625,13 @@ uint32 GetVirtualRealmAddress()
{
return realm.Id.GetAddress();
}
+
+CliCommandHolder::CliCommandHolder(void* callbackArg, char const* command, Print zprint, CommandFinished commandFinished)
+ : m_callbackArg(callbackArg), m_command(strdup(command)), m_print(zprint), m_commandFinished(commandFinished)
+{
+}
+
+CliCommandHolder::~CliCommandHolder()
+{
+ free(m_command);
+}
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index 501e6798b1f..e48df5d3e82 100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -24,27 +24,25 @@
#define __WORLD_H
#include "Common.h"
-#include "Realm/Realm.h"
+#include "DatabaseEnvFwd.h"
+#include "LockedQueue.h"
#include "ObjectGuid.h"
-#include "Timer.h"
-#include "SharedDefines.h"
-#include "QueryResult.h"
#include "QueryCallbackProcessor.h"
-#include "Realm/Realm.h"
-#include "LockedQueue.h"
+#include "SharedDefines.h"
+#include "Timer.h"
#include <atomic>
-#include <map>
-#include <set>
#include <list>
+#include <map>
+#include <memory>
#include <unordered_map>
+#include <vector>
-class Object;
+class Player;
class WorldPacket;
class WorldSession;
-class Player;
class WorldSocket;
-class SystemMgr;
+struct Realm;
// ServerMessages.dbc
enum ServerMessageType
@@ -64,14 +62,14 @@ enum ServerMessageType
SERVER_MSG_TICKET_WAIT_TIME = 13,
};
-enum ShutdownMask
+enum ShutdownMask : uint32
{
SHUTDOWN_MASK_RESTART = 1,
SHUTDOWN_MASK_IDLE = 2,
SHUTDOWN_MASK_FORCE = 4
};
-enum ShutdownExitCode
+enum ShutdownExitCode : uint32
{
SHUTDOWN_EXIT_CODE = 0,
ERROR_EXIT_CODE = 1,
@@ -546,26 +544,20 @@ enum WorldStates
WS_GUILD_WEEKLY_RESET_TIME = 20050, // Next guild week reset time
};
-#define MAX_CHARACTERS_PER_REALM 12
-
/// Storage class for commands issued for delayed execution
-struct CliCommandHolder
+struct TC_GAME_API CliCommandHolder
{
- typedef void Print(void*, const char*);
- typedef void CommandFinished(void*, bool success);
+ typedef void(*Print)(void*, const char*);
+ typedef void(*CommandFinished)(void*, bool success);
void* m_callbackArg;
char *m_command;
- Print* m_print;
-
- CommandFinished* m_commandFinished;
+ Print m_print;
- CliCommandHolder(void* callbackArg, const char *command, Print* zprint, CommandFinished* commandFinished)
- : m_callbackArg(callbackArg), m_command(strdup(command)), m_print(zprint), m_commandFinished(commandFinished)
- {
- }
+ CommandFinished m_commandFinished;
- ~CliCommandHolder() { free(m_command); }
+ CliCommandHolder(void* callbackArg, char const* command, Print zprint, CommandFinished commandFinished);
+ ~CliCommandHolder();
private:
CliCommandHolder(CliCommandHolder const& right) = delete;
@@ -759,8 +751,8 @@ class TC_GAME_API World
void LoadWorldStates();
/// Are we on a "Player versus Player" server?
- bool IsPvPRealm() const { return (getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP || getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP); }
- bool IsFFAPvPRealm() const { return getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP; }
+ bool IsPvPRealm() const;
+ bool IsFFAPvPRealm() const;
void KickAll();
void KickAllLess(AccountTypes sec);
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 5c8332beba8..bfb9897cbf3 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -24,10 +24,12 @@ EndScriptData */
#include "AccountMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
#include "Log.h"
#include "Player.h"
#include "ScriptMgr.h"
+#include "World.h"
#include <boost/asio/ip/address_v4.hpp>
class account_commandscript : public CommandScript
diff --git a/src/server/scripts/Commands/cs_arena.cpp b/src/server/scripts/Commands/cs_arena.cpp
index 8ffb641d7d3..10194b7c896 100644
--- a/src/server/scripts/Commands/cs_arena.cpp
+++ b/src/server/scripts/Commands/cs_arena.cpp
@@ -22,10 +22,11 @@ Comment: All arena team related commands
Category: commandscripts
EndScriptData */
-#include "ObjectMgr.h"
+#include "ArenaTeamMgr.h"
#include "Chat.h"
#include "Language.h"
-#include "ArenaTeamMgr.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
index 3d1b5982523..c81ca30355b 100644
--- a/src/server/scripts/Commands/cs_ban.cpp
+++ b/src/server/scripts/Commands/cs_ban.cpp
@@ -24,11 +24,13 @@ EndScriptData */
#include "AccountMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
+#include "World.h"
class ban_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_battlenet_account.cpp b/src/server/scripts/Commands/cs_battlenet_account.cpp
index c62db6d774b..6365cdc4b17 100644
--- a/src/server/scripts/Commands/cs_battlenet_account.cpp
+++ b/src/server/scripts/Commands/cs_battlenet_account.cpp
@@ -15,9 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "BattlenetAccountMgr.h"
#include "AccountMgr.h"
+#include "BattlenetAccountMgr.h"
+#include "BigNumber.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
#include "Log.h"
#include "Player.h"
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index f0151fca3d6..51ee5c0b313 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -24,11 +24,14 @@ EndScriptData */
#include "AccountMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "PlayerDump.h"
#include "Player.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
+#include "World.h"
class character_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index be738602fe3..f98d5e35a4c 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -22,24 +22,24 @@ Comment: All debug related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "ObjectMgr.h"
#include "BattlefieldMgr.h"
#include "BattlegroundMgr.h"
-#include "Chat.h"
#include "Cell.h"
#include "CellImpl.h"
+#include "Chat.h"
#include "Conversation.h"
+#include "GossipDef.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "GossipDef.h"
-#include "M2Stores.h"
-#include "Transport.h"
#include "Language.h"
+#include "Log.h"
+#include "M2Stores.h"
#include "MapManager.h"
#include "MovementPackets.h"
+#include "ObjectMgr.h"
+#include "ScriptMgr.h"
#include "SpellPackets.h"
-
+#include "Transport.h"
#include <fstream>
#include <limits>
@@ -379,26 +379,6 @@ public:
parsedStream >> val6;
data << val6;
}
- else if (type == "appitsguid")
- {
- data << unit->GetPackGUID();
- }
- else if (type == "appmyguid")
- {
- data << player->GetPackGUID();
- }
- else if (type == "appgoguid")
- {
- GameObject* obj = handler->GetNearbyGameObject();
- if (!obj)
- {
- handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, UI64LIT(0));
- handler->SetSentErrorMessage(true);
- ifs.close();
- return false;
- }
- data << obj->GetPackGUID();
- }
else if (type == "goguid")
{
GameObject* obj = handler->GetNearbyGameObject();
diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp
index 0349f4eb83f..6c1df3910c5 100644
--- a/src/server/scripts/Commands/cs_disable.cpp
+++ b/src/server/scripts/Commands/cs_disable.cpp
@@ -22,9 +22,10 @@ Comment: All disable related commands
Category: commandscripts
EndScriptData */
-#include "DisableMgr.h"
-#include "CriteriaHandler.h"
#include "Chat.h"
+#include "CriteriaHandler.h"
+#include "DatabaseEnv.h"
+#include "DisableMgr.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "OutdoorPvP.h"
diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp
index 17abb11f790..a625b9d3a33 100644
--- a/src/server/scripts/Commands/cs_gm.cpp
+++ b/src/server/scripts/Commands/cs_gm.cpp
@@ -22,14 +22,16 @@ Comment: All gm related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "ObjectMgr.h"
-#include "Chat.h"
#include "AccountMgr.h"
+#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
-#include "World.h"
-#include "Player.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
+#include "Player.h"
+#include "Realm.h"
+#include "ScriptMgr.h"
+#include "World.h"
#include <boost/thread/shared_mutex.hpp>
#include <boost/thread/locks.hpp>
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index edb9dc7440f..802f8830ff8 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -22,13 +22,14 @@ Comment: All go related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "ObjectMgr.h"
-#include "MapManager.h"
-#include "SupportMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
+#include "MapManager.h"
+#include "ObjectMgr.h"
#include "Player.h"
+#include "ScriptMgr.h"
+#include "SupportMgr.h"
#include "Transport.h"
class go_commandscript : public CommandScript
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 016fc358468..9fafa61be20 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -22,15 +22,17 @@ Comment: All gobject related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "GameEventMgr.h"
-#include "ObjectMgr.h"
-#include "PoolMgr.h"
-#include "MapManager.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "GameEventMgr.h"
#include "Language.h"
-#include "Player.h"
+#include "Log.h"
+#include "MapManager.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
+#include "Player.h"
+#include "PoolMgr.h"
+#include "ScriptMgr.h"
class gobject_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp
index 981bfcf852c..8abad46babe 100644
--- a/src/server/scripts/Commands/cs_group.cpp
+++ b/src/server/scripts/Commands/cs_group.cpp
@@ -16,11 +16,12 @@
*/
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "GroupMgr.h"
#include "Language.h"
#include "LFG.h"
-#include "Player.h"
#include "ObjectMgr.h"
-#include "GroupMgr.h"
+#include "Player.h"
#include "ScriptMgr.h"
class group_commandscript : public CommandScript
diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp
index a2c722082b3..d21357a8ef9 100644
--- a/src/server/scripts/Commands/cs_guild.cpp
+++ b/src/server/scripts/Commands/cs_guild.cpp
@@ -28,6 +28,7 @@ EndScriptData */
#include "Guild.h"
#include "GuildMgr.h"
#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include <iomanip>
diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp
index 66144be75b6..07123744e18 100644
--- a/src/server/scripts/Commands/cs_lfg.cpp
+++ b/src/server/scripts/Commands/cs_lfg.cpp
@@ -15,14 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "Group.h"
+#include "GroupMgr.h"
#include "Language.h"
#include "LFGMgr.h"
#include "ObjectMgr.h"
-#include "Group.h"
-#include "GroupMgr.h"
#include "Player.h"
+#include "ScriptMgr.h"
void GetPlayerInfo(ChatHandler* handler, Player* player)
{
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index cc61406ebdf..c324c292463 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -22,14 +22,14 @@ Comment: All list related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
#include "Chat.h"
-#include "SpellAuraEffects.h"
+#include "DatabaseEnv.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include <iostream>
+#include "ScriptMgr.h"
+#include "SpellAuraEffects.h"
class list_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp
index 18e15346679..19fa8fde081 100644
--- a/src/server/scripts/Commands/cs_lookup.cpp
+++ b/src/server/scripts/Commands/cs_lookup.cpp
@@ -24,6 +24,7 @@ EndScriptData */
#include "AccountMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "GameEventMgr.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
@@ -31,6 +32,7 @@ EndScriptData */
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "SpellInfo.h"
+#include "World.h"
class lookup_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp
index 85c7c5edafa..e9c681f1904 100644
--- a/src/server/scripts/Commands/cs_message.cpp
+++ b/src/server/scripts/Commands/cs_message.cpp
@@ -22,13 +22,15 @@ Comment: All message related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
#include "Chat.h"
#include "Channel.h"
#include "ChannelMgr.h"
+#include "DatabaseEnv.h"
#include "Language.h"
#include "Player.h"
#include "ObjectMgr.h"
+#include "ScriptMgr.h"
+#include "World.h"
class message_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 3a57c4ccd69..35fe2ed5e89 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -15,32 +15,37 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "DB2Stores.h"
-#include "Chat.h"
-#include "ScriptMgr.h"
#include "AccountMgr.h"
#include "ArenaTeamMgr.h"
#include "CellImpl.h"
+#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "DB2Stores.h"
+#include "DisableMgr.h"
#include "GridNotifiers.h"
#include "Group.h"
+#include "GroupMgr.h"
#include "InstanceSaveMgr.h"
#include "Language.h"
+#include "LFG.h"
+#include "Log.h"
+#include "MapManager.h"
+#include "MiscPackets.h"
+#include "MMapFactory.h"
#include "MovementGenerator.h"
#include "ObjectAccessor.h"
#include "Opcodes.h"
-#include "SpellAuras.h"
-#include "TargetedMovementGenerator.h"
-#include "WeatherMgr.h"
-#include "Player.h"
#include "Pet.h"
-#include "LFG.h"
-#include "GroupMgr.h"
-#include "MMapFactory.h"
-#include "DisableMgr.h"
+#include "Player.h"
+#include "Realm.h"
+#include "ScriptMgr.h"
+#include "SpellAuras.h"
#include "SpellHistory.h"
-#include "MiscPackets.h"
+#include "TargetedMovementGenerator.h"
#include "Transport.h"
-#include "MapManager.h"
+#include "Weather.h"
+#include "WeatherMgr.h"
+#include "World.h"
#include <boost/asio/ip/address_v4.hpp>
// temporary hack until database includes are sorted out (don't want to pull in Windows.h everywhere from mysql.h)
@@ -186,7 +191,7 @@ public:
{
case HighGuid::Player:
{
- object = sObjectMgr->GetPlayerByLowGUID(guidLow);
+ object = ObjectAccessor::FindConnectedPlayer(ObjectGuid::Create<HighGuid::Player>(guidLow));
if (!object)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
@@ -823,7 +828,7 @@ public:
{
case HighGuid::Player:
{
- object = sObjectMgr->GetPlayerByLowGUID(guidLow);
+ object = ObjectAccessor::GetPlayer(*handler->GetSession()->GetPlayer(), ObjectGuid::Create<HighGuid::Player>(guidLow));
if (!object)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
@@ -1358,7 +1363,7 @@ public:
return false;
}
- Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId), GuidSet(), 0, bonusListIDs);
+ Item* item = playerTarget->StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId), GuidSet(), 0, bonusListIDs);
// remove binding (let GM give it to another player later)
if (player == playerTarget)
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 4071a8f4ed2..bc8940a88a1 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -23,7 +23,7 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
-#include "ObjectMgr.h"
+#include "Log.h"
#include "Opcodes.h"
#include "Pet.h"
#include "Player.h"
@@ -741,14 +741,14 @@ public:
target->Mount(mId);
WorldPacket data(SMSG_MOVE_SET_RUN_SPEED, (8+4+1+4));
- data << target->GetPackGUID();
+ data << target->GetGUID();
data << (uint32)0;
data << (uint8)0; //new 2.1.0
data << float(speed);
target->SendMessageToSet(&data, true);
data.Initialize(SMSG_MOVE_SET_SWIM_SPEED, (8+4+4));
- data << target->GetPackGUID();
+ data << target->GetGUID();
data << (uint32)0;
data << float(speed);
target->SendMessageToSet(&data, true);
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index ec7835b5654..34f77727ca3 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -22,16 +22,19 @@ Comment: All npc related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "ObjectMgr.h"
#include "Chat.h"
-#include "Transport.h"
+#include "CreatureAI.h"
#include "CreatureGroups.h"
+#include "DatabaseEnv.h"
#include "Language.h"
-#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
-#include "CreatureAI.h"
-#include "Player.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "Pet.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
+#include "Transport.h"
+#include "World.h"
template<typename E, typename T = char const*>
struct EnumName
diff --git a/src/server/scripts/Commands/cs_pet.cpp b/src/server/scripts/Commands/cs_pet.cpp
index c82129ca7ec..7591600365a 100644
--- a/src/server/scripts/Commands/cs_pet.cpp
+++ b/src/server/scripts/Commands/cs_pet.cpp
@@ -17,6 +17,7 @@
#include "Chat.h"
#include "Language.h"
+#include "Log.h"
#include "Pet.h"
#include "Player.h"
#include "ObjectMgr.h"
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 6f377270ae4..5234b3c240b 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -23,10 +23,12 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
+#include "World.h"
class quest_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_rbac.cpp b/src/server/scripts/Commands/cs_rbac.cpp
index eb646d8bcd8..a07bc32fd38 100644
--- a/src/server/scripts/Commands/cs_rbac.cpp
+++ b/src/server/scripts/Commands/cs_rbac.cpp
@@ -23,11 +23,13 @@ Category: commandscripts
EndScriptData */
#include "AccountMgr.h"
-#include "Config.h"
#include "Chat.h"
+#include "Config.h"
#include "Language.h"
#include "Player.h"
+#include "Realm.h"
#include "ScriptMgr.h"
+#include "World.h"
struct RBACCommandData
{
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index 2732d6d8be7..5c467c9e021 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -31,9 +31,12 @@ EndScriptData */
#include "Chat.h"
#include "ConversationDataStore.h"
#include "CreatureTextMgr.h"
+#include "DatabaseEnv.h"
#include "DisableMgr.h"
#include "Language.h"
#include "LFGMgr.h"
+#include "Log.h"
+#include "LootMgr.h"
#include "MapManager.h"
#include "ObjectMgr.h"
#include "ScriptMgr.h"
diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp
index f94a0220a3c..ebce9ccd9c4 100644
--- a/src/server/scripts/Commands/cs_reset.cpp
+++ b/src/server/scripts/Commands/cs_reset.cpp
@@ -24,12 +24,14 @@ EndScriptData */
#include "AchievementMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Pet.h"
#include "ScriptMgr.h"
+#include "World.h"
#include <boost/thread/shared_mutex.hpp>
#include <boost/thread/locks.hpp>
diff --git a/src/server/scripts/Commands/cs_send.cpp b/src/server/scripts/Commands/cs_send.cpp
index 2a35b190bbe..724a1ef7567 100644
--- a/src/server/scripts/Commands/cs_send.cpp
+++ b/src/server/scripts/Commands/cs_send.cpp
@@ -16,6 +16,7 @@
*/
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
#include "Pet.h"
#include "Player.h"
diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp
index b807ee30bfa..d02e3da9208 100644
--- a/src/server/scripts/Commands/cs_server.cpp
+++ b/src/server/scripts/Commands/cs_server.cpp
@@ -24,13 +24,14 @@ EndScriptData */
#include "Chat.h"
#include "Config.h"
+#include "GitRevision.h"
#include "Language.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptMgr.h"
-#include "GitRevision.h"
#include "Util.h"
+#include "World.h"
class server_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp
index 5579080a648..c910b942bbf 100644
--- a/src/server/scripts/Commands/cs_tele.cpp
+++ b/src/server/scripts/Commands/cs_tele.cpp
@@ -23,6 +23,7 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Group.h"
#include "Language.h"
#include "MapManager.h"
diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp
index f9a0cef1c66..1f305b8983f 100644
--- a/src/server/scripts/Commands/cs_ticket.cpp
+++ b/src/server/scripts/Commands/cs_ticket.cpp
@@ -29,8 +29,10 @@ EndScriptData */
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
+#include "Realm.h"
#include "ScriptMgr.h"
#include "SupportMgr.h"
+#include "World.h"
class ticket_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 6aac5045d78..620b68950a4 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -23,6 +23,7 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "Player.h"
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
index 5692c2c39c3..4e3d446fd73 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
@@ -21,6 +21,7 @@
#include "ScriptedGossip.h"
#include "blackrock_depths.h"
#include "Player.h"
+#include "Log.h"
#include "WorldSession.h"
//go_shadowforge_brazier
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
index 9eb10fc9a8b..e6e5bf78608 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
@@ -19,6 +19,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "InstanceScript.h"
+#include "Log.h"
#include "blackrock_depths.h"
#define TIMER_TOMBOFTHESEVEN 15000
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
index 9a8ec451232..5e88f66e1d0 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
@@ -18,6 +18,7 @@
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "gnomeregan.h"
+#include "Log.h"
#include "Player.h"
#define MAX_ENCOUNTER 1
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index c151eda2075..bf231e8cae5 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -29,6 +29,7 @@ EndScriptData */
#include "karazhan.h"
#include "Player.h"
#include "SpellInfo.h"
+#include "Log.h"
/***********************************/
/*** OPERA WIZARD OF OZ EVENT *****/
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
index d45fa9fc9b2..5b5001c5c8b 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
@@ -34,6 +34,7 @@ EndContentData */
#include "karazhan.h"
#include "ScriptedEscortAI.h"
#include "Player.h"
+#include "Log.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index 5a979c379a6..d552d455cf8 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -253,7 +253,7 @@ public:
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID());
// Use packet hack
WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12);
- data << unit->GetPackGUID();
+ data << unit->GetGUID();
data << uint32(0);
unit->SendMessageToSet(&data, true);
}
@@ -273,7 +273,7 @@ public:
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT);
WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12);
- data << unit->GetPackGUID();
+ data << unit->GetGUID();
data << uint32(0);
unit->SendMessageToSet(&data, true);
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index 40dee62d459..9fe6e9c7721 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -27,6 +27,7 @@
#include "SpellInfo.h"
#include "CreatureTextMgr.h"
#include "MoveSplineInit.h"
+#include "Log.h"
/*######
##Quest 12848
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
index 9e84eb6f59e..386cdd53b88 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
@@ -28,6 +28,7 @@ EndScriptData */
#include "InstanceScript.h"
#include "shadowfang_keep.h"
#include "TemporarySummon.h"
+#include "Log.h"
#define MAX_ENCOUNTER 4
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
index e0edf1d189c..2fa3e298109 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
@@ -28,6 +28,7 @@ EndScriptData */
#include "InstanceScript.h"
#include "stratholme.h"
#include "Player.h"
+#include "Log.h"
enum Misc
{
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
index bde2a220398..7dc575526c9 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
@@ -22,6 +22,7 @@ SD%Complete: 80
SDComment: Find a way to start the intro, best code for the intro
EndScriptData */
+#include "Log.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index 299293088ba..9e495c1086c 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -23,6 +23,7 @@ SDComment:
SDCategory: Sunwell_Plateau
EndScriptData */
+#include "Log.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index fb587cdd6e5..e7bac5ec171 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -24,11 +24,12 @@ EndScriptData */
/// @todo rewrite Armageddon
+#include "Log.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
-#include <math.h>
#include "Player.h"
+#include <cmath>
/*** Speech and sounds***/
enum Yells
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
index 1976aab174d..1a7e3045b3e 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
@@ -17,6 +17,7 @@
#include "ScriptMgr.h"
#include "InstanceScript.h"
+#include "Log.h"
#include "Player.h"
#include "sunwell_plateau.h"
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
index 4d9c852b44f..b21235b4293 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
@@ -27,6 +27,7 @@ EndScriptData */
#include "InstanceScript.h"
#include "uldaman.h"
#include "CreatureAI.h"
+#include "Log.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp b/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp
index 5360a4fbbb8..04cc5c5badf 100644
--- a/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp
@@ -15,15 +15,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "BattlefieldTB.h"
-#include "Battlefield.h"
-#include "ScriptSystem.h"
-#include "WorldSession.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "ScriptMgr.h"
+#include "ScriptSystem.h"
#include "SpellScript.h"
-#include "Player.h"
+#include "WorldSession.h"
enum TBSpiritGuide
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
index a0459e9eaf1..6c22a3c716e 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
@@ -34,6 +34,7 @@ EndContentData */
#include "ScriptedGossip.h"
#include "hyjalAI.h"
#include "Player.h"
+#include "Log.h"
#define GOSSIP_ITEM_BEGIN_ALLY "My companions and I are with you, Lady Proudmoore."
#define GOSSIP_ITEM_ANETHERON "We are ready for whatever Archimonde might send our way, Lady Proudmoore."
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
index ef63e45e904..52db6e7d9ba 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
@@ -30,6 +30,7 @@ EndScriptData */
#include "GridNotifiersImpl.h"
#include "Cell.h"
#include "CellImpl.h"
+#include "Log.h"
#include "hyjalAI.h"
#include "hyjal_trash.h"
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
index 7900359d803..39dfcabc6ea 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
@@ -27,6 +27,7 @@ EndScriptData */
#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "hyjal.h"
+#include "Log.h"
/* Battle of Mount Hyjal encounters:
0 - Rage Winterchill event
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
index 5e4c9c0ed0e..ee798819ee6 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
@@ -28,6 +28,7 @@ EndScriptData */
#include "InstanceScript.h"
#include "old_hillsbrad.h"
#include "Player.h"
+#include "Log.h"
#define MAX_ENCOUNTER 6
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
index 053b670c254..81990a81fb3 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
@@ -30,6 +30,7 @@ Category: Caverns of Time, The Black Morass
#include "TemporarySummon.h"
#include "SpellInfo.h"
#include "ScriptedCreature.h"
+#include "Log.h"
enum Misc
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp
index e4c63e3941f..e164b6ca2fa 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp
@@ -35,6 +35,7 @@ EndContentData */
#include "the_black_morass.h"
#include "Player.h"
#include "SpellInfo.h"
+#include "Log.h"
enum MedivhBm
{
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
index 2ab9b1ec66c..dc0bbd57255 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
@@ -27,6 +27,7 @@ EndScriptData */
#include "InstanceScript.h"
#include "razorfen_kraul.h"
#include "Player.h"
+#include "Log.h"
#define WARD_KEEPERS_NR 2
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
index 4287e247943..8a111f1de10 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
@@ -15,14 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ruins_of_ahnqiraj.h"
+#include "MiscPackets.h"
#include "Player.h"
+#include "ruins_of_ahnqiraj.h"
+#include "ScriptedCreature.h"
+#include "ScriptMgr.h"
#include "SpellInfo.h"
+#include "Weather.h"
#include "WorldPacket.h"
-#include "Opcodes.h"
-#include "Packets/MiscPackets.h"
enum Texts
{
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
index 672bae016c1..c5a360258c6 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
@@ -23,8 +23,9 @@ SDComment: Everything seems to work, still need some checking
SDCategory: Wailing Caverns
EndScriptData */
-#include "ScriptMgr.h"
+#include "Log.h"
#include "InstanceScript.h"
+#include "ScriptMgr.h"
#include "wailing_caverns.h"
#define MAX_ENCOUNTER 9
diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
index 0a7695eaf13..6a06ff3f7be 100644
--- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
@@ -36,10 +36,9 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
-#include "Cell.h"
#include "CellImpl.h"
#include "GridNotifiersImpl.h"
-#include "GridNotifiers.h"
+#include "Log.h"
/*######
## npc_draenei_survivor
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
index d05c2c303a4..48db0ee6e4e 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
@@ -26,6 +26,7 @@ EndScriptData */
#include "InstanceScript.h"
#include "trial_of_the_champion.h"
#include "Player.h"
+#include "Log.h"
#define MAX_ENCOUNTER 4
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
index c364e396c7f..eafad7be015 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
@@ -16,10 +16,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptMgr.h"
#include "InstanceScript.h"
-#include "trial_of_the_crusader.h"
+#include "Log.h"
#include "Player.h"
+#include "ScriptMgr.h"
+#include "trial_of_the_crusader.h"
#include "TemporarySummon.h"
BossBoundaryData const boundaries = {
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
index 95e42ab8569..5f2e364dbfc 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
@@ -15,19 +15,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "CellImpl.h"
+#include "CreatureTextMgr.h"
+#include "GridNotifiersImpl.h"
+#include "icecrown_citadel.h"
#include "ObjectMgr.h"
-#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "ScriptMgr.h"
#include "Spell.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
#include "Vehicle.h"
-#include "Cell.h"
-#include "CellImpl.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "CreatureTextMgr.h"
-#include "icecrown_citadel.h"
+#include "Weather.h"
enum Texts
{
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
index 573ce8a53c5..4a548395b68 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
@@ -18,6 +18,7 @@
#ifndef ICECROWN_CITADEL_H_
#define ICECROWN_CITADEL_H_
+#include "ScriptMgr.h"
#include "SpellScript.h"
#define ICCScriptName "instance_icecrown_citadel"
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
index 2231b1e2515..864e4d85438 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
@@ -15,12 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Log.h"
+#include "naxxramas.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "naxxramas.h"
enum Horseman
{
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index 6888bb6ac9b..a0615886611 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -21,6 +21,7 @@
#include "GridNotifiers.h"
#include "CombatAI.h"
#include "AreaBoundary.h"
+#include "Log.h"
#include "naxxramas.h"
/* Constants */
diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp
index db440f7d060..37777af0e57 100644
--- a/src/server/scripts/Northrend/zone_dalaran.cpp
+++ b/src/server/scripts/Northrend/zone_dalaran.cpp
@@ -23,6 +23,7 @@ SDComment: For what is 63990+63991? Same function but don't work correct...
SDCategory: Dalaran
Script Data End */
+#include "DatabaseEnv.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp
index a9df87a3969..ac145753f3c 100644
--- a/src/server/scripts/Northrend/zone_wintergrasp.cpp
+++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp
@@ -15,18 +15,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "BattlefieldWG.h"
-#include "Battlefield.h"
-#include "ScriptSystem.h"
-#include "WorldSession.h"
-#include "ObjectMgr.h"
-#include "Vehicle.h"
#include "GameObjectAI.h"
+#include "ObjectMgr.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "ScriptMgr.h"
+#include "ScriptSystem.h"
#include "SpellScript.h"
-#include "Player.h"
+#include "Vehicle.h"
+#include "WorldSession.h"
#define GOSSIP_HELLO_DEMO1 "Build catapult."
#define GOSSIP_HELLO_DEMO2 "Build demolisher."
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
index fa1a53627f7..9283b870a71 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
@@ -23,6 +23,7 @@
#include "Player.h"
#include "ObjectMgr.h"
#include "WorldPacket.h"
+#include "WorldStatePackets.h"
const uint32 HP_LANG_CAPTURE_A[HP_TOWER_NUM] = { TEXT_BROKEN_HILL_TAKEN_ALLIANCE, TEXT_OVERLOOK_TAKEN_ALLIANCE, TEXT_STADIUM_TAKEN_ALLIANCE };
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
index 6220aefb843..6f821514bb4 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
@@ -22,6 +22,7 @@
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
#include "WorldPacket.h"
+#include "WorldStatePackets.h"
OutdoorPvPNA::OutdoorPvPNA()
{
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index 431acb23abf..efceec2482e 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -26,6 +26,7 @@
#include "ReputationMgr.h"
#include "Language.h"
#include "World.h"
+#include "WorldStatePackets.h"
OutdoorPvPSI::OutdoorPvPSI()
{
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
index 110bf0f09af..c273e3c26db 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
@@ -23,6 +23,7 @@
#include "WorldPacket.h"
#include "Player.h"
#include "ObjectMgr.h"
+#include "WorldStatePackets.h"
OutdoorPvPTF::OutdoorPvPTF()
{
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
index 3445c3080ac..b6841462139 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
@@ -25,6 +25,7 @@
#include "ObjectAccessor.h"
#include "WorldPacket.h"
#include "GossipDef.h"
+#include "WorldStatePackets.h"
OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type)
: OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index ad0d27476c3..03a73e0a1cf 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -24,11 +24,12 @@ SDCategory: Black Temple
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "PassiveAI.h"
#include "black_temple.h"
+#include "Log.h"
+#include "PassiveAI.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
// Other defines
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
index 46622d25dd0..0030b0ddbdd 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
@@ -25,8 +25,9 @@ EndScriptData */
#include "ScriptMgr.h"
#include "InstanceScript.h"
-#include "serpent_shrine.h"
+#include "Log.h"
#include "Player.h"
+#include "serpent_shrine.h"
#include "TemporarySummon.h"
#define MAX_ENCOUNTER 6
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
index 30ea7ab41fe..b4b7d0f5fce 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
@@ -17,6 +17,7 @@
#include "ScriptMgr.h"
#include "InstanceScript.h"
+#include "Log.h"
#include "steam_vault.h"
class go_main_chambers_access_panel : public GameObjectScript
diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
index 8e353b66014..92d87b5a279 100644
--- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
@@ -31,10 +31,11 @@ npc_fel_guard_hound
EndContentData */
#include "ScriptMgr.h"
+#include "Log.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
-#include "Player.h"
+#include "ScriptedGossip.h"
#include "WorldSession.h"
/*######
diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp
index 0d463c82dfd..9532d43c162 100644
--- a/src/server/scripts/Outland/zone_netherstorm.cpp
+++ b/src/server/scripts/Outland/zone_netherstorm.cpp
@@ -31,10 +31,11 @@ go_captain_tyralius_prison
EndContentData */
#include "ScriptMgr.h"
+#include "Log.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
-#include "Player.h"
+#include "ScriptedGossip.h"
/*######
## npc_commander_dawnforge
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 62408425efa..d53a014343e 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -31,14 +31,15 @@
#include "Group.h"
#include "InstanceScript.h"
#include "LFGMgr.h"
+#include "Log.h"
+#include "NPCPackets.h"
#include "Pet.h"
#include "ReputationMgr.h"
#include "SkillDiscovery.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
+#include "SpellScript.h"
#include "Vehicle.h"
-#include "NPCPackets.h"
class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader
{
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index ca3615a141e..c04559b15c5 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -29,6 +29,7 @@
#include "SpellHistory.h"
#include "SkillDiscovery.h"
#include "Battleground.h"
+#include "Log.h"
// Generic script for handling item dummy effects which trigger another spell.
class spell_item_trigger_spell : public SpellScriptLoader
@@ -120,13 +121,13 @@ enum AlchemistStone
SPELL_ALCHEMIST_STONE_EXTRA_MANA = 21400
};
-// Item - 13503: Alchemist's Stone
-// Item - 35748: Guardian's Alchemist Stone
-// Item - 35749: Sorcerer's Alchemist Stone
-// Item - 35750: Redeemer's Alchemist Stone
-// Item - 35751: Assassin's Alchemist Stone
-// Item - 44322: Mercurial Alchemist Stone
-// Item - 44323: Indestructible Alchemist's Stone
+// Item - 13503: Alchemist's Stone
+// Item - 35748: Guardian's Alchemist Stone
+// Item - 35749: Sorcerer's Alchemist Stone
+// Item - 35750: Redeemer's Alchemist Stone
+// Item - 35751: Assassin's Alchemist Stone
+// Item - 44322: Mercurial Alchemist Stone
+// Item - 44323: Indestructible Alchemist's Stone
// Item - 44324: Mighty Alchemist's Stone
// 17619 - Alchemist Stone
@@ -294,7 +295,7 @@ enum AuraOfMadness
SAY_MADNESS = 21954
};
-// Item - 31859: Darkmoon Card: Madness
+// Item - 31859: Darkmoon Card: Madness
// 39446 - Aura of Madness
class spell_item_aura_of_madness : public SpellScriptLoader
{
@@ -1294,8 +1295,8 @@ enum MarkOfConquest
SPELL_MARK_OF_CONQUEST_ENERGIZE = 39599
};
-// Item - 27920: Mark of Conquest
-// Item - 27921: Mark of Conquest
+// Item - 27920: Mark of Conquest
+// Item - 27921: Mark of Conquest
// 33510 - Health Restore
class spell_item_mark_of_conquest : public SpellScriptLoader
{
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index fbb86df1b04..af4283b0e94 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -21,12 +21,13 @@
* Scriptnames of files in this file should be prefixed with "spell_rog_".
*/
-#include "Player.h"
#include "ScriptMgr.h"
-#include "SpellScript.h"
+#include "Containers.h"
+#include "Log.h"
+#include "Player.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
-#include "Containers.h"
+#include "SpellScript.h"
enum RogueSpells
{
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index 6ed2e92592d..7e40ec29f67 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -317,7 +317,7 @@ public:
void HandleEffectProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
- GetAura()->SetCastExtraParam("procTargetGUID", eventInfo.GetProcTarget()->GetGUID());
+ _procTargetGuid = eventInfo.GetProcTarget()->GetGUID();
eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_SHAMAN_EARTHEN_RAGE_PERIODIC, true);
}
@@ -325,6 +325,14 @@ public:
{
OnEffectProc += AuraEffectProcFn(spell_sha_earthen_rage_passive_AuraScript::HandleEffectProc, EFFECT_0, SPELL_AURA_DUMMY);
}
+
+ ObjectGuid _procTargetGuid;
+
+ public:
+ ObjectGuid const& GetProcTargetGuid() const
+ {
+ return _procTargetGuid;
+ }
};
AuraScript* GetAuraScript() const override
@@ -354,10 +362,12 @@ public:
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
+ using earthen_rage_script_t = spell_sha_earthen_rage_passive::spell_sha_earthen_rage_passive_AuraScript;
+
PreventDefaultAction();
if (Aura const* aura = GetCaster()->GetAura(SPELL_SHAMAN_EARTHEN_RAGE_PASSIVE))
- if (ObjectGuid const* procTargetGUID = aura->GetCastExtraParam<ObjectGuid>("procTargetGUID"))
- if (Unit* procTarget = ObjectAccessor::GetUnit(*GetCaster(), *procTargetGUID))
+ if (earthen_rage_script_t const* earthen_rage_script = dynamic_cast<earthen_rage_script_t const*>(aura->GetScriptByName("spell_sha_earthen_rage_passive")))
+ if (Unit* procTarget = ObjectAccessor::GetUnit(*GetCaster(), earthen_rage_script->GetProcTargetGuid()))
GetTarget()->CastSpell(procTarget, SPELL_SHAMAN_EARTHEN_RAGE_DAMAGE, true);
}
diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp
index 4c828ce635c..8ab65038028 100644
--- a/src/server/scripts/World/action_ip_logger.cpp
+++ b/src/server/scripts/World/action_ip_logger.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "DatabaseEnv.h"
#include "Player.h"
enum IPLoggingTypes
diff --git a/src/server/scripts/World/chat_log.cpp b/src/server/scripts/World/chat_log.cpp
index dc77fd0799d..7366b12e8ea 100644
--- a/src/server/scripts/World/chat_log.cpp
+++ b/src/server/scripts/World/chat_log.cpp
@@ -19,6 +19,7 @@
#include "Channel.h"
#include "Guild.h"
#include "Group.h"
+#include "Log.h"
class ChatLogScript : public PlayerScript
{
diff --git a/src/server/scripts/World/duel_reset.cpp b/src/server/scripts/World/duel_reset.cpp
index d792a1cb47f..ba746a498f3 100644
--- a/src/server/scripts/World/duel_reset.cpp
+++ b/src/server/scripts/World/duel_reset.cpp
@@ -19,6 +19,7 @@
#include "Player.h"
#include "Pet.h"
#include "SpellInfo.h"
+#include "World.h"
class DuelResetScript : public PlayerScript
{
diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp
index b1163a760e7..4f7015bd222 100644
--- a/src/server/scripts/World/go_scripts.cpp
+++ b/src/server/scripts/World/go_scripts.cpp
@@ -45,11 +45,12 @@ go_toy_train_set
EndContentData */
#include "ScriptMgr.h"
+#include "GameObjectAI.h"
+#include "Log.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "GameObjectAI.h"
#include "Spell.h"
-#include "Player.h"
#include "WorldSession.h"
/*######
diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp
index 60a282f26de..05f9054ab48 100644
--- a/src/server/scripts/World/item_scripts.cpp
+++ b/src/server/scripts/World/item_scripts.cpp
@@ -159,7 +159,7 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 39883, 1); // Cracked Egg
if (msg == EQUIP_ERR_OK)
- player->StoreNewItem(dest, 39883, true, Item::GenerateItemRandomPropertyId(39883));
+ player->StoreNewItem(dest, 39883, true, GenerateItemRandomPropertyId(39883));
return true;
}
@@ -179,7 +179,7 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 44718, 1); // Ripe Disgusting Jar
if (msg == EQUIP_ERR_OK)
- player->StoreNewItem(dest, 44718, true, Item::GenerateItemRandomPropertyId(44718));
+ player->StoreNewItem(dest, 44718, true, GenerateItemRandomPropertyId(44718));
return true;
}
diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp
index f9b25732270..57fd0e34176 100644
--- a/src/server/scripts/World/npc_professions.cpp
+++ b/src/server/scripts/World/npc_professions.cpp
@@ -24,9 +24,10 @@ SDCategory: NPCs
EndScriptData */
#include "ScriptMgr.h"
+#include "Log.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "Player.h"
#include "SpellInfo.h"
#include "WorldSession.h"
@@ -1224,7 +1225,7 @@ enum MultiProfessionTrainer
GOSSIP_OPTION_SKINNING = 9,
GOSSIP_OPTION_TAILORING = 10,
GOSSIP_OPTION_MULTI = 11,
-
+
GOSSIP_MENU_HERBALISM = 12188,
GOSSIP_MENU_MINING = 12189,
GOSSIP_MENU_SKINNING = 12190,
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index c568929c28f..9987168141c 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -17,23 +17,24 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
-#include "World.h"
-#include "PassiveAI.h"
+#include "Cell.h"
+#include "CellImpl.h"
+#include "CreatureTextMgr.h"
#include "GameEventMgr.h"
#include "GameObjectAI.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "Cell.h"
-#include "CellImpl.h"
-#include "SpellAuras.h"
+#include "Log.h"
+#include "ObjectMgr.h"
+#include "PassiveAI.h"
#include "Pet.h"
-#include "CreatureTextMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "ScriptMgr.h"
+#include "SpellAuras.h"
#include "SpellHistory.h"
+#include "World.h"
/*########
# npc_air_force_bots