aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-09-20 11:05:30 +0200
committerShauren <shauren.trinity@gmail.com>2014-09-20 11:05:30 +0200
commit8e288dd6731ed608d8285f9f966783ee9b46eebf (patch)
treea0dfb3e110f4ba63214ccde1ade6d633294e4746 /src/server
parent7cbaa028cd3192725ed47226c08fb3e6f82f02d3 (diff)
parent050d56ac21fff48d260908e72e430f212e1d770d (diff)
Merge branch 'master' of https://github.com/TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Achievements/AchievementMgr.cpp src/server/game/Battlefield/Battlefield.h src/server/game/Battlegrounds/ArenaScore.h src/server/game/Battlegrounds/ArenaTeam.cpp src/server/game/Battlegrounds/ArenaTeam.h src/server/game/Battlegrounds/ArenaTeamMgr.cpp src/server/game/Battlegrounds/BattlegroundMgr.cpp src/server/game/Battlegrounds/BattlegroundMgr.h src/server/game/Battlegrounds/BattlegroundQueue.h src/server/game/Battlegrounds/BattlegroundScore.h src/server/game/Battlegrounds/Zones/BattlegroundAB.h src/server/game/Battlegrounds/Zones/BattlegroundAV.h src/server/game/Battlegrounds/Zones/BattlegroundEY.h src/server/game/Battlegrounds/Zones/BattlegroundIC.h src/server/game/Battlegrounds/Zones/BattlegroundSA.h src/server/game/Battlegrounds/Zones/BattlegroundWS.h src/server/game/DungeonFinding/LFG.h src/server/game/DungeonFinding/LFGMgr.cpp src/server/game/DungeonFinding/LFGMgr.h src/server/game/DungeonFinding/LFGQueue.cpp src/server/game/DungeonFinding/LFGQueue.h src/server/game/Entities/Corpse/Corpse.cpp src/server/game/Entities/Creature/Creature.cpp src/server/game/Entities/Creature/GossipDef.cpp src/server/game/Entities/Creature/GossipDef.h src/server/game/Entities/Creature/TemporarySummon.cpp src/server/game/Entities/DynamicObject/DynamicObject.cpp src/server/game/Entities/Object/Object.cpp src/server/game/Entities/Object/Object.h src/server/game/Entities/Object/ObjectDefines.h src/server/game/Entities/Object/Updates/UpdateData.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Entities/Player/Player.h src/server/game/Entities/Unit/Unit.cpp src/server/game/Entities/Unit/Unit.h src/server/game/Globals/ObjectAccessor.cpp src/server/game/Globals/ObjectAccessor.h src/server/game/Globals/ObjectMgr.cpp src/server/game/Groups/Group.cpp src/server/game/Groups/Group.h src/server/game/Guilds/Guild.cpp src/server/game/Guilds/Guild.h src/server/game/Handlers/AuctionHouseHandler.cpp src/server/game/Handlers/BattleGroundHandler.cpp src/server/game/Handlers/CalendarHandler.cpp src/server/game/Handlers/CharacterHandler.cpp src/server/game/Handlers/ChatHandler.cpp src/server/game/Handlers/GroupHandler.cpp src/server/game/Handlers/GuildHandler.cpp src/server/game/Handlers/ItemHandler.cpp src/server/game/Handlers/LFGHandler.cpp src/server/game/Handlers/MailHandler.cpp src/server/game/Handlers/MiscHandler.cpp src/server/game/Handlers/MovementHandler.cpp src/server/game/Handlers/NPCHandler.cpp src/server/game/Handlers/PetHandler.cpp src/server/game/Handlers/QueryHandler.cpp src/server/game/Handlers/QuestHandler.cpp src/server/game/Handlers/TradeHandler.cpp src/server/game/Handlers/VehicleHandler.cpp src/server/game/Movement/Spline/MoveSplineInit.cpp src/server/game/Server/WorldSession.cpp src/server/game/Server/WorldSession.h src/server/game/Spells/Spell.cpp src/server/scripts/Commands/cs_debug.cpp src/server/scripts/Commands/cs_gm.cpp src/server/scripts/Commands/cs_misc.cpp src/server/scripts/Commands/cs_modify.cpp src/server/scripts/Commands/cs_reset.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp src/server/scripts/Kalimdor/zone_azshara.cpp src/server/scripts/Kalimdor/zone_durotar.cpp src/server/scripts/Kalimdor/zone_moonglade.cpp src/server/scripts/Kalimdor/zone_orgrimmar.cpp src/server/scripts/Kalimdor/zone_ungoro_crater.cpp src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp src/server/scripts/Spells/spell_dk.cpp src/server/scripts/Spells/spell_generic.cpp src/server/shared/Packets/ByteBuffer.h
Diffstat (limited to 'src/server')
-rw-r--r--src/server/collision/Maps/TileAssembler.cpp2
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp6
-rw-r--r--src/server/game/AI/CoreAI/PetAI.h2
-rw-r--r--src/server/game/AI/CoreAI/TotemAI.cpp4
-rw-r--r--src/server/game/AI/CoreAI/TotemAI.h2
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.h4
-rw-r--r--src/server/game/AI/CreatureAI.cpp7
-rw-r--r--src/server/game/AI/CreatureAI.h8
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp4
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h8
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp7
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.h6
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp5
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h2
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp16
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h6
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp44
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.h11
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp1
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h6
-rw-r--r--src/server/game/Accounts/AccountMgr.cpp3
-rw-r--r--src/server/game/Achievements/AchievementMgr.cpp60
-rw-r--r--src/server/game/Achievements/AchievementMgr.h7
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp21
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp59
-rw-r--r--src/server/game/Battlefield/Battlefield.h40
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.cpp2
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.h2
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp66
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.h10
-rw-r--r--src/server/game/Battlegrounds/Arena.cpp6
-rw-r--r--src/server/game/Battlegrounds/Arena.h4
-rw-r--r--src/server/game/Battlegrounds/ArenaScore.h2
-rw-r--r--src/server/game/Battlegrounds/ArenaTeam.cpp60
-rw-r--r--src/server/game/Battlegrounds/ArenaTeam.h43
-rw-r--r--src/server/game/Battlegrounds/ArenaTeamMgr.cpp2
-rw-r--r--src/server/game/Battlegrounds/ArenaTeamMgr.h2
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp110
-rw-r--r--src/server/game/Battlegrounds/Battleground.h58
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp120
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.h8
-rw-r--r--src/server/game/Battlegrounds/BattlegroundQueue.cpp18
-rw-r--r--src/server/game/Battlegrounds/BattlegroundQueue.h18
-rw-r--r--src/server/game/Battlegrounds/BattlegroundScore.h2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp4
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.h4
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp16
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.h4
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundBFG.h2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp26
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundEY.h22
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp6
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.h6
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.h4
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundTP.h2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp38
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.h24
-rw-r--r--src/server/game/Calendar/CalendarMgr.cpp62
-rw-r--r--src/server/game/Calendar/CalendarMgr.h51
-rw-r--r--src/server/game/Chat/Channels/Channel.cpp94
-rw-r--r--src/server/game/Chat/Channels/Channel.h70
-rw-r--r--src/server/game/Chat/Chat.cpp74
-rw-r--r--src/server/game/Chat/Chat.h24
-rw-r--r--src/server/game/Combat/ThreatManager.cpp2
-rw-r--r--src/server/game/Combat/ThreatManager.h5
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp7
-rw-r--r--src/server/game/Conditions/ConditionMgr.h5
-rw-r--r--src/server/game/DungeonFinding/LFG.h9
-rw-r--r--src/server/game/DungeonFinding/LFGGroupData.cpp14
-rw-r--r--src/server/game/DungeonFinding/LFGGroupData.h14
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp312
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.h140
-rw-r--r--src/server/game/DungeonFinding/LFGPlayerData.cpp8
-rw-r--r--src/server/game/DungeonFinding/LFGPlayerData.h6
-rw-r--r--src/server/game/DungeonFinding/LFGQueue.cpp108
-rw-r--r--src/server/game/DungeonFinding/LFGQueue.h31
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.cpp51
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.h8
-rw-r--r--src/server/game/Entities/Corpse/Corpse.cpp12
-rw-r--r--src/server/game/Entities/Corpse/Corpse.h2
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp30
-rw-r--r--src/server/game/Entities/Creature/Creature.h20
-rw-r--r--src/server/game/Entities/Creature/GossipDef.cpp26
-rw-r--r--src/server/game/Entities/Creature/GossipDef.h19
-rw-r--r--src/server/game/Entities/Creature/TemporarySummon.cpp6
-rw-r--r--src/server/game/Entities/Creature/TemporarySummon.h4
-rw-r--r--src/server/game/Entities/DynamicObject/DynamicObject.cpp2
-rw-r--r--src/server/game/Entities/DynamicObject/DynamicObject.h2
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp59
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h18
-rw-r--r--src/server/game/Entities/Item/Container/Bag.cpp23
-rw-r--r--src/server/game/Entities/Item/Container/Bag.h4
-rw-r--r--src/server/game/Entities/Item/Item.cpp41
-rw-r--r--src/server/game/Entities/Item/Item.h8
-rw-r--r--src/server/game/Entities/Object/Object.cpp96
-rw-r--r--src/server/game/Entities/Object/Object.h117
-rw-r--r--src/server/game/Entities/Object/ObjectDefines.h205
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.cpp111
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.h289
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateData.cpp8
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateData.h9
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp14
-rw-r--r--src/server/game/Entities/Pet/Pet.h2
-rw-r--r--src/server/game/Entities/Player/Player.cpp432
-rw-r--r--src/server/game/Entities/Player/Player.h130
-rw-r--r--src/server/game/Entities/Player/SocialMgr.cpp6
-rw-r--r--src/server/game/Entities/Totem/Totem.cpp2
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp319
-rw-r--r--src/server/game/Entities/Unit/Unit.h152
-rw-r--r--src/server/game/Entities/Vehicle/Vehicle.h2
-rw-r--r--src/server/game/Entities/Vehicle/VehicleDefines.h6
-rw-r--r--src/server/game/Events/GameEventMgr.cpp8
-rw-r--r--src/server/game/Globals/ObjectAccessor.cpp70
-rw-r--r--src/server/game/Globals/ObjectAccessor.h64
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp208
-rw-r--r--src/server/game/Globals/ObjectMgr.h41
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.cpp4
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.h10
-rw-r--r--src/server/game/Grids/ObjectGridLoader.cpp2
-rw-r--r--src/server/game/Groups/Group.cpp176
-rw-r--r--src/server/game/Groups/Group.h98
-rw-r--r--src/server/game/Groups/GroupRefManager.h2
-rw-r--r--src/server/game/Guilds/Guild.cpp203
-rw-r--r--src/server/game/Guilds/Guild.h56
-rw-r--r--src/server/game/Guilds/GuildFinderMgr.cpp10
-rw-r--r--src/server/game/Guilds/GuildFinderMgr.h9
-rw-r--r--src/server/game/Guilds/GuildMgr.cpp8
-rw-r--r--src/server/game/Guilds/GuildMgr.h4
-rw-r--r--src/server/game/Handlers/ArenaTeamHandler.cpp10
-rw-r--r--src/server/game/Handlers/AuctionHouseHandler.cpp63
-rw-r--r--src/server/game/Handlers/BattleGroundHandler.cpp24
-rw-r--r--src/server/game/Handlers/BattlefieldHandler.cpp180
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp114
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp126
-rw-r--r--src/server/game/Handlers/ChatHandler.cpp2
-rw-r--r--src/server/game/Handlers/CombatHandler.cpp8
-rw-r--r--src/server/game/Handlers/DuelHandler.cpp6
-rw-r--r--src/server/game/Handlers/GroupHandler.cpp36
-rw-r--r--src/server/game/Handlers/GuildFinderHandler.cpp16
-rw-r--r--src/server/game/Handlers/GuildHandler.cpp73
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp80
-rw-r--r--src/server/game/Handlers/LFGHandler.cpp34
-rw-r--r--src/server/game/Handlers/LootHandler.cpp46
-rw-r--r--src/server/game/Handlers/MailHandler.cpp67
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp92
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp34
-rw-r--r--src/server/game/Handlers/NPCHandler.cpp80
-rw-r--r--src/server/game/Handlers/PetHandler.cpp74
-rw-r--r--src/server/game/Handlers/PetitionsHandler.cpp112
-rw-r--r--src/server/game/Handlers/QueryHandler.cpp20
-rw-r--r--src/server/game/Handlers/QuestHandler.cpp52
-rw-r--r--src/server/game/Handlers/ReferAFriendHandler.cpp10
-rw-r--r--src/server/game/Handlers/SkillHandler.cpp4
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp36
-rw-r--r--src/server/game/Handlers/TaxiHandler.cpp18
-rw-r--r--src/server/game/Handlers/TicketHandler.cpp4
-rw-r--r--src/server/game/Handlers/TradeHandler.cpp12
-rw-r--r--src/server/game/Handlers/VehicleHandler.cpp50
-rw-r--r--src/server/game/Handlers/VoidStorageHandler.cpp24
-rw-r--r--src/server/game/Instances/InstanceScript.cpp98
-rw-r--r--src/server/game/Instances/InstanceScript.h53
-rw-r--r--src/server/game/Loot/LootMgr.cpp18
-rw-r--r--src/server/game/Loot/LootMgr.h14
-rw-r--r--src/server/game/Mails/Mail.cpp5
-rw-r--r--src/server/game/Maps/Map.cpp78
-rw-r--r--src/server/game/Maps/Map.h17
-rw-r--r--src/server/game/Maps/MapInstanced.h4
-rw-r--r--src/server/game/Maps/MapManager.cpp4
-rw-r--r--src/server/game/Maps/ZoneScript.h3
-rw-r--r--src/server/game/Miscellaneous/Language.h3
-rw-r--r--src/server/game/Movement/MotionMaster.cpp8
-rw-r--r--src/server/game/Movement/MotionMaster.h2
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h6
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp2
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp10
-rw-r--r--src/server/game/Movement/Spline/MovementPacketBuilder.cpp4
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvP.cpp70
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvP.h32
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp4
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvPMgr.h4
-rw-r--r--src/server/game/Pools/PoolMgr.cpp8
-rw-r--r--src/server/game/Scripting/MapScripts.cpp52
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp14
-rw-r--r--src/server/game/Scripting/ScriptMgr.h28
-rw-r--r--src/server/game/Server/Protocol/PacketLog.cpp2
-rw-r--r--src/server/game/Server/Protocol/PacketLog.h2
-rw-r--r--src/server/game/Server/WorldSession.cpp18
-rw-r--r--src/server/game/Server/WorldSession.h74
-rw-r--r--src/server/game/Server/WorldSocket.cpp8
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp44
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h4
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp18
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.h38
-rw-r--r--src/server/game/Spells/Spell.cpp174
-rw-r--r--src/server/game/Spells/Spell.h30
-rw-r--r--src/server/game/Spells/SpellEffects.cpp51
-rw-r--r--src/server/game/Spells/SpellMgr.cpp4
-rw-r--r--src/server/game/Spells/SpellScript.cpp2
-rw-r--r--src/server/game/Spells/SpellScript.h2
-rw-r--r--src/server/game/Texts/CreatureTextMgr.cpp50
-rw-r--r--src/server/game/Texts/CreatureTextMgr.h58
-rw-r--r--src/server/game/Tickets/TicketMgr.cpp22
-rw-r--r--src/server/game/Tickets/TicketMgr.h26
-rw-r--r--src/server/game/Tools/PlayerDump.cpp16
-rw-r--r--src/server/game/Warden/WardenMac.cpp4
-rw-r--r--src/server/game/World/World.cpp32
-rw-r--r--src/server/game/World/World.h19
-rw-r--r--src/server/scripts/Commands/cs_account.cpp2
-rw-r--r--src/server/scripts/Commands/cs_arena.cpp8
-rw-r--r--src/server/scripts/Commands/cs_ban.cpp2
-rw-r--r--src/server/scripts/Commands/cs_character.cpp74
-rw-r--r--src/server/scripts/Commands/cs_cheat.cpp2
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp44
-rw-r--r--src/server/scripts/Commands/cs_gm.cpp2
-rw-r--r--src/server/scripts/Commands/cs_go.cpp2
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp8
-rw-r--r--src/server/scripts/Commands/cs_group.cpp24
-rw-r--r--src/server/scripts/Commands/cs_guild.cpp10
-rw-r--r--src/server/scripts/Commands/cs_honor.cpp6
-rw-r--r--src/server/scripts/Commands/cs_instance.cpp2
-rw-r--r--src/server/scripts/Commands/cs_lfg.cpp4
-rw-r--r--src/server/scripts/Commands/cs_list.cpp16
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp65
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp44
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp10
-rw-r--r--src/server/scripts/Commands/cs_pet.cpp2
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp4
-rw-r--r--src/server/scripts/Commands/cs_reset.cpp12
-rw-r--r--src/server/scripts/Commands/cs_send.cpp12
-rw-r--r--src/server/scripts/Commands/cs_tele.cpp10
-rw-r--r--src/server/scripts/Commands/cs_ticket.cpp8
-rw-r--r--src/server/scripts/Commands/cs_titles.cpp8
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp26
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp105
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp24
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp119
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp85
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp28
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp32
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp19
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp31
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp39
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp42
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp55
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp24
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp19
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp43
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp97
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp21
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp29
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp31
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp26
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp65
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp21
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp21
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp34
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp50
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp28
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp78
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp32
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp24
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp34
-rw-r--r--src/server/scripts/EasternKingdoms/zone_undercity.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp3
-rw-r--r--src/server/scripts/Events/childrens_week.cpp60
-rw-r--r--src/server/scripts/Examples/example_escort.cpp2
-rw-r--r--src/server/scripts/Examples/example_spell.cpp4
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp2
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp30
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp22
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp42
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h8
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp32
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp48
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp58
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp51
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp25
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp10
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp7
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp2
-rw-r--r--src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp2
-rw-r--r--src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp6
-rw-r--r--src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp8
-rw-r--r--src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp31
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp10
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp23
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp3
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp3
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp5
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp8
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp14
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp8
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp28
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp40
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp25
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp18
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp7
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp20
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp34
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp11
-rw-r--r--src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp14
-rw-r--r--src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_desolace.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_felwood.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_mulgore.cpp4
-rw-r--r--src/server/scripts/Kalimdor/zone_silithus.cpp44
-rw-r--r--src/server/scripts/Kalimdor/zone_tanaris.cpp30
-rw-r--r--src/server/scripts/Kalimdor/zone_the_barrens.cpp12
-rw-r--r--src/server/scripts/Kalimdor/zone_winterspring.cpp15
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp23
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp27
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp53
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp4
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp12
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp105
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp20
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp16
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp22
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp6
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp6
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp78
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp52
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp4
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp5
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp37
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp42
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp45
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp46
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp14
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp12
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp33
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp10
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp95
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp55
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp4
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp10
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp2
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp29
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp4
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp10
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp96
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h4
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp93
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp18
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp20
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp28
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp2
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp62
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_eck.cpp134
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp416
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp247
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp69
-rw-r--r--src/server/scripts/Northrend/Gundrak/gundrak.h106
-rw-r--r--src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp779
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp67
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp26
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp28
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp15
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp38
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp22
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp13
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp16
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp20
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp17
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp58
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp30
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp40
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp157
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp12
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp22
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp6
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp18
-rw-r--r--src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp54
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp62
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp44
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp12
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp18
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp22
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp20
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp6
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp37
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp8
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp21
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp72
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp52
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp20
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp8
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp11
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp41
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp21
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp12
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp90
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp40
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp14
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp70
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp144
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp6
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp2
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp2
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp35
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h8
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp28
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp10
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp18
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp12
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp51
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp6
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp2
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp10
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_erekem.cpp28
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp14
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_moragg.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp4
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp83
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.cpp6
-rw-r--r--src/server/scripts/Northrend/zone_borean_tundra.cpp61
-rw-r--r--src/server/scripts/Northrend/zone_crystalsong_forest.cpp4
-rw-r--r--src/server/scripts/Northrend/zone_dragonblight.cpp19
-rw-r--r--src/server/scripts/Northrend/zone_grizzly_hills.cpp14
-rw-r--r--src/server/scripts/Northrend/zone_howling_fjord.cpp8
-rw-r--r--src/server/scripts/Northrend/zone_icecrown.cpp15
-rw-r--r--src/server/scripts/Northrend/zone_sholazar_basin.cpp12
-rw-r--r--src/server/scripts/Northrend/zone_storm_peaks.cpp22
-rw-r--r--src/server/scripts/Northrend/zone_wintergrasp.cpp6
-rw-r--r--src/server/scripts/Northrend/zone_zuldrak.cpp9
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp2
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp6
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPNA.h2
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp4
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp4
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp18
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPZM.h6
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp4
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp4
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp10
-rw-r--r--src/server/scripts/Outland/BlackTemple/black_temple.cpp8
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp8
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp73
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp8
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp24
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp80
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp20
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp395
-rw-r--r--src/server/scripts/Outland/BlackTemple/illidari_council.cpp44
-rw-r--r--src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp49
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp54
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp12
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp18
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp61
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp20
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp45
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp17
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp22
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp8
-rw-r--r--src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp8
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp25
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp48
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp13
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp3
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp10
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp27
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp10
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp8
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp13
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp23
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp26
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp6
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp6
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp16
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp20
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp28
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp19
-rw-r--r--src/server/scripts/Outland/boss_doomwalker.cpp2
-rw-r--r--src/server/scripts/Outland/zone_blades_edge_mountains.cpp12
-rw-r--r--src/server/scripts/Outland/zone_hellfire_peninsula.cpp4
-rw-r--r--src/server/scripts/Outland/zone_nagrand.cpp8
-rw-r--r--src/server/scripts/Outland/zone_netherstorm.cpp19
-rw-r--r--src/server/scripts/Outland/zone_shadowmoon_valley.cpp53
-rw-r--r--src/server/scripts/Outland/zone_terokkar_forest.cpp2
-rw-r--r--src/server/scripts/Pet/pet_dk.cpp4
-rw-r--r--src/server/scripts/Pet/pet_generic.cpp10
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp2
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp4
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp2
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp59
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp4
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp2
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp6
-rw-r--r--src/server/scripts/World/action_ip_logger.cpp8
-rw-r--r--src/server/scripts/World/areatrigger_scripts.cpp8
-rw-r--r--src/server/scripts/World/boss_emerald_dragons.cpp6
-rw-r--r--src/server/scripts/World/go_scripts.cpp8
-rw-r--r--src/server/scripts/World/guards.cpp12
-rw-r--r--src/server/scripts/World/item_scripts.cpp2
-rw-r--r--src/server/scripts/World/npcs_special.cpp41
-rw-r--r--src/server/shared/DataStores/DBCFileLoader.cpp6
-rw-r--r--src/server/shared/Database/DatabaseWorkerPool.h3
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp2
-rw-r--r--src/server/shared/Database/Implementation/WorldDatabase.cpp2
-rw-r--r--src/server/shared/Database/MySQLConnection.cpp3
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.cpp2
-rw-r--r--src/server/shared/Define.h2
-rw-r--r--src/server/shared/Networking/Socket.h48
-rw-r--r--src/server/shared/Packets/ByteBuffer.h3
-rw-r--r--src/server/shared/Threading/ProcessPriority.h2
-rw-r--r--src/server/shared/Utilities/ServiceWin32.cpp3
-rw-r--r--src/server/shared/Utilities/Util.cpp16
-rw-r--r--src/server/shared/Utilities/Util.h7
-rw-r--r--src/server/worldserver/Main.cpp3
-rw-r--r--src/server/worldserver/RemoteAccess/RASession.cpp4
583 files changed, 8286 insertions, 9322 deletions
diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp
index f2bc47638e6..cc454a5822f 100644
--- a/src/server/collision/Maps/TileAssembler.cpp
+++ b/src/server/collision/Maps/TileAssembler.cpp
@@ -236,7 +236,7 @@ namespace VMAP
MapData::iterator map_iter = mapData.find(mapID);
if (map_iter == mapData.end())
{
- printf("spawning Map %d\n", mapID);
+ printf("spawning Map %u\n", mapID);
mapData[mapID] = current = new MapSpawns();
}
else current = (*map_iter).second;
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 603c34e2403..327ad6ba8fa 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -164,7 +164,7 @@ void PetAI::UpdateAI(uint32 diff)
continue;
}
- Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0);
+ Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE);
bool spellUsed = false;
// Some spells can target enemy or friendly (DK Ghoul's Leap)
@@ -192,7 +192,7 @@ void PetAI::UpdateAI(uint32 diff)
// No enemy, check friendly
if (!spellUsed)
{
- for (std::set<uint64>::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar)
+ for (GuidSet::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar)
{
Unit* ally = ObjectAccessor::GetUnit(*me, *tar);
@@ -215,7 +215,7 @@ void PetAI::UpdateAI(uint32 diff)
}
else if (me->GetVictim() && CanAttack(me->GetVictim()) && spellInfo->CanBeUsedInCombat())
{
- Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0);
+ Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE);
if (spell->CanAutoCast(me->GetVictim()))
targetSpellStore.push_back(std::make_pair(me->GetVictim(), spell));
else
diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h
index c24bf3a0c1b..9517efd8927 100644
--- a/src/server/game/AI/CoreAI/PetAI.h
+++ b/src/server/game/AI/CoreAI/PetAI.h
@@ -57,7 +57,7 @@ class PetAI : public CreatureAI
void UpdateAllies();
TimeTracker i_tracker;
- std::set<uint64> m_AllySet;
+ GuidSet m_AllySet;
uint32 m_updateAlliesTimer;
Unit* SelectNextTarget(bool allowAutoSelect) const;
diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp
index 27ecc2716f3..6f456c0fd24 100644
--- a/src/server/game/AI/CoreAI/TotemAI.cpp
+++ b/src/server/game/AI/CoreAI/TotemAI.cpp
@@ -35,7 +35,7 @@ int TotemAI::Permissible(Creature const* creature)
return PERMIT_BASE_NO;
}
-TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid(0)
+TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid()
{
ASSERT(c->IsTotem());
}
@@ -90,7 +90,7 @@ void TotemAI::UpdateAI(uint32 /*diff*/)
me->CastSpell(victim, me->ToTotem()->GetSpell(), false);
}
else
- i_victimGuid = 0;
+ i_victimGuid.Clear();
}
void TotemAI::AttackStart(Unit* /*victim*/)
diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h
index 93106b91492..c63da0af31c 100644
--- a/src/server/game/AI/CoreAI/TotemAI.h
+++ b/src/server/game/AI/CoreAI/TotemAI.h
@@ -39,7 +39,7 @@ class TotemAI : public CreatureAI
static int Permissible(Creature const* creature);
private:
- uint64 i_victimGuid;
+ ObjectGuid i_victimGuid;
};
#endif
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index 979fe4fe558..5d67c9546aa 100644
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -137,8 +137,8 @@ class UnitAI
virtual void DoAction(int32 /*param*/) { }
virtual uint32 GetData(uint32 /*id = 0*/) const { return 0; }
virtual void SetData(uint32 /*id*/, uint32 /*value*/) { }
- virtual void SetGUID(uint64 /*guid*/, int32 /*id*/ = 0) { }
- virtual uint64 GetGUID(int32 /*id*/ = 0) const { return 0; }
+ virtual void SetGUID(ObjectGuid /*guid*/, int32 /*id*/ = 0) { }
+ virtual ObjectGuid GetGUID(int32 /*id*/ = 0) const { return ObjectGuid::Empty; }
Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
// Select the targets satisfying the predicate.
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index 7a79bb722a0..933cb38aef5 100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -38,16 +38,11 @@ void CreatureAI::OnCharmed(bool /*apply*/)
AISpellInfoType* UnitAI::AISpellInfo;
AISpellInfoType* GetAISpellInfo(uint32 i) { return &CreatureAI::AISpellInfo[i]; }
-void CreatureAI::Talk(uint8 id, WorldObject const* whisperTarget /*= NULL*/)
+void CreatureAI::Talk(uint8 id, WorldObject const* whisperTarget /*= nullptr*/)
{
sCreatureTextMgr->SendChat(me, id, whisperTarget);
}
-void CreatureAI::TalkToMap(uint8 id, WorldObject const* whisperTarget /*= NULL*/)
-{
- sCreatureTextMgr->SendChat(me, id, whisperTarget, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
-}
-
void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToNearestTarget /* = 50.0f*/)
{
if (!creature)
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index b79dd6abbc8..83ecb11a8ef 100644
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -78,8 +78,8 @@ class CreatureAI : public UnitAI
Creature* DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
public:
- void Talk(uint8 id, WorldObject const* whisperTarget = NULL);
- void TalkToMap(uint8 id, WorldObject const* whisperTarget = NULL);
+ void Talk(uint8 id, WorldObject const* whisperTarget = nullptr);
+
explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), m_MoveInLineOfSight_locked(false) { }
virtual ~CreatureAI() { }
@@ -165,14 +165,12 @@ class CreatureAI : public UnitAI
/// == Fields =======================================
- // Pointer to controlled by AI creature
- //Creature* const me;
-
virtual void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool /*apply*/) { }
virtual void OnSpellClick(Unit* /*clicker*/, bool& /*result*/) { }
virtual bool CanSeeAlways(WorldObject const* /*obj*/) { return false; }
+
protected:
virtual void MoveInLineOfSight(Unit* /*who*/);
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 614f5826824..4f4f56d3fe3 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -311,8 +311,8 @@ void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o
if (Player* player = unit->ToPlayer())
player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
else
- TC_LOG_ERROR("scripts", "Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.",
- me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
+ TC_LOG_ERROR("scripts", "Creature %s Tried to teleport non-player unit (%s) to x: %f y:%f z: %f o: %f. Aborted.",
+ me->GetGUID().ToString().c_str(), unit->GetGUID().ToString().c_str(), x, y, z, o);
}
void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index d1e54ab84fe..e9a797c7db8 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -40,7 +40,7 @@ class InstanceScript;
class SummonList
{
public:
- typedef std::list<uint64> StorageType;
+ typedef GuidList StorageType;
typedef StorageType::iterator iterator;
typedef StorageType::const_iterator const_iterator;
typedef StorageType::size_type size_type;
@@ -104,7 +104,7 @@ public:
{
// We need to use a copy of SummonList here, otherwise original SummonList would be modified
StorageType listCopy = storage_;
- Trinity::Containers::RandomResizeList<uint64, Predicate>(listCopy, predicate, max);
+ Trinity::Containers::RandomResizeList<ObjectGuid, Predicate>(listCopy, predicate, max);
for (StorageType::iterator i = listCopy.begin(); i != listCopy.end(); )
{
Creature* summon = ObjectAccessor::GetCreature(*me, *i++);
@@ -126,7 +126,7 @@ class EntryCheckPredicate
{
public:
EntryCheckPredicate(uint32 entry) : _entry(entry) { }
- bool operator()(uint64 guid) { return GUID_ENPART(guid) == _entry; }
+ bool operator()(ObjectGuid guid) { return guid.GetEntry() == _entry; }
private:
uint32 _entry;
@@ -135,7 +135,7 @@ class EntryCheckPredicate
class DummyEntryCheckPredicate
{
public:
- bool operator()(uint64) { return true; }
+ bool operator()(ObjectGuid) { return true; }
};
struct ScriptedAI : public CreatureAI
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index d06f90c1aeb..0b69391f935 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -23,10 +23,10 @@ SDComment:
SDCategory: Npc
EndScriptData */
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "Group.h"
-#include "Player.h"
enum Points
{
@@ -35,7 +35,6 @@ enum Points
};
npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature),
- m_uiPlayerGUID(0),
m_uiWPWaitTimer(2500),
m_uiPlayerCheckTimer(1000),
m_uiEscortState(STATE_ESCORT_NONE),
@@ -430,7 +429,7 @@ void npc_escortAI::SetRun(bool on)
}
/// @todo get rid of this many variables passed in function.
-void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, uint64 playerGUID /* = 0 */, Quest const* quest /* = NULL */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */)
+void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, ObjectGuid playerGUID /* = 0 */, Quest const* quest /* = NULL */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */)
{
if (me->GetVictim())
{
@@ -486,7 +485,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
}
- TC_LOG_DEBUG("scripts", "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
+ TC_LOG_DEBUG("scripts", "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, %s", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID.ToString().c_str());
CurrentWP = WaypointList.begin();
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
index b8c9ee57aeb..22280ee3575 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
@@ -88,7 +88,7 @@ struct npc_escortAI : public ScriptedAI
virtual void WaypointReached(uint32 pointId) = 0;
virtual void WaypointStart(uint32 /*pointId*/) { }
- void Start(bool isActiveAttacker = true, bool run = false, uint64 playerGUID = 0, Quest const* quest = NULL, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true);
+ void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = ObjectGuid::Empty, Quest const* quest = NULL, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true);
void SetRun(bool on = true);
void SetEscortPaused(bool on);
@@ -103,7 +103,7 @@ struct npc_escortAI : public ScriptedAI
void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; }
bool GetAttack() { return m_bIsActiveAttacker; }//used in EnterEvadeMode override
void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; }
- uint64 GetEventStarterGUID() { return m_uiPlayerGUID; }
+ ObjectGuid GetEventStarterGUID() { return m_uiPlayerGUID; }
protected:
Player* GetPlayerForEscort() { return ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID); }
@@ -116,7 +116,7 @@ struct npc_escortAI : public ScriptedAI
void AddEscortState(uint32 escortState) { m_uiEscortState |= escortState; }
void RemoveEscortState(uint32 escortState) { m_uiEscortState &= ~escortState; }
- uint64 m_uiPlayerGUID;
+ ObjectGuid m_uiPlayerGUID;
uint32 m_uiWPWaitTimer;
uint32 m_uiPlayerCheckTimer;
uint32 m_uiEscortState;
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index a106c98c786..00aa8eacc93 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -23,10 +23,10 @@ SDComment: This AI is under development
SDCategory: Npc
EndScriptData */
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedFollowerAI.h"
#include "Group.h"
-#include "Player.h"
const float MAX_PLAYER_DISTANCE = 100.0f;
@@ -36,7 +36,6 @@ enum Points
};
FollowerAI::FollowerAI(Creature* creature) : ScriptedAI(creature),
- m_uiLeaderGUID(0),
m_uiUpdateFollowTimer(2500),
m_uiFollowState(STATE_FOLLOW_NONE),
m_pQuestForFollow(NULL)
@@ -320,7 +319,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
- TC_LOG_DEBUG("scripts", "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID);
+ TC_LOG_DEBUG("scripts", "FollowerAI start follow %s (%s)", player->GetName().c_str(), m_uiLeaderGUID.ToString().c_str());
}
Player* FollowerAI::GetLeaderForFollower()
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
index adb17ef76b1..88b3ccd6a64 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
@@ -71,7 +71,7 @@ class FollowerAI : public ScriptedAI
bool AssistPlayerInCombat(Unit* who);
- uint64 m_uiLeaderGUID;
+ ObjectGuid m_uiLeaderGUID;
uint32 m_uiUpdateFollowTimer;
uint32 m_uiFollowState;
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 41f783f4289..bdad018c622 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -61,7 +61,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
mDespawnState = 0;
mEscortInvokerCheckTimer = 1000;
- mFollowGuid = 0;
+ mFollowGuid.Clear();
mFollowDist = 0;
mFollowAngle = 0;
mFollowCredit = 0;
@@ -540,7 +540,7 @@ void SmartAI::JustRespawned()
mJustReset = true;
JustReachedHome();
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
- mFollowGuid = 0;//do not reset follower on Reset(), we need it after combat evade
+ mFollowGuid.Clear();//do not reset follower on Reset(), we need it after combat evade
mFollowDist = 0;
mFollowAngle = 0;
mFollowCredit = 0;
@@ -674,8 +674,8 @@ void SmartAI::OnCharmed(bool apply)
{
GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, NULL, 0, 0, apply);
- if (!apply && !me->IsInEvadeMode() && me->GetUInt64Value(UNIT_FIELD_CHARMEDBY))
- if (Unit* charmer = ObjectAccessor::GetUnit(*me, me->GetUInt64Value(UNIT_FIELD_CHARMEDBY)))
+ if (!apply && !me->IsInEvadeMode() && me->GetCharmerGUID())
+ if (Unit* charmer = ObjectAccessor::GetUnit(*me, me->GetCharmerGUID()))
AttackStart(charmer);
}
@@ -694,11 +694,11 @@ void SmartAI::SetData(uint32 id, uint32 value)
GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, NULL, id, value);
}
-void SmartAI::SetGUID(uint64 /*guid*/, int32 /*id*/) { }
+void SmartAI::SetGUID(ObjectGuid /*guid*/, int32 /*id*/) { }
-uint64 SmartAI::GetGUID(int32 /*id*/) const
+ObjectGuid SmartAI::GetGUID(int32 /*id*/) const
{
- return 0;
+ return ObjectGuid::Empty;
}
void SmartAI::SetRun(bool run)
@@ -800,7 +800,7 @@ void SmartAI::StopFollow()
player->GroupEventHappens(mFollowCredit, me);
}
- mFollowGuid = 0;
+ mFollowGuid.Clear();
mFollowDist = 0;
mFollowAngle = 0;
mFollowCredit = 0;
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index b0d5d4f8343..a5abf2a33e3 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -154,10 +154,10 @@ class SmartAI : public CreatureAI
void SetData(uint32 id, uint32 value) override;
// Used in scripts to share variables
- void SetGUID(uint64 guid, int32 id = 0) override;
+ void SetGUID(ObjectGuid guid, int32 id = 0) override;
// Used in scripts to share variables
- uint64 GetGUID(int32 id = 0) const override;
+ ObjectGuid GetGUID(int32 id = 0) const override;
//core related
static int Permissible(const Creature*);
@@ -199,7 +199,7 @@ class SmartAI : public CreatureAI
uint32 mFollowArrivedTimer;
uint32 mFollowCredit;
uint32 mFollowArrivedEntry;
- uint64 mFollowGuid;
+ ObjectGuid mFollowGuid;
float mFollowDist;
float mFollowAngle;
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 9bfbce6b4f9..fb3bbd17a69 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -51,9 +51,6 @@ SmartScript::SmartScript()
mUseTextTimer = false;
mTalkerEntry = 0;
mTemplate = SMARTAI_TEMPLATE_BASIC;
- meOrigGUID = 0;
- goOrigGUID = 0;
- mLastInvoker = 0;
mScriptType = SMART_SCRIPT_TYPE_CREATURE;
isProcessingTimedActionList = false;
}
@@ -79,7 +76,7 @@ void SmartScript::OnReset()
}
}
ProcessEventsFor(SMART_EVENT_RESET);
- mLastInvoker = 0;
+ mLastInvoker.Clear();
}
void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
@@ -509,10 +506,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
go->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CAST:: %s: %u casts spell %u on target %u with castflags %u",
- GetLogNameForGuid(me ? me->GetGUID() : go->GetGUID()), me ? me->GetGUIDLow() : go->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
+ (me ? me->GetGUID() : go->GetGUID()).GetTypeName(), me ? me->GetGUIDLow() : go->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
}
else
- TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
+ TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (%s) already has the aura", e.action.cast.spell, (*itr)->GetGUID().ToString().c_str());
}
delete targets;
@@ -543,7 +540,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
}
else
- TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
+ TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (%s) already has the aura", e.action.cast.spell, (*itr)->GetGUID().ToString().c_str());
}
delete targets;
@@ -939,9 +936,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!targets)
break;
- instance->SetData64(e.action.setInstanceData64.field, targets->front()->GetGUID());
- TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: " UI64FMTD,
- e.action.setInstanceData64.field, targets->front()->GetGUID());
+ instance->SetGuidData(e.action.setInstanceData64.field, targets->front()->GetGUID());
+ TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: %s",
+ e.action.setInstanceData64.field, targets->front()->GetGUID().ToString().c_str());
delete targets;
break;
@@ -1277,13 +1274,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
delete targets;
break;
}
- case SMART_ACTION_STORE_VARIABLE_DECIMAL:
- {
- if (mStoredDecimals.find(e.action.storeVar.id) != mStoredDecimals.end())
- mStoredDecimals.erase(e.action.storeVar.id);
- mStoredDecimals[e.action.storeVar.id] = e.action.storeVar.number;
- break;
- }
case SMART_ACTION_STORE_TARGET_LIST:
{
ObjectList* targets = GetTargets(e, unit);
@@ -1568,20 +1558,20 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (IsCreature(*itr))
{
- if (!meOrigGUID)
- meOrigGUID = me ? me->GetGUID() : 0;
- if (!goOrigGUID)
- goOrigGUID = go ? go->GetGUID() : 0;
+ if (!meOrigGUID && me)
+ meOrigGUID = me->GetGUID();
+ if (!goOrigGUID && go)
+ goOrigGUID = go->GetGUID();
go = NULL;
me = (*itr)->ToCreature();
break;
}
else if (IsGameObject(*itr))
{
- if (!meOrigGUID)
- meOrigGUID = me ? me->GetGUID() : 0;
- if (!goOrigGUID)
- goOrigGUID = go ? go->GetGUID() : 0;
+ if (!meOrigGUID && me)
+ meOrigGUID = me->GetGUID();
+ if (!goOrigGUID && go)
+ goOrigGUID = go->GetGUID();
go = (*itr)->ToGameObject();
me = NULL;
break;
@@ -1723,7 +1713,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
unit->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
}
else
- TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId()));
+ TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (%s) already has the aura", e.action.cast.spell, (*it)->GetGUID().ToString().c_str());
}
}
@@ -2637,7 +2627,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
{
if (me)
{
- uint64 charmerOrOwnerGuid = me->GetCharmerOrOwnerGUID();
+ ObjectGuid charmerOrOwnerGuid = me->GetCharmerOrOwnerGUID();
if (!charmerOrOwnerGuid)
charmerOrOwnerGuid = me->GetCreatorGUID();
diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h
index 0931756a026..02bc1a2b487 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -197,14 +197,14 @@ class SmartScript
go = o;
}
}
- goOrigGUID = 0;
- meOrigGUID = 0;
+ goOrigGUID.Clear();
+ meOrigGUID.Clear();
}
//TIMED_ACTIONLIST (script type 9 aka script9)
void SetScript9(SmartScriptHolder& e, uint32 entry);
Unit* GetLastInvoker();
- uint64 mLastInvoker;
+ ObjectGuid mLastInvoker;
private:
void IncPhase(int32 p = 1)
@@ -224,14 +224,13 @@ class SmartScript
SmartAIEventList mTimedActionList;
bool isProcessingTimedActionList;
Creature* me;
- uint64 meOrigGUID;
+ ObjectGuid meOrigGUID;
GameObject* go;
- uint64 goOrigGUID;
+ ObjectGuid goOrigGUID;
AreaTriggerEntry const* trigger;
SmartScriptType mScriptType;
uint32 mEventPhase;
- std::unordered_map<int32, int32> mStoredDecimals;
uint32 mPathId;
SmartAIEventList mStoredEvents;
std::list<uint32>mRemIDs;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 7831594016a..db61730326c 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -1055,7 +1055,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_DIE:
case SMART_ACTION_SET_IN_COMBAT_WITH_ZONE:
case SMART_ACTION_SET_ACTIVE:
- case SMART_ACTION_STORE_VARIABLE_DECIMAL:
case SMART_ACTION_WP_RESUME:
case SMART_ACTION_KILL_UNIT:
case SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL:
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index e3c4e644751..4404b224db1 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -480,7 +480,7 @@ enum SMART_ACTION
SMART_ACTION_SET_FLY = 60, // 0/1
SMART_ACTION_SET_SWIM = 61, // 0/1
SMART_ACTION_TELEPORT = 62, // mapID,
- SMART_ACTION_STORE_VARIABLE_DECIMAL = 63, // varID, number
+ // 63 unused
SMART_ACTION_STORE_TARGET_LIST = 64, // varID,
SMART_ACTION_WP_RESUME = 65, // none
SMART_ACTION_SET_ORIENTATION = 66, //
@@ -1360,7 +1360,7 @@ struct SmartScriptHolder
typedef std::unordered_map<uint32, WayPoint*> WPPath;
typedef std::list<WorldObject*> ObjectList;
-typedef std::list<uint64> GuidList;
+
class ObjectGuidList
{
ObjectList* m_objectList;
@@ -1393,7 +1393,7 @@ public:
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: " UI64FMTD, *itr);
+ TC_LOG_DEBUG("scripts.ai", "SmartScript::mTargetStorage stores a guid to an invalid object: %s", itr->ToString().c_str());
}
}
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index c7437909f05..682df18b2d1 100644
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -81,8 +81,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accountId)
{
do
{
- uint32 guidLow = (*result)[0].GetUInt32();
- uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
+ ObjectGuid guid(HIGHGUID_PLAYER, (*result)[0].GetUInt32());
// Kick if player is online
if (Player* p = ObjectAccessor::FindPlayer(guid))
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index a391093c583..0bb6fd8d3a1 100644
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -504,37 +504,37 @@ void AchievementMgr<Guild>::ResetAchievementCriteria(AchievementCriteriaTypes /*
}
template<class T>
-void AchievementMgr<T>::DeleteFromDB(uint32 /*lowguid*/)
+void AchievementMgr<T>::DeleteFromDB(ObjectGuid /*guid*/)
{
}
template<>
-void AchievementMgr<Player>::DeleteFromDB(uint32 lowguid)
+void AchievementMgr<Player>::DeleteFromDB(ObjectGuid guid)
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT);
- stmt->setUInt32(0, lowguid);
+ stmt->setUInt32(0, guid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS);
- stmt->setUInt32(0, lowguid);
+ stmt->setUInt32(0, guid.GetCounter());
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
}
template<>
-void AchievementMgr<Guild>::DeleteFromDB(uint32 lowguid)
+void AchievementMgr<Guild>::DeleteFromDB(ObjectGuid guid)
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_GUILD_ACHIEVEMENTS);
- stmt->setUInt32(0, lowguid);
+ stmt->setUInt32(0, guid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_GUILD_ACHIEVEMENT_CRITERIA);
- stmt->setUInt32(0, lowguid);
+ stmt->setUInt32(0, guid.GetCounter());
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
@@ -557,11 +557,11 @@ void AchievementMgr<Player>::SaveToDB(SQLTransaction& trans)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
stmt->setUInt16(0, iter->first);
- stmt->setUInt32(1, GetOwner()->GetGUID());
+ stmt->setUInt32(1, GetOwner()->GetGUID().GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT);
- stmt->setUInt32(0, GetOwner()->GetGUID());
+ stmt->setUInt32(0, GetOwner()->GetGUID().GetCounter());
stmt->setUInt16(1, iter->first);
stmt->setUInt32(2, uint32(iter->second.date));
trans->Append(stmt);
@@ -578,14 +578,14 @@ void AchievementMgr<Player>::SaveToDB(SQLTransaction& trans)
continue;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS_BY_CRITERIA);
- stmt->setUInt32(0, GetOwner()->GetGUID());
+ stmt->setUInt32(0, GetOwner()->GetGUID().GetCounter());
stmt->setUInt16(1, iter->first);
trans->Append(stmt);
if (iter->second.counter)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT_PROGRESS);
- stmt->setUInt32(0, GetOwner()->GetGUID());
+ stmt->setUInt32(0, GetOwner()->GetGUID().GetCounter());
stmt->setUInt16(1, iter->first);
stmt->setUInt32(2, iter->second.counter);
stmt->setUInt32(3, uint32(iter->second.date));
@@ -616,8 +616,8 @@ void AchievementMgr<Guild>::SaveToDB(SQLTransaction& trans)
stmt->setUInt32(0, GetOwner()->GetId());
stmt->setUInt16(1, itr->first);
stmt->setUInt32(2, itr->second.date);
- for (std::set<uint64>::const_iterator gItr = itr->second.guids.begin(); gItr != itr->second.guids.end(); ++gItr)
- guidstr << GUID_LOPART(*gItr) << ',';
+ for (GuidSet::const_iterator gItr = itr->second.guids.begin(); gItr != itr->second.guids.end(); ++gItr)
+ guidstr << gItr->GetCounter() << ',';
stmt->setString(3, guidstr.str());
trans->Append(stmt);
@@ -640,7 +640,7 @@ void AchievementMgr<Guild>::SaveToDB(SQLTransaction& trans)
stmt->setUInt16(1, itr->first);
stmt->setUInt64(2, itr->second.counter);
stmt->setUInt32(3, itr->second.date);
- stmt->setUInt32(4, GUID_LOPART(itr->second.CompletedGUID));
+ stmt->setUInt32(4, itr->second.CompletedGUID.GetCounter());
trans->Append(stmt);
}
}
@@ -735,7 +735,7 @@ void AchievementMgr<Guild>::LoadFromDB(PreparedQueryResult achievementResult, Pr
ca.date = time_t(fields[1].GetUInt32());
Tokenizer guids(fields[2].GetString(), ' ');
for (uint32 i = 0; i < guids.size(); ++i)
- ca.guids.insert(MAKE_NEW_GUID(atol(guids[i]), 0, HIGHGUID_PLAYER));
+ ca.guids.insert(ObjectGuid(HIGHGUID_PLAYER, uint32(atol(guids[i]))));
ca.changed = false;
@@ -753,7 +753,7 @@ void AchievementMgr<Guild>::LoadFromDB(PreparedQueryResult achievementResult, Pr
uint32 id = fields[0].GetUInt16();
uint32 counter = fields[1].GetUInt32();
time_t date = time_t(fields[2].GetUInt32());
- uint64 guid = fields[3].GetUInt32();
+ uint32 guid = fields[3].GetUInt32();
AchievementCriteriaEntry const* criteria = sAchievementMgr->GetAchievementCriteria(id);
if (!criteria)
@@ -773,7 +773,7 @@ void AchievementMgr<Guild>::LoadFromDB(PreparedQueryResult achievementResult, Pr
CriteriaProgress& progress = m_criteriaProgress[id];
progress.counter = counter;
progress.date = date;
- progress.CompletedGUID = MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER);
+ progress.CompletedGUID = ObjectGuid(HIGHGUID_PLAYER, guid);
progress.changed = false;
} while (criteriaResult->NextRow());
}
@@ -804,7 +804,7 @@ void AchievementMgr<Player>::Reset()
m_completedAchievements.clear();
_achievementPoints = 0;
m_criteriaProgress.clear();
- DeleteFromDB(GetOwner()->GetGUIDLow());
+ DeleteFromDB(GetOwner()->GetGUID());
// re-fill data
CheckAllAchievementCriteria(GetOwner());
@@ -844,7 +844,7 @@ void AchievementMgr<Guild>::Reset()
_achievementPoints = 0;
m_completedAchievements.clear();
- DeleteFromDB(GetOwner()->GetId());
+ DeleteFromDB(GetOwner()->GetGUID());
}
template<class T>
@@ -883,7 +883,7 @@ void AchievementMgr<T>::SendAchievementEarned(AchievementEntry const* achievemen
}
WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8);
- data.append(GetOwner()->GetPackGUID());
+ data << GetOwner()->GetPackGUID();
data << uint32(achievement->ID);
data.AppendPackedTime(time(NULL));
data << uint32(0); // does not notify player ingame
@@ -933,7 +933,7 @@ void AchievementMgr<Player>::SendCriteriaUpdate(AchievementCriteriaEntry const*
// the counter is packed like a packed Guid
data.appendPackGUID(progress->counter);
- data.appendPackGUID(GetOwner()->GetGUID());
+ data << GetOwner()->GetPackGUID();
if (!entry->timeLimit)
data << uint32(0);
else
@@ -950,7 +950,7 @@ void AchievementMgr<Guild>::SendCriteriaUpdate(AchievementCriteriaEntry const* e
//will send response to criteria progress request
WorldPacket data(SMSG_GUILD_CRITERIA_DATA, 3 + 1 + 1 + 8 + 8 + 4 + 4 + 4 + 4 + 4);
- ObjectGuid counter = progress->counter; // for accessing every byte individually
+ ObjectGuid counter(progress->counter); // for accessing every byte individually
ObjectGuid guid = progress->CompletedGUID;
data.WriteBits(1, 21);
@@ -1047,12 +1047,12 @@ void AchievementMgr<T>::UpdateAchievementCriteria(AchievementCriteriaTypes type,
if (referencePlayer->IsGameMaster())
{
TC_LOG_DEBUG("achievement", "UpdateAchievementCriteria: [Player %s GM mode on] %s, %s (%u), " UI64FMTD ", " UI64FMTD ", " UI64FMTD
- , referencePlayer->GetName().c_str(), GetLogNameForGuid(GetOwner()->GetGUID()), AchievementGlobalMgr::GetCriteriaTypeString(type), type, miscValue1, miscValue2, miscValue3);
+ , referencePlayer->GetName().c_str(), GetOwner()->GetGUID().ToString().c_str(), AchievementGlobalMgr::GetCriteriaTypeString(type), type, miscValue1, miscValue2, miscValue3);
return;
}
TC_LOG_DEBUG("achievement", "UpdateAchievementCriteria: %s, %s (%u), " UI64FMTD ", " UI64FMTD ", " UI64FMTD
- , GetLogNameForGuid(GetOwner()->GetGUID()), AchievementGlobalMgr::GetCriteriaTypeString(type), type, miscValue1, miscValue2, miscValue3);
+ , GetOwner()->GetGUID().ToString().c_str(), AchievementGlobalMgr::GetCriteriaTypeString(type), type, miscValue1, miscValue2, miscValue3);
// Lua_GetGuildLevelEnabled() is checked in achievement UI to display guild tab
if (IsGuild<T>() && !sWorld->getBoolConfig(CONFIG_GUILD_LEVELING_ENABLED))
@@ -1660,8 +1660,8 @@ void AchievementMgr<T>::SetCriteriaProgress(AchievementCriteriaEntry const* entr
if (entry->timeLimit && timedIter == m_timedAchievements.end())
return;
- TC_LOG_DEBUG("achievement", "SetCriteriaProgress(%u, " UI64FMTD ") for (%s GUID: %u)",
- entry->ID, changeValue, GetLogNameForGuid(GetOwner()->GetGUID()), GUID_LOPART(GetOwner()->GetGUID()));
+ TC_LOG_DEBUG("achievement", "SetCriteriaProgress(%u, " UI64FMTD ") for (%s)",
+ entry->ID, changeValue, GetOwner()->GetGUID().ToString().c_str());
CriteriaProgress* progress = GetCriteriaProgress(entry);
if (!progress)
@@ -1899,7 +1899,7 @@ void AchievementMgr<Guild>::CompletedAchievement(AchievementEntry const* achieve
if (achievement->flags & ACHIEVEMENT_FLAG_SHOW_IN_GUILD_NEWS)
if (Guild* guild = referencePlayer->GetGuild())
- guild->AddGuildNews(GUILD_NEWS_GUILD_ACHIEVEMENT, 0, achievement->flags & ACHIEVEMENT_FLAG_SHOW_IN_GUILD_HEADER, achievement->ID);
+ guild->AddGuildNews(GUILD_NEWS_GUILD_ACHIEVEMENT, ObjectGuid::Empty, achievement->flags & ACHIEVEMENT_FLAG_SHOW_IN_GUILD_HEADER, achievement->ID);
SendAchievementEarned(achievement);
CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
@@ -1949,7 +1949,7 @@ void AchievementMgr<T>::SendAllAchievementData(Player* /*receiver*/) const
data.WriteBits(numCriteria, 21);
for (CriteriaProgressMap::const_iterator itr = m_criteriaProgress.begin(); itr != m_criteriaProgress.end(); ++itr)
{
- counter = itr->second.counter;
+ counter.Set(itr->second.counter);
data.WriteBit(guid[4]);
data.WriteBit(counter[3]);
@@ -2052,7 +2052,7 @@ void AchievementMgr<Player>::SendAchievementInfo(Player* receiver, uint32 /*achi
data.WriteBit(guid[2]);
for (CriteriaProgressMap::const_iterator itr = m_criteriaProgress.begin(); itr != m_criteriaProgress.end(); ++itr)
{
- counter = itr->second.counter;
+ counter.Set(itr->second.counter);
data.WriteBit(counter[5]);
data.WriteBit(counter[3]);
@@ -2159,7 +2159,7 @@ void AchievementMgr<Guild>::SendAchievementInfo(Player* receiver, uint32 achieve
if (progress == m_criteriaProgress.end())
continue;
- counter = progress->second.counter;
+ counter.Set(progress->second.counter);
guid = progress->second.CompletedGUID;
criteriaBits.WriteBit(counter[4]);
diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h
index efa3e3ce5fa..efa275ed3be 100644
--- a/src/server/game/Achievements/AchievementMgr.h
+++ b/src/server/game/Achievements/AchievementMgr.h
@@ -26,6 +26,7 @@
#include "DatabaseEnv.h"
#include "DBCEnums.h"
#include "DBCStores.h"
+#include "ObjectGuid.h"
class Unit;
class Player;
@@ -41,7 +42,7 @@ struct CriteriaProgress
{
uint64 counter;
time_t date; // latest update time.
- uint64 CompletedGUID; // GUID of the player that completed this criteria (guild achievements)
+ ObjectGuid CompletedGUID; // GUID of the player that completed this criteria (guild achievements)
bool changed;
};
@@ -233,7 +234,7 @@ typedef std::unordered_map<uint32, AchievementRewardLocale> AchievementRewardLoc
struct CompletedAchievementData
{
time_t date;
- std::set<uint64> guids;
+ GuidSet guids;
bool changed;
};
@@ -255,7 +256,7 @@ class AchievementMgr
~AchievementMgr();
void Reset();
- static void DeleteFromDB(uint32 lowguid);
+ static void DeleteFromDB(ObjectGuid lowguid);
void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult);
void SaveToDB(SQLTransaction& trans);
void ResetAchievementCriteria(AchievementCriteriaTypes type, uint64 miscValue1 = 0, uint64 miscValue2 = 0, bool evenIfCriteriaComplete = false);
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 40935a0712c..2479c8fa2f0 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -92,7 +92,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
return;
uint32 bidderAccId = 0;
- uint64 bidderGuid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
+ ObjectGuid bidderGuid(HIGHGUID_PLAYER, auction->bidder);
Player* bidder = ObjectAccessor::FindPlayer(bidderGuid);
// data for gm.log
std::string bidderName;
@@ -115,11 +115,12 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
if (logGmTrade)
{
+ ObjectGuid ownerGuid = ObjectGuid(HIGHGUID_PLAYER, auction->owner);
std::string ownerName;
- if (!sObjectMgr->GetPlayerNameByGUID(auction->owner, ownerName))
+ if (!sObjectMgr->GetPlayerNameByGUID(ownerGuid, ownerName))
ownerName = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
- uint32 ownerAccId = sObjectMgr->GetPlayerAccountIdByGUID(auction->owner);
+ uint32 ownerAccId = sObjectMgr->GetPlayerAccountIdByGUID(ownerGuid);
sLog->outCommand(bidderAccId, "GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
bidderName.c_str(), bidderAccId, pItem->GetTemplate()->Name1.c_str(), pItem->GetEntry(), pItem->GetCount(), auction->bid, ownerName.c_str(), ownerAccId);
@@ -150,7 +151,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTransaction& trans)
{
- uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
+ ObjectGuid owner_guid(HIGHGUID_PLAYER, auction->owner);
Player* owner = ObjectAccessor::FindPlayer(owner_guid);
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
// owner exist (online or offline)
@@ -162,7 +163,7 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTrans
//call this method to send mail to auction owner, when auction is successful, it does not clear ram
void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransaction& trans)
{
- uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
+ ObjectGuid owner_guid(HIGHGUID_PLAYER, auction->owner);
Player* owner = ObjectAccessor::FindPlayer(owner_guid);
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
// owner exist
@@ -193,7 +194,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
if (!pItem)
return;
- uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
+ ObjectGuid owner_guid(HIGHGUID_PLAYER, auction->owner);
Player* owner = ObjectAccessor::FindPlayer(owner_guid);
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
// owner exist
@@ -211,7 +212,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
//this function sends mail to old bidder
void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans)
{
- uint64 oldBidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
+ ObjectGuid oldBidder_guid(HIGHGUID_PLAYER, auction->bidder);
Player* oldBidder = ObjectAccessor::FindPlayer(oldBidder_guid);
uint32 oldBidder_accId = 0;
@@ -233,7 +234,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
//this function sends mail, when auction is cancelled to old bidder
void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans, Item* item)
{
- uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
+ ObjectGuid bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
Player* bidder = ObjectAccessor::FindPlayer(bidder_guid);
uint32 bidder_accId = 0;
@@ -291,7 +292,7 @@ void AuctionHouseMgr::LoadAuctionItems()
}
Item* item = NewItemOrBag(proto);
- if (!item->LoadFromDB(item_guid, 0, fields, itemEntry))
+ if (!item->LoadFromDB(item_guid, ObjectGuid::Empty, fields, itemEntry))
{
delete item;
continue;
@@ -851,7 +852,7 @@ std::string AuctionEntry::BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint3
{
std::ostringstream strm;
strm.width(16);
- strm << std::right << std::hex << MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER); // HIGHGUID_PLAYER always present, even for empty guids
+ strm << std::right << std::hex << ObjectGuid(HIGHGUID_PLAYER, lowGuid).GetRawValue(); // HIGHGUID_PLAYER always present, even for empty guids
strm << std::dec << ':' << bid << ':' << buyout;
strm << ':' << deposit << ':' << cut;
return strm.str();
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 935dd8d72f9..24eb7c8664e 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -37,7 +37,6 @@ Battlefield::Battlefield()
m_isActive = false;
m_DefenderTeam = TEAM_NEUTRAL;
- m_Guid = 0;
m_TypeId = 0;
m_BattleId = 0;
m_ZoneId = 0;
@@ -57,7 +56,6 @@ Battlefield::Battlefield()
m_LastResurrectTimer = 30 * IN_MILLISECONDS;
m_StartGroupingTimer = 0;
m_StartGrouping = false;
- StalkerGuid = 0;
}
Battlefield::~Battlefield()
@@ -300,7 +298,7 @@ void Battlefield::KickAfkPlayers()
KickPlayerFromBattlefield(*itr);
}
-void Battlefield::KickPlayerFromBattlefield(uint64 guid)
+void Battlefield::KickPlayerFromBattlefield(ObjectGuid guid)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
if (player->GetZoneId() == GetZoneId())
@@ -360,10 +358,7 @@ void Battlefield::DoPlaySoundToAll(uint32 SoundID)
data << uint32(SoundID);
data << uint64(0);
- for (int team = 0; team < BG_TEAMS_COUNT; team++)
- for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
- if (Player* player = ObjectAccessor::FindPlayer(*itr))
- player->SendDirectMessage(&data);
+ BroadcastPacketToWar(data);
}
bool Battlefield::HasPlayer(Player* player) const
@@ -446,18 +441,10 @@ void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
player->SendDirectMessage(&data);
}
-void Battlefield::SendWarningToAllInZone(uint32 entry)
+void Battlefield::SendWarning(uint8 id, WorldObject const* target /*= nullptr*/)
{
if (Creature* stalker = GetCreature(StalkerGuid))
- // FIXME: replaced CHAT_TYPE_END with CHAT_MSG_BG_SYSTEM_NEUTRAL to fix compile, it's a guessed change :/
- sCreatureTextMgr->SendChat(stalker, (uint8) entry, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_ADDON, TEXT_RANGE_ZONE);
-}
-
-void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
-{
- if (player)
- if (Creature* stalker = GetCreature(StalkerGuid))
- sCreatureTextMgr->SendChat(stalker, (uint8)entry, player);
+ sCreatureTextMgr->SendChat(stalker, id, target);
}
void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
@@ -503,17 +490,17 @@ void Battlefield::ShowNpc(Creature* creature, bool aggressive)
Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
{
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
- if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
+ if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter()))
if (!group->IsFull())
return group;
return NULL;
}
-Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId)
+Group* Battlefield::GetGroupPlayer(ObjectGuid guid, TeamId TeamId)
{
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
- if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
+ if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter()))
if (group->IsMember(guid))
return group;
@@ -598,7 +585,7 @@ WorldSafeLocsEntry const* Battlefield::GetClosestGraveYard(Player* player)
return NULL;
}
-void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
+void Battlefield::AddPlayerToResurrectQueue(ObjectGuid npcGuid, ObjectGuid playerGuid)
{
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
{
@@ -613,7 +600,7 @@ void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
}
}
-void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
+void Battlefield::RemovePlayerFromResurrectQueue(ObjectGuid playerGuid)
{
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
{
@@ -628,7 +615,7 @@ void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
}
}
-void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid)
+void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, ObjectGuid guid)
{
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
uint32 time = m_LastResurrectTimer; // resurrect every 30 seconds
@@ -645,8 +632,8 @@ BfGraveyard::BfGraveyard(Battlefield* battlefield)
m_Bf = battlefield;
m_GraveyardId = 0;
m_ControlTeam = TEAM_NEUTRAL;
- m_SpiritGuide[0] = 0;
- m_SpiritGuide[1] = 0;
+ m_SpiritGuide[0].Clear();
+ m_SpiritGuide[1].Clear();
}
void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId)
@@ -673,7 +660,7 @@ float BfGraveyard::GetDistance(Player* player)
return player->GetDistance2d(safeLoc->x, safeLoc->y);
}
-void BfGraveyard::AddPlayer(uint64 playerGuid)
+void BfGraveyard::AddPlayer(ObjectGuid playerGuid)
{
if (!m_ResurrectQueue.count(playerGuid))
{
@@ -684,7 +671,7 @@ void BfGraveyard::AddPlayer(uint64 playerGuid)
}
}
-void BfGraveyard::RemovePlayer(uint64 playerGuid)
+void BfGraveyard::RemovePlayer(ObjectGuid playerGuid)
{
m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid));
@@ -756,7 +743,7 @@ void BfGraveyard::RelocateDeadPlayers()
}
}
-bool BfGraveyard::HasNpc(uint64 guid)
+bool BfGraveyard::HasNpc(ObjectGuid guid)
{
if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
return false;
@@ -837,25 +824,25 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
return go;
}
-Creature* Battlefield::GetCreature(uint64 GUID)
+Creature* Battlefield::GetCreature(ObjectGuid guid)
{
if (!m_Map)
return NULL;
- return m_Map->GetCreature(GUID);
+ return m_Map->GetCreature(guid);
}
-GameObject* Battlefield::GetGameObject(uint64 GUID)
+GameObject* Battlefield::GetGameObject(ObjectGuid guid)
{
if (!m_Map)
return NULL;
- return m_Map->GetGameObject(GUID);
+ return m_Map->GetGameObject(guid);
}
// *******************************************************
// ******************* CapturePoint **********************
// *******************************************************
-BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePointGUID(0)
+BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePointGUID()
{
m_team = TEAM_NEUTRAL;
m_value = 0;
@@ -920,7 +907,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint)
TC_LOG_DEBUG("bg.battlefield", "Creating capture point %u", capturePoint->GetEntry());
- m_capturePointGUID = MAKE_NEW_GUID(capturePoint->GetGUIDLow(), capturePoint->GetEntry(), HIGHGUID_GAMEOBJECT);
+ m_capturePointGUID = ObjectGuid(HIGHGUID_GAMEOBJECT, capturePoint->GetEntry(), capturePoint->GetGUIDLow());
// check info existence
GameObjectTemplate const* goinfo = capturePoint->GetGOInfo();
@@ -965,7 +952,7 @@ bool BfCapturePoint::DelCapturePoint()
capturePoint->Delete();
capturePoint = NULL;
}
- m_capturePointGUID = 0;
+ m_capturePointGUID.Clear();
}
return true;
@@ -1101,7 +1088,7 @@ void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
player->SendUpdateWorldState(field, value);
}
-void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
+void BfCapturePoint::SendObjectiveComplete(uint32 id, ObjectGuid guid)
{
uint8 team;
switch (m_State)
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
index e4fe45d45d5..b09350bb770 100644
--- a/src/server/game/Battlefield/Battlefield.h
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -65,9 +65,8 @@ class Unit;
class Battlefield;
class BfGraveyard;
-typedef std::set<uint64> GuidSet;
typedef std::vector<BfGraveyard*> GraveyardVect;
-typedef std::map<uint64, time_t> PlayerTimerMap;
+typedef std::map<ObjectGuid, time_t> PlayerTimerMap;
class BfCapturePoint
{
@@ -82,7 +81,7 @@ class BfCapturePoint
void SendUpdateWorldState(uint32 field, uint32 value);
// Send kill notify to players in the controlling faction
- void SendObjectiveComplete(uint32 id, uint64 guid);
+ void SendObjectiveComplete(uint32 id, ObjectGuid guid);
// Used when player is activated/inactivated in the area
virtual bool HandlePlayerEnter(Player* player);
@@ -133,7 +132,7 @@ class BfCapturePoint
uint32 m_capturePointEntry;
// Gameobject related to that capture point
- uint64 m_capturePointGUID;
+ ObjectGuid m_capturePointGUID;
};
class BfGraveyard
@@ -155,10 +154,10 @@ class BfGraveyard
void SetSpirit(Creature* spirit, TeamId team);
// Add a player to the graveyard
- void AddPlayer(uint64 player_guid);
+ void AddPlayer(ObjectGuid player_guid);
// Remove a player from the graveyard
- void RemovePlayer(uint64 player_guid);
+ void RemovePlayer(ObjectGuid player_guid);
// Resurrect players
void Resurrect();
@@ -167,10 +166,10 @@ class BfGraveyard
void RelocateDeadPlayers();
// Check if this graveyard has a spirit guide
- bool HasNpc(uint64 guid);
+ bool HasNpc(ObjectGuid guid);
// Check if a player is in this graveyard's resurrect queue
- bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
+ bool HasPlayer(ObjectGuid guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
// Get the graveyard's ID.
uint32 GetGraveyardId() const { return m_GraveyardId; }
@@ -178,7 +177,7 @@ class BfGraveyard
protected:
TeamId m_ControlTeam;
uint32 m_GraveyardId;
- uint64 m_SpiritGuide[BG_TEAMS_COUNT];
+ ObjectGuid m_SpiritGuide[BG_TEAMS_COUNT];
GuidSet m_ResurrectQueue;
Battlefield* m_Bf;
};
@@ -223,7 +222,7 @@ class Battlefield : public ZoneScript
uint32 GetTypeId() { return m_TypeId; }
uint32 GetZoneId() { return m_ZoneId; }
- uint64 GetGUID() { return m_Guid; }
+ ObjectGuid GetGUID() { return m_Guid; }
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
@@ -239,7 +238,7 @@ class Battlefield : public ZoneScript
* \brief Kick player from battlefield and teleport him to kick-point location
* \param guid : guid of player who must be kick
*/
- void KickPlayerFromBattlefield(uint64 guid);
+ void KickPlayerFromBattlefield(ObjectGuid guid);
/// Called when player (player) enter in zone
void HandlePlayerEnterZone(Player* player, uint32 zone);
@@ -268,7 +267,7 @@ class Battlefield : public ZoneScript
*/
Group* GetFreeBfRaid(TeamId TeamId);
/// Return battlefield group where player is.
- Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
+ Group* GetGroupPlayer(ObjectGuid guid, TeamId TeamId);
/// Force player to join a battlefield group
bool AddOrSetPlayerToCorrectBfGroup(Player* player);
@@ -276,8 +275,8 @@ class Battlefield : public ZoneScript
// Find which graveyard the player must be teleported to to be resurrected by spiritguide
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
- virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
- void RemovePlayerFromResurrectQueue(uint64 player_guid);
+ virtual void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid);
+ void RemovePlayerFromResurrectQueue(ObjectGuid player_guid);
void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
BfGraveyard* GetGraveyardById(uint32 id) const;
@@ -286,8 +285,8 @@ class Battlefield : public ZoneScript
Creature* SpawnCreature(uint32 entry, Position const& pos, TeamId /*teamId*/);
GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
- Creature* GetCreature(uint64 GUID);
- GameObject* GetGameObject(uint64 GUID);
+ Creature* GetCreature(ObjectGuid guid);
+ GameObject* GetGameObject(ObjectGuid guid);
// Script-methods
@@ -306,8 +305,7 @@ class Battlefield : public ZoneScript
/// Called when a player enter in battlefield zone
virtual void OnPlayerEnterZone(Player* /*player*/) { }
- void SendWarningToAllInZone(uint32 entry);
- void SendWarningToPlayer(Player* player, uint32 entry);
+ void SendWarning(uint8 id, WorldObject const* target = nullptr);
void PlayerAcceptInviteToQueue(Player* player);
void PlayerAcceptInviteToWar(Player* player);
@@ -323,7 +321,7 @@ class Battlefield : public ZoneScript
/// Return if we can use mount in battlefield
bool CanFlyIn() { return !m_isActive; }
- void SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid);
+ void SendAreaSpiritHealerQueryOpcode(Player* player, ObjectGuid guid);
void StartBattle();
void EndBattle(bool endByTimer);
@@ -344,9 +342,9 @@ class Battlefield : public ZoneScript
void InitStalker(uint32 entry, Position const& pos);
protected:
- uint64 m_Guid;
+ ObjectGuid m_Guid;
- uint64 StalkerGuid;
+ ObjectGuid StalkerGuid;
uint32 m_Timer; // Global timer for event
bool m_IsEnabled;
bool m_isActive;
diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp
index c531e22bc20..eec9797ba1b 100644
--- a/src/server/game/Battlefield/BattlefieldMgr.cpp
+++ b/src/server/game/Battlefield/BattlefieldMgr.cpp
@@ -123,7 +123,7 @@ Battlefield* BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleId)
return NULL;
}
-Battlefield* BattlefieldMgr::GetBattlefieldByGUID(uint64 guid)
+Battlefield* BattlefieldMgr::GetBattlefieldByGUID(ObjectGuid guid)
{
for (BattlefieldSet::iterator itr = _battlefieldSet.begin(); itr != _battlefieldSet.end(); ++itr)
if ((*itr)->GetGUID() == guid)
diff --git a/src/server/game/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h
index 0fa4add13a8..8150f7e1ef7 100644
--- a/src/server/game/Battlefield/BattlefieldMgr.h
+++ b/src/server/game/Battlefield/BattlefieldMgr.h
@@ -44,7 +44,7 @@ class BattlefieldMgr
// return assigned battlefield
Battlefield* GetBattlefieldToZoneId(uint32 zoneId);
Battlefield* GetBattlefieldByBattleId(uint32 battleId);
- Battlefield* GetBattlefieldByGUID(uint64 guid);
+ Battlefield* GetBattlefieldByGUID(ObjectGuid guid);
ZoneScript* GetZoneScript(uint32 zoneId);
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
index e05c918f501..360d2d68bc3 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -268,7 +268,7 @@ void BattlefieldWG::OnBattleStart()
// Initialize vehicle counter
UpdateCounterVehicle(true);
// Send start warning to all players
- SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START);
+ SendWarning(BATTLEFIELD_WG_TEXT_START);
}
void BattlefieldWG::UpdateCounterVehicle(bool init)
@@ -301,7 +301,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
if (m_titansRelicGUID)
if (GameObject* relic = GetGameObject(m_titansRelicGUID))
relic->RemoveFromWorld();
- m_titansRelicGUID = 0;
+ m_titansRelicGUID.Clear();
// Remove turret
for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
@@ -409,9 +409,9 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
}
if (!endByTimer) // win alli/horde
- SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1);
+ SendWarning((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1);
else // defend alli/horde
- SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1);
+ SendWarning((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1);
}
// *******************************************************
@@ -442,7 +442,7 @@ void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player*
void BattlefieldWG::OnStartGrouping()
{
- SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START);
+ SendWarning(BATTLEFIELD_WG_TEXT_WILL_START);
}
uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) const
@@ -689,7 +689,7 @@ void BattlefieldWG::PromotePlayer(Player* killer)
{
killer->RemoveAura(SPELL_RECRUIT);
killer->CastSpell(killer, SPELL_CORPORAL, true);
- SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_FIRSTRANK);
+ SendWarning(BATTLEFIELD_WG_TEXT_FIRSTRANK, killer);
}
else
killer->CastSpell(killer, SPELL_RECRUIT, true);
@@ -700,7 +700,7 @@ void BattlefieldWG::PromotePlayer(Player* killer)
{
killer->RemoveAura(SPELL_CORPORAL);
killer->CastSpell(killer, SPELL_LIEUTENANT, true);
- SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_SECONDRANK);
+ SendWarning(BATTLEFIELD_WG_TEXT_SECONDRANK, killer);
}
else
killer->CastSpell(killer, SPELL_CORPORAL, true);
@@ -1065,7 +1065,6 @@ BfWGGameObjectBuilding::BfWGGameObjectBuilding(BattlefieldWG* wg)
{
m_WG = wg;
m_Team = 0;
- m_BuildGUID = 0;
m_Type = 0;
m_WorldState = 0;
m_State = 0;
@@ -1117,13 +1116,13 @@ void BfWGGameObjectBuilding::Damaged()
// Send warning message
if (m_NameId) // tower damage + name
- m_WG->SendWarningToAllInZone(m_NameId);
+ m_WG->SendWarning(m_NameId);
- for (uint64 guid : m_CreatureTopList[m_WG->GetAttackerTeam()])
+ for (ObjectGuid guid : m_CreatureTopList[m_WG->GetAttackerTeam()])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
- for (uint64 guid : m_TurretTopList)
+ for (ObjectGuid guid : m_TurretTopList)
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
@@ -1141,7 +1140,7 @@ void BfWGGameObjectBuilding::Destroyed()
// Warn players
if (m_NameId)
- m_WG->SendWarningToAllInZone(m_NameId);
+ m_WG->SendWarning(m_NameId);
switch (m_Type)
{
@@ -1331,34 +1330,34 @@ void BfWGGameObjectBuilding::Init(GameObject* go, uint32 type, uint32 worldstate
void BfWGGameObjectBuilding::UpdateCreatureAndGo()
{
- for (uint64 guid : m_CreatureTopList[m_WG->GetDefenderTeam()])
+ for (ObjectGuid guid : m_CreatureTopList[m_WG->GetDefenderTeam()])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
- for (uint64 guid : m_CreatureTopList[m_WG->GetAttackerTeam()])
+ for (ObjectGuid guid : m_CreatureTopList[m_WG->GetAttackerTeam()])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->ShowNpc(creature, true);
- for (uint64 guid : m_CreatureBottomList[m_WG->GetDefenderTeam()])
+ for (ObjectGuid guid : m_CreatureBottomList[m_WG->GetDefenderTeam()])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
- for (uint64 guid : m_CreatureBottomList[m_WG->GetAttackerTeam()])
+ for (ObjectGuid guid : m_CreatureBottomList[m_WG->GetAttackerTeam()])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->ShowNpc(creature, true);
- for (uint64 guid : m_GameObjectList[m_WG->GetDefenderTeam()])
+ for (ObjectGuid guid : m_GameObjectList[m_WG->GetDefenderTeam()])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_ONE_DAY);
- for (uint64 guid : m_GameObjectList[m_WG->GetAttackerTeam()])
+ for (ObjectGuid guid : m_GameObjectList[m_WG->GetAttackerTeam()])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_IMMEDIATELY);
}
void BfWGGameObjectBuilding::UpdateTurretAttack(bool disable)
{
- for (uint64 guid : m_TowerCannonBottomList)
+ for (ObjectGuid guid : m_TowerCannonBottomList)
{
if (Creature* creature = m_WG->GetCreature(guid))
{
@@ -1391,7 +1390,7 @@ void BfWGGameObjectBuilding::UpdateTurretAttack(bool disable)
}
}
- for (uint64 guid : m_TurretTopList)
+ for (ObjectGuid guid : m_TurretTopList)
{
if (Creature* creature = m_WG->GetCreature(guid))
{
@@ -1448,7 +1447,7 @@ void WGWorkshop::GiveControlTo(uint8 team, bool init)
{
// Send warning message to all player to inform a faction attack to a workshop
// alliance / horde attacking a workshop
- bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1);
+ bf->SendWarning(teamControl ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1);
break;
}
case BATTLEFIELD_WG_TEAM_ALLIANCE:
@@ -1460,7 +1459,7 @@ void WGWorkshop::GiveControlTo(uint8 team, bool init)
// Warning message
if (!init) // workshop taken - alliance
- bf->SendWarningToAllInZone(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1);
+ bf->SendWarning(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1);
// Found associate graveyard and update it
if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
@@ -1492,7 +1491,6 @@ void WGWorkshop::Save()
WintergraspWorkshopData::WintergraspWorkshopData(BattlefieldWG* wg)
{
m_WG = wg;
- m_BuildGUID = 0;
m_Type = 0;
m_State = 0;
m_WorldState = 0;
@@ -1532,28 +1530,28 @@ void WintergraspWorkshopData::GiveControlTo(uint8 team, bool init)
{
// Send warning message to all player for inform a faction attack a workshop
// alliance / horde attacking workshop
- m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1);
+ m_WG->SendWarning(m_TeamControl ? m_NameId : m_NameId + 1);
break;
}
case BATTLEFIELD_WG_TEAM_ALLIANCE:
{
// Show Alliance creature
- for (uint64 guid : m_CreatureOnPoint[TEAM_ALLIANCE])
+ for (ObjectGuid guid : m_CreatureOnPoint[TEAM_ALLIANCE])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->ShowNpc(creature, creature->GetEntry() != 30499);
// Hide Horde creature
- for (uint64 guid : m_CreatureOnPoint[TEAM_HORDE])
+ for (ObjectGuid guid : m_CreatureOnPoint[TEAM_HORDE])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
// Show Alliance gameobject
- for (uint64 guid : m_GameObjectOnPoint[TEAM_ALLIANCE])
+ for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_ALLIANCE])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_IMMEDIATELY);
// Hide Horde gameobject
- for (uint64 guid : m_GameObjectOnPoint[TEAM_HORDE])
+ for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_HORDE])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_ONE_DAY);
@@ -1564,7 +1562,7 @@ void WintergraspWorkshopData::GiveControlTo(uint8 team, bool init)
// Warning message
if (!init) // workshop taken - alliance
- m_WG->SendWarningToAllInZone(m_NameId);
+ m_WG->SendWarning(m_NameId);
// Found associate graveyard and update it
if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
@@ -1577,22 +1575,22 @@ void WintergraspWorkshopData::GiveControlTo(uint8 team, bool init)
case BATTLEFIELD_WG_TEAM_HORDE:
{
// Show Horde creature
- for (uint64 guid : m_CreatureOnPoint[TEAM_HORDE])
+ for (ObjectGuid guid : m_CreatureOnPoint[TEAM_HORDE])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->ShowNpc(creature, creature->GetEntry() != 30400);
// Hide Alliance creature
- for (uint64 guid : m_CreatureOnPoint[TEAM_ALLIANCE])
+ for (ObjectGuid guid : m_CreatureOnPoint[TEAM_ALLIANCE])
if (Creature* creature = m_WG->GetCreature(guid))
m_WG->HideNpc(creature);
// Hide Alliance gameobject
- for (uint64 guid : m_GameObjectOnPoint[TEAM_ALLIANCE])
+ for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_ALLIANCE])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_ONE_DAY);
// Show Horde gameobject
- for (uint64 guid : m_GameObjectOnPoint[TEAM_HORDE])
+ for (ObjectGuid guid : m_GameObjectOnPoint[TEAM_HORDE])
if (GameObject* object = m_WG->GetGameObject(guid))
object->SetRespawnTime(RESPAWN_IMMEDIATELY);
@@ -1602,7 +1600,7 @@ void WintergraspWorkshopData::GiveControlTo(uint8 team, bool init)
// Warning message
if (!init) // workshop taken - horde
- m_WG->SendWarningToAllInZone(m_NameId + 1);
+ m_WG->SendWarning(m_NameId + 1);
// Update graveyard control
if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h
index 622236b4162..7f2e6194222 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.h
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h
@@ -383,7 +383,7 @@ class BattlefieldWG : public Battlefield
GameObject* GetRelic() { return GetGameObject(m_titansRelicGUID); }
/// Define relic object
- void SetRelic(uint64 relicGUID) { m_titansRelicGUID = relicGUID; }
+ void SetRelic(ObjectGuid relicGUID) { m_titansRelicGUID = relicGUID; }
/// Check if players can interact with the relic (Only if the last door has been broken)
bool CanInteractWithRelic() { return m_isRelicInteractible; }
@@ -429,7 +429,7 @@ class BattlefieldWG : public Battlefield
uint32 m_tenacityStack;
uint32 m_saveTimer;
- uint64 m_titansRelicGUID;
+ ObjectGuid m_titansRelicGUID;
};
uint32 const VehNumWorldState[] = { 3680, 3490 };
@@ -578,7 +578,7 @@ struct WintergraspBuildingSpawnData
struct WintergraspRebuildableBuildingData
{
- uint64 Guid;
+ ObjectGuid Guid;
uint32 entry;
uint32 WorldState;
float x;
@@ -1068,7 +1068,7 @@ struct BfWGGameObjectBuilding
BattlefieldWG* m_WG;
// Linked gameobject
- uint64 m_BuildGUID;
+ ObjectGuid m_BuildGUID;
// eWGGameObjectBuildingType
uint32 m_Type;
@@ -1132,7 +1132,7 @@ struct WGWorkshop
struct WintergraspWorkshopData
{
BattlefieldWG* m_WG; // Pointer to wintergrasp
- uint64 m_BuildGUID;
+ ObjectGuid m_BuildGUID;
uint32 m_Type;
uint32 m_State; // For worldstate
uint32 m_WorldState;
diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp
index 7a72afa2b12..39fff2529b9 100644
--- a/src/server/game/Battlegrounds/Arena.cpp
+++ b/src/server/game/Battlegrounds/Arena.cpp
@@ -62,7 +62,7 @@ void Arena::AddPlayer(Player* player)
UpdateArenaWorldState();
}
-void Arena::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
+void Arena::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -94,7 +94,7 @@ void Arena::HandleKillPlayer(Player* player, Player* killer)
CheckWinConditions();
}
-void Arena::RemovePlayerAtLeave(uint64 guid, bool transport, bool sendPacket)
+void Arena::RemovePlayerAtLeave(ObjectGuid guid, bool transport, bool sendPacket)
{
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
{
@@ -180,7 +180,7 @@ void Arena::EndBattleground(uint32 winner)
if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
for (auto const& score : PlayerScores)
- if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(score.first, 0, HIGHGUID_PLAYER)))
+ if (Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, score.first)))
{
TC_LOG_DEBUG("bg.arena", "Statistics match Type: %u for %s (GUID: %u, Team: %d, IP: %s): %s",
GetArenaType(), player->GetName().c_str(), score.first, player->GetArenaTeamId(GetArenaType() == 5 ? 2 : GetArenaType() == 3),
diff --git a/src/server/game/Battlegrounds/Arena.h b/src/server/game/Battlegrounds/Arena.h
index 8aea92d496d..4f622618bd4 100644
--- a/src/server/game/Battlegrounds/Arena.h
+++ b/src/server/game/Battlegrounds/Arena.h
@@ -42,7 +42,7 @@ class Arena : public Battleground
Arena();
void AddPlayer(Player* player) override;
- void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) override;
+ void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) override;
void FillInitialWorldStates(WorldPacket& data) override;
void UpdateArenaWorldState();
@@ -50,7 +50,7 @@ class Arena : public Battleground
void HandleKillPlayer(Player* player, Player* killer) override;
private:
- void RemovePlayerAtLeave(uint64 guid, bool transport, bool sendPacket) override;
+ void RemovePlayerAtLeave(ObjectGuid guid, bool transport, bool sendPacket) override;
void CheckWinConditions() override;
void EndBattleground(uint32 winner) override;
};
diff --git a/src/server/game/Battlegrounds/ArenaScore.h b/src/server/game/Battlegrounds/ArenaScore.h
index 6de7fae8d05..a1847f546ea 100644
--- a/src/server/game/Battlegrounds/ArenaScore.h
+++ b/src/server/game/Battlegrounds/ArenaScore.h
@@ -28,7 +28,7 @@ struct ArenaScore : public BattlegroundScore
friend class Arena;
protected:
- ArenaScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), TeamId(team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE) { }
+ ArenaScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), TeamId(team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE) { }
void AppendToPacket(WorldPacket& data, ByteBuffer& content) final override
{
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index d55fe33e192..c26238cdc9c 100644
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -17,17 +17,17 @@
*/
#include "ObjectMgr.h"
+#include "Player.h"
#include "WorldPacket.h"
#include "ArenaTeam.h"
#include "World.h"
#include "Group.h"
#include "ArenaTeamMgr.h"
-#include "Player.h"
#include "WorldSession.h"
#include "Opcodes.h"
ArenaTeam::ArenaTeam()
- : TeamId(0), Type(0), TeamName(), CaptainGuid(0), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
+ : TeamId(0), Type(0), TeamName(), CaptainGuid(), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
BorderStyle(0), BorderColor(0)
{
Stats.WeekGames = 0;
@@ -41,16 +41,14 @@ ArenaTeam::ArenaTeam()
ArenaTeam::~ArenaTeam()
{ }
-bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& arenaTeamName,
- uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor,
- uint8 borderStyle, uint32 borderColor)
+bool ArenaTeam::Create(ObjectGuid captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
{
// Check if captain is present
if (!ObjectAccessor::FindPlayer(captainGuid))
return false;
// Check if arena team name is already taken
- if (sArenaTeamMgr->GetArenaTeamByName(arenaTeamName))
+ if (sArenaTeamMgr->GetArenaTeamByName(teamName))
return false;
// Generate new arena team id
@@ -59,13 +57,13 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& arenaT
// Assign member variables
CaptainGuid = captainGuid;
Type = type;
- TeamName = arenaTeamName;
+ TeamName = teamName;
BackgroundColor = backgroundColor;
EmblemStyle = emblemStyle;
EmblemColor = emblemColor;
BorderStyle = borderStyle;
BorderColor = borderColor;
- uint32 captainLowGuid = GUID_LOPART(captainGuid);
+ uint32 captainLowGuid = captainGuid.GetCounter();
// Save arena team to db
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM);
@@ -88,7 +86,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& arenaT
return true;
}
-bool ArenaTeam::AddMember(uint64 playerGuid)
+bool ArenaTeam::AddMember(ObjectGuid playerGuid)
{
std::string playerName;
uint8 playerClass;
@@ -109,7 +107,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// 0 1
// SELECT name, class FROM characters WHERE guid = ?
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_CLASS);
- stmt->setUInt32(0, GUID_LOPART(playerGuid));
+ stmt->setUInt32(0, playerGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
@@ -122,7 +120,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// Check if player is already in a similar arena team
if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0)
{
- TC_LOG_DEBUG("bg.arena", "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
+ TC_LOG_DEBUG("bg.arena", "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), playerGuid.GetCounter(), GetType());
return false;
}
@@ -136,7 +134,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// Try to get player's match maker rating from db and fall back to config setting if not found
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MATCH_MAKER_RATING);
- stmt->setUInt32(0, GUID_LOPART(playerGuid));
+ stmt->setUInt32(0, playerGuid.GetCounter());
stmt->setUInt8(1, GetSlot());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -167,7 +165,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// Save player's arena team membership to db
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER);
stmt->setUInt32(0, TeamId);
- stmt->setUInt32(1, GUID_LOPART(playerGuid));
+ stmt->setUInt32(1, playerGuid.GetCounter());
CharacterDatabase.Execute(stmt);
// Inform player if online
@@ -181,7 +179,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
}
- TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId(), GetName().c_str());
+ TC_LOG_INFO("bg.arena", "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), playerGuid.GetCounter(), GetType(), GetId(), GetName().c_str());
return true;
}
@@ -195,7 +193,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult result)
TeamId = fields[0].GetUInt32();
TeamName = fields[1].GetString();
- CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
+ CaptainGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32());
Type = fields[3].GetUInt8();
BackgroundColor = fields[4].GetUInt32();
EmblemStyle = fields[5].GetUInt8();
@@ -234,7 +232,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
break;
ArenaTeamMember newMember;
- newMember.Guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
+ newMember.Guid = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
newMember.WeekGames = fields[2].GetUInt16();
newMember.WeekWins = fields[3].GetUInt16();
newMember.SeasonGames = fields[4].GetUInt16();
@@ -247,7 +245,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
// Delete member if character information is missing
if (newMember.Name.empty())
{
- TC_LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
+ TC_LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, newMember.Guid.GetCounter());
DelMember(newMember.Guid, true);
continue;
}
@@ -284,7 +282,7 @@ bool ArenaTeam::SetName(std::string const& name)
return true;
}
-void ArenaTeam::SetCaptain(uint64 guid)
+void ArenaTeam::SetCaptain(ObjectGuid guid)
{
// Disable remove/promote buttons
Player* oldCaptain = ObjectAccessor::FindPlayer(GetCaptain());
@@ -296,7 +294,7 @@ void ArenaTeam::SetCaptain(uint64 guid)
// Update database
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_CAPTAIN);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
stmt->setUInt32(1, GetId());
CharacterDatabase.Execute(stmt);
@@ -313,7 +311,7 @@ void ArenaTeam::SetCaptain(uint64 guid)
}
}
-void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
+void ArenaTeam::DelMember(ObjectGuid guid, bool cleanDb)
{
// Remove member from team
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
@@ -337,7 +335,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBER);
stmt->setUInt32(0, GetId());
- stmt->setUInt32(1, GUID_LOPART(guid));
+ stmt->setUInt32(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
}
@@ -347,7 +345,7 @@ void ArenaTeam::Disband(WorldSession* session)
// Broadcast update
if (session)
{
- BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), "");
+ BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, ObjectGuid::Empty, 2, session->GetPlayerName(), GetName(), "");
if (Player* player = session->GetPlayer())
TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u, Name: %s].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId(), GetName().c_str());
}
@@ -471,7 +469,7 @@ void ArenaTeam::NotifyStatsChanged()
SendStats(player->GetSession());
}
-void ArenaTeam::Inspect(WorldSession* session, uint64 guid)
+void ArenaTeam::Inspect(WorldSession* session, ObjectGuid guid)
{
ArenaTeamMember* member = GetMember(guid);
if (!member)
@@ -518,7 +516,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket* packet)
player->GetSession()->SendPacket(packet);
}
-void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3)
+void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3)
{
WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1+1+1);
data << uint8(event);
@@ -558,7 +556,7 @@ void ArenaTeam::MassInviteToEvent(WorldSession* session)
{
if (itr->Guid != session->GetPlayer()->GetGUID())
{
- data.appendPackGUID(itr->Guid);
+ data << itr->Guid.WriteAsPacked();
data << uint8(0); // unk
}
}
@@ -594,7 +592,7 @@ uint8 ArenaTeam::GetTypeBySlot(uint8 slot)
return 0xFF;
}
-bool ArenaTeam::IsMember(uint64 guid) const
+bool ArenaTeam::IsMember(ObjectGuid guid) const
{
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
if (itr->Guid == guid)
@@ -781,7 +779,7 @@ void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32
}
}
-void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 matchmakerRatingChange)
+void ArenaTeam::OfflineMemberLost(ObjectGuid guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
{
// Called for offline player after ending rated arena match!
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
@@ -793,7 +791,7 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, i
itr->ModifyPersonalRating(NULL, mod, GetType());
// update matchmaker rating
- itr->ModifyMatchmakerRating(matchmakerRatingChange, GetSlot());
+ itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot());
// update personal played stats
itr->WeekGames += 1;
@@ -856,11 +854,11 @@ void ArenaTeam::SaveToDB()
stmt->setUInt16(3, itr->SeasonGames);
stmt->setUInt16(4, itr->SeasonWins);
stmt->setUInt32(5, GetId());
- stmt->setUInt32(6, GUID_LOPART(itr->Guid));
+ stmt->setUInt32(6, itr->Guid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHARACTER_ARENA_STATS);
- stmt->setUInt32(0, GUID_LOPART(itr->Guid));
+ stmt->setUInt32(0, itr->Guid.GetCounter());
stmt->setUInt8(1, GetSlot());
stmt->setUInt16(2, itr->MatchMakerRating);
trans->Append(stmt);
@@ -902,7 +900,7 @@ ArenaTeamMember* ArenaTeam::GetMember(const std::string& name)
return NULL;
}
-ArenaTeamMember* ArenaTeam::GetMember(uint64 guid)
+ArenaTeamMember* ArenaTeam::GetMember(ObjectGuid guid)
{
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
if (itr->Guid == guid)
diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h
index 25808f14c1b..038fad50221 100644
--- a/src/server/game/Battlegrounds/ArenaTeam.h
+++ b/src/server/game/Battlegrounds/ArenaTeam.h
@@ -21,6 +21,7 @@
#include "Define.h"
#include "QueryResult.h"
+#include "ObjectGuid.h"
#include <list>
#include <string>
#include <map>
@@ -82,7 +83,7 @@ enum ArenaTeamTypes
struct ArenaTeamMember
{
- uint64 Guid;
+ ObjectGuid Guid;
std::string Name;
uint8 Class;
uint16 WeekGames;
@@ -114,9 +115,7 @@ class ArenaTeam
ArenaTeam();
~ArenaTeam();
- bool Create(uint64 captainGuid, uint8 type, std::string const& teamName,
- uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor,
- uint8 borderStyle, uint32 borderColor);
+ bool Create(ObjectGuid captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
void Disband(WorldSession* session);
void Disband();
@@ -127,25 +126,25 @@ class ArenaTeam
uint8 GetSlot() const { return GetSlotByType(GetType()); }
static uint8 GetSlotByType(uint32 type);
static uint8 GetTypeBySlot(uint8 slot);
- uint64 GetCaptain() const { return CaptainGuid; }
+ ObjectGuid GetCaptain() const { return CaptainGuid; }
std::string const& GetName() const { return TeamName; }
const ArenaTeamStats& GetStats() const { return Stats; }
uint32 GetRating() const { return Stats.Rating; }
uint32 GetAverageMMR(Group* group) const;
- void SetCaptain(uint64 guid);
+ void SetCaptain(ObjectGuid guid);
bool SetName(std::string const& name);
- bool AddMember(uint64 PlayerGuid);
- void DelMember(uint64 guid, bool cleanDb);
+ bool AddMember(ObjectGuid PlayerGuid);
+ void DelMember(ObjectGuid guid, bool cleanDb);
size_t GetMembersSize() const { return Members.size(); }
bool Empty() const { return Members.empty(); }
MemberList::iterator m_membersBegin() { return Members.begin(); }
MemberList::iterator m_membersEnd() { return Members.end(); }
- bool IsMember(uint64 guid) const;
+ bool IsMember(ObjectGuid guid) const;
- ArenaTeamMember* GetMember(uint64 guid);
+ ArenaTeamMember* GetMember(ObjectGuid guid);
ArenaTeamMember* GetMember(std::string const& name);
bool IsFighting() const;
@@ -156,7 +155,7 @@ class ArenaTeam
void SaveToDB();
void BroadcastPacket(WorldPacket* packet);
- void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3);
+ void BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3);
void NotifyStatsChanged();
void MassInviteToEvent(WorldSession* session);
@@ -164,18 +163,20 @@ class ArenaTeam
void Roster(WorldSession* session);
void Query(WorldSession* session);
void SendStats(WorldSession* session);
- void Inspect(WorldSession* session, uint64 guid);
+ void Inspect(WorldSession* session, ObjectGuid guid);
+
+ uint32 GetPoints(uint32 MemberRating);
+ int32 GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
+ int32 GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
+ float GetChanceAgainst(uint32 ownRating, uint32 opponentRating);
+ int32 WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change);
+ void MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange);
+ int32 LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change);
+ void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
+ void OfflineMemberLost(ObjectGuid guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
- static int32 GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
- static int32 GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
- static float GetChanceAgainst(uint32 ownRating, uint32 opponentRating);
- int32 WonAgainst(uint32 ownMMRating, uint32 opponentMMRating, int32& rating_change);
- void MemberWon(Player* player, uint32 againstMatchmakerRating, int32 matchmakerRatingChange = 12);
- int32 LostAgainst(uint32 ownMMRating, uint32 opponentMMRating, int32& rating_change);
- void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 matchmakerRatingChange = -12);
- void OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 matchmakerRatingChange = -12);
void FinishWeek();
void FinishGame(int32 mod);
@@ -185,7 +186,7 @@ class ArenaTeam
uint32 TeamId;
uint8 Type;
std::string TeamName;
- uint64 CaptainGuid;
+ ObjectGuid CaptainGuid;
uint32 BackgroundColor; // ARGB format
uint8 EmblemStyle; // icon id
diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
index 0098c8a1bcb..be7576bcc8a 100644
--- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
@@ -59,7 +59,7 @@ ArenaTeam* ArenaTeamMgr::GetArenaTeamByName(const std::string& arenaTeamName) co
return NULL;
}
-ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(uint64 guid) const
+ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(ObjectGuid guid) const
{
for (ArenaTeamContainer::const_iterator itr = ArenaTeamStore.begin(); itr != ArenaTeamStore.end(); ++itr)
if (itr->second->GetCaptain() == guid)
diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.h b/src/server/game/Battlegrounds/ArenaTeamMgr.h
index eaf39278c28..fb162d63ea9 100644
--- a/src/server/game/Battlegrounds/ArenaTeamMgr.h
+++ b/src/server/game/Battlegrounds/ArenaTeamMgr.h
@@ -37,7 +37,7 @@ public:
ArenaTeam* GetArenaTeamById(uint32 arenaTeamId) const;
ArenaTeam* GetArenaTeamByName(std::string const& arenaTeamName) const;
- ArenaTeam* GetArenaTeamByCaptain(uint64 guid) const;
+ ArenaTeam* GetArenaTeamByCaptain(ObjectGuid guid) const;
void LoadArenaTeams();
void AddArenaTeam(ArenaTeam* arenaTeam);
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 1a1f3b94577..b1189e6c03e 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -43,7 +43,7 @@ namespace Trinity
class BattlegroundChatBuilder
{
public:
- BattlegroundChatBuilder(ChatMsg msgtype, int32 textId, Player const* source, va_list* args = NULL)
+ BattlegroundChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, va_list* args = NULL)
: _msgtype(msgtype), _textId(textId), _source(source), _args(args) { }
void operator()(WorldPacket& data, LocaleConstant loc_idx)
@@ -72,7 +72,7 @@ namespace Trinity
}
ChatMsg _msgtype;
- int32 _textId;
+ uint32 _textId;
Player const* _source;
va_list* _args;
};
@@ -80,7 +80,7 @@ namespace Trinity
class Battleground2ChatBuilder
{
public:
- Battleground2ChatBuilder(ChatMsg msgtype, int32 textId, Player const* source, int32 arg1, int32 arg2)
+ Battleground2ChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, uint32 arg1, uint32 arg2)
: _msgtype(msgtype), _textId(textId), _source(source), _arg1(arg1), _arg2(arg2) { }
void operator()(WorldPacket& data, LocaleConstant loc_idx)
@@ -97,10 +97,10 @@ namespace Trinity
private:
ChatMsg _msgtype;
- int32 _textId;
+ uint32 _textId;
Player const* _source;
- int32 _arg1;
- int32 _arg2;
+ uint32 _arg1;
+ uint32 _arg2;
};
} // namespace Trinity
@@ -114,7 +114,6 @@ void Battleground::BroadcastWorker(Do& _do)
Battleground::Battleground()
{
- m_Guid = 0;
m_TypeID = BATTLEGROUND_TYPE_NONE;
m_RandomTypeID = BATTLEGROUND_TYPE_NONE;
m_InstanceID = 0;
@@ -137,7 +136,6 @@ Battleground::Battleground()
m_IsRated = false;
m_BuffChange = false;
m_IsRandom = false;
- m_Name = "";
m_LevelMin = 0;
m_LevelMax = 0;
m_InBGFreeSlotQueue = false;
@@ -335,10 +333,10 @@ inline void Battleground::_ProcessResurrect(uint32 diff)
{
if (GetReviveQueueSize())
{
- for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
+ for (std::map<ObjectGuid, GuidVector>::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
{
Creature* sh = NULL;
- for (std::vector<uint64>::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
+ for (GuidVector::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
{
Player* player = ObjectAccessor::FindPlayer(*itr2);
if (!player)
@@ -369,7 +367,7 @@ inline void Battleground::_ProcessResurrect(uint32 diff)
}
else if (m_LastResurrectTime > 500) // Resurrect players only half a second later, to see spirit heal effect on NPC
{
- for (std::vector<uint64>::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
+ for (GuidVector::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
{
Player* player = ObjectAccessor::FindPlayer(*itr);
if (!player)
@@ -595,7 +593,7 @@ inline void Battleground::_ProcessLeave(uint32 diff)
}
}
-Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, char const* context) const
+Player* Battleground::_GetPlayer(ObjectGuid guid, bool offlineRemove, char const* context) const
{
Player* player = NULL;
if (!offlineRemove)
@@ -603,7 +601,7 @@ Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, char const* co
player = ObjectAccessor::FindPlayer(guid);
if (!player)
TC_LOG_ERROR("bg.battleground", "Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!",
- context, GUID_LOPART(guid), m_MapId, m_InstanceID);
+ context, guid.GetCounter(), m_MapId, m_InstanceID);
}
return player;
}
@@ -655,7 +653,7 @@ void Battleground::SendPacketToTeam(uint32 TeamID, WorldPacket* packet, Player*
void Battleground::SendChatMessage(Creature* source, uint8 textId, WorldObject* target /*= NULL*/)
{
- sCreatureTextMgr->SendChat(source, textId, target, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
+ sCreatureTextMgr->SendChat(source, textId, target);
}
void Battleground::PlaySoundToAll(uint32 SoundID)
@@ -904,7 +902,7 @@ void Battleground::BlockMovement(Player* player)
player->SetClientControl(player, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave()
}
-void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket)
+void Battleground::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket)
{
uint32 team = GetPlayerTeam(guid);
bool participant = false;
@@ -918,7 +916,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
participant = true;
}
- BattlegroundScoreMap::iterator itr2 = PlayerScores.find(GUID_LOPART(guid));
+ BattlegroundScoreMap::iterator itr2 = PlayerScores.find(guid.GetCounter());
if (itr2 != PlayerScores.end())
{
delete itr2->second; // delete player's score
@@ -1069,7 +1067,6 @@ void Battleground::AddPlayer(Player* player)
// score struct must be created in inherited class
- uint64 guid = player->GetGUID();
uint32 team = player->GetBGTeam();
int32 primaryTree = player->GetPrimaryTalentTree(player->GetActiveSpec());
@@ -1079,7 +1076,7 @@ void Battleground::AddPlayer(Player* player)
bp.PrimaryTree = primaryTree;
// Add to list/maps
- m_Players[guid] = bp;
+ m_Players[player->GetGUID()] = bp;
UpdatePlayersCountByTeam(team, false); // +1 player
@@ -1144,7 +1141,7 @@ void Battleground::AddPlayer(Player* player)
// this method adds player to his team's bg group, or sets his correct group if player is already in bg group
void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team)
{
- uint64 playerGuid = player->GetGUID();
+ ObjectGuid playerGuid = player->GetGUID();
Group* group = GetBgRaid(team);
if (!group) // first player joined
{
@@ -1175,9 +1172,9 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team)
// This method should be called when player logs into running battleground
void Battleground::EventPlayerLoggedIn(Player* player)
{
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
// player is correct pointer
- for (std::deque<uint64>::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr)
+ for (GuidDeque::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr)
{
if (*itr == guid)
{
@@ -1194,7 +1191,7 @@ void Battleground::EventPlayerLoggedIn(Player* player)
// This method should be called when player logs out from running battleground
void Battleground::EventPlayerLoggedOut(Player* player)
{
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
if (!IsPlayerInBattleground(guid)) // Check if this player really is in battleground (might be a GM who teleported inside)
return;
@@ -1358,7 +1355,7 @@ bool Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value,
return true;
}
-void Battleground::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid)
+void Battleground::AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid)
{
m_ReviveQueue[npc_guid].push_back(player_guid);
@@ -1369,15 +1366,15 @@ void Battleground::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid
player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
}
-void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid)
+void Battleground::RemovePlayerFromResurrectQueue(ObjectGuid player_guid)
{
- for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
+ for (std::map<ObjectGuid, GuidVector>::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
{
- for (std::vector<uint64>::iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
+ for (GuidVector::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
{
if (*itr2 == player_guid)
{
- (itr->second).erase(itr2);
+ itr->second.erase(itr2);
if (Player* player = ObjectAccessor::FindPlayer(player_guid))
player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
return;
@@ -1386,14 +1383,14 @@ void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid)
}
}
-void Battleground::RelocateDeadPlayers(uint64 queueIndex)
+void Battleground::RelocateDeadPlayers(ObjectGuid guideGuid)
{
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
- std::vector<uint64>& ghostList = m_ReviveQueue[queueIndex];
+ GuidVector& ghostList = m_ReviveQueue[guideGuid];
if (!ghostList.empty())
{
WorldSafeLocsEntry const* closestGrave = NULL;
- for (std::vector<uint64>::const_iterator itr = ghostList.begin(); itr != ghostList.end(); ++itr)
+ for (GuidVector::const_iterator itr = ghostList.begin(); itr != ghostList.end(); ++itr)
{
Player* player = ObjectAccessor::FindPlayer(*itr);
if (!player)
@@ -1482,7 +1479,7 @@ void Battleground::DoorClose(uint32 type)
}
else
TC_LOG_ERROR("bg.battleground", "Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
- type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
+ type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID);
}
void Battleground::DoorOpen(uint32 type)
@@ -1494,7 +1491,7 @@ void Battleground::DoorOpen(uint32 type)
}
else
TC_LOG_ERROR("bg.battleground", "Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
- type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
+ type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID);
}
GameObject* Battleground::GetBGObject(uint32 type, bool logError)
@@ -1504,10 +1501,10 @@ GameObject* Battleground::GetBGObject(uint32 type, bool logError)
{
if (logError)
TC_LOG_ERROR("bg.battleground", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
- type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
+ type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID);
else
TC_LOG_INFO("bg.battleground", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
- type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
+ type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID);
}
return obj;
}
@@ -1519,10 +1516,10 @@ Creature* Battleground::GetBGCreature(uint32 type, bool logError)
{
if (logError)
TC_LOG_ERROR("bg.battleground", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
- type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
+ type, BgCreatures[type].GetCounter(), m_MapId, m_InstanceID);
else
TC_LOG_INFO("bg.battleground", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
- type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
+ type, BgCreatures[type].GetCounter(), m_MapId, m_InstanceID);
}
return creature;
}
@@ -1599,13 +1596,13 @@ bool Battleground::DelCreature(uint32 type)
if (Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]))
{
creature->AddObjectToRemoveList();
- BgCreatures[type] = 0;
+ BgCreatures[type].Clear();
return true;
}
TC_LOG_ERROR("bg.battleground", "Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
- type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
- BgCreatures[type] = 0;
+ type, BgCreatures[type].GetCounter(), m_MapId, m_InstanceID);
+ BgCreatures[type].Clear();
return false;
}
@@ -1618,12 +1615,12 @@ bool Battleground::DelObject(uint32 type)
{
obj->SetRespawnTime(0); // not save respawn time
obj->Delete();
- BgObjects[type] = 0;
+ BgObjects[type].Clear();
return true;
}
TC_LOG_ERROR("bg.battleground", "Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
- type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
- BgObjects[type] = 0;
+ type, BgObjects[type].GetCounter(), m_MapId, m_InstanceID);
+ BgObjects[type].Clear();
return false;
}
@@ -1634,7 +1631,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
if (Creature* creature = AddCreature(entry, type, x, y, z, o, teamId))
{
creature->setDeathState(DEAD);
- creature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID());
+ creature->SetChannelObjectGuid(creature->GetGUID());
// aura
/// @todo Fix display here
// creature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL);
@@ -1657,7 +1654,7 @@ bool Battleground::AddSpiritGuide(uint32 type, Position const& pos, TeamId teamI
return AddSpiritGuide(type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamId);
}
-void Battleground::SendMessageToAll(int32 entry, ChatMsg type, Player const* source)
+void Battleground::SendMessageToAll(uint32 entry, ChatMsg type, Player const* source)
{
if (!entry)
return;
@@ -1667,7 +1664,7 @@ void Battleground::SendMessageToAll(int32 entry, ChatMsg type, Player const* sou
BroadcastWorker(bg_do);
}
-void Battleground::PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ...)
+void Battleground::PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...)
{
if (!entry)
return;
@@ -1682,7 +1679,7 @@ void Battleground::PSendMessageToAll(int32 entry, ChatMsg type, Player const* so
va_end(ap);
}
-void Battleground::SendWarningToAll(int32 entry, ...)
+void Battleground::SendWarningToAll(uint32 entry, ...)
{
if (!entry)
return;
@@ -1708,7 +1705,7 @@ void Battleground::SendWarningToAll(int32 entry, ...)
}
}
-void Battleground::SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 arg1, int32 arg2)
+void Battleground::SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 arg1, uint32 arg2)
{
Trinity::Battleground2ChatBuilder bg_builder(type, entry, source, arg1, arg2);
Trinity::LocalizedPacketDo<Trinity::Battleground2ChatBuilder> bg_do(bg_builder);
@@ -1722,17 +1719,10 @@ void Battleground::EndNow()
SetRemainingTime(0);
}
-// To be removed
-char const* Battleground::GetTrinityString(int32 entry)
-{
- // FIXME: now we have different DBC locales and need localized message for each target client
- return sObjectMgr->GetTrinityStringForDBCLocale(entry);
-}
-
// IMPORTANT NOTICE:
// buffs aren't spawned/despawned when players captures anything
// buffs are in their positions when battleground starts
-void Battleground::HandleTriggerBuff(uint64 go_guid)
+void Battleground::HandleTriggerBuff(ObjectGuid go_guid)
{
GameObject* obj = GetBgMap()->GetGameObject(go_guid);
if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
@@ -1745,7 +1735,7 @@ void Battleground::HandleTriggerBuff(uint64 go_guid)
if (index < 0)
{
TC_LOG_ERROR("bg.battleground", "Battleground::HandleTriggerBuff: cannot find buff gameobject (GUID: %u, entry: %u, type: %u) in internal data for BG (map: %u, instance id: %u)!",
- GUID_LOPART(go_guid), obj->GetEntry(), obj->GetGoType(), m_MapId, m_InstanceID);
+ go_guid.GetCounter(), obj->GetEntry(), obj->GetGoType(), m_MapId, m_InstanceID);
return;
}
@@ -1805,7 +1795,7 @@ void Battleground::HandleKillPlayer(Player* victim, Player* killer)
// Return the player's team based on battlegroundplayer info
// Used in same faction arena matches mainly
-uint32 Battleground::GetPlayerTeam(uint64 guid) const
+uint32 Battleground::GetPlayerTeam(ObjectGuid guid) const
{
BattlegroundPlayerMap::const_iterator itr = m_Players.find(guid);
if (itr != m_Players.end())
@@ -1818,7 +1808,7 @@ uint32 Battleground::GetOtherTeam(uint32 teamId) const
return teamId ? ((teamId == ALLIANCE) ? HORDE : ALLIANCE) : 0;
}
-bool Battleground::IsPlayerInBattleground(uint64 guid) const
+bool Battleground::IsPlayerInBattleground(ObjectGuid guid) const
{
BattlegroundPlayerMap::const_iterator itr = m_Players.find(guid);
if (itr != m_Players.end())
@@ -1863,13 +1853,13 @@ void Battleground::SetHoliday(bool is_holiday)
m_HonorMode = is_holiday ? BG_HOLIDAY : BG_NORMAL;
}
-int32 Battleground::GetObjectType(uint64 guid)
+int32 Battleground::GetObjectType(ObjectGuid guid)
{
for (uint32 i = 0; i < BgObjects.size(); ++i)
if (BgObjects[i] == guid)
return i;
TC_LOG_ERROR("bg.battleground", "Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
- GUID_LOPART(guid), m_MapId, m_InstanceID);
+ guid.GetCounter(), m_MapId, m_InstanceID);
return -1;
}
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index d445cee42ab..1c4b3de4f76 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -240,7 +240,7 @@ class Battleground
/* Battleground */
// Get methods:
std::string const& GetName() const { return m_Name; }
- uint64 GetGUID() { return m_Guid; }
+ ObjectGuid GetGUID() { return m_Guid; }
BattlegroundTypeId GetTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_TypeID; }
BattlegroundBracketId GetBracketId() const { return m_BracketId; }
uint32 GetInstanceID() const { return m_InstanceID; }
@@ -266,7 +266,7 @@ class Battleground
bool IsRandom() const { return m_IsRandom; }
// Set methods:
- void SetGuid(uint64 newGuid) { m_Guid = newGuid; }
+ void SetGuid(ObjectGuid newGuid) { m_Guid = newGuid; }
void SetName(std::string const& name) { m_Name = name; }
void SetTypeID(BattlegroundTypeId TypeID) { m_TypeID = TypeID; }
void SetRandomTypeID(BattlegroundTypeId TypeID) { m_RandomTypeID = TypeID; }
@@ -308,7 +308,7 @@ class Battleground
bool isBattleground() const { return !m_IsArena; }
bool isRated() const { return m_IsRated; }
- typedef std::map<uint64, BattlegroundPlayer> BattlegroundPlayerMap;
+ typedef std::map<ObjectGuid, BattlegroundPlayer> BattlegroundPlayerMap;
BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
uint32 GetPlayersSize() const { return m_Players.size(); }
@@ -317,11 +317,11 @@ class Battleground
uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
- void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
- void RemovePlayerFromResurrectQueue(uint64 player_guid);
+ void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid);
+ void RemovePlayerFromResurrectQueue(ObjectGuid player_guid);
/// Relocate all players in ReviveQueue to the closest graveyard
- void RelocateDeadPlayers(uint64 queueIndex);
+ void RelocateDeadPlayers(ObjectGuid guideGuid);
void StartBattleground();
@@ -365,12 +365,12 @@ class Battleground
virtual void EndBattleground(uint32 winner);
void BlockMovement(Player* player);
- void SendWarningToAll(int32 entry, ...);
- void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL);
- void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ...);
+ void SendWarningToAll(uint32 entry, ...);
+ void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = NULL);
+ void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...);
// specialized version with 2 string id args
- void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0);
+ void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 strId1 = 0, uint32 strId2 = 0);
// Raid Group
Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE]; }
@@ -414,7 +414,7 @@ class Battleground
virtual void ProcessEvent(WorldObject* /*obj*/, uint32 /*eventId*/, WorldObject* /*invoker*/ = NULL) { }
// this function can be used by spell to interact with the BG map
- virtual void DoAction(uint32 /*action*/, uint64 /*var*/) { }
+ virtual void DoAction(uint32 /*action*/, ObjectGuid /*var*/) { }
virtual void HandlePlayerResurrect(Player* /*player*/) { }
@@ -425,17 +425,15 @@ class Battleground
void AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team);
- virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket);
+ virtual void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket);
// can be extended in in BG subclass
- void HandleTriggerBuff(uint64 go_guid);
+ void HandleTriggerBuff(ObjectGuid go_guid);
void SetHoliday(bool is_holiday);
/// @todo make this protected:
- typedef std::vector<uint64> BGObjects;
- typedef std::vector<uint64> BGCreatures;
- BGObjects BgObjects;
- BGCreatures BgCreatures;
+ GuidVector BgObjects;
+ GuidVector BgCreatures;
void SpawnBGObject(uint32 type, uint32 respawntime);
virtual bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0);
bool AddObject(uint32 type, uint32 entry, Position const& pos, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0);
@@ -445,19 +443,17 @@ class Battleground
bool DelObject(uint32 type);
virtual bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId = TEAM_NEUTRAL);
bool AddSpiritGuide(uint32 type, Position const& pos, TeamId teamId = TEAM_NEUTRAL);
- int32 GetObjectType(uint64 guid);
+ int32 GetObjectType(ObjectGuid guid);
void DoorOpen(uint32 type);
void DoorClose(uint32 type);
- //to be removed
- const char* GetTrinityString(int32 entry);
virtual bool HandlePlayerUnderMap(Player* /*player*/) { return false; }
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
- uint32 GetPlayerTeam(uint64 guid) const;
+ uint32 GetPlayerTeam(ObjectGuid guid) const;
uint32 GetOtherTeam(uint32 teamId) const;
- bool IsPlayerInBattleground(uint64 guid) const;
+ bool IsPlayerInBattleground(ObjectGuid guid) const;
bool ToBeDeleted() const { return m_SetDeleteThis; }
void SetDeleteThis() { m_SetDeleteThis = true; }
@@ -465,8 +461,8 @@ class Battleground
void RewardXPAtKill(Player* killer, Player* victim);
bool CanAwardArenaPoints() const { return m_LevelMin >= BG_AWARD_ARENA_POINTS_MIN_LEVEL; }
- virtual uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return 0; }
- virtual void SetDroppedFlagGUID(uint64 /*guid*/, int32 /*team*/ = -1) { }
+ virtual ObjectGuid GetFlagPickerGUID(int32 /*team*/ = -1) const { return ObjectGuid::Empty; }
+ virtual void SetDroppedFlagGUID(ObjectGuid /*guid*/, int32 /*team*/ = -1) { }
virtual void HandleQuestComplete(uint32 /*questid*/, Player* /*player*/) { }
virtual bool CanActivateGO(int32 /*entry*/, uint32 /*team*/) const { return true; }
virtual bool IsSpellAllowed(uint32 /*spellId*/, Player const* /*player*/) const { return true; }
@@ -482,7 +478,7 @@ class Battleground
void EndNow();
void PlayerAddedToBGCheckIfBGIsRunning(Player* player);
- Player* _GetPlayer(uint64 guid, bool offlineRemove, const char* context) const;
+ Player* _GetPlayer(ObjectGuid guid, bool offlineRemove, const char* context) const;
Player* _GetPlayer(BattlegroundPlayerMap::iterator itr, const char* context) { return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); }
Player* _GetPlayer(BattlegroundPlayerMap::const_iterator itr, const char* context) const { return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); }
Player* _GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char* context) const;
@@ -497,12 +493,12 @@ class Battleground
// Scorekeeping
BattlegroundScoreMap PlayerScores; // Player scores
// must be implemented in BG subclass
- virtual void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) { }
+ virtual void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) { }
// Player lists, those need to be accessible by inherited classes
- BattlegroundPlayerMap m_Players;
+ BattlegroundPlayerMap m_Players;
// Spirit Guide guid + Player list GUIDS
- std::map<uint64, std::vector<uint64> > m_ReviveQueue;
+ std::map<ObjectGuid, GuidVector> m_ReviveQueue;
// these are important variables used for starting messages
uint8 m_Events;
@@ -542,7 +538,7 @@ class Battleground
bool m_PrematureCountDown;
uint32 m_PrematureCountDownTimer;
std::string m_Name;
- uint64 m_Guid;
+ ObjectGuid m_Guid;
/* Pre- and post-update hooks */
@@ -575,8 +571,8 @@ class Battleground
virtual void PostUpdateImpl(uint32 /* diff */) { }
// Player lists
- std::vector<uint64> m_ResurrectQueue; // Player GUID
- std::deque<uint64> m_OfflineQueue; // Player GUID
+ GuidVector m_ResurrectQueue; // Player GUID
+ GuidDeque m_OfflineQueue; // Player GUID
// Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction
// Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index a0fd1f988a7..e2c1c931b18 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -359,7 +359,7 @@ void BattlegroundMgr::BuildStatusFailedPacket(WorldPacket* data, Battleground* b
{
ObjectGuid guidBytes1 = player->GetGUID(); // player who caused the error
ObjectGuid guidBytes2 = bg->GetGUID();
- ObjectGuid unkGuid3 = 0;
+ ObjectGuid unkGuid3;
data->Initialize(SMSG_BATTLEFIELD_STATUS_FAILED);
@@ -440,54 +440,50 @@ void BattlegroundMgr::BuildPlaySoundPacket(WorldPacket* data, uint32 soundid)
*data << uint64(0);
}
-void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid)
+void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid)
{
- ObjectGuid guidBytes = guid;
-
data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8);
- data->WriteBit(guidBytes[7]);
- data->WriteBit(guidBytes[6]);
- data->WriteBit(guidBytes[2]);
- data->WriteBit(guidBytes[4]);
- data->WriteBit(guidBytes[5]);
- data->WriteBit(guidBytes[1]);
- data->WriteBit(guidBytes[3]);
- data->WriteBit(guidBytes[0]);
-
- data->WriteByteSeq(guidBytes[4]);
- data->WriteByteSeq(guidBytes[2]);
- data->WriteByteSeq(guidBytes[5]);
- data->WriteByteSeq(guidBytes[7]);
- data->WriteByteSeq(guidBytes[0]);
- data->WriteByteSeq(guidBytes[6]);
- data->WriteByteSeq(guidBytes[1]);
- data->WriteByteSeq(guidBytes[3]);
+ data->WriteBit(guid[7]);
+ data->WriteBit(guid[6]);
+ data->WriteBit(guid[2]);
+ data->WriteBit(guid[4]);
+ data->WriteBit(guid[5]);
+ data->WriteBit(guid[1]);
+ data->WriteBit(guid[3]);
+ data->WriteBit(guid[0]);
+
+ data->WriteByteSeq(guid[4]);
+ data->WriteByteSeq(guid[2]);
+ data->WriteByteSeq(guid[5]);
+ data->WriteByteSeq(guid[7]);
+ data->WriteByteSeq(guid[0]);
+ data->WriteByteSeq(guid[6]);
+ data->WriteByteSeq(guid[1]);
+ data->WriteByteSeq(guid[3]);
}
-void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, uint64 guid)
+void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, ObjectGuid guid)
{
- ObjectGuid guidBytes = guid;
-
data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8);
- data->WriteBit(guidBytes[0]);
- data->WriteBit(guidBytes[4]);
- data->WriteBit(guidBytes[3]);
- data->WriteBit(guidBytes[5]);
- data->WriteBit(guidBytes[7]);
- data->WriteBit(guidBytes[6]);
- data->WriteBit(guidBytes[2]);
- data->WriteBit(guidBytes[1]);
-
- data->WriteByteSeq(guidBytes[1]);
- data->WriteByteSeq(guidBytes[5]);
- data->WriteByteSeq(guidBytes[3]);
- data->WriteByteSeq(guidBytes[2]);
- data->WriteByteSeq(guidBytes[0]);
- data->WriteByteSeq(guidBytes[7]);
- data->WriteByteSeq(guidBytes[4]);
- data->WriteByteSeq(guidBytes[6]);
+ data->WriteBit(guid[0]);
+ data->WriteBit(guid[4]);
+ data->WriteBit(guid[3]);
+ data->WriteBit(guid[5]);
+ data->WriteBit(guid[7]);
+ data->WriteBit(guid[6]);
+ data->WriteBit(guid[2]);
+ data->WriteBit(guid[1]);
+
+ data->WriteByteSeq(guid[1]);
+ data->WriteByteSeq(guid[5]);
+ data->WriteByteSeq(guid[3]);
+ data->WriteByteSeq(guid[2]);
+ data->WriteByteSeq(guid[0]);
+ data->WriteByteSeq(guid[7]);
+ data->WriteByteSeq(guid[4]);
+ data->WriteByteSeq(guid[6]);
}
Battleground* BattlegroundMgr::GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId)
@@ -656,7 +652,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original
bg->SetRandomTypeID(bgTypeId);
bg->SetRated(isRated);
bg->SetRandom(isRandom);
- bg->SetGuid(MAKE_NEW_GUID(bgTypeId, 0, HIGHGUID_BATTLEGROUND));
+ bg->SetGuid(ObjectGuid(HIGHGUID_BATTLEGROUND, uint32(bgTypeId)));
// Set up correct min/max player counts for scoreboards
if (bg->isArena())
@@ -759,7 +755,7 @@ bool BattlegroundMgr::CreateBattleground(BattlegroundTemplate const* bgTemplate)
bg->SetStartMaxDist(bgTemplate->MaxStartDistSq);
bg->SetLevelRange(bgTemplate->MinLevel, bgTemplate->MaxLevel);
bg->SetScriptId(bgTemplate->ScriptId);
- bg->SetGuid(MAKE_NEW_GUID(bgTemplate->Id, 0, HIGHGUID_BATTLEGROUND));
+ bg->SetGuid(ObjectGuid(HIGHGUID_BATTLEGROUND, uint32(bgTemplate->Id)));
AddBattleground(bg);
@@ -866,7 +862,7 @@ void BattlegroundMgr::LoadBattlegroundTemplates()
TC_LOG_INFO("server.loading", ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
-void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId)
+void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattlegroundTypeId bgTypeId)
{
if (!player)
return;
@@ -879,8 +875,6 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
uint32 winnerHonor = (player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_FIRST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_LAST)) / CURRENCY_PRECISION;
uint32 loserHonor = (!player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST)) / CURRENCY_PRECISION;
- ObjectGuid guidBytes = guid;
-
data->Initialize(SMSG_BATTLEFIELD_LIST);
*data << uint32(winnerConquest) // Winner Conquest Reward or Random Winner Conquest Reward
<< uint32(winnerConquest) // Winner Conquest Reward or Random Winner Conquest Reward
@@ -892,29 +886,29 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
<< uint8(bgTemplate->MaxLevel) // max level
<< uint8(bgTemplate->MinLevel); // min level
- data->WriteBit(guidBytes[0]);
- data->WriteBit(guidBytes[1]);
- data->WriteBit(guidBytes[7]);
+ data->WriteBit(guid[0]);
+ data->WriteBit(guid[1]);
+ data->WriteBit(guid[7]);
data->WriteBit(0); // unk
data->WriteBit(0); // unk
size_t count_pos = data->bitwpos();
data->WriteBits(0, 24); // placeholder
- data->WriteBit(guidBytes[6]);
- data->WriteBit(guidBytes[4]);
- data->WriteBit(guidBytes[2]);
- data->WriteBit(guidBytes[3]);
+ data->WriteBit(guid[6]);
+ data->WriteBit(guid[4]);
+ data->WriteBit(guid[2]);
+ data->WriteBit(guid[3]);
data->WriteBit(0); // unk
- data->WriteBit(guidBytes[5]);
+ data->WriteBit(guid[5]);
data->WriteBit(0); // unk
data->FlushBits();
- data->WriteByteSeq(guidBytes[6]);
- data->WriteByteSeq(guidBytes[1]);
- data->WriteByteSeq(guidBytes[7]);
- data->WriteByteSeq(guidBytes[5]);
+ data->WriteByteSeq(guid[6]);
+ data->WriteByteSeq(guid[1]);
+ data->WriteByteSeq(guid[7]);
+ data->WriteByteSeq(guid[5]);
BattlegroundDataContainer::iterator it = bgDataStore.find(bgTypeId);
if (it != bgDataStore.end())
@@ -932,10 +926,10 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
}
}
- data->WriteByteSeq(guidBytes[0]);
- data->WriteByteSeq(guidBytes[2]);
- data->WriteByteSeq(guidBytes[4]);
- data->WriteByteSeq(guidBytes[3]);
+ data->WriteByteSeq(guid[0]);
+ data->WriteByteSeq(guid[2]);
+ data->WriteByteSeq(guid[4]);
+ data->WriteByteSeq(guid[3]);
}
void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, BattlegroundTypeId bgTypeId)
@@ -953,7 +947,7 @@ void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, Batt
TC_LOG_ERROR("bg.battleground", "BattlegroundMgr::SendToBattleground: Instance %u (bgType %u) not found while trying to teleport player %s", instanceId, bgTypeId, player->GetName().c_str());
}
-void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid)
+void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, ObjectGuid guid)
{
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h
index e6f8eee354e..23689c03fba 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.h
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.h
@@ -70,14 +70,14 @@ class BattlegroundMgr
void Update(uint32 diff);
/* Packet Building */
- void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, uint64 guid);
- void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid);
- void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId);
+ void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, ObjectGuid guid);
+ void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid);
+ void BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattlegroundTypeId bgTypeId);
void BuildStatusFailedPacket(WorldPacket* data, Battleground* bg, Player* pPlayer, uint8 QueueSlot, GroupJoinBattlegroundResult result);
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, Player* player, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType);
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundId);
- void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid);
+ void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, ObjectGuid guid);
/* Battlegrounds */
Battleground* GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId);
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index 81844cb8b8a..375c896fd39 100644
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -281,7 +281,7 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, Battleg
}
//remove player from queue and from group info, if group info is empty then remove it too
-void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
+void BattlegroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
{
int32 bracket_id = -1; // signed for proper for-loop finish
QueuedPlayersMap::iterator itr;
@@ -293,7 +293,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
std::string playerName = "Unknown";
if (Player* player = ObjectAccessor::FindPlayer(guid))
playerName = player->GetName();
- TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: couldn't find player %s (GUID: %u)", playerName.c_str(), GUID_LOPART(guid));
+ TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: couldn't find player %s (GUID: %u)", playerName.c_str(), guid.GetCounter());
return;
}
@@ -328,10 +328,10 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
//player can't be in queue without group, but just in case
if (bracket_id == -1)
{
- TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid));
+ TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", guid.GetCounter());
return;
}
- TC_LOG_DEBUG("bg.battleground", "BattlegroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id);
+ TC_LOG_DEBUG("bg.battleground", "BattlegroundQueue: Removing player GUID %u, from bracket_id %u", guid.GetCounter(), (uint32)bracket_id);
// ALL variables are correctly set
// We can ignore leveling up in queue - it should not cause crash
@@ -339,7 +339,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
// if only one player there, remove group
// remove player queue info from group queue info
- std::map<uint64, PlayerQueueInfo*>::iterator pitr = group->Players.find(guid);
+ std::map<ObjectGuid, PlayerQueueInfo*>::iterator pitr = group->Players.find(guid);
if (pitr != group->Players.end())
group->Players.erase(pitr);
@@ -361,7 +361,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
{
if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId))
{
- TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
+ TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", guid.GetCounter(), group->OpponentsTeamRating);
if (Player* player = ObjectAccessor::FindPlayer(guid))
at->MemberLost(player, group->OpponentsMatchmakerRating);
else
@@ -403,7 +403,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
}
//returns true when player pl_guid is in queue and is invited to bgInstanceGuid
-bool BattlegroundQueue::IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
+bool BattlegroundQueue::IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
{
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid);
return (qItr != m_QueuedPlayers.end()
@@ -411,7 +411,7 @@ bool BattlegroundQueue::IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceG
&& qItr->second.GroupInfo->RemoveInviteTime == removeTime);
}
-bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo)
+bool BattlegroundQueue::GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo)
{
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid);
if (qItr == m_QueuedPlayers.end())
@@ -447,7 +447,7 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg,
ginfo->RemoveInviteTime = getMSTime() + INVITE_ACCEPT_WAIT_TIME;
// loop through the players
- for (std::map<uint64, PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
+ for (std::map<ObjectGuid, PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
{
// get the player
Player* player = ObjectAccessor::FindPlayer(itr->first);
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.h b/src/server/game/Battlegrounds/BattlegroundQueue.h
index 879fb7eabbd..810e78658c3 100644
--- a/src/server/game/Battlegrounds/BattlegroundQueue.h
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.h
@@ -40,7 +40,7 @@ struct PlayerQueueInfo // stores informatio
struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!)
{
- std::map<uint64, PlayerQueueInfo*> Players; // player queue info map
+ std::map<ObjectGuid, PlayerQueueInfo*> Players; // player queue info map
uint32 Team; // Player team (ALLIANCE/HORDE)
BattlegroundTypeId BgTypeId; // battleground type id
bool IsRated; // rated
@@ -79,13 +79,13 @@ class BattlegroundQueue
bool CheckNormalMatch(Battleground* bg_template, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam);
GroupQueueInfo* AddGroup(Player* leader, Group* group, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 ArenaTeamId = 0);
- void RemovePlayer(uint64 guid, bool decreaseInvitedCount);
- bool IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
- bool GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo);
+ void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount);
+ bool IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
+ bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id);
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id) const;
- typedef std::map<uint64, PlayerQueueInfo> QueuedPlayersMap;
+ typedef std::map<ObjectGuid, PlayerQueueInfo> QueuedPlayersMap;
QueuedPlayersMap m_QueuedPlayers;
//do NOT use deque because deque.erase() invalidates ALL iterators
@@ -138,7 +138,7 @@ class BattlegroundQueue
class BGQueueInviteEvent : public BasicEvent
{
public:
- BGQueueInviteEvent(uint64 pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
+ BGQueueInviteEvent(ObjectGuid pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
{ }
virtual ~BGQueueInviteEvent() { }
@@ -146,7 +146,7 @@ class BGQueueInviteEvent : public BasicEvent
virtual bool Execute(uint64 e_time, uint32 p_time) override;
virtual void Abort(uint64 e_time) override;
private:
- uint64 m_PlayerGuid;
+ ObjectGuid m_PlayerGuid;
uint32 m_BgInstanceGUID;
BattlegroundTypeId m_BgTypeId;
uint8 m_ArenaType;
@@ -161,7 +161,7 @@ class BGQueueInviteEvent : public BasicEvent
class BGQueueRemoveEvent : public BasicEvent
{
public:
- BGQueueRemoveEvent(uint64 pl_guid, uint32 bgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
+ BGQueueRemoveEvent(ObjectGuid pl_guid, uint32 bgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
: m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_ArenaType(arenaType), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId)
{ }
@@ -170,7 +170,7 @@ class BGQueueRemoveEvent : public BasicEvent
virtual bool Execute(uint64 e_time, uint32 p_time) override;
virtual void Abort(uint64 e_time) override;
private:
- uint64 m_PlayerGuid;
+ ObjectGuid m_PlayerGuid;
uint32 m_BgInstanceGUID;
uint8 m_ArenaType;
uint32 m_RemoveTime;
diff --git a/src/server/game/Battlegrounds/BattlegroundScore.h b/src/server/game/Battlegrounds/BattlegroundScore.h
index 6cb0aaadb73..2bca2788c61 100644
--- a/src/server/game/Battlegrounds/BattlegroundScore.h
+++ b/src/server/game/Battlegrounds/BattlegroundScore.h
@@ -57,7 +57,7 @@ struct BattlegroundScore
friend class Battleground;
protected:
- BattlegroundScore(uint64 playerGuid, uint32 team) : PlayerGuid(playerGuid), TeamId(team == ALLIANCE ? 1 : 0),
+ BattlegroundScore(ObjectGuid playerGuid, uint32 team) : PlayerGuid(playerGuid), TeamId(team == ALLIANCE ? 1 : 0),
KillingBlows(0), Deaths(0), HonorableKills(0), BonusHonor(0), DamageDone(0), HealingDone(0) { }
virtual ~BattlegroundScore() { }
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index 91174682218..a106fb6046b 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -227,7 +227,7 @@ void BattlegroundAB::AddPlayer(Player* player)
PlayerScores[player->GetGUIDLow()] = new BattlegroundABScore(player->GetGUID(), player->GetBGTeam());
}
-void BattlegroundAB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundAB::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/)
{
}
@@ -392,7 +392,7 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
if (capturedNodes >= 4)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team);
- Creature* trigger = BgCreatures[node+7] ? GetBGCreature(node+7) : NULL; // 0-6 spirit guides
+ Creature* trigger = !BgCreatures[node + 7] ? GetBGCreature(node + 7) : NULL; // 0-6 spirit guides
if (!trigger)
trigger = AddCreature(WORLD_TRIGGER, node+7, BG_AB_NodePositions[node], GetTeamIndexByTeamId(team));
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
index d99c206e0c8..dab5674ff0a 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
@@ -242,7 +242,7 @@ struct BattlegroundABScore final : public BattlegroundScore
friend class BattlegroundAB;
protected:
- BattlegroundABScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), BasesAssaulted(0), BasesDefended(0) { }
+ BattlegroundABScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), BasesAssaulted(0), BasesDefended(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -283,7 +283,7 @@ class BattlegroundAB : public Battleground
void AddPlayer(Player* player) override;
void StartingEventCloseDoors() override;
void StartingEventOpenDoors() override;
- void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
+ void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* Source, uint32 Trigger) override;
bool SetupBattleground() override;
void Reset() override;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index ce095e39592..0f3b42b3b2c 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -119,7 +119,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
DelCreature(AV_CPLACE_TRIGGER16);
if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD))
- herold->AI()->TalkToMap(TEXT_STORMPIKE_GENERAL_DEAD);
+ herold->AI()->Talk(TEXT_STORMPIKE_GENERAL_DEAD);
}
else if (entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN])
{
@@ -138,7 +138,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
DelCreature(AV_CPLACE_TRIGGER18);
if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD))
- herold->AI()->TalkToMap(TEXT_FROSTWOLF_GENERAL_DEAD);
+ herold->AI()->Talk(TEXT_FROSTWOLF_GENERAL_DEAD);
}
else if (entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_N_4] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_A_4] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_H_4])
ChangeMineOwner(AV_NORTH_MINE, killer->GetTeam());
@@ -480,7 +480,7 @@ void BattlegroundAV::EndBattleground(uint32 winner)
Battleground::EndBattleground(winner);
}
-void BattlegroundAV::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundAV::RemovePlayer(Player* player, ObjectGuid /*guid*/, uint32 /*team*/)
{
if (!player)
{
@@ -603,7 +603,7 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node))
if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD))
- herold->AI()->TalkToMap(owner == ALLIANCE ? nodeInfo->TextIds.AllianceCapture : nodeInfo->TextIds.HordeCapture);
+ herold->AI()->Talk(owner == ALLIANCE ? nodeInfo->TextIds.AllianceCapture : nodeInfo->TextIds.HordeCapture);
}
void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
@@ -679,9 +679,9 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD))
{
if (mine == AV_NORTH_MINE)
- herold->AI()->TalkToMap(team == ALLIANCE ? TEXT_IRONDEEP_MINE_ALLIANCE_TAKEN : TEXT_IRONDEEP_MINE_HORDE_TAKEN);
+ herold->AI()->Talk(team == ALLIANCE ? TEXT_IRONDEEP_MINE_ALLIANCE_TAKEN : TEXT_IRONDEEP_MINE_HORDE_TAKEN);
else if (mine == AV_SOUTH_MINE)
- herold->AI()->TalkToMap(team == ALLIANCE ? TEXT_COLDTOOTH_MINE_ALLIANCE_TAKEN : TEXT_COLDTOOTH_MINE_HORDE_TAKEN);
+ herold->AI()->Talk(team == ALLIANCE ? TEXT_COLDTOOTH_MINE_ALLIANCE_TAKEN : TEXT_COLDTOOTH_MINE_HORDE_TAKEN);
}
}
else
@@ -923,7 +923,7 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node))
if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD))
- herold->AI()->TalkToMap(team == ALLIANCE ? nodeInfo->TextIds.AllianceCapture : nodeInfo->TextIds.HordeCapture);
+ herold->AI()->Talk(team == ALLIANCE ? nodeInfo->TextIds.AllianceCapture : nodeInfo->TextIds.HordeCapture);
// update the statistic for the defending player
UpdatePlayerScore(player, IsTower(node) ? SCORE_TOWERS_DEFENDED : SCORE_GRAVEYARDS_DEFENDED, 1);
@@ -1014,7 +1014,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node))
if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD))
- herold->AI()->TalkToMap(team == ALLIANCE ? nodeInfo->TextIds.AllianceAttack : nodeInfo->TextIds.HordeAttack);
+ herold->AI()->Talk(team == ALLIANCE ? nodeInfo->TextIds.AllianceAttack : nodeInfo->TextIds.HordeAttack);
// update the statistic for the assaulting player
UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
index aef8438dcfb..4df0bcb38b7 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
@@ -1554,7 +1554,7 @@ struct BattlegroundAVScore final : public BattlegroundScore
friend class BattlegroundAV;
protected:
- BattlegroundAVScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0) { }
+ BattlegroundAVScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -1615,7 +1615,7 @@ class BattlegroundAV : public Battleground
void StartingEventCloseDoors() override;
void StartingEventOpenDoors() override;
- void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
+ void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* player, uint32 trigger) override;
bool SetupBattleground() override;
void ResetBGSubclass() override;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h b/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h
index e00c940e134..91e416c795a 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h
@@ -24,7 +24,7 @@
class BattlegroundBFGScore final : public BattlegroundScore
{
protected:
- BattlegroundBFGScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), BasesAssaulted(0), BasesDefended(0) { }
+ BattlegroundBFGScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), BasesAssaulted(0), BasesDefended(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index c25c915dd7a..1c336e1a359 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -46,8 +46,8 @@ BattlegroundEY::BattlegroundEY()
m_HonorScoreTics[TEAM_HORDE] = 0;
m_TeamPointsCount[TEAM_ALLIANCE] = 0;
m_TeamPointsCount[TEAM_HORDE] = 0;
- m_FlagKeeper = 0;
- m_DroppedFlagGUID = 0;
+ m_FlagKeeper.Clear();
+ m_DroppedFlagGUID.Clear();
m_FlagCapturedBgObjectType = 0;
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
m_FlagsTimer = 0;
@@ -171,7 +171,7 @@ void BattlegroundEY::CheckSomeoneJoinedPoint()
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
if (!player)
{
- TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j]));
+ TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneJoinedPoint: Player (%s) not found!", m_PlayersNearPoint[EY_POINTS_MAX][j].ToString().c_str());
++j;
continue;
}
@@ -211,7 +211,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint()
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]);
if (!player)
{
- TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
+ TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneLeftPoint Player (%s) not found!", m_PlayersNearPoint[i][j].ToString().c_str());
//move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
@@ -368,7 +368,7 @@ void BattlegroundEY::AddPlayer(Player* player)
m_PlayersNearPoint[EY_POINTS_MAX].push_back(player->GetGUID());
}
-void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
+void BattlegroundEY::RemovePlayer(Player* player, ObjectGuid guid, uint32 /*team*/)
{
// sometimes flag aura not removed :(
for (int j = EY_POINTS_MAX; j >= 0; --j)
@@ -385,7 +385,7 @@ void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
EventPlayerDroppedFlag(player);
else
{
- SetFlagPicker(0);
+ SetFlagPicker(ObjectGuid::Empty);
RespawnFlag(true);
}
}
@@ -548,8 +548,8 @@ void BattlegroundEY::Reset()
m_HonorScoreTics[TEAM_HORDE] = 0;
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
m_FlagCapturedBgObjectType = 0;
- m_FlagKeeper = 0;
- m_DroppedFlagGUID = 0;
+ m_FlagKeeper.Clear();
+ m_DroppedFlagGUID.Clear();
m_PointAddingTimer = 0;
m_TowerCapCheckTimer = 0;
bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
@@ -593,9 +593,9 @@ void BattlegroundEY::RespawnFlagAfterDrop()
if (obj)
obj->Delete();
else
- TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID()));
+ TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Unknown dropped flag (%s)", GetDroppedFlagGUID().ToString().c_str());
- SetDroppedFlagGUID(0);
+ SetDroppedFlagGUID(ObjectGuid::Empty);
}
void BattlegroundEY::HandleKillPlayer(Player* player, Player* killer)
@@ -615,7 +615,7 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player)
// just take off the aura
if (IsFlagPickedup() && GetFlagPickerGUID() == player->GetGUID())
{
- SetFlagPicker(0);
+ SetFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
}
return;
@@ -627,7 +627,7 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player)
if (GetFlagPickerGUID() != player->GetGUID())
return;
- SetFlagPicker(0);
+ SetFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
m_FlagState = BG_EY_FLAG_STATE_ON_GROUND;
m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME;
@@ -795,7 +795,7 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != player->GetGUID())
return;
- SetFlagPicker(0);
+ SetFlagPicker(ObjectGuid::Empty);
m_FlagState = BG_EY_FLAG_STATE_WAIT_RESPAWN;
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
index e1eaa6dd5fe..b3e167c4b23 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
@@ -328,7 +328,7 @@ struct BattlegroundEYScore final : public BattlegroundScore
friend class BattlegroundEY;
protected:
- BattlegroundEYScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), FlagCaptures(0) { }
+ BattlegroundEYScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), FlagCaptures(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -366,15 +366,14 @@ class BattlegroundEY : public Battleground
void StartingEventOpenDoors() override;
/* BG Flags */
- uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const override { return m_FlagKeeper; }
- void SetFlagPicker(uint64 guid) { m_FlagKeeper = guid; }
- bool IsFlagPickedup() const { return m_FlagKeeper != 0; }
+ ObjectGuid GetFlagPickerGUID(int32 /*team*/ = -1) const override { return m_FlagKeeper; }
+ void SetFlagPicker(ObjectGuid guid) { m_FlagKeeper = guid; }
+ bool IsFlagPickedup() const { return !m_FlagKeeper.IsEmpty(); }
uint8 GetFlagState() const { return m_FlagState; }
void RespawnFlag(bool send_message);
void RespawnFlagAfterDrop();
- void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
- void HandleBuffUse(uint64 buff_guid);
+ void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* Source, uint32 Trigger) override;
void HandleKillPlayer(Player* player, Player* killer) override;
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player) override;
@@ -384,8 +383,8 @@ class BattlegroundEY : public Battleground
void EndBattleground(uint32 winner) override;
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
void FillInitialWorldStates(WorldPacket& data) override;
- void SetDroppedFlagGUID(uint64 guid, int32 /*TeamID*/ = -1) override { m_DroppedFlagGUID = guid;}
- uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;}
+ void SetDroppedFlagGUID(ObjectGuid guid, int32 /*TeamID*/ = -1) override { m_DroppedFlagGUID = guid; }
+ ObjectGuid GetDroppedFlagGUID() const { return m_DroppedFlagGUID; }
/* Battleground Events */
void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj) override;
@@ -420,8 +419,8 @@ class BattlegroundEY : public Battleground
uint32 m_Points_Trigger[EY_POINTS_MAX];
- uint64 m_FlagKeeper; // keepers guid
- uint64 m_DroppedFlagGUID;
+ ObjectGuid m_FlagKeeper; // keepers guid
+ ObjectGuid m_DroppedFlagGUID;
uint32 m_FlagCapturedBgObjectType; // type that should be despawned when flag is captured
uint8 m_FlagState; // for checking flag state
int32 m_FlagsTimer;
@@ -430,8 +429,7 @@ class BattlegroundEY : public Battleground
uint32 m_PointOwnedByTeam[EY_POINTS_MAX];
uint8 m_PointState[EY_POINTS_MAX];
int32 m_PointBarStatus[EY_POINTS_MAX];
- typedef std::vector<uint64> PlayersNearPointType;
- PlayersNearPointType m_PlayersNearPoint[EY_POINTS_MAX + 1];
+ GuidVector m_PlayersNearPoint[EY_POINTS_MAX + 1];
uint8 m_CurrentPointPlayersCount[2*EY_POINTS_MAX];
int32 m_PointAddingTimer;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index e5de2e86a2e..4e0bdd17162 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -68,7 +68,7 @@ void BattlegroundIC::HandlePlayerResurrect(Player* player)
player->CastSpell(player, SPELL_OIL_REFINERY, true);
}
-void BattlegroundIC::DoAction(uint32 action, uint64 var)
+void BattlegroundIC::DoAction(uint32 action, ObjectGuid var)
{
if (action != ACTION_TELEPORT_PLAYER_TO_TRANSPORT)
return;
@@ -282,7 +282,7 @@ void BattlegroundIC::AddPlayer(Player* player)
player->CastSpell(player, SPELL_OIL_REFINERY, true);
}
-void BattlegroundIC::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundIC::RemovePlayer(Player* player, ObjectGuid /*guid*/, uint32 /*team*/)
{
if (player)
{
@@ -865,7 +865,7 @@ bool BattlegroundIC::IsSpellAllowed(uint32 spellId, Player const* player) const
case SPELL_QUARRY:
{
uint32 team = player->GetTeamId();
- uint8 nodeType = spellId = SPELL_OIL_REFINERY ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
+ uint8 nodeType = spellId == SPELL_OIL_REFINERY ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
uint8 nodeState = team == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
return GetNodeState(nodeType) == nodeState;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
index 8a7995cf2c1..64186faf9ea 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
@@ -853,7 +853,7 @@ struct BattlegroundICScore final : public BattlegroundScore
friend class BattlegroundIC;
protected:
- BattlegroundICScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), BasesAssaulted(0), BasesDefended(0) { }
+ BattlegroundICScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), BasesAssaulted(0), BasesDefended(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -897,7 +897,7 @@ class BattlegroundIC : public Battleground
void StartingEventOpenDoors() override;
void PostUpdateImpl(uint32 diff) override;
- void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
+ void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* player, uint32 trigger) override;
bool SetupBattleground() override;
void SpawnLeader(uint32 teamid);
@@ -913,7 +913,7 @@ class BattlegroundIC : public Battleground
/* Scorekeeping */
void FillInitialWorldStates(WorldPacket& data) override;
- void DoAction(uint32 action, uint64 var) override;
+ void DoAction(uint32 action, ObjectGuid var) override;
void HandlePlayerResurrect(Player* player) override;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index 11e07566092..63f7ceaef65 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -506,7 +506,7 @@ void BattlegroundSA::AddPlayer(Player* player)
}
}
-void BattlegroundSA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) { }
+void BattlegroundSA::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) { }
void BattlegroundSA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
index 6f5363aeaa8..dad44d07545 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
@@ -513,7 +513,7 @@ struct BattlegroundSAScore final : public BattlegroundScore
friend class BattlegroundSA;
protected:
- BattlegroundSAScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), DemolishersDestroyed(0), GatesDestroyed(0) { }
+ BattlegroundSAScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), DemolishersDestroyed(0), GatesDestroyed(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -594,7 +594,7 @@ class BattlegroundSA : public Battleground
void EndBattleground(uint32 winner) override;
/// Called when a player leave battleground
- void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
+ void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* Source, uint32 Trigger) override;
/* Scorekeeping */
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundTP.h b/src/server/game/Battlegrounds/Zones/BattlegroundTP.h
index 77f649d971c..d8aaaafbd41 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundTP.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundTP.h
@@ -24,7 +24,7 @@
class BattlegroundTPScore final : public BattlegroundScore
{
protected:
- BattlegroundTPScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), FlagCaptures(0), FlagReturns(0) { }
+ BattlegroundTPScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), FlagCaptures(0), FlagReturns(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index bcf7093a640..17478781137 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -54,10 +54,10 @@ BattlegroundWS::BattlegroundWS()
_flagSpellForceTimer = 0;
_bothFlagsKept = false;
_flagDebuffState = 0;
- m_FlagKeepers[TEAM_ALLIANCE] = 0;
- m_FlagKeepers[TEAM_HORDE] = 0;
- m_DroppedFlagGUID[TEAM_ALLIANCE] = 0;
- m_DroppedFlagGUID[TEAM_HORDE] = 0;
+ m_FlagKeepers[TEAM_ALLIANCE].Clear();
+ m_FlagKeepers[TEAM_HORDE].Clear();
+ m_DroppedFlagGUID[TEAM_ALLIANCE].Clear();
+ m_DroppedFlagGUID[TEAM_HORDE].Clear();
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
_flagsTimer[TEAM_ALLIANCE] = 0;
@@ -278,9 +278,9 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
if (GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team)))
obj->Delete();
else
- TC_LOG_ERROR("bg.battleground", "unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team)));
+ TC_LOG_ERROR("bg.battleground", "unknown dropped flag (%s)", GetDroppedFlagGUID(team).ToString().c_str());
- SetDroppedFlagGUID(0, GetTeamIndexByTeamId(team));
+ SetDroppedFlagGUID(ObjectGuid::Empty, GetTeamIndexByTeamId(team));
_bothFlagsKept = false;
}
@@ -296,7 +296,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
{
if (!IsHordeFlagPickedup())
return;
- SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
+ SetHordeFlagPicker(ObjectGuid::Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet)
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
@@ -315,7 +315,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
{
if (!IsAllianceFlagPickedup())
return;
- SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
+ SetAllianceFlagPicker(ObjectGuid::Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet)
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
@@ -385,7 +385,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID())
{
- SetHordeFlagPicker(0);
+ SetHordeFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
}
}
@@ -396,7 +396,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID())
{
- SetAllianceFlagPicker(0);
+ SetAllianceFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
}
}
@@ -411,7 +411,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
return;
if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID())
{
- SetHordeFlagPicker(0);
+ SetHordeFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if (_flagDebuffState == 1)
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
@@ -428,7 +428,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
return;
if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID())
{
- SetAllianceFlagPicker(0);
+ SetAllianceFlagPicker(ObjectGuid::Empty);
player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if (_flagDebuffState == 1)
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
@@ -583,7 +583,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
-void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
+void BattlegroundWS::RemovePlayer(Player* player, ObjectGuid guid, uint32 /*team*/)
{
// sometimes flag aura not removed :(
if (IsAllianceFlagPickedup() && m_FlagKeepers[TEAM_ALLIANCE] == guid)
@@ -591,7 +591,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
if (!player)
{
TC_LOG_ERROR("bg.battleground", "BattlegroundWS: Removing offline player who has the FLAG!!");
- SetAllianceFlagPicker(0);
+ SetAllianceFlagPicker(ObjectGuid::Empty);
RespawnFlag(ALLIANCE, false);
}
else
@@ -602,7 +602,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
if (!player)
{
TC_LOG_ERROR("bg.battleground", "BattlegroundWS: Removing offline player who has the FLAG!!");
- SetHordeFlagPicker(0);
+ SetHordeFlagPicker(ObjectGuid::Empty);
RespawnFlag(HORDE, false);
}
else
@@ -731,10 +731,10 @@ void BattlegroundWS::Reset()
//call parent's class reset
Battleground::Reset();
- m_FlagKeepers[TEAM_ALLIANCE] = 0;
- m_FlagKeepers[TEAM_HORDE] = 0;
- m_DroppedFlagGUID[TEAM_ALLIANCE] = 0;
- m_DroppedFlagGUID[TEAM_HORDE] = 0;
+ m_FlagKeepers[TEAM_ALLIANCE].Clear();
+ m_FlagKeepers[TEAM_HORDE].Clear();
+ m_DroppedFlagGUID[TEAM_ALLIANCE].Clear();
+ m_DroppedFlagGUID[TEAM_HORDE].Clear();
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
m_TeamScores[TEAM_ALLIANCE] = 0;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
index 5691b42d4e9..51dd77d36c3 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
@@ -152,7 +152,7 @@ struct BattlegroundWGScore final : public BattlegroundScore
friend class BattlegroundWS;
protected:
- BattlegroundWGScore(uint64 playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), FlagCaptures(0), FlagReturns(0) { }
+ BattlegroundWGScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), FlagCaptures(0), FlagReturns(0) { }
void UpdateScore(uint32 type, uint32 value) override
{
@@ -197,16 +197,16 @@ class BattlegroundWS : public Battleground
void StartingEventOpenDoors() override;
/* BG Flags */
- uint64 GetFlagPickerGUID(int32 team) const override
+ ObjectGuid GetFlagPickerGUID(int32 team) const override
{
if (team == TEAM_ALLIANCE || team == TEAM_HORDE)
return m_FlagKeepers[team];
- return 0;
+ return ObjectGuid::Empty;
}
- void SetAllianceFlagPicker(uint64 guid) { m_FlagKeepers[TEAM_ALLIANCE] = guid; }
- void SetHordeFlagPicker(uint64 guid) { m_FlagKeepers[TEAM_HORDE] = guid; }
- bool IsAllianceFlagPickedup() const { return m_FlagKeepers[TEAM_ALLIANCE] != 0; }
- bool IsHordeFlagPickedup() const { return m_FlagKeepers[TEAM_HORDE] != 0; }
+ void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[TEAM_ALLIANCE] = guid; }
+ void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[TEAM_HORDE] = guid; }
+ bool IsAllianceFlagPickedup() const { return !m_FlagKeepers[TEAM_ALLIANCE].IsEmpty(); }
+ bool IsHordeFlagPickedup() const { return !m_FlagKeepers[TEAM_HORDE].IsEmpty(); }
void RespawnFlag(uint32 Team, bool captured);
void RespawnFlagAfterDrop(uint32 Team);
uint8 GetFlagState(uint32 team) { return _flagState[GetTeamIndexByTeamId(team)]; }
@@ -216,7 +216,7 @@ class BattlegroundWS : public Battleground
void EventPlayerClickedOnFlag(Player* player, GameObject* target_obj) override;
void EventPlayerCapturedFlag(Player* player);
- void RemovePlayer(Player* player, uint64 guid, uint32 team) override;
+ void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* player, uint32 trigger) override;
void HandleKillPlayer(Player* player, Player* killer) override;
bool SetupBattleground() override;
@@ -228,13 +228,13 @@ class BattlegroundWS : public Battleground
void SetLastFlagCapture(uint32 team) { _lastFlagCaptureTeam = team; }
void UpdateTeamScore(uint32 team);
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
- void SetDroppedFlagGUID(uint64 guid, int32 team = -1) override
+ void SetDroppedFlagGUID(ObjectGuid guid, int32 team = -1) override
{
if (team == TEAM_ALLIANCE || team == TEAM_HORDE)
m_DroppedFlagGUID[team] = guid;
}
- uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];}
+ ObjectGuid GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)]; }
void FillInitialWorldStates(WorldPacket& data) override;
/* Scorekeeping */
@@ -248,8 +248,8 @@ class BattlegroundWS : public Battleground
bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscvalue1 = 0) override;
private:
- uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde
- uint64 m_DroppedFlagGUID[2];
+ ObjectGuid m_FlagKeepers[2]; // 0 - alliance, 1 - horde
+ ObjectGuid m_DroppedFlagGUID[2];
uint8 _flagState[2]; // for checking flag state
int32 _flagsTimer[2];
int32 _flagsDropTimer[2];
diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp
index 64116b8f8c1..2e62e8514a0 100644
--- a/src/server/game/Calendar/CalendarMgr.cpp
+++ b/src/server/game/Calendar/CalendarMgr.cpp
@@ -58,7 +58,7 @@ void CalendarMgr::LoadFromDB()
Field* fields = result->Fetch();
uint64 eventId = fields[0].GetUInt64();
- uint64 creatorGUID = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
+ ObjectGuid creatorGUID = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
std::string title = fields[2].GetString();
std::string description = fields[3].GetString();
CalendarEventType type = CalendarEventType(fields[4].GetUInt8());
@@ -91,8 +91,8 @@ void CalendarMgr::LoadFromDB()
uint64 inviteId = fields[0].GetUInt64();
uint64 eventId = fields[1].GetUInt64();
- uint64 invitee = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
- uint64 senderGUID = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER);
+ ObjectGuid invitee = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32());
+ ObjectGuid senderGUID = ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt32());
CalendarInviteStatus status = CalendarInviteStatus(fields[4].GetUInt8());
uint32 statusTime = fields[5].GetUInt32();
CalendarModerationRank rank = CalendarModerationRank(fields[6].GetUInt8());
@@ -146,7 +146,7 @@ void CalendarMgr::AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite
}
}
-void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
+void CalendarMgr::RemoveEvent(uint64 eventId, ObjectGuid remover)
{
CalendarEvent* calendarEvent = GetEvent(eventId);
@@ -173,7 +173,7 @@ void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
// guild events only? check invite status here?
// When an event is deleted, all invited (accepted/declined? - verify) guildies are notified via in-game mail. (wowwiki)
if (remover && invite->GetInviteeGUID() != remover)
- mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID()), calendarEvent, MAIL_CHECK_MASK_COPIED);
+ mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID().GetCounter()), calendarEvent, MAIL_CHECK_MASK_COPIED);
delete invite;
}
@@ -189,7 +189,7 @@ void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
_events.erase(calendarEvent);
}
-void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, uint64 /*remover*/)
+void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid /*remover*/)
{
CalendarEvent* calendarEvent = GetEvent(eventId);
@@ -228,7 +228,7 @@ void CalendarMgr::UpdateEvent(CalendarEvent* calendarEvent)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_EVENT);
stmt->setUInt64(0, calendarEvent->GetEventId());
- stmt->setUInt32(1, GUID_LOPART(calendarEvent->GetCreatorGUID()));
+ stmt->setUInt32(1, calendarEvent->GetCreatorGUID().GetCounter());
stmt->setString(2, calendarEvent->GetTitle());
stmt->setString(3, calendarEvent->GetDescription());
stmt->setUInt8(4, calendarEvent->GetType());
@@ -250,8 +250,8 @@ void CalendarMgr::UpdateInvite(CalendarInvite* invite, SQLTransaction& trans)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_INVITE);
stmt->setUInt64(0, invite->GetInviteId());
stmt->setUInt64(1, invite->GetEventId());
- stmt->setUInt32(2, GUID_LOPART(invite->GetInviteeGUID()));
- stmt->setUInt32(3, GUID_LOPART(invite->GetSenderGUID()));
+ stmt->setUInt32(2, invite->GetInviteeGUID().GetCounter());
+ stmt->setUInt32(3, invite->GetSenderGUID().GetCounter());
stmt->setUInt8(4, invite->GetStatus());
stmt->setUInt32(5, uint32(invite->GetStatusTime()));
stmt->setUInt8(6, invite->GetRank());
@@ -259,18 +259,18 @@ void CalendarMgr::UpdateInvite(CalendarInvite* invite, SQLTransaction& trans)
CharacterDatabase.ExecuteOrAppend(trans, stmt);
}
-void CalendarMgr::RemoveAllPlayerEventsAndInvites(uint64 guid)
+void CalendarMgr::RemoveAllPlayerEventsAndInvites(ObjectGuid guid)
{
for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
if ((*itr)->GetCreatorGUID() == guid)
- RemoveEvent((*itr)->GetEventId(), 0); // don't send mail if removing a character
+ RemoveEvent((*itr)->GetEventId(), ObjectGuid::Empty); // don't send mail if removing a character
CalendarInviteStore playerInvites = GetPlayerInvites(guid);
for (CalendarInviteStore::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr)
RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
}
-void CalendarMgr::RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId)
+void CalendarMgr::RemovePlayerGuildEventsAndSignups(ObjectGuid guid, uint32 guildId)
{
for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
if ((*itr)->GetCreatorGUID() == guid && ((*itr)->IsGuildEvent() || (*itr)->IsGuildAnnouncement()))
@@ -340,7 +340,7 @@ uint64 CalendarMgr::GetFreeInviteId()
return inviteId;
}
-CalendarEventStore CalendarMgr::GetPlayerEvents(uint64 guid)
+CalendarEventStore CalendarMgr::GetPlayerEvents(ObjectGuid guid)
{
CalendarEventStore events;
@@ -363,7 +363,7 @@ CalendarInviteStore const& CalendarMgr::GetEventInvites(uint64 eventId)
return _invites[eventId];
}
-CalendarInviteStore CalendarMgr::GetPlayerInvites(uint64 guid)
+CalendarInviteStore CalendarMgr::GetPlayerInvites(ObjectGuid guid)
{
CalendarInviteStore invites;
@@ -375,7 +375,7 @@ CalendarInviteStore CalendarMgr::GetPlayerInvites(uint64 guid)
return invites;
}
-uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
+uint32 CalendarMgr::GetPlayerNumPending(ObjectGuid guid)
{
CalendarInviteStore const& invites = GetPlayerInvites(guid);
@@ -397,10 +397,10 @@ uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
return pendingNum;
}
-std::string CalendarEvent::BuildCalendarMailSubject(uint64 remover) const
+std::string CalendarEvent::BuildCalendarMailSubject(ObjectGuid remover) const
{
std::ostringstream strm;
- strm << remover << ':' << _title;
+ strm << remover.GetRawValue() << ':' << _title;
return strm.str();
}
@@ -423,13 +423,13 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite)
time_t statusTime = invite.GetStatusTime();
bool hasStatusTime = statusTime != 946684800; // 01/01/2000 00:00:00
- uint64 invitee = invite.GetInviteeGUID();
+ ObjectGuid invitee = invite.GetInviteeGUID();
Player* player = ObjectAccessor::FindPlayer(invitee);
uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(invitee);
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1);
- data.appendPackGUID(invitee);
+ data << invitee.WriteAsPacked();
data << uint64(invite.GetEventId());
data << uint64(invite.GetInviteId());
data << uint8(level);
@@ -474,7 +474,7 @@ void CalendarMgr::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEven
void CalendarMgr::SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
WorldPacket data(SMSG_CALENDAR_EVENT_STATUS, 8 + 8 + 4 + 4 + 1 + 1 + 4);
- data.appendPackGUID(invite.GetInviteeGUID());
+ data << invite.GetInviteeGUID().WriteAsPacked();
data << uint64(calendarEvent.GetEventId());
data.AppendPackedTime(calendarEvent.GetEventTime());
data << uint32(calendarEvent.GetFlags());
@@ -498,7 +498,7 @@ void CalendarMgr::SendCalendarEventRemovedAlert(CalendarEvent const& calendarEve
void CalendarMgr::SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags)
{
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED, 8 + 4 + 4 + 1);
- data.appendPackGUID(invite.GetInviteeGUID());
+ data << invite.GetInviteeGUID().WriteAsPacked();
data << uint64(invite.GetEventId());
data << uint32(flags);
data << uint8(1); // FIXME
@@ -509,7 +509,7 @@ void CalendarMgr::SendCalendarEventInviteRemove(CalendarEvent const& calendarEve
void CalendarMgr::SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
WorldPacket data(SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT, 8 + 8 + 1 + 1);
- data.appendPackGUID(invite.GetInviteeGUID());
+ data << invite.GetInviteeGUID().WriteAsPacked();
data << uint64(invite.GetEventId());
data << uint8(invite.GetRank());
data << uint8(1); // Unk boolean - Display to client?
@@ -533,8 +533,8 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEven
data << uint8(invite.GetStatus());
data << uint8(invite.GetRank());
- data.appendPackGUID(calendarEvent.GetCreatorGUID());
- data.appendPackGUID(invite.GetSenderGUID());
+ data << calendarEvent.GetCreatorGUID().WriteAsPacked();
+ data << invite.GetSenderGUID().WriteAsPacked();
if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
{
@@ -546,7 +546,7 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEven
player->SendDirectMessage(&data);
}
-void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType)
+void CalendarMgr::SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType)
{
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
@@ -556,7 +556,7 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv
WorldPacket data(SMSG_CALENDAR_SEND_EVENT, 60 + eventInviteeList.size() * 32);
data << uint8(sendType);
- data.appendPackGUID(calendarEvent.GetCreatorGUID());
+ data << calendarEvent.GetCreatorGUID().WriteAsPacked();
data << uint64(calendarEvent.GetEventId());
data << calendarEvent.GetTitle();
data << calendarEvent.GetDescription();
@@ -575,13 +575,13 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv
for (CalendarInviteStore::const_iterator itr = eventInviteeList.begin(); itr != eventInviteeList.end(); ++itr)
{
CalendarInvite const* calendarInvite = (*itr);
- uint64 inviteeGuid = calendarInvite->GetInviteeGUID();
+ ObjectGuid inviteeGuid = calendarInvite->GetInviteeGUID();
Player* invitee = ObjectAccessor::FindPlayer(inviteeGuid);
uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromDB(inviteeGuid);
uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromDB(inviteeGuid);
- data.appendPackGUID(inviteeGuid);
+ data << inviteeGuid.WriteAsPacked();
data << uint8(inviteeLevel);
data << uint8(calendarInvite->GetStatus());
data << uint8(calendarInvite->GetRank());
@@ -594,7 +594,7 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv
player->SendDirectMessage(&data);
}
-void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status)
+void CalendarMgr::SendCalendarEventInviteRemoveAlert(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
{
@@ -608,7 +608,7 @@ void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent
}
}
-void CalendarMgr::SendCalendarClearPendingAction(uint64 guid)
+void CalendarMgr::SendCalendarClearPendingAction(ObjectGuid guid)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
{
@@ -617,7 +617,7 @@ void CalendarMgr::SendCalendarClearPendingAction(uint64 guid)
}
}
-void CalendarMgr::SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param /*= NULL*/)
+void CalendarMgr::SendCalendarCommandResult(ObjectGuid guid, CalendarError err, char const* param /*= NULL*/)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
{
diff --git a/src/server/game/Calendar/CalendarMgr.h b/src/server/game/Calendar/CalendarMgr.h
index cd527a7373e..02b707d5a12 100644
--- a/src/server/game/Calendar/CalendarMgr.h
+++ b/src/server/game/Calendar/CalendarMgr.h
@@ -21,6 +21,7 @@
#include "Common.h"
#include "DatabaseEnv.h"
#include "WorldPacket.h"
+#include "ObjectGuid.h"
enum CalendarMailAnswers
{
@@ -141,10 +142,10 @@ struct CalendarInvite
_text = calendarInvite.GetText();
}
- CalendarInvite() : _inviteId(1), _eventId(0), _invitee(0), _senderGUID(0), _statusTime(time(NULL)),
+ CalendarInvite() : _inviteId(1), _eventId(0), _invitee(), _senderGUID(), _statusTime(time(NULL)),
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { }
- CalendarInvite(uint64 inviteId, uint64 eventId, uint64 invitee, uint64 senderGUID, time_t statusTime,
+ CalendarInvite(uint64 inviteId, uint64 eventId, ObjectGuid invitee, ObjectGuid senderGUID, time_t statusTime,
CalendarInviteStatus status, CalendarModerationRank rank, std::string text) :
_inviteId(inviteId), _eventId(eventId), _invitee(invitee), _senderGUID(senderGUID), _statusTime(statusTime),
_status(status), _rank(rank), _text(text) { }
@@ -157,11 +158,11 @@ struct CalendarInvite
void SetEventId(uint64 eventId) { _eventId = eventId; }
uint64 GetEventId() const { return _eventId; }
- void SetSenderGUID(uint64 guid) { _senderGUID = guid; }
- uint64 GetSenderGUID() const { return _senderGUID; }
+ void SetSenderGUID(ObjectGuid guid) { _senderGUID = guid; }
+ ObjectGuid GetSenderGUID() const { return _senderGUID; }
- void SetInvitee(uint64 guid) { _invitee = guid; }
- uint64 GetInviteeGUID() const { return _invitee; }
+ void SetInvitee(ObjectGuid guid) { _invitee = guid; }
+ ObjectGuid GetInviteeGUID() const { return _invitee; }
void SetStatusTime(time_t statusTime) { _statusTime = statusTime; }
time_t GetStatusTime() const { return _statusTime; }
@@ -178,8 +179,8 @@ struct CalendarInvite
private:
uint64 _inviteId;
uint64 _eventId;
- uint64 _invitee;
- uint64 _senderGUID;
+ ObjectGuid _invitee;
+ ObjectGuid _senderGUID;
time_t _statusTime;
CalendarInviteStatus _status;
CalendarModerationRank _rank;
@@ -203,13 +204,13 @@ struct CalendarEvent
_description = calendarEvent.GetDescription();
}
- CalendarEvent(uint64 eventId, uint64 creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
+ CalendarEvent(uint64 eventId, ObjectGuid creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
time_t eventTime, uint32 flags, time_t timezoneTime, std::string title, std::string description) :
_eventId(eventId), _creatorGUID(creatorGUID), _guildId(guildId), _type(type), _dungeonId(dungeonId),
_eventTime(eventTime), _flags(flags), _timezoneTime(timezoneTime), _title(title),
_description(description) { }
- CalendarEvent() : _eventId(1), _creatorGUID(0), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0),
+ CalendarEvent() : _eventId(1), _creatorGUID(), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0),
_flags(0), _timezoneTime(0), _title(""), _description("") { }
~CalendarEvent();
@@ -217,8 +218,8 @@ struct CalendarEvent
void SetEventId(uint64 eventId) { _eventId = eventId; }
uint64 GetEventId() const { return _eventId; }
- void SetCreatorGUID(uint64 guid) { _creatorGUID = guid; }
- uint64 GetCreatorGUID() const { return _creatorGUID; }
+ void SetCreatorGUID(ObjectGuid guid) { _creatorGUID = guid; }
+ ObjectGuid GetCreatorGUID() const { return _creatorGUID; }
void SetGuildId(uint32 guildId) { _guildId = guildId; }
uint32 GetGuildId() const { return _guildId; }
@@ -247,12 +248,12 @@ struct CalendarEvent
bool IsGuildEvent() const { return (_flags & CALENDAR_FLAG_GUILD_EVENT) != 0; }
bool IsGuildAnnouncement() const { return (_flags & CALENDAR_FLAG_WITHOUT_INVITES) != 0; }
- std::string BuildCalendarMailSubject(uint64 remover) const;
+ std::string BuildCalendarMailSubject(ObjectGuid remover) const;
std::string BuildCalendarMailBody() const;
private:
uint64 _eventId;
- uint64 _creatorGUID;
+ ObjectGuid _creatorGUID;
uint32 _guildId;
CalendarEventType _type;
int32 _dungeonId;
@@ -291,44 +292,44 @@ class CalendarMgr
CalendarEvent* GetEvent(uint64 eventId) const;
CalendarEventStore const& GetEvents() const { return _events; }
- CalendarEventStore GetPlayerEvents(uint64 guid);
+ CalendarEventStore GetPlayerEvents(ObjectGuid guid);
CalendarInvite* GetInvite(uint64 inviteId) const;
CalendarEventInviteStore const& GetInvites() const { return _invites; }
CalendarInviteStore const& GetEventInvites(uint64 eventId);
- CalendarInviteStore GetPlayerInvites(uint64 guid);
+ CalendarInviteStore GetPlayerInvites(ObjectGuid guid);
void FreeEventId(uint64 id);
uint64 GetFreeEventId();
void FreeInviteId(uint64 id);
uint64 GetFreeInviteId();
- uint32 GetPlayerNumPending(uint64 guid);
+ uint32 GetPlayerNumPending(ObjectGuid guid);
void AddEvent(CalendarEvent* calendarEvent, CalendarSendEventType sendType);
- void RemoveEvent(uint64 eventId, uint64 remover);
+ void RemoveEvent(uint64 eventId, ObjectGuid remover);
void UpdateEvent(CalendarEvent* calendarEvent);
void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite);
void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite, SQLTransaction& trans);
- void RemoveInvite(uint64 inviteId, uint64 eventId, uint64 remover);
+ void RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid remover);
void UpdateInvite(CalendarInvite* invite);
void UpdateInvite(CalendarInvite* invite, SQLTransaction& trans);
- void RemoveAllPlayerEventsAndInvites(uint64 guid);
- void RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId);
+ void RemoveAllPlayerEventsAndInvites(ObjectGuid guid);
+ void RemovePlayerGuildEventsAndSignups(ObjectGuid guid, uint32 guildId);
- void SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType);
+ void SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType);
void SendCalendarEventInvite(CalendarInvite const& invite);
void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
void SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags);
- void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
+ void SendCalendarEventInviteRemoveAlert(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
void SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, time_t oldEventTime);
void SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent);
void SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
- void SendCalendarClearPendingAction(uint64 guid);
- void SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param = NULL);
+ void SendCalendarClearPendingAction(ObjectGuid guid);
+ void SendCalendarCommandResult(ObjectGuid guid, CalendarError err, char const* param = NULL);
void SendPacketToAllEventRelatives(WorldPacket& packet, CalendarEvent const& calendarEvent);
};
diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index 3f6a40d825d..654ce8da2b9 100644
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -32,7 +32,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 team):
_flags(0),
_channelId(channelId),
_Team(team),
- _ownerGUID(0),
+ _ownerGUID(),
_name(name),
_password("")
{
@@ -80,10 +80,10 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 team):
Tokenizer tokens(db_BannedList, ' ');
for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i)
{
- uint64 banned_guid = atol(*i);
+ ObjectGuid banned_guid(uint64(strtoull(*i, NULL, 10)));
if (banned_guid)
{
- TC_LOG_DEBUG("chat.system", "Channel(%s) loaded bannedStore guid:" UI64FMTD "", name.c_str(), banned_guid);
+ TC_LOG_DEBUG("chat.system", "Channel(%s) loaded bannedStore %s", name.c_str(), banned_guid.ToString().c_str());
bannedStore.insert(banned_guid);
}
}
@@ -110,7 +110,7 @@ void Channel::UpdateChannelInDB() const
std::ostringstream banlist;
BannedContainer::const_iterator iter;
for (iter = bannedStore.begin(); iter != bannedStore.end(); ++iter)
- banlist << (*iter) << ' ';
+ banlist << iter->GetRawValue() << ' ';
std::string banListStr = banlist.str();
@@ -149,7 +149,7 @@ void Channel::CleanOldChannelsInDB()
void Channel::JoinChannel(Player* player, std::string const& pass)
{
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
if (IsOn(guid))
{
// Do not send error message for built-in channels
@@ -227,7 +227,7 @@ void Channel::JoinChannel(Player* player, std::string const& pass)
void Channel::LeaveChannel(Player* player, bool send)
{
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
if (send)
@@ -269,7 +269,7 @@ void Channel::LeaveChannel(Player* player, bool send)
// If the channel owner left and there are still playersStore inside, pick a new owner
if (changeowner && _ownership && !playersStore.empty())
{
- uint64 newowner = playersStore.begin()->second.player;
+ ObjectGuid newowner = playersStore.begin()->second.player;
playersStore[newowner].SetModerator(true);
SetOwner(newowner);
}
@@ -278,7 +278,7 @@ void Channel::LeaveChannel(Player* player, bool send)
void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
{
- uint64 good = player->GetGUID();
+ ObjectGuid good = player->GetGUID();
if (!IsOn(good))
{
@@ -297,7 +297,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
}
Player* bad = sObjectAccessor->FindPlayerByName(badname);
- uint64 victim = bad ? bad->GetGUID() : 0;
+ ObjectGuid victim = bad ? bad->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim))
{
WorldPacket data;
@@ -340,7 +340,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
if (changeowner && _ownership && !playersStore.empty())
{
- uint64 newowner = good;
+ ObjectGuid newowner = good;
playersStore[newowner].SetModerator(true);
SetOwner(newowner);
}
@@ -348,7 +348,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
void Channel::UnBan(Player const* player, std::string const& badname)
{
- uint64 good = player->GetGUID();
+ ObjectGuid good = player->GetGUID();
if (!IsOn(good))
{
@@ -367,7 +367,7 @@ void Channel::UnBan(Player const* player, std::string const& badname)
}
Player* bad = sObjectAccessor->FindPlayerByName(badname);
- uint64 victim = bad ? bad->GetGUID(): 0;
+ ObjectGuid victim = bad ? bad->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsBanned(victim))
{
@@ -388,7 +388,7 @@ void Channel::UnBan(Player const* player, std::string const& badname)
void Channel::Password(Player const* player, std::string const& pass)
{
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
ChatHandler chat(player->GetSession());
if (!IsOn(guid))
@@ -418,7 +418,7 @@ void Channel::Password(Player const* player, std::string const& pass)
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -440,7 +440,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
return;
Player* newp = sObjectAccessor->FindPlayerByName(p2n);
- uint64 victim = newp ? newp->GetGUID() : 0;
+ ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim) ||
(player->GetTeam() != newp->GetTeam() &&
@@ -469,7 +469,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
void Channel::SetOwner(Player const* player, std::string const& newname)
{
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -488,7 +488,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
}
Player* newp = sObjectAccessor->FindPlayerByName(newname);
- uint64 victim = newp ? newp->GetGUID() : 0;
+ ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim) ||
(player->GetTeam() != newp->GetTeam() &&
@@ -505,7 +505,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
SetOwner(victim);
}
-void Channel::SendWhoOwner(uint64 guid)
+void Channel::SendWhoOwner(ObjectGuid guid)
{
WorldPacket data;
if (IsOn(guid))
@@ -517,7 +517,7 @@ void Channel::SendWhoOwner(uint64 guid)
void Channel::List(Player const* player)
{
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -565,7 +565,7 @@ void Channel::List(Player const* player)
void Channel::Announce(Player const* player)
{
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -595,7 +595,7 @@ void Channel::Announce(Player const* player)
UpdateChannelInDB();
}
-void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
+void Channel::Say(ObjectGuid guid, std::string const& what, uint32 lang)
{
if (what.empty())
return;
@@ -626,12 +626,12 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
else
ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, Language(lang), guid, guid, what, 0, "", "", 0, false, _name);
- SendToAll(&data, !playersStore[guid].IsModerator() ? guid : false);
+ SendToAll(&data, !playersStore[guid].IsModerator() ? guid : ObjectGuid::Empty);
}
void Channel::Invite(Player const* player, std::string const& newname)
{
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
if (!IsOn(guid))
{
@@ -676,7 +676,7 @@ void Channel::Invite(Player const* player, std::string const& newname)
return;
}
- if (!newp->GetSocial()->HasIgnore(GUID_LOPART(guid)))
+ if (!newp->GetSocial()->HasIgnore(guid.GetCounter()))
{
WorldPacket data;
MakeInvite(&data, guid);
@@ -689,7 +689,7 @@ void Channel::Invite(Player const* player, std::string const& newname)
SendToOne(&data, guid);
}
-void Channel::SetOwner(uint64 guid, bool exclaim)
+void Channel::SetOwner(ObjectGuid guid, bool exclaim)
{
if (_ownerGUID)
{
@@ -720,15 +720,15 @@ void Channel::SetOwner(uint64 guid, bool exclaim)
}
}
-void Channel::SendToAll(WorldPacket* data, uint64 guid)
+void Channel::SendToAll(WorldPacket* data, ObjectGuid guid)
{
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
if (Player* player = ObjectAccessor::FindPlayer(i->first))
- if (!guid || !player->GetSocial()->HasIgnore(GUID_LOPART(guid)))
+ if (!guid || !player->GetSocial()->HasIgnore(guid.GetCounter()))
player->GetSession()->SendPacket(data);
}
-void Channel::SendToAllButOne(WorldPacket* data, uint64 who)
+void Channel::SendToAllButOne(WorldPacket* data, ObjectGuid who)
{
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
if (i->first != who)
@@ -736,18 +736,18 @@ void Channel::SendToAllButOne(WorldPacket* data, uint64 who)
player->GetSession()->SendPacket(data);
}
-void Channel::SendToOne(WorldPacket* data, uint64 who)
+void Channel::SendToOne(WorldPacket* data, ObjectGuid who)
{
if (Player* player = ObjectAccessor::FindPlayer(who))
player->GetSession()->SendPacket(data);
}
-void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/)
+void Channel::Voice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
{
}
-void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/)
+void Channel::DeVoice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
{
}
@@ -759,13 +759,13 @@ void Channel::MakeNotifyPacket(WorldPacket* data, uint8 notify_type)
*data << _name;
}
-void Channel::MakeJoined(WorldPacket* data, uint64 guid)
+void Channel::MakeJoined(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_JOINED_NOTICE);
*data << uint64(guid);
}
-void Channel::MakeLeft(WorldPacket* data, uint64 guid)
+void Channel::MakeLeft(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_LEFT_NOTICE);
*data << uint64(guid);
@@ -801,13 +801,13 @@ void Channel::MakeNotModerator(WorldPacket* data)
MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE);
}
-void Channel::MakePasswordChanged(WorldPacket* data, uint64 guid)
+void Channel::MakePasswordChanged(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE);
*data << uint64(guid);
}
-void Channel::MakeOwnerChanged(WorldPacket* data, uint64 guid)
+void Channel::MakeOwnerChanged(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE);
*data << uint64(guid);
@@ -835,7 +835,7 @@ void Channel::MakeChannelOwner(WorldPacket* data)
*data << ((IsConstant() || !_ownerGUID) ? "Nobody" : name);
}
-void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags)
+void Channel::MakeModeChange(WorldPacket* data, ObjectGuid guid, uint8 oldflags)
{
MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE);
*data << uint64(guid);
@@ -843,13 +843,13 @@ void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags)
*data << uint8(GetPlayerFlags(guid));
}
-void Channel::MakeAnnouncementsOn(WorldPacket* data, uint64 guid)
+void Channel::MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE);
*data << uint64(guid);
}
-void Channel::MakeAnnouncementsOff(WorldPacket* data, uint64 guid)
+void Channel::MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE);
*data << uint64(guid);
@@ -860,7 +860,7 @@ void Channel::MakeMuted(WorldPacket* data)
MakeNotifyPacket(data, CHAT_MUTED_NOTICE);
}
-void Channel::MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good)
+void Channel::MakePlayerKicked(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE);
*data << uint64(bad);
@@ -872,14 +872,14 @@ void Channel::MakeBanned(WorldPacket* data)
MakeNotifyPacket(data, CHAT_BANNED_NOTICE);
}
-void Channel::MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good)
+void Channel::MakePlayerBanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE);
*data << uint64(bad);
*data << uint64(good);
}
-void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good)
+void Channel::MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE);
*data << uint64(bad);
@@ -892,13 +892,13 @@ void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string &name)
*data << name;
}
-void Channel::MakePlayerAlreadyMember(WorldPacket* data, uint64 guid)
+void Channel::MakePlayerAlreadyMember(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE);
*data << uint64(guid);
}
-void Channel::MakeInvite(WorldPacket* data, uint64 guid)
+void Channel::MakeInvite(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_INVITE_NOTICE);
*data << uint64(guid);
@@ -951,19 +951,19 @@ void Channel::MakeNotInLfg(WorldPacket* data)
MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE);
}
-void Channel::MakeVoiceOn(WorldPacket* data, uint64 guid)
+void Channel::MakeVoiceOn(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE);
*data << uint64(guid);
}
-void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid)
+void Channel::MakeVoiceOff(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE);
*data << uint64(guid);
}
-void Channel::JoinNotify(uint64 guid)
+void Channel::JoinNotify(ObjectGuid guid)
{
WorldPacket data(IsConstant() ? SMSG_USERLIST_ADD : SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size());
data << uint64(guid);
@@ -978,7 +978,7 @@ void Channel::JoinNotify(uint64 guid)
SendToAll(&data);
}
-void Channel::LeaveNotify(uint64 guid)
+void Channel::LeaveNotify(ObjectGuid guid)
{
WorldPacket data(SMSG_USERLIST_REMOVE, 8 + 1 + 4 + GetName().size());
data << uint64(guid);
diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h
index 877c1e826c9..6489c8b47ad 100644
--- a/src/server/game/Chat/Channels/Channel.h
+++ b/src/server/game/Chat/Channels/Channel.h
@@ -122,7 +122,7 @@ class Channel
{
struct PlayerInfo
{
- uint64 player;
+ ObjectGuid player;
uint8 flags;
bool HasFlag(uint8 flag) const { return (flags & flag) != 0; }
@@ -169,21 +169,21 @@ class Channel
void UnBan(Player const* player, std::string const& badname);
void Password(Player const* player, std::string const& pass);
void SetMode(Player const* player, std::string const& p2n, bool mod, bool set);
- void SetOwner(uint64 guid, bool exclaim = true);
+ void SetOwner(ObjectGuid guid, bool exclaim = true);
void SetOwner(Player const* player, std::string const& name);
- void SendWhoOwner(uint64 guid);
+ void SendWhoOwner(ObjectGuid guid);
void SetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, true); }
void UnsetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, false); }
void SetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, true); }
void UnsetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, false); }
void List(Player const* player);
void Announce(Player const* player);
- void Say(uint64 guid, std::string const& what, uint32 lang);
+ void Say(ObjectGuid guid, std::string const& what, uint32 lang);
void Invite(Player const* player, std::string const& newp);
- void Voice(uint64 guid1, uint64 guid2);
- void DeVoice(uint64 guid1, uint64 guid2);
- void JoinNotify(uint64 guid); // invisible notify
- void LeaveNotify(uint64 guid); // invisible notify
+ void Voice(ObjectGuid guid1, ObjectGuid guid2);
+ void DeVoice(ObjectGuid guid1, ObjectGuid guid2);
+ void JoinNotify(ObjectGuid guid); // invisible notify
+ void LeaveNotify(ObjectGuid guid); // invisible notify
void SetOwnership(bool ownership) { _ownership = ownership; };
static void CleanOldChannelsInDB();
@@ -191,29 +191,29 @@ class Channel
// initial packet data (notify type and channel name)
void MakeNotifyPacket(WorldPacket* data, uint8 notify_type);
// type specific packet data
- void MakeJoined(WorldPacket* data, uint64 guid); //+ 0x00
- void MakeLeft(WorldPacket* data, uint64 guid); //+ 0x01
+ void MakeJoined(WorldPacket* data, ObjectGuid guid); //+ 0x00
+ void MakeLeft(WorldPacket* data, ObjectGuid guid); //+ 0x01
void MakeYouJoined(WorldPacket* data); //+ 0x02
void MakeYouLeft(WorldPacket* data); //+ 0x03
void MakeWrongPassword(WorldPacket* data); //? 0x04
void MakeNotMember(WorldPacket* data); //? 0x05
void MakeNotModerator(WorldPacket* data); //? 0x06
- void MakePasswordChanged(WorldPacket* data, uint64 guid); //+ 0x07
- void MakeOwnerChanged(WorldPacket* data, uint64 guid); //? 0x08
- void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09
+ void MakePasswordChanged(WorldPacket* data, ObjectGuid guid); //+ 0x07
+ void MakeOwnerChanged(WorldPacket* data, ObjectGuid guid); //? 0x08
+ void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09
void MakeNotOwner(WorldPacket* data); //? 0x0A
void MakeChannelOwner(WorldPacket* data); //? 0x0B
- void MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags); //+ 0x0C
- void MakeAnnouncementsOn(WorldPacket* data, uint64 guid); //+ 0x0D
- void MakeAnnouncementsOff(WorldPacket* data, uint64 guid); //+ 0x0E
+ void MakeModeChange(WorldPacket* data, ObjectGuid guid, uint8 oldflags);//+ 0x0C
+ void MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid); //+ 0x0D
+ void MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid); //+ 0x0E
void MakeMuted(WorldPacket* data); //? 0x11
- void MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good); //? 0x12
+ void MakePlayerKicked(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x12
void MakeBanned(WorldPacket* data); //? 0x13
- void MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x14
- void MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x15
- void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16
- void MakePlayerAlreadyMember(WorldPacket* data, uint64 guid); //+ 0x17
- void MakeInvite(WorldPacket* data, uint64 guid); //? 0x18
+ void MakePlayerBanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x14
+ void MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x15
+ void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16
+ void MakePlayerAlreadyMember(WorldPacket* data, ObjectGuid guid); //+ 0x17
+ void MakeInvite(WorldPacket* data, ObjectGuid guid); //? 0x18
void MakeInviteWrongFaction(WorldPacket* data); //? 0x19
void MakeWrongFaction(WorldPacket* data); //? 0x1A
void MakeInvalidName(WorldPacket* data); //? 0x1B
@@ -223,26 +223,26 @@ class Channel
void MakeThrottled(WorldPacket* data); //? 0x1F
void MakeNotInArea(WorldPacket* data); //? 0x20
void MakeNotInLfg(WorldPacket* data); //? 0x21
- void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22
- void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23
+ void MakeVoiceOn(WorldPacket* data, ObjectGuid guid); //+ 0x22
+ void MakeVoiceOff(WorldPacket* data, ObjectGuid guid); //+ 0x23
- void SendToAll(WorldPacket* data, uint64 guid = 0);
- void SendToAllButOne(WorldPacket* data, uint64 who);
- void SendToOne(WorldPacket* data, uint64 who);
+ void SendToAll(WorldPacket* data, ObjectGuid guid = ObjectGuid::Empty);
+ void SendToAllButOne(WorldPacket* data, ObjectGuid who);
+ void SendToOne(WorldPacket* data, ObjectGuid who);
- bool IsOn(uint64 who) const { return playersStore.find(who) != playersStore.end(); }
- bool IsBanned(uint64 guid) const { return bannedStore.find(guid) != bannedStore.end(); }
+ bool IsOn(ObjectGuid who) const { return playersStore.find(who) != playersStore.end(); }
+ bool IsBanned(ObjectGuid guid) const { return bannedStore.find(guid) != bannedStore.end(); }
void UpdateChannelInDB() const;
void UpdateChannelUseageInDB() const;
- uint8 GetPlayerFlags(uint64 guid) const
+ uint8 GetPlayerFlags(ObjectGuid guid) const
{
PlayerContainer::const_iterator itr = playersStore.find(guid);
return itr != playersStore.end() ? itr->second.flags : 0;
}
- void SetModerator(uint64 guid, bool set)
+ void SetModerator(ObjectGuid guid, bool set)
{
if (playersStore[guid].IsModerator() != set)
{
@@ -255,7 +255,7 @@ class Channel
}
}
- void SetMute(uint64 guid, bool set)
+ void SetMute(ObjectGuid guid, bool set)
{
if (playersStore[guid].IsMuted() != set)
{
@@ -268,8 +268,8 @@ class Channel
}
}
- typedef std::map<uint64, PlayerInfo> PlayerContainer;
- typedef std::set<uint64> BannedContainer;
+ typedef std::map<ObjectGuid, PlayerInfo> PlayerContainer;
+ typedef GuidSet BannedContainer;
bool _announce;
bool _ownership;
@@ -277,7 +277,7 @@ class Channel
uint8 _flags;
uint32 _channelId;
uint32 _Team;
- uint64 _ownerGUID;
+ ObjectGuid _ownerGUID;
std::string _name;
std::string _password;
PlayerContainer playersStore;
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index be2d0ecb726..ace13989efb 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -104,7 +104,7 @@ ChatCommand* ChatHandler::getCommandTable()
return commandTableCache;
}
-std::string ChatHandler::PGetParseString(int32 entry, ...) const
+std::string ChatHandler::PGetParseString(uint32 entry, ...) const
{
const char *format = GetTrinityString(entry);
char str[1024];
@@ -115,7 +115,7 @@ std::string ChatHandler::PGetParseString(int32 entry, ...) const
return std::string(str);
}
-const char *ChatHandler::GetTrinityString(int32 entry) const
+char const* ChatHandler::GetTrinityString(uint32 entry) const
{
return m_session->GetTrinityString(entry);
}
@@ -125,7 +125,7 @@ bool ChatHandler::isAvailable(ChatCommand const& cmd) const
return HasPermission(cmd.Permission);
}
-bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
+bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong)
{
WorldSession* target_session = NULL;
uint32 target_account = 0;
@@ -253,12 +253,12 @@ void ChatHandler::SendGlobalGMSysMessage(const char *str)
free(buf);
}
-void ChatHandler::SendSysMessage(int32 entry)
+void ChatHandler::SendSysMessage(uint32 entry)
{
SendSysMessage(GetTrinityString(entry));
}
-void ChatHandler::PSendSysMessage(int32 entry, ...)
+void ChatHandler::PSendSysMessage(uint32 entry, ...)
{
const char *format = GetTrinityString(entry);
va_list ap;
@@ -345,7 +345,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, st
Player* player = m_session->GetPlayer();
if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
{
- uint64 guid = player->GetTarget();
+ ObjectGuid guid = player->GetTarget();
uint32 areaId = player->GetAreaId();
std::string areaName = "Unknown";
std::string zoneName = "Unknown";
@@ -356,14 +356,14 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, st
zoneName = zone->area_name;
}
- sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (Guid: %u) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected %s: %s (GUID: %u)]",
- fullcmd.c_str(), player->GetName().c_str(), GUID_LOPART(player->GetGUID()),
+ sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (%s) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected: %s (%s)]",
+ fullcmd.c_str(), player->GetName().c_str(), player->GetGUID().ToString().c_str(),
m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(),
player->GetPositionZ(), player->GetMapId(),
player->GetMap() ? player->GetMap()->GetMapName() : "Unknown",
- areaId, areaName.c_str(), zoneName.c_str(), GetLogNameForGuid(guid),
+ areaId, areaName.c_str(), zoneName.c_str(),
(player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
- GUID_LOPART(guid));
+ guid.ToString().c_str());
}
}
// some commands have custom error messages. Don't send the default one in these cases.
@@ -628,7 +628,7 @@ bool ChatHandler::ShowHelpForCommand(ChatCommand* table, const char* cmd)
return ShowHelpForSubCommands(table, "", cmd);
}
-size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag,
+size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const& message, uint8 chatTag,
std::string const& senderName /*= ""*/, std::string const& receiverName /*= ""*/,
uint32 achievementId /*= 0*/, bool gmMessage /*= false*/, std::string const& channelName /*= ""*/,
std::string const& addonPrefix /*= ""*/)
@@ -653,7 +653,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
data << senderName;
receiverGUIDPos = data.wpos();
data << uint64(receiverGUID);
- if (receiverGUID && !IS_PLAYER_GUID(receiverGUID) && !IS_PET_GUID(receiverGUID))
+ if (receiverGUID && !receiverGUID.IsPlayer() && !receiverGUID.IsPet())
{
data << uint32(receiverName.length() + 1);
data << receiverName;
@@ -675,7 +675,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
case CHAT_MSG_BG_SYSTEM_HORDE:
receiverGUIDPos = data.wpos();
data << uint64(receiverGUID);
- if (receiverGUID && !IS_PLAYER_GUID(receiverGUID))
+ if (receiverGUID && !receiverGUID.IsPlayer())
{
data << uint32(receiverName.length() + 1);
data << receiverName;
@@ -730,11 +730,11 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string const& message,
uint32 achievementId /*= 0*/, std::string const& channelName /*= ""*/, LocaleConstant locale /*= DEFAULT_LOCALE*/, std::string const& addonPrefix /*= ""*/)
{
- uint64 senderGUID = 0;
+ ObjectGuid senderGUID;
std::string senderName = "";
uint8 chatTag = 0;
bool gmMessage = false;
- uint64 receiverGUID = 0;
+ ObjectGuid receiverGUID;
std::string receiverName = "";
if (sender)
{
@@ -761,7 +761,7 @@ Player* ChatHandler::getSelectedPlayer()
if (!m_session)
return NULL;
- uint64 selected = m_session->GetPlayer()->GetTarget();
+ ObjectGuid selected = m_session->GetPlayer()->GetTarget();
if (!selected)
return m_session->GetPlayer();
@@ -784,9 +784,9 @@ WorldObject* ChatHandler::getSelectedObject()
if (!m_session)
return NULL;
- uint64 guid = m_session->GetPlayer()->GetTarget();
+ ObjectGuid guid = m_session->GetPlayer()->GetTarget();
- if (guid == 0)
+ if (!guid)
return GetNearbyGameObject();
return ObjectAccessor::GetUnit(*m_session->GetPlayer(), guid);
@@ -805,7 +805,7 @@ Player* ChatHandler::getSelectedPlayerOrSelf()
if (!m_session)
return NULL;
- uint64 selected = m_session->GetPlayer()->GetTarget();
+ ObjectGuid selected = m_session->GetPlayer()->GetTarget();
if (!selected)
return m_session->GetPlayer();
@@ -950,7 +950,7 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid
Player* pl = m_session->GetPlayer();
- GameObject* obj = pl->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT));
+ GameObject* obj = pl->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, entry, lowguid));
if (!obj && sObjectMgr->GetGOData(lowguid)) // guid is DB guid of object
{
@@ -1071,7 +1071,7 @@ static char const* const guidKeys[] =
nullptr
};
-uint64 ChatHandler::extractGuidFromLink(char* text)
+ObjectGuid ChatHandler::extractGuidFromLink(char* text)
{
int type = 0;
@@ -1080,7 +1080,7 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
// |color|Hplayer:name|h[name]|h|r
char* idS = extractKeyFromLink(text, guidKeys, &type);
if (!idS)
- return 0;
+ return ObjectGuid::Empty;
switch (type)
{
@@ -1088,38 +1088,38 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
{
std::string name = idS;
if (!normalizePlayerName(name))
- return 0;
+ return ObjectGuid::Empty;
if (Player* player = sObjectAccessor->FindPlayerByName(name))
return player->GetGUID();
- if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(name))
+ if (ObjectGuid guid = sObjectMgr->GetPlayerGUIDByName(name))
return guid;
- return 0;
+ return ObjectGuid::Empty;
}
case SPELL_LINK_CREATURE:
{
uint32 lowguid = (uint32)atol(idS);
if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid))
- return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT);
+ return ObjectGuid(HIGHGUID_UNIT, data->id, lowguid);
else
- return 0;
+ return ObjectGuid::Empty;
}
case SPELL_LINK_GAMEOBJECT:
{
uint32 lowguid = (uint32)atol(idS);
if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid))
- return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_GAMEOBJECT);
+ return ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, lowguid);
else
- return 0;
+ return ObjectGuid::Empty;
}
}
// unknown type?
- return 0;
+ return ObjectGuid::Empty;
}
std::string ChatHandler::extractPlayerNameFromLink(char* text)
@@ -1136,7 +1136,7 @@ std::string ChatHandler::extractPlayerNameFromLink(char* text)
return name;
}
-bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* player_guid /*=NULL*/, std::string* player_name /*= NULL*/)
+bool ChatHandler::extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid /*=NULL*/, std::string* player_name /*= NULL*/)
{
if (args && *args)
{
@@ -1155,7 +1155,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe
*player = pl;
// if need guid value from DB (in name case for check player existence)
- uint64 guid = !pl && (player_guid || player_name) ? sObjectMgr->GetPlayerGUIDByName(name) : 0;
+ ObjectGuid guid = !pl && (player_guid || player_name) ? sObjectMgr->GetPlayerGUIDByName(name) : ObjectGuid::Empty;
// if allowed player guid (if no then only online players allowed)
if (player_guid)
@@ -1172,7 +1172,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe
*player = pl;
// if allowed player guid (if no then only online players allowed)
if (player_guid)
- *player_guid = pl ? pl->GetGUID() : 0;
+ *player_guid = pl ? pl->GetGUID() : ObjectGuid::Empty;
if (player_name)
*player_name = pl ? pl->GetName() : "";
@@ -1268,7 +1268,7 @@ std::string ChatHandler::GetNameLink(Player* chr) const
return playerLink(chr->GetName());
}
-const char *CliHandler::GetTrinityString(int32 entry) const
+char const* CliHandler::GetTrinityString(uint32 entry) const
{
return sObjectMgr->GetTrinityStringForDBCLocale(entry);
}
@@ -1295,10 +1295,10 @@ bool CliHandler::needReportToTarget(Player* /*chr*/) const
return true;
}
-bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline)
+bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline)
{
- player = NULL;
- guid = 0;
+ player = NULL;
+ guid.Clear();
if (cname)
{
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index 58bc11f786f..deae5d6e937 100644
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -54,7 +54,7 @@ class ChatHandler
virtual ~ChatHandler() { }
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
- static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, uint64 senderGUID, uint64 receiverGUID, std::string const& message, uint8 chatTag,
+ static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const& message, uint8 chatTag,
std::string const& senderName = "", std::string const& receiverName = "",
uint32 achievementId = 0, bool gmMessage = false, std::string const& channelName = "",
std::string const& addonPrefix = "");
@@ -65,13 +65,13 @@ class ChatHandler
static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = NULL; return start; }
// function with different implementation for chat/console
- virtual const char *GetTrinityString(int32 entry) const;
- virtual void SendSysMessage(const char *str);
+ virtual char const* GetTrinityString(uint32 entry) const;
+ virtual void SendSysMessage(char const* str);
- void SendSysMessage(int32 entry);
- void PSendSysMessage(const char *format, ...) ATTR_PRINTF(2, 3);
- void PSendSysMessage(int32 entry, ...);
- std::string PGetParseString(int32 entry, ...) const;
+ void SendSysMessage(uint32 entry);
+ void PSendSysMessage(char const* format, ...) ATTR_PRINTF(2, 3);
+ void PSendSysMessage(uint32 entry, ...);
+ std::string PGetParseString(uint32 entry, ...) const;
bool ParseCommands(const char* text);
@@ -90,7 +90,7 @@ class ChatHandler
virtual LocaleConstant GetSessionDbcLocale() const;
virtual int GetSessionDbLocaleIndex() const;
- bool HasLowerSecurity(Player* target, uint64 guid, bool strong = false);
+ bool HasLowerSecurity(Player* target, ObjectGuid guid, bool strong = false);
bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false);
void SendGlobalGMSysMessage(const char *str);
@@ -109,12 +109,12 @@ class ChatHandler
char* extractQuotedArg(char* args);
uint32 extractSpellIdFromLink(char* text);
- uint64 extractGuidFromLink(char* text);
+ ObjectGuid extractGuidFromLink(char* text);
GameTele const* extractGameTeleFromLink(char* text);
- bool GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline = false);
+ bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline = false);
std::string extractPlayerNameFromLink(char* text);
// select by arg (name/link) or in-game selection online/offline player or self if a creature is selected
- bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = NULL);
+ bool extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid = NULL, std::string* player_name = NULL);
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; }
std::string GetNameLink(Player* chr) const;
@@ -148,7 +148,7 @@ class CliHandler : public ChatHandler
explicit CliHandler(void* callbackArg, Print* zprint) : m_callbackArg(callbackArg), m_print(zprint) { }
// overwrite functions
- const char *GetTrinityString(int32 entry) const override;
+ char const* GetTrinityString(uint32 entry) const override;
bool isAvailable(ChatCommand const& cmd) const override;
bool HasPermission(uint32 /*permission*/) const override { return true; }
void SendSysMessage(const char *str) override;
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index edf15aaf1ff..85510ab0545 100644
--- a/src/server/game/Combat/ThreatManager.cpp
+++ b/src/server/game/Combat/ThreatManager.cpp
@@ -269,7 +269,7 @@ HostileReference* ThreatContainer::getReferenceByTarget(Unit* victim) const
if (!victim)
return NULL;
- uint64 const guid = victim->GetGUID();
+ ObjectGuid guid = victim->GetGUID();
for (ThreatContainer::StorageType::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
{
HostileReference* ref = (*i);
diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h
index f0741f81067..62b3d10e554 100644
--- a/src/server/game/Combat/ThreatManager.h
+++ b/src/server/game/Combat/ThreatManager.h
@@ -23,6 +23,7 @@
#include "SharedDefines.h"
#include "LinkedReference/Reference.h"
#include "UnitEvents.h"
+#include "ObjectGuid.h"
#include <list>
@@ -103,7 +104,7 @@ class HostileReference : public Reference<Unit, ThreatManager>
//=================================================
- uint64 getUnitGuid() const { return iUnitGuid; }
+ ObjectGuid getUnitGuid() const { return iUnitGuid; }
//=================================================
// reference is not needed anymore. realy delete it !
@@ -132,7 +133,7 @@ class HostileReference : public Reference<Unit, ThreatManager>
private:
float iThreat;
float iTempThreatModifier; // used for taunt
- uint64 iUnitGuid;
+ ObjectGuid iUnitGuid;
bool iOnline;
bool iAccessible;
};
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 739a373dbf0..921b6832d67 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -166,12 +166,15 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
case INSTANCE_INFO_DATA:
condMeets = instance->GetData(ConditionValue1) == ConditionValue2;
break;
- case INSTANCE_INFO_DATA64:
- condMeets = instance->GetData64(ConditionValue1) == ConditionValue2;
+ case INSTANCE_INFO_GUID_DATA:
+ condMeets = instance->GetGuidData(ConditionValue1) == ObjectGuid(uint64(ConditionValue2));
break;
case INSTANCE_INFO_BOSS_STATE:
condMeets = instance->GetBossState(ConditionValue1) == EncounterState(ConditionValue2);
break;
+ case INSTANCE_INFO_DATA64:
+ condMeets = instance->GetData64(ConditionValue1) == ConditionValue2;
+ break;
}
}
}
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index 317db5b2019..686b0945719 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -146,8 +146,9 @@ enum RelationType
enum InstanceInfo
{
INSTANCE_INFO_DATA = 0,
- INSTANCE_INFO_DATA64,
- INSTANCE_INFO_BOSS_STATE
+ INSTANCE_INFO_GUID_DATA,
+ INSTANCE_INFO_BOSS_STATE,
+ INSTANCE_INFO_DATA64
};
enum MaxConditionTargets
diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h
index efafd5d3afd..a112eb9c98e 100644
--- a/src/server/game/DungeonFinding/LFG.h
+++ b/src/server/game/DungeonFinding/LFG.h
@@ -19,6 +19,7 @@
#define _LFG_H
#include "Common.h"
+#include "ObjectGuid.h"
namespace lfg
{
@@ -110,11 +111,9 @@ struct LfgLockInfoData
typedef std::set<uint32> LfgDungeonSet;
typedef std::map<uint32, LfgLockInfoData> LfgLockMap;
-typedef std::map<uint64, LfgLockMap> LfgLockPartyMap;
-typedef std::set<uint64> LfgGuidSet;
-typedef std::list<uint64> LfgGuidList;
-typedef std::map<uint64, uint8> LfgRolesMap;
-typedef std::map<uint64, uint64> LfgGroupsMap;
+typedef std::map<ObjectGuid, LfgLockMap> LfgLockPartyMap;
+typedef std::map<ObjectGuid, uint8> LfgRolesMap;
+typedef std::map<ObjectGuid, ObjectGuid> LfgGroupsMap;
std::string ConcatenateDungeons(LfgDungeonSet const& dungeons);
std::string GetRolesString(uint8 roles);
diff --git a/src/server/game/DungeonFinding/LFGGroupData.cpp b/src/server/game/DungeonFinding/LFGGroupData.cpp
index d7c9efeb70e..81859f4f946 100644
--- a/src/server/game/DungeonFinding/LFGGroupData.cpp
+++ b/src/server/game/DungeonFinding/LFGGroupData.cpp
@@ -22,7 +22,7 @@ namespace lfg
{
LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
- m_Leader(0), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
+ m_Leader(), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
{ }
LfgGroupData::~LfgGroupData()
@@ -54,14 +54,14 @@ void LfgGroupData::RestoreState()
m_State = m_OldState;
}
-void LfgGroupData::AddPlayer(uint64 guid)
+void LfgGroupData::AddPlayer(ObjectGuid guid)
{
m_Players.insert(guid);
}
-uint8 LfgGroupData::RemovePlayer(uint64 guid)
+uint8 LfgGroupData::RemovePlayer(ObjectGuid guid)
{
- LfgGuidSet::iterator it = m_Players.find(guid);
+ GuidSet::iterator it = m_Players.find(guid);
if (it != m_Players.end())
m_Players.erase(it);
return uint8(m_Players.size());
@@ -72,7 +72,7 @@ void LfgGroupData::RemoveAllPlayers()
m_Players.clear();
}
-void LfgGroupData::SetLeader(uint64 guid)
+void LfgGroupData::SetLeader(ObjectGuid guid)
{
m_Leader = guid;
}
@@ -98,7 +98,7 @@ LfgState LfgGroupData::GetOldState() const
return m_OldState;
}
-LfgGuidSet const& LfgGroupData::GetPlayers() const
+GuidSet const& LfgGroupData::GetPlayers() const
{
return m_Players;
}
@@ -108,7 +108,7 @@ uint8 LfgGroupData::GetPlayerCount() const
return m_Players.size();
}
-uint64 LfgGroupData::GetLeader() const
+ObjectGuid LfgGroupData::GetLeader() const
{
return m_Leader;
}
diff --git a/src/server/game/DungeonFinding/LFGGroupData.h b/src/server/game/DungeonFinding/LFGGroupData.h
index b2bffd5a13b..45df76aca2a 100644
--- a/src/server/game/DungeonFinding/LFGGroupData.h
+++ b/src/server/game/DungeonFinding/LFGGroupData.h
@@ -42,10 +42,10 @@ class LfgGroupData
// General
void SetState(LfgState state);
void RestoreState();
- void AddPlayer(uint64 guid);
- uint8 RemovePlayer(uint64 guid);
+ void AddPlayer(ObjectGuid guid);
+ uint8 RemovePlayer(ObjectGuid guid);
void RemoveAllPlayers();
- void SetLeader(uint64 guid);
+ void SetLeader(ObjectGuid guid);
// Dungeon
void SetDungeon(uint32 dungeon);
@@ -56,9 +56,9 @@ class LfgGroupData
// General
LfgState GetState() const;
LfgState GetOldState() const;
- LfgGuidSet const& GetPlayers() const;
+ GuidSet const& GetPlayers() const;
uint8 GetPlayerCount() const;
- uint64 GetLeader() const;
+ ObjectGuid GetLeader() const;
// Dungeon
uint32 GetDungeon(bool asId = true) const;
@@ -70,8 +70,8 @@ class LfgGroupData
// General
LfgState m_State; ///< State if group in LFG
LfgState m_OldState; ///< Old State
- uint64 m_Leader; ///< Leader GUID
- LfgGuidSet m_Players; ///< Players in group
+ ObjectGuid m_Leader; ///< Leader GUID
+ GuidSet m_Players; ///< Players in group
// Dungeon
uint32 m_Dungeon; ///< Dungeon entry
// Vote Kick
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 0efc7fd6230..4bed997bced 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -50,15 +50,15 @@ LFGMgr::~LFGMgr()
delete itr->second;
}
-void LFGMgr::_LoadFromDB(Field* fields, uint64 guid)
+void LFGMgr::_LoadFromDB(Field* fields, ObjectGuid guid)
{
if (!fields)
return;
- if (!IS_GROUP_GUID(guid))
+ if (!guid.IsGroup())
return;
- SetLeader(guid, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
+ SetLeader(guid, ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()));
uint32 dungeon = fields[17].GetUInt32();
uint8 state = fields[18].GetUInt8();
@@ -79,9 +79,9 @@ void LFGMgr::_LoadFromDB(Field* fields, uint64 guid)
}
}
-void LFGMgr::_SaveToDB(uint64 guid, uint32 db_guid)
+void LFGMgr::_SaveToDB(ObjectGuid guid, uint32 db_guid)
{
- if (!IS_GROUP_GUID(guid))
+ if (!guid.IsGroup())
return;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA);
@@ -276,7 +276,7 @@ void LFGMgr::Update(uint32 diff)
for (LfgRolesMap::const_iterator itRoles = roleCheck.roles.begin(); itRoles != roleCheck.roles.end(); ++itRoles)
{
- uint64 guid = itRoles->first;
+ ObjectGuid guid = itRoles->first;
RestoreState(guid, "Remove Obsolete RoleCheck");
SendLfgRoleCheckUpdate(guid, roleCheck);
if (guid == roleCheck.leader)
@@ -305,7 +305,7 @@ void LFGMgr::Update(uint32 diff)
boot.inProgress = false;
for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
{
- uint64 pguid = itVotes->first;
+ ObjectGuid pguid = itVotes->first;
if (pguid != boot.victim)
SendLfgBootProposalUpdate(pguid, boot);
SetState(pguid, LFG_STATE_DUNGEON);
@@ -329,12 +329,12 @@ void LFGMgr::Update(uint32 diff)
uint32 proposalId = itProposal->first;
LfgProposal& proposal = ProposalsStore[proposalId];
- uint64 guid = 0;
+ ObjectGuid guid;
for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers)
{
guid = itPlayers->first;
SetState(guid, LFG_STATE_PROPOSAL);
- if (uint64 gguid = GetGroup(guid))
+ if (ObjectGuid gguid = GetGroup(guid))
{
SetState(gguid, LFG_STATE_PROPOSAL);
SendLfgUpdateStatus(guid, LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)), true);
@@ -376,10 +376,10 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
return;
Group* grp = player->GetGroup();
- uint64 guid = player->GetGUID();
- uint64 gguid = grp ? grp->GetGUID() : guid;
+ ObjectGuid guid = player->GetGUID();
+ ObjectGuid gguid = grp ? grp->GetGUID() : guid;
LfgJoinResultData joinData;
- LfgGuidSet players;
+ GuidSet players;
uint32 rDungeonId = 0;
bool isContinue = grp && grp->isLFGGroup() && GetState(gguid) != LFG_STATE_FINISHED_DUNGEON;
@@ -491,7 +491,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
if (joinData.result != LFG_JOIN_OK)
{
TC_LOG_DEBUG("lfg.join", "%u joining with %u members. Result: %u, Dungeons: %s",
- GUID_LOPART(guid), grp ? grp->GetMembersCount() : 1, joinData.result, ConcatenateDungeons(dungeons).c_str());
+ guid.GetCounter(), grp ? grp->GetMembersCount() : 1, joinData.result, ConcatenateDungeons(dungeons).c_str());
if (!dungeons.empty()) // Only should show lockmap when have no dungeons available
joinData.lockmap.clear();
@@ -503,7 +503,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
if (isRaid)
{
- TC_LOG_DEBUG("lfg.join", "%u trying to join raid browser and it's disabled.", GUID_LOPART(guid));
+ TC_LOG_DEBUG("lfg.join", "%u trying to join raid browser and it's disabled.", guid.GetCounter());
return;
}
@@ -531,7 +531,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
{
if (Player* plrg = itr->GetSource())
{
- uint64 pguid = plrg->GetGUID();
+ ObjectGuid pguid = plrg->GetGUID();
plrg->GetSession()->SendLfgUpdateStatus(updateData, true);
SetState(pguid, LFG_STATE_ROLECHECK);
if (!isContinue)
@@ -569,7 +569,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
debugNames.append(player->GetName());
}
- TC_LOG_DEBUG("lfg.join", "%u joined (%s), Members: %s. Dungeons (%u): %s", GUID_LOPART(guid),
+ TC_LOG_DEBUG("lfg.join", "%u joined (%s), Members: %s. Dungeons (%u): %s", guid.GetCounter(),
grp ? "group" : "player", debugNames.c_str(), uint32(dungeons.size()), ConcatenateDungeons(dungeons).c_str());
}
@@ -579,11 +579,11 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
@param[in] guid Player or group guid
*/
-void LFGMgr::LeaveLfg(uint64 guid)
+void LFGMgr::LeaveLfg(ObjectGuid guid)
{
- uint64 gguid = IS_GROUP_GUID(guid) ? guid : GetGroup(guid);
+ ObjectGuid gguid = guid.IsGroup() ? guid : GetGroup(guid);
- TC_LOG_DEBUG("lfg.leave", "%u left (%s)", GUID_LOPART(guid), guid == gguid ? "group" : "player");
+ TC_LOG_DEBUG("lfg.leave", "%u left (%s)", guid.GetCounter(), guid == gguid ? "group" : "player");
LfgState state = GetState(guid);
switch (state)
@@ -594,8 +594,8 @@ void LFGMgr::LeaveLfg(uint64 guid)
LFGQueue& queue = GetQueue(gguid);
queue.RemoveFromQueue(gguid);
SetState(gguid, LFG_STATE_NONE);
- const LfgGuidSet& players = GetPlayers(gguid);
- for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
+ GuidSet const& players = GetPlayers(gguid);
+ for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
{
SetState(*it, LFG_STATE_NONE);
SendLfgUpdateStatus(*it, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE), true);
@@ -617,7 +617,7 @@ void LFGMgr::LeaveLfg(uint64 guid)
{
// Remove from Proposals
LfgProposalContainer::iterator it = ProposalsStore.begin();
- uint64 pguid = gguid == guid ? GetLeader(gguid) : guid;
+ ObjectGuid pguid = gguid == guid ? GetLeader(gguid) : guid;
while (it != ProposalsStore.end())
{
LfgProposalPlayerContainer::iterator itPlayer = it->second.players.find(pguid);
@@ -654,7 +654,7 @@ void LFGMgr::LeaveLfg(uint64 guid)
@param[in] guid Player guid (0 = rolecheck failed)
@param[in] roles Player selected roles
*/
-void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* = PLAYER_ROLE_NONE */)
+void LFGMgr::UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid /* = ObjectGuid::Empty */, uint8 roles /* = PLAYER_ROLE_NONE */)
{
if (!gguid)
return;
@@ -701,7 +701,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
LfgJoinResultData joinData = LfgJoinResultData(joinResult, roleCheck.state);
for (LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it)
{
- uint64 pguid = it->first;
+ ObjectGuid pguid = it->first;
if (sendRoleChosen)
SendLfgRoleChosen(pguid, guid, roles);
@@ -746,12 +746,12 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
@param[in] players Set of players to check their dungeon restrictions
@param[out] lockMap Map of players Lock status info of given dungeons (Empty if dungeons is not empty)
*/
-void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap)
+void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& players, LfgLockPartyMap& lockMap)
{
lockMap.clear();
- for (LfgGuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
+ for (GuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
{
- uint64 guid = (*it);
+ ObjectGuid guid = (*it);
LfgLockMap const& cachedLockMap = GetLockedDungeons(guid);
for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2)
{
@@ -847,12 +847,12 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
*/
void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
{
- LfgGuidList players;
- LfgGuidList playersToTeleport;
+ GuidList players;
+ GuidList playersToTeleport;
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
- uint64 guid = it->first;
+ ObjectGuid guid = it->first;
if (guid == proposal.leader)
players.push_front(guid);
else
@@ -866,10 +866,10 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
LFGDungeonData const* dungeon = GetLFGDungeon(proposal.dungeonId);
ASSERT(dungeon);
- Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(GUID_LOPART(proposal.group)) : NULL;
- for (LfgGuidList::const_iterator it = players.begin(); it != players.end(); ++it)
+ Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(proposal.group.GetCounter()) : NULL;
+ for (GuidList::const_iterator it = players.begin(); it != players.end(); ++it)
{
- uint64 pguid = (*it);
+ ObjectGuid pguid = (*it);
Player* player = ObjectAccessor::FindPlayer(pguid);
if (!player)
continue;
@@ -883,7 +883,7 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
grp = new Group();
grp->ConvertToLFG();
grp->Create(player);
- uint64 gguid = grp->GetGUID();
+ ObjectGuid gguid = grp->GetGUID();
SetState(gguid, LFG_STATE_PROPOSAL);
sGroupMgr->AddGroup(grp);
}
@@ -899,14 +899,14 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
ASSERT(grp);
grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty));
- uint64 gguid = grp->GetGUID();
+ ObjectGuid gguid = grp->GetGUID();
SetDungeon(gguid, dungeon->Entry());
SetState(gguid, LFG_STATE_DUNGEON);
_SaveToDB(gguid, grp->GetDbStoreId());
// Teleport Player
- for (LfgGuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
+ for (GuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
if (Player* player = ObjectAccessor::FindPlayer(*it))
TeleportPlayer(player, false);
@@ -928,7 +928,7 @@ uint32 LFGMgr::AddProposal(LfgProposal& proposal)
@param[in] guid Player guid to update answer
@param[in] accept Player answer
*/
-void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
+void LFGMgr::UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept)
{
// Check if the proposal exists
LfgProposalContainer::iterator itProposal = ProposalsStore.find(proposalId);
@@ -945,7 +945,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
LfgProposalPlayer& player = itProposalPlayer->second;
player.accept = LfgAnswer(accept);
- TC_LOG_DEBUG("lfg.proposal.update", "Player %u, Proposal %u, Selection: %u", GUID_LOPART(guid), proposalId, accept);
+ TC_LOG_DEBUG("lfg.proposal.update", "Player %u, Proposal %u, Selection: %u", guid.GetCounter(), proposalId, accept);
if (!accept)
{
RemoveProposal(itProposal, LFG_UPDATETYPE_PROPOSAL_DECLINED);
@@ -974,8 +974,8 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND);
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
- uint64 pguid = it->first;
- uint64 gguid = it->second.group;
+ ObjectGuid pguid = it->first;
+ ObjectGuid gguid = it->second.group;
uint32 dungeonId = (*GetSelectedDungeons(pguid).begin());
int32 waitTime = -1;
if (sendUpdate)
@@ -1018,7 +1018,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
}
// Remove players/groups from Queue
- for (LfgGuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it)
+ for (GuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it)
queue.RemoveFromQueue(*it);
MakeNewGroup(proposal);
@@ -1044,13 +1044,13 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
it->second.accept = LFG_ANSWER_DENY;
// Mark players/groups to be removed
- LfgGuidSet toRemove;
+ GuidSet toRemove;
for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
if (it->second.accept == LFG_ANSWER_AGREE)
continue;
- uint64 guid = it->second.group ? it->second.group : it->first;
+ ObjectGuid guid = it->second.group ? it->second.group : it->first;
// Player didn't accept or still pending when no secs left
if (it->second.accept == LFG_ANSWER_DENY || type == LFG_UPDATETYPE_PROPOSAL_FAILED)
{
@@ -1062,8 +1062,8 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
// Notify players
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
- uint64 guid = it->first;
- uint64 gguid = it->second.group ? it->second.group : guid;
+ ObjectGuid guid = it->first;
+ ObjectGuid gguid = it->second.group ? it->second.group : guid;
SendLfgUpdateProposal(guid, proposal);
@@ -1073,12 +1073,12 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
if (it->second.accept == LFG_ANSWER_DENY)
{
updateData.updateType = type;
- TC_LOG_DEBUG("lfg.proposal.remove", "%u didn't accept. Removing from queue and compatible cache", GUID_LOPART(guid));
+ TC_LOG_DEBUG("lfg.proposal.remove", "%u didn't accept. Removing from queue and compatible cache", guid.GetCounter());
}
else
{
updateData.updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE;
- TC_LOG_DEBUG("lfg.proposal.remove", "%u in same group that someone that didn't accept. Removing from queue and compatible cache", GUID_LOPART(guid));
+ TC_LOG_DEBUG("lfg.proposal.remove", "%u in same group that someone that didn't accept. Removing from queue and compatible cache", guid.GetCounter());
}
RestoreState(guid, "Proposal Fail (didn't accepted or in group with someone that didn't accept");
@@ -1092,7 +1092,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
}
else
{
- TC_LOG_DEBUG("lfg.proposal.remove", "Readding %u to queue.", GUID_LOPART(guid));
+ TC_LOG_DEBUG("lfg.proposal.remove", "Readding %u to queue.", guid.GetCounter());
SetState(guid, LFG_STATE_QUEUED);
if (gguid != guid)
{
@@ -1106,17 +1106,17 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
LFGQueue& queue = GetQueue(proposal.players.begin()->first);
// Remove players/groups from queue
- for (LfgGuidSet::const_iterator it = toRemove.begin(); it != toRemove.end(); ++it)
+ for (GuidSet::const_iterator it = toRemove.begin(); it != toRemove.end(); ++it)
{
- uint64 guid = *it;
+ ObjectGuid guid = *it;
queue.RemoveFromQueue(guid);
proposal.queues.remove(guid);
}
// Readd to queue
- for (LfgGuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it)
+ for (GuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it)
{
- uint64 guid = *it;
+ ObjectGuid guid = *it;
queue.AddToQueue(guid);
}
@@ -1131,7 +1131,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
@param[in] victim Victim guid
@param[in] reason Kick reason
*/
-void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string const& reason)
+void LFGMgr::InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, std::string const& reason)
{
SetState(gguid, LFG_STATE_BOOT);
@@ -1141,12 +1141,12 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co
boot.reason = reason;
boot.victim = victim;
- LfgGuidSet const& players = GetPlayers(gguid);
+ GuidSet const& players = GetPlayers(gguid);
// Set votes
- for (LfgGuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ for (GuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
- uint64 guid = (*itr);
+ ObjectGuid guid = (*itr);
SetState(guid, LFG_STATE_BOOT);
boot.votes[guid] = LFG_ANSWER_PENDING;
}
@@ -1155,7 +1155,7 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co
boot.votes[kicker] = LFG_ANSWER_AGREE; // Kicker auto vote YES
// Notify players
- for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
+ for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
SendLfgBootProposalUpdate(*it, boot);
}
@@ -1165,9 +1165,9 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co
@param[in] guid Player who has answered
@param[in] player answer
*/
-void LFGMgr::UpdateBoot(uint64 guid, bool accept)
+void LFGMgr::UpdateBoot(ObjectGuid guid, bool accept)
{
- uint64 gguid = GetGroup(guid);
+ ObjectGuid gguid = GetGroup(guid);
if (!gguid)
return;
@@ -1202,7 +1202,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept)
boot.inProgress = false;
for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
{
- uint64 pguid = itVotes->first;
+ ObjectGuid pguid = itVotes->first;
if (pguid != boot.victim)
{
SetState(pguid, LFG_STATE_DUNGEON);
@@ -1213,7 +1213,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept)
SetState(gguid, LFG_STATE_DUNGEON);
if (agreeNum == LFG_GROUP_KICK_VOTES_NEEDED) // Vote passed - Kick player
{
- if (Group* group = sGroupMgr->GetGroupByGUID(GUID_LOPART(gguid)))
+ if (Group* group = sGroupMgr->GetGroupByGUID(gguid.GetCounter()))
Player::RemoveFromGroup(group, boot.victim, GROUP_REMOVEMETHOD_KICK_LFG);
DecreaseKicksLeft(gguid);
}
@@ -1320,30 +1320,30 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*
@param[in] guid Group guid
@param[in] dungeonId Dungeonid
*/
-void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId)
+void LFGMgr::FinishDungeon(ObjectGuid gguid, const uint32 dungeonId)
{
uint32 gDungeonId = GetDungeon(gguid);
if (gDungeonId != dungeonId)
{
- TC_LOG_DEBUG("lfg.dungeon.finish", "Group %u finished dungeon %u but queued for %u", GUID_LOPART(gguid), dungeonId, gDungeonId);
+ TC_LOG_DEBUG("lfg.dungeon.finish", "Group %u finished dungeon %u but queued for %u", gguid.GetCounter(), dungeonId, gDungeonId);
return;
}
if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) // Shouldn't happen. Do not reward multiple times
{
- TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u already rewarded", GUID_LOPART(gguid));
+ TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u already rewarded", gguid.GetCounter());
return;
}
SetState(gguid, LFG_STATE_FINISHED_DUNGEON);
- const LfgGuidSet& players = GetPlayers(gguid);
- for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
+ GuidSet const& players = GetPlayers(gguid);
+ for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
{
- uint64 guid = (*it);
+ ObjectGuid guid = (*it);
if (GetState(guid) == LFG_STATE_FINISHED_DUNGEON)
{
- TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u already rewarded", GUID_LOPART(gguid), GUID_LOPART(guid));
+ TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u already rewarded", gguid.GetCounter(), guid.GetCounter());
continue;
}
@@ -1359,14 +1359,14 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId)
if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM && !dungeon->seasonal))
{
- TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u dungeon %u is not random or seasonal", GUID_LOPART(gguid), GUID_LOPART(guid), rDungeonId);
+ TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u dungeon %u is not random or seasonal", gguid.GetCounter(), guid.GetCounter(), rDungeonId);
continue;
}
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player || !player->IsInWorld())
{
- TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u not found in world", GUID_LOPART(gguid), GUID_LOPART(guid));
+ TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u not found in world", gguid.GetCounter(), guid.GetCounter());
continue;
}
@@ -1375,7 +1375,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId)
if (player->GetMapId() != mapId)
{
- TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u is in map %u and should be in %u to get reward", GUID_LOPART(gguid), GUID_LOPART(guid), player->GetMapId(), mapId);
+ TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u is in map %u and should be in %u to get reward", gguid.GetCounter(), guid.GetCounter(), player->GetMapId(), mapId);
continue;
}
@@ -1406,7 +1406,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId)
}
// Give rewards
- TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u done dungeon %u, %s previously done.", GUID_LOPART(gguid), GUID_LOPART(guid), GetDungeon(gguid), done? " " : " not");
+ TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u done dungeon %u, %s previously done.", gguid.GetCounter(), guid.GetCounter(), GetDungeon(gguid), done? " " : " not");
LfgPlayerRewardData data = LfgPlayerRewardData(dungeon->Entry(), GetDungeon(gguid, false), done, quest);
player->GetSession()->SendLfgPlayerReward(data);
}
@@ -1466,48 +1466,48 @@ LfgType LFGMgr::GetDungeonType(uint32 dungeonId)
return LfgType(dungeon->type);
}
-LfgState LFGMgr::GetState(uint64 guid)
+LfgState LFGMgr::GetState(ObjectGuid guid)
{
LfgState state;
- if (IS_GROUP_GUID(guid))
+ if (guid.IsGroup())
{
state = GroupsStore[guid].GetState();
- TC_LOG_TRACE("lfg.data.group.state.get", "Group: %u, State: %u", GUID_LOPART(guid), state);
+ TC_LOG_TRACE("lfg.data.group.state.get", "Group: %u, State: %u", guid.GetCounter(), state);
}
else
{
state = PlayersStore[guid].GetState();
- TC_LOG_TRACE("lfg.data.player.state.get", "Player: %u, State: %u", GUID_LOPART(guid), state);
+ TC_LOG_TRACE("lfg.data.player.state.get", "Player: %u, State: %u", guid.GetCounter(), state);
}
return state;
}
-LfgState LFGMgr::GetOldState(uint64 guid)
+LfgState LFGMgr::GetOldState(ObjectGuid guid)
{
LfgState state;
- if (IS_GROUP_GUID(guid))
+ if (guid.IsGroup())
{
state = GroupsStore[guid].GetOldState();
- TC_LOG_TRACE("lfg.data.group.oldstate.get", "Group: %u, Old state: %u", GUID_LOPART(guid), state);
+ TC_LOG_TRACE("lfg.data.group.oldstate.get", "Group: %u, Old state: %u", guid.GetCounter(), state);
}
else
{
state = PlayersStore[guid].GetOldState();
- TC_LOG_TRACE("lfg.data.player.oldstate.get", "Player: %u, Old state: %u", GUID_LOPART(guid), state);
+ TC_LOG_TRACE("lfg.data.player.oldstate.get", "Player: %u, Old state: %u", guid.GetCounter(), state);
}
return state;
}
-uint32 LFGMgr::GetDungeon(uint64 guid, bool asId /*= true */)
+uint32 LFGMgr::GetDungeon(ObjectGuid guid, bool asId /*= true */)
{
uint32 dungeon = GroupsStore[guid].GetDungeon(asId);
- TC_LOG_TRACE("lfg.data.group.dungeon.get", "Group: %u, asId: %u, Dungeon: %u", GUID_LOPART(guid), asId, dungeon);
+ TC_LOG_TRACE("lfg.data.group.dungeon.get", "Group: %u, asId: %u, Dungeon: %u", guid.GetCounter(), asId, dungeon);
return dungeon;
}
-uint32 LFGMgr::GetDungeonMapId(uint64 guid)
+uint32 LFGMgr::GetDungeonMapId(ObjectGuid guid)
{
uint32 dungeonId = GroupsStore[guid].GetDungeon(true);
uint32 mapId = 0;
@@ -1515,38 +1515,38 @@ uint32 LFGMgr::GetDungeonMapId(uint64 guid)
if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId))
mapId = dungeon->map;
- TC_LOG_TRACE("lfg.data.group.dungeon.map", "Group: %u, MapId: %u (DungeonId: %u)", GUID_LOPART(guid), mapId, dungeonId);
+ TC_LOG_TRACE("lfg.data.group.dungeon.map", "Group: %u, MapId: %u (DungeonId: %u)", guid.GetCounter(), mapId, dungeonId);
return mapId;
}
-uint8 LFGMgr::GetRoles(uint64 guid)
+uint8 LFGMgr::GetRoles(ObjectGuid guid)
{
uint8 roles = PlayersStore[guid].GetRoles();
- TC_LOG_TRACE("lfg.data.player.role.get", "Player: %u, Role: %u", GUID_LOPART(guid), roles);
+ TC_LOG_TRACE("lfg.data.player.role.get", "Player: %u, Role: %u", guid.GetCounter(), roles);
return roles;
}
-const std::string& LFGMgr::GetComment(uint64 guid)
+const std::string& LFGMgr::GetComment(ObjectGuid guid)
{
- TC_LOG_TRACE("lfg.data.player.comment.get", "Player: %u, Comment: %s", GUID_LOPART(guid), PlayersStore[guid].GetComment().c_str());
+ TC_LOG_TRACE("lfg.data.player.comment.get", "Player: %u, Comment: %s", guid.GetCounter(), PlayersStore[guid].GetComment().c_str());
return PlayersStore[guid].GetComment();
}
-LfgDungeonSet const& LFGMgr::GetSelectedDungeons(uint64 guid)
+LfgDungeonSet const& LFGMgr::GetSelectedDungeons(ObjectGuid guid)
{
- TC_LOG_TRACE("lfg.data.player.dungeons.selected.get", "Player: %u, Selected Dungeons: %s", GUID_LOPART(guid), ConcatenateDungeons(PlayersStore[guid].GetSelectedDungeons()).c_str());
+ TC_LOG_TRACE("lfg.data.player.dungeons.selected.get", "Player: %u, Selected Dungeons: %s", guid.GetCounter(), ConcatenateDungeons(PlayersStore[guid].GetSelectedDungeons()).c_str());
return PlayersStore[guid].GetSelectedDungeons();
}
-LfgLockMap const LFGMgr::GetLockedDungeons(uint64 guid)
+LfgLockMap const LFGMgr::GetLockedDungeons(ObjectGuid guid)
{
- TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %u, LockedDungeons.", GUID_LOPART(guid));
+ TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %u, LockedDungeons.", guid.GetCounter());
LfgLockMap lock;
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
{
- TC_LOG_WARN("lfg.data.player.dungeons.locked.get", "Player: %u not ingame while retrieving his LockedDungeons.", GUID_LOPART(guid));
+ TC_LOG_WARN("lfg.data.player.dungeons.locked.get", "Player: %u not ingame while retrieving his LockedDungeons.", guid.GetCounter());
return lock;
}
@@ -1609,20 +1609,20 @@ LfgLockMap const LFGMgr::GetLockedDungeons(uint64 guid)
return lock;
}
-uint8 LFGMgr::GetKicksLeft(uint64 guid)
+uint8 LFGMgr::GetKicksLeft(ObjectGuid guid)
{
uint8 kicks = GroupsStore[guid].GetKicksLeft();
- TC_LOG_TRACE("lfg.data.group.kickleft.get", "Group: %u, Kicks left: %u", GUID_LOPART(guid), kicks);
+ TC_LOG_TRACE("lfg.data.group.kickleft.get", "Group: %u, Kicks left: %u", guid.GetCounter(), kicks);
return kicks;
}
-void LFGMgr::RestoreState(uint64 guid, char const* debugMsg)
+void LFGMgr::RestoreState(ObjectGuid guid, char const* debugMsg)
{
- if (IS_GROUP_GUID(guid))
+ if (guid.IsGroup())
{
LfgGroupData& data = GroupsStore[guid];
TC_LOG_TRACE("lfg.data.group.state.restore", "Group: %u (%s), State: %s, Old state: %s",
- GUID_LOPART(guid), debugMsg, GetStateString(data.GetState()).c_str(),
+ guid.GetCounter(), debugMsg, GetStateString(data.GetState()).c_str(),
GetStateString(data.GetOldState()).c_str());
data.RestoreState();
@@ -1631,20 +1631,20 @@ void LFGMgr::RestoreState(uint64 guid, char const* debugMsg)
{
LfgPlayerData& data = PlayersStore[guid];
TC_LOG_TRACE("lfg.data.player.state.restore", "Player: %u (%s), State: %s, Old state: %s",
- GUID_LOPART(guid), debugMsg, GetStateString(data.GetState()).c_str(),
+ guid.GetCounter(), debugMsg, GetStateString(data.GetState()).c_str(),
GetStateString(data.GetOldState()).c_str());
data.RestoreState();
}
}
-void LFGMgr::SetState(uint64 guid, LfgState state)
+void LFGMgr::SetState(ObjectGuid guid, LfgState state)
{
- if (IS_GROUP_GUID(guid))
+ if (guid.IsGroup())
{
LfgGroupData& data = GroupsStore[guid];
TC_LOG_TRACE("lfg.data.group.state.set", "Group: %u, New state: %s, Previous: %s, Old state: %s",
- GUID_LOPART(guid), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(),
+ guid.GetCounter(), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(),
GetStateString(data.GetOldState()).c_str());
data.SetState(state);
@@ -1653,64 +1653,64 @@ void LFGMgr::SetState(uint64 guid, LfgState state)
{
LfgPlayerData& data = PlayersStore[guid];
TC_LOG_TRACE("lfg.data.player.state.set", "Player: %u, New state: %s, Previous: %s, OldState: %s",
- GUID_LOPART(guid), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(),
+ guid.GetCounter(), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(),
GetStateString(data.GetOldState()).c_str());
data.SetState(state);
}
}
-void LFGMgr::SetDungeon(uint64 guid, uint32 dungeon)
+void LFGMgr::SetDungeon(ObjectGuid guid, uint32 dungeon)
{
- TC_LOG_TRACE("lfg.data.group.dungeon.set", "Group: %u, Dungeon: %u", GUID_LOPART(guid), dungeon);
+ TC_LOG_TRACE("lfg.data.group.dungeon.set", "Group: %u, Dungeon: %u", guid.GetCounter(), dungeon);
GroupsStore[guid].SetDungeon(dungeon);
}
-void LFGMgr::SetRoles(uint64 guid, uint8 roles)
+void LFGMgr::SetRoles(ObjectGuid guid, uint8 roles)
{
- TC_LOG_TRACE("lfg.data.player.role.set", "Player: %u, Roles: %u", GUID_LOPART(guid), roles);
+ TC_LOG_TRACE("lfg.data.player.role.set", "Player: %u, Roles: %u", guid.GetCounter(), roles);
PlayersStore[guid].SetRoles(roles);
}
-void LFGMgr::SetComment(uint64 guid, std::string const& comment)
+void LFGMgr::SetComment(ObjectGuid guid, std::string const& comment)
{
- TC_LOG_TRACE("lfg.data.player.comment.set", "Player: %u, Comment: %s", GUID_LOPART(guid), comment.c_str());
+ TC_LOG_TRACE("lfg.data.player.comment.set", "Player: %u, Comment: %s", guid.GetCounter(), comment.c_str());
PlayersStore[guid].SetComment(comment);
}
-void LFGMgr::SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons)
+void LFGMgr::SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const& dungeons)
{
- TC_LOG_TRACE("lfg.data.player.dungeon.selected.set", "Player: %u, Dungeons: %s", GUID_LOPART(guid), ConcatenateDungeons(dungeons).c_str());
+ TC_LOG_TRACE("lfg.data.player.dungeon.selected.set", "Player: %u, Dungeons: %s", guid.GetCounter(), ConcatenateDungeons(dungeons).c_str());
PlayersStore[guid].SetSelectedDungeons(dungeons);
}
-void LFGMgr::DecreaseKicksLeft(uint64 guid)
+void LFGMgr::DecreaseKicksLeft(ObjectGuid guid)
{
GroupsStore[guid].DecreaseKicksLeft();
- TC_LOG_TRACE("lfg.data.group.kicksleft.decrease", "Group: %u, Kicks: %u", GUID_LOPART(guid), GroupsStore[guid].GetKicksLeft());
+ TC_LOG_TRACE("lfg.data.group.kicksleft.decrease", "Group: %u, Kicks: %u", guid.GetCounter(), GroupsStore[guid].GetKicksLeft());
}
-void LFGMgr::RemovePlayerData(uint64 guid)
+void LFGMgr::RemovePlayerData(ObjectGuid guid)
{
- TC_LOG_TRACE("lfg.data.player.remove", "Player: %u", GUID_LOPART(guid));
+ TC_LOG_TRACE("lfg.data.player.remove", "Player: %u", guid.GetCounter());
LfgPlayerDataContainer::iterator it = PlayersStore.find(guid);
if (it != PlayersStore.end())
PlayersStore.erase(it);
}
-void LFGMgr::RemoveGroupData(uint64 guid)
+void LFGMgr::RemoveGroupData(ObjectGuid guid)
{
- TC_LOG_TRACE("lfg.data.group.remove", "Group: %u", GUID_LOPART(guid));
+ TC_LOG_TRACE("lfg.data.group.remove", "Group: %u", guid.GetCounter());
LfgGroupDataContainer::iterator it = GroupsStore.find(guid);
if (it == GroupsStore.end())
return;
LfgState state = GetState(guid);
// If group is being formed after proposal success do nothing more
- LfgGuidSet const& players = it->second.GetPlayers();
- for (uint64 playerGUID : players)
+ GuidSet const& players = it->second.GetPlayers();
+ for (ObjectGuid playerGUID : players)
{
- SetGroup(playerGUID, 0);
+ SetGroup(playerGUID, ObjectGuid::Empty);
if (state != LFG_STATE_PROPOSAL)
{
SetState(playerGUID, LFG_STATE_NONE);
@@ -1720,29 +1720,29 @@ void LFGMgr::RemoveGroupData(uint64 guid)
GroupsStore.erase(it);
}
-uint8 LFGMgr::GetTeam(uint64 guid)
+uint8 LFGMgr::GetTeam(ObjectGuid guid)
{
uint8 team = PlayersStore[guid].GetTeam();
- TC_LOG_TRACE("lfg.data.player.team.get", "Player: %u, Team: %u", GUID_LOPART(guid), team);
+ TC_LOG_TRACE("lfg.data.player.team.get", "Player: %u, Team: %u", guid.GetCounter(), team);
return team;
}
-uint8 LFGMgr::RemovePlayerFromGroup(uint64 gguid, uint64 guid)
+uint8 LFGMgr::RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid)
{
return GroupsStore[gguid].RemovePlayer(guid);
}
-void LFGMgr::AddPlayerToGroup(uint64 gguid, uint64 guid)
+void LFGMgr::AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid)
{
GroupsStore[gguid].AddPlayer(guid);
}
-void LFGMgr::SetLeader(uint64 gguid, uint64 leader)
+void LFGMgr::SetLeader(ObjectGuid gguid, ObjectGuid leader)
{
GroupsStore[gguid].SetLeader(leader);
}
-void LFGMgr::SetTeam(uint64 guid, uint8 team)
+void LFGMgr::SetTeam(ObjectGuid guid, uint8 team)
{
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
team = 0;
@@ -1750,93 +1750,91 @@ void LFGMgr::SetTeam(uint64 guid, uint8 team)
PlayersStore[guid].SetTeam(team);
}
-uint64 LFGMgr::GetGroup(uint64 guid)
+ObjectGuid LFGMgr::GetGroup(ObjectGuid guid)
{
return PlayersStore[guid].GetGroup();
}
-void LFGMgr::SetGroup(uint64 guid, uint64 group)
+void LFGMgr::SetGroup(ObjectGuid guid, ObjectGuid group)
{
PlayersStore[guid].SetGroup(group);
}
-LfgGuidSet const& LFGMgr::GetPlayers(uint64 guid)
+GuidSet const& LFGMgr::GetPlayers(ObjectGuid guid)
{
return GroupsStore[guid].GetPlayers();
}
-uint8 LFGMgr::GetPlayerCount(uint64 guid)
+uint8 LFGMgr::GetPlayerCount(ObjectGuid guid)
{
return GroupsStore[guid].GetPlayerCount();
}
-uint64 LFGMgr::GetLeader(uint64 guid)
+ObjectGuid LFGMgr::GetLeader(ObjectGuid guid)
{
return GroupsStore[guid].GetLeader();
}
-bool LFGMgr::HasIgnore(uint64 guid1, uint64 guid2)
+bool LFGMgr::HasIgnore(ObjectGuid guid1, ObjectGuid guid2)
{
Player* plr1 = ObjectAccessor::FindPlayer(guid1);
Player* plr2 = ObjectAccessor::FindPlayer(guid2);
- uint32 low1 = GUID_LOPART(guid1);
- uint32 low2 = GUID_LOPART(guid2);
- return plr1 && plr2 && (plr1->GetSocial()->HasIgnore(low2) || plr2->GetSocial()->HasIgnore(low1));
+ return plr1 && plr2 && (plr1->GetSocial()->HasIgnore(guid2.GetCounter()) || plr2->GetSocial()->HasIgnore(guid1.GetCounter()));
}
-void LFGMgr::SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles)
+void LFGMgr::SendLfgRoleChosen(ObjectGuid guid, ObjectGuid pguid, uint8 roles)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgRoleChosen(pguid, roles);
}
-void LFGMgr::SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck)
+void LFGMgr::SendLfgRoleCheckUpdate(ObjectGuid guid, LfgRoleCheck const& roleCheck)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgRoleCheckUpdate(roleCheck);
}
-void LFGMgr::SendLfgUpdateStatus(uint64 guid, LfgUpdateData const& data, bool party)
+void LFGMgr::SendLfgUpdateStatus(ObjectGuid guid, LfgUpdateData const& data, bool party)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgUpdateStatus(data, party);
}
-void LFGMgr::SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data)
+void LFGMgr::SendLfgJoinResult(ObjectGuid guid, LfgJoinResultData const& data)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgJoinResult(data);
}
-void LFGMgr::SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot)
+void LFGMgr::SendLfgBootProposalUpdate(ObjectGuid guid, LfgPlayerBoot const& boot)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgBootProposalUpdate(boot);
}
-void LFGMgr::SendLfgUpdateProposal(uint64 guid, LfgProposal const& proposal)
+void LFGMgr::SendLfgUpdateProposal(ObjectGuid guid, LfgProposal const& proposal)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgUpdateProposal(proposal);
}
-void LFGMgr::SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data)
+void LFGMgr::SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendLfgQueueStatus(data);
}
-bool LFGMgr::IsLfgGroup(uint64 guid)
+bool LFGMgr::IsLfgGroup(ObjectGuid guid)
{
- return guid && IS_GROUP_GUID(guid) && GroupsStore[guid].IsLfgGroup();
+ return guid && guid.IsGroup() && GroupsStore[guid].IsLfgGroup();
}
-uint8 LFGMgr::GetQueueId(uint64 guid)
+uint8 LFGMgr::GetQueueId(ObjectGuid guid)
{
- if (IS_GROUP_GUID(guid))
+ if (guid.IsGroup())
{
- LfgGuidSet const& players = GetPlayers(guid);
- uint64 pguid = players.empty() ? 0 : (*players.begin());
+ GuidSet const& players = GetPlayers(guid);
+ ObjectGuid pguid = players.empty() ? ObjectGuid::Empty : (*players.begin());
if (pguid)
return GetTeam(pguid);
}
@@ -1844,24 +1842,24 @@ uint8 LFGMgr::GetQueueId(uint64 guid)
return GetTeam(guid);
}
-LFGQueue& LFGMgr::GetQueue(uint64 guid)
+LFGQueue& LFGMgr::GetQueue(ObjectGuid guid)
{
uint8 queueId = GetQueueId(guid);
return QueuesStore[queueId];
}
-bool LFGMgr::AllQueued(LfgGuidList const& check)
+bool LFGMgr::AllQueued(GuidList const& check)
{
if (check.empty())
return false;
- for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it)
+ for (GuidList::const_iterator it = check.begin(); it != check.end(); ++it)
if (GetState(*it) != LFG_STATE_QUEUED)
return false;
return true;
}
-time_t LFGMgr::GetQueueJoinTime(uint64 guid)
+time_t LFGMgr::GetQueueJoinTime(ObjectGuid guid)
{
uint8 queueId = GetQueueId(guid);
LfgQueueContainer::const_iterator itr = QueuesStore.find(queueId);
@@ -1892,7 +1890,7 @@ void LFGMgr::SetOptions(uint32 options)
m_options = options;
}
-LfgUpdateData LFGMgr::GetLfgStatus(uint64 guid)
+LfgUpdateData LFGMgr::GetLfgStatus(ObjectGuid guid)
{
LfgPlayerData& playerData = PlayersStore[guid];
return LfgUpdateData(LFG_UPDATETYPE_UPDATE_STATUS, playerData.GetState(), playerData.GetSelectedDungeons());
@@ -1930,7 +1928,7 @@ std::string LFGMgr::DumpQueueInfo(bool full)
return o.str();
}
-void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid)
+void LFGMgr::SetupGroupMember(ObjectGuid guid, ObjectGuid gguid)
{
LfgDungeonSet dungeons;
dungeons.insert(GetDungeon(gguid));
@@ -1940,7 +1938,7 @@ void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid)
AddPlayerToGroup(gguid, guid);
}
-bool LFGMgr::selectedRandomLfgDungeon(uint64 guid)
+bool LFGMgr::selectedRandomLfgDungeon(ObjectGuid guid)
{
if (GetState(guid) != LFG_STATE_NONE)
{
@@ -1956,9 +1954,9 @@ bool LFGMgr::selectedRandomLfgDungeon(uint64 guid)
return false;
}
-bool LFGMgr::inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty)
+bool LFGMgr::inLfgDungeonMap(ObjectGuid guid, uint32 map, Difficulty difficulty)
{
- if (!IS_GROUP_GUID(guid))
+ if (!guid.IsGroup())
guid = GetGroup(guid);
if (uint32 dungeonId = GetDungeon(guid, true))
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index b04b4f1a7ab..343705a58ab 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -138,13 +138,13 @@ typedef std::map<uint8, LFGQueue> LfgQueueContainer;
typedef std::multimap<uint32, LfgReward const*> LfgRewardContainer;
typedef std::pair<LfgRewardContainer::const_iterator, LfgRewardContainer::const_iterator> LfgRewardContainerBounds;
typedef std::map<uint8, LfgDungeonSet> LfgCachedDungeonContainer;
-typedef std::map<uint64, LfgAnswer> LfgAnswerContainer;
-typedef std::map<uint64, LfgRoleCheck> LfgRoleCheckContainer;
+typedef std::map<ObjectGuid, LfgAnswer> LfgAnswerContainer;
+typedef std::map<ObjectGuid, LfgRoleCheck> LfgRoleCheckContainer;
typedef std::map<uint32, LfgProposal> LfgProposalContainer;
-typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerContainer;
-typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootContainer;
-typedef std::map<uint64, LfgGroupData> LfgGroupDataContainer;
-typedef std::map<uint64, LfgPlayerData> LfgPlayerDataContainer;
+typedef std::map<ObjectGuid, LfgProposalPlayer> LfgProposalPlayerContainer;
+typedef std::map<ObjectGuid, LfgPlayerBoot> LfgPlayerBootContainer;
+typedef std::map<ObjectGuid, LfgGroupData> LfgGroupDataContainer;
+typedef std::map<ObjectGuid, LfgPlayerData> LfgPlayerDataContainer;
typedef std::unordered_map<uint32, LFGDungeonData> LFGDungeonContainer;
// Data needed by SMSG_LFG_JOIN_RESULT
@@ -218,29 +218,29 @@ struct LfgReward
/// Stores player data related to proposal to join
struct LfgProposalPlayer
{
- LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group(0) { }
+ LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group() { }
uint8 role; ///< Proposed role
LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree)
- uint64 group; ///< Original group guid. 0 if no original group
+ ObjectGuid group; ///< Original group guid. 0 if no original group
};
/// Stores group data related to proposal to join
struct LfgProposal
{
LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING),
- group(0), leader(0), cancelTime(0), encounters(0), isNew(true)
+ group(), leader(), cancelTime(0), encounters(0), isNew(true)
{ }
uint32 id; ///< Proposal Id
uint32 dungeonId; ///< Dungeon to join
LfgProposalState state; ///< State of the proposal
- uint64 group; ///< Proposal group (0 if new)
- uint64 leader; ///< Leader guid.
+ ObjectGuid group; ///< Proposal group (0 if new)
+ ObjectGuid leader; ///< Leader guid.
time_t cancelTime; ///< Time when we will cancel this proposal
uint32 encounters; ///< Dungeon Encounters
bool isNew; ///< Determines if it's new group or not
- LfgGuidList queues; ///< Queue Ids to remove/readd
- LfgGuidList showorder; ///< Show order in update window
+ GuidList queues; ///< Queue Ids to remove/readd
+ GuidList showorder; ///< Show order in update window
LfgProposalPlayerContainer players; ///< Players data
};
@@ -252,7 +252,7 @@ struct LfgRoleCheck
LfgRoleCheckState state; ///< State of the rolecheck
LfgDungeonSet dungeons; ///< Dungeons group is applying for (expanded random dungeons)
uint32 rDungeonId; ///< Random Dungeon Id.
- uint64 leader; ///< Leader of the group
+ ObjectGuid leader; ///< Leader of the group
};
/// Stores information of a current vote to kick someone from a group
@@ -261,7 +261,7 @@ struct LfgPlayerBoot
time_t cancelTime; ///< Time left to vote
bool inProgress; ///< Vote in progress
LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
- uint64 victim; ///< Player guid to be kicked (can't vote)
+ ObjectGuid victim; ///< Player guid to be kicked (can't vote)
std::string reason; ///< kick reason
};
@@ -313,7 +313,7 @@ class LFGMgr
// World.cpp
/// Finish the dungeon for the given group. All check are performed using internal lfg data
- void FinishDungeon(uint64 gguid, uint32 dungeonId);
+ void FinishDungeon(ObjectGuid gguid, uint32 dungeonId);
/// Loads rewards for random dungeons
void LoadRewards();
/// Loads dungeons from dbc and adds teleport coords
@@ -321,31 +321,31 @@ class LFGMgr
// Multiple files
/// Check if given guid applied for random dungeon
- bool selectedRandomLfgDungeon(uint64 guid);
+ bool selectedRandomLfgDungeon(ObjectGuid guid);
/// Check if given guid applied for given map and difficulty. Used to know
- bool inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty);
+ bool inLfgDungeonMap(ObjectGuid guid, uint32 map, Difficulty difficulty);
/// Get selected dungeons
- LfgDungeonSet const& GetSelectedDungeons(uint64 guid);
+ LfgDungeonSet const& GetSelectedDungeons(ObjectGuid guid);
/// Get current lfg state
- LfgState GetState(uint64 guid);
+ LfgState GetState(ObjectGuid guid);
/// Get current dungeon
- uint32 GetDungeon(uint64 guid, bool asId = true);
+ uint32 GetDungeon(ObjectGuid guid, bool asId = true);
/// Get the map id of the current dungeon
- uint32 GetDungeonMapId(uint64 guid);
+ uint32 GetDungeonMapId(ObjectGuid guid);
/// Get kicks left in current group
- uint8 GetKicksLeft(uint64 gguid);
+ uint8 GetKicksLeft(ObjectGuid gguid);
/// Load Lfg group info from DB
- void _LoadFromDB(Field* fields, uint64 guid);
+ void _LoadFromDB(Field* fields, ObjectGuid guid);
/// Initializes player data after loading group data from DB
- void SetupGroupMember(uint64 guid, uint64 gguid);
+ void SetupGroupMember(ObjectGuid guid, ObjectGuid gguid);
/// Return Lfg dungeon entry for given dungeon id
uint32 GetLFGDungeonEntry(uint32 id);
// cs_lfg
/// Get current player roles
- uint8 GetRoles(uint64 guid);
+ uint8 GetRoles(ObjectGuid guid);
/// Get current player comment (used for LFR)
- std::string const& GetComment(uint64 gguid);
+ std::string const& GetComment(ObjectGuid gguid);
/// Gets current lfg options
uint32 GetOptions();
/// Sets new lfg options
@@ -359,27 +359,27 @@ class LFGMgr
// LFGScripts
/// Get leader of the group (using internal data)
- uint64 GetLeader(uint64 guid);
+ ObjectGuid GetLeader(ObjectGuid guid);
/// Sets player team
- void SetTeam(uint64 guid, uint8 team);
+ void SetTeam(ObjectGuid guid, uint8 team);
/// Sets player group
- void SetGroup(uint64 guid, uint64 group);
+ void SetGroup(ObjectGuid guid, ObjectGuid group);
/// Gets player group
- uint64 GetGroup(uint64 guid);
+ ObjectGuid GetGroup(ObjectGuid guid);
/// Sets the leader of the group
- void SetLeader(uint64 gguid, uint64 leader);
+ void SetLeader(ObjectGuid gguid, ObjectGuid leader);
/// Removes saved group data
- void RemoveGroupData(uint64 guid);
+ void RemoveGroupData(ObjectGuid guid);
/// Removes a player from a group
- uint8 RemovePlayerFromGroup(uint64 gguid, uint64 guid);
+ uint8 RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid);
/// Adds player to group
- void AddPlayerToGroup(uint64 gguid, uint64 guid);
+ void AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid);
// LFGHandler
/// Get locked dungeons
- LfgLockMap const GetLockedDungeons(uint64 guid);
+ LfgLockMap const GetLockedDungeons(ObjectGuid guid);
/// Returns current lfg status
- LfgUpdateData GetLfgStatus(uint64 guid);
+ LfgUpdateData GetLfgStatus(ObjectGuid guid);
/// Checks if Seasonal dungeon is active
bool IsSeasonActive(uint32 dungeonId);
/// Gets the random dungeon reward corresponding to given dungeon and player level
@@ -389,55 +389,55 @@ class LFGMgr
/// Teleport a player to/from selected dungeon
void TeleportPlayer(Player* player, bool out, bool fromOpcode = false);
/// Inits new proposal to boot a player
- void InitBoot(uint64 gguid, uint64 kguid, uint64 vguid, std::string const& reason);
+ void InitBoot(ObjectGuid gguid, ObjectGuid kguid, ObjectGuid vguid, std::string const& reason);
/// Updates player boot proposal with new player answer
- void UpdateBoot(uint64 guid, bool accept);
+ void UpdateBoot(ObjectGuid guid, bool accept);
/// Updates proposal to join dungeon with player answer
- void UpdateProposal(uint32 proposalId, uint64 guid, bool accept);
+ void UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept);
/// Updates the role check with player answer
- void UpdateRoleCheck(uint64 gguid, uint64 guid = 0, uint8 roles = PLAYER_ROLE_NONE);
+ void UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid = ObjectGuid::Empty, uint8 roles = PLAYER_ROLE_NONE);
/// Sets player lfg roles
- void SetRoles(uint64 guid, uint8 roles);
+ void SetRoles(ObjectGuid guid, uint8 roles);
/// Sets player lfr comment
- void SetComment(uint64 guid, std::string const& comment);
+ void SetComment(ObjectGuid guid, std::string const& comment);
/// Join Lfg with selected roles, dungeons and comment
void JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment);
/// Leaves lfg
- void LeaveLfg(uint64 guid);
+ void LeaveLfg(ObjectGuid guid);
// LfgQueue
/// Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON)
- LfgState GetOldState(uint64 guid);
+ LfgState GetOldState(ObjectGuid guid);
/// Check if given group guid is lfg
- bool IsLfgGroup(uint64 guid);
+ bool IsLfgGroup(ObjectGuid guid);
/// Gets the player count of given group
- uint8 GetPlayerCount(uint64 guid);
+ uint8 GetPlayerCount(ObjectGuid guid);
/// Add a new Proposal
uint32 AddProposal(LfgProposal& proposal);
/// Returns queue id
- uint8 GetQueueId(uint64 guid);
+ uint8 GetQueueId(ObjectGuid guid);
/// Checks if all players are queued
- bool AllQueued(LfgGuidList const& check);
+ bool AllQueued(GuidList const& check);
/// Gets queue join time
- time_t GetQueueJoinTime(uint64 guid);
+ time_t GetQueueJoinTime(ObjectGuid guid);
/// Checks if given roles match, modifies given roles map with new roles
static bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
/// Checks if given players are ignoring each other
- static bool HasIgnore(uint64 guid1, uint64 guid2);
+ static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2);
/// Sends queue status to player
- static void SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data);
+ static void SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data);
private:
- uint8 GetTeam(uint64 guid);
- void RestoreState(uint64 guid, char const* debugMsg);
- void ClearState(uint64 guid, char const* debugMsg);
- void SetDungeon(uint64 guid, uint32 dungeon);
- void SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons);
- void DecreaseKicksLeft(uint64 guid);
- void SetState(uint64 guid, LfgState state);
- void RemovePlayerData(uint64 guid);
- void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap);
- void _SaveToDB(uint64 guid, uint32 db_guid);
+ uint8 GetTeam(ObjectGuid guid);
+ void RestoreState(ObjectGuid guid, char const* debugMsg);
+ void ClearState(ObjectGuid guid, char const* debugMsg);
+ void SetDungeon(ObjectGuid guid, uint32 dungeon);
+ void SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const& dungeons);
+ void DecreaseKicksLeft(ObjectGuid guid);
+ void SetState(ObjectGuid guid, LfgState state);
+ void RemovePlayerData(ObjectGuid guid);
+ void GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& players, LfgLockPartyMap& lockMap);
+ void _SaveToDB(ObjectGuid guid, uint32 db_guid);
LFGDungeonData const* GetLFGDungeon(uint32 id);
// Proposals
@@ -445,19 +445,19 @@ class LFGMgr
void MakeNewGroup(LfgProposal const& proposal);
// Generic
- LFGQueue& GetQueue(uint64 guid);
+ LFGQueue& GetQueue(ObjectGuid guid);
LfgDungeonSet const& GetDungeonsByRandom(uint32 randomdungeon);
LfgType GetDungeonType(uint32 dungeon);
- void SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot);
- void SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data);
- void SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles);
- void SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck);
- void SendLfgUpdateStatus(uint64 guid, LfgUpdateData const& data, bool party);
- void SendLfgUpdateProposal(uint64 guid, LfgProposal const& proposal);
+ void SendLfgBootProposalUpdate(ObjectGuid guid, LfgPlayerBoot const& boot);
+ void SendLfgJoinResult(ObjectGuid guid, LfgJoinResultData const& data);
+ void SendLfgRoleChosen(ObjectGuid guid, ObjectGuid pguid, uint8 roles);
+ void SendLfgRoleCheckUpdate(ObjectGuid guid, LfgRoleCheck const& roleCheck);
+ void SendLfgUpdateStatus(ObjectGuid guid, LfgUpdateData const& data, bool party);
+ void SendLfgUpdateProposal(ObjectGuid guid, LfgProposal const& proposal);
- LfgGuidSet const& GetPlayers(uint64 guid);
+ GuidSet const& GetPlayers(ObjectGuid guid);
// General variables
uint32 m_QueueTimer; ///< used to check interval of update
diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp
index 84b93543d7f..6be50be9b9c 100644
--- a/src/server/game/DungeonFinding/LFGPlayerData.cpp
+++ b/src/server/game/DungeonFinding/LFGPlayerData.cpp
@@ -21,7 +21,7 @@ namespace lfg
{
LfgPlayerData::LfgPlayerData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
- m_Team(0), m_Group(0), m_Roles(0), m_Comment("")
+ m_Team(0), m_Group(), m_Roles(0), m_Comment("")
{ }
LfgPlayerData::~LfgPlayerData() { }
@@ -34,7 +34,7 @@ void LfgPlayerData::SetState(LfgState state)
case LFG_STATE_FINISHED_DUNGEON:
m_Roles = 0;
m_SelectedDungeons.clear();
- m_Comment = "";
+ m_Comment.clear();
// No break on purpose
case LFG_STATE_DUNGEON:
m_OldState = state;
@@ -59,7 +59,7 @@ void LfgPlayerData::SetTeam(uint8 team)
m_Team = team;
}
-void LfgPlayerData::SetGroup(uint64 group)
+void LfgPlayerData::SetGroup(ObjectGuid group)
{
m_Group = group;
}
@@ -94,7 +94,7 @@ uint8 LfgPlayerData::GetTeam() const
return m_Team;
}
-uint64 LfgPlayerData::GetGroup() const
+ObjectGuid LfgPlayerData::GetGroup() const
{
return m_Group;
}
diff --git a/src/server/game/DungeonFinding/LFGPlayerData.h b/src/server/game/DungeonFinding/LFGPlayerData.h
index 996764e7620..160fd221630 100644
--- a/src/server/game/DungeonFinding/LFGPlayerData.h
+++ b/src/server/game/DungeonFinding/LFGPlayerData.h
@@ -36,7 +36,7 @@ class LfgPlayerData
void SetState(LfgState state);
void RestoreState();
void SetTeam(uint8 team);
- void SetGroup(uint64 group);
+ void SetGroup(ObjectGuid group);
// Queue
void SetRoles(uint8 roles);
@@ -47,7 +47,7 @@ class LfgPlayerData
LfgState GetState() const;
LfgState GetOldState() const;
uint8 GetTeam() const;
- uint64 GetGroup() const;
+ ObjectGuid GetGroup() const;
// Queue
uint8 GetRoles() const;
@@ -60,7 +60,7 @@ class LfgPlayerData
LfgState m_OldState; ///< Old State - Used to restore state after failed Rolecheck/Proposal
// Player
uint8 m_Team; ///< Player team - determines the queue to join
- uint64 m_Group; ///< Original group of player when joined LFG
+ ObjectGuid m_Group; ///< Original group of player when joined LFG
// Queue
uint8 m_Roles; ///< Roles the player selected when joined LFG
diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp
index a44c7780c6b..df08b55a856 100644
--- a/src/server/game/DungeonFinding/LFGQueue.cpp
+++ b/src/server/game/DungeonFinding/LFGQueue.cpp
@@ -36,20 +36,20 @@ namespace lfg
@param[in] check list of guids
@returns Concatenated string
*/
-std::string ConcatenateGuids(LfgGuidList const& check)
+std::string ConcatenateGuids(GuidList const& check)
{
if (check.empty())
return "";
// need the guids in order to avoid duplicates
- LfgGuidSet guids(check.begin(), check.end());
+ GuidSet guids(check.begin(), check.end());
std::ostringstream o;
- LfgGuidSet::const_iterator it = guids.begin();
- o << (*it);
+ GuidSet::const_iterator it = guids.begin();
+ o << it->GetRawValue();
for (++it; it != guids.end(); ++it)
- o << '|' << (*it);
+ o << '|' << it->GetRawValue();
return o.str();
}
@@ -83,26 +83,26 @@ char const* GetCompatibleString(LfgCompatibility compatibles)
}
}
-void LFGQueue::AddToQueue(uint64 guid)
+void LFGQueue::AddToQueue(ObjectGuid guid)
{
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
if (itQueue == QueueDataStore.end())
{
- TC_LOG_ERROR("lfg.queue.add", "Queue data not found for [" UI64FMTD "]", guid);
+ TC_LOG_ERROR("lfg.queue.add", "Queue data not found for [%s]", guid.ToString().c_str());
return;
}
AddToNewQueue(guid);
}
-void LFGQueue::RemoveFromQueue(uint64 guid)
+void LFGQueue::RemoveFromQueue(ObjectGuid guid)
{
RemoveFromNewQueue(guid);
RemoveFromCurrentQueue(guid);
RemoveFromCompatibles(guid);
std::ostringstream o;
- o << guid;
+ o << guid.GetRawValue();
std::string sguid = o.str();
LfgQueueDataContainer::iterator itDelete = QueueDataStore.end();
@@ -122,33 +122,33 @@ void LFGQueue::RemoveFromQueue(uint64 guid)
QueueDataStore.erase(itDelete);
}
-void LFGQueue::AddToNewQueue(uint64 guid)
+void LFGQueue::AddToNewQueue(ObjectGuid guid)
{
newToQueueStore.push_back(guid);
}
-void LFGQueue::RemoveFromNewQueue(uint64 guid)
+void LFGQueue::RemoveFromNewQueue(ObjectGuid guid)
{
newToQueueStore.remove(guid);
}
-void LFGQueue::AddToCurrentQueue(uint64 guid)
+void LFGQueue::AddToCurrentQueue(ObjectGuid guid)
{
currentQueueStore.push_back(guid);
}
-void LFGQueue::RemoveFromCurrentQueue(uint64 guid)
+void LFGQueue::RemoveFromCurrentQueue(ObjectGuid guid)
{
currentQueueStore.remove(guid);
}
-void LFGQueue::AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap)
+void LFGQueue::AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap)
{
QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap);
AddToQueue(guid);
}
-void LFGQueue::RemoveQueueData(uint64 guid)
+void LFGQueue::RemoveQueueData(ObjectGuid guid)
{
LfgQueueDataContainer::iterator it = QueueDataStore.find(guid);
if (it != QueueDataStore.end())
@@ -188,13 +188,13 @@ void LFGQueue::UpdateWaitTimeDps(int32 waitTime, uint32 dungeonId)
@param[in] guid Guid to remove from compatible cache
*/
-void LFGQueue::RemoveFromCompatibles(uint64 guid)
+void LFGQueue::RemoveFromCompatibles(ObjectGuid guid)
{
std::stringstream out;
- out << guid;
+ out << guid.GetRawValue();
std::string strGuid = out.str();
- TC_LOG_DEBUG("lfg.queue.data.compatibles.remove", "Removing [" UI64FMTD "]", guid);
+ TC_LOG_DEBUG("lfg.queue.data.compatibles.remove", "Removing %s", guid.ToString().c_str());
for (LfgCompatibleContainer::iterator itNext = CompatibleMapStore.begin(); itNext != CompatibleMapStore.end();)
{
LfgCompatibleContainer::iterator it = itNext++;
@@ -247,16 +247,18 @@ LfgCompatibilityData* LFGQueue::GetCompatibilityData(std::string const& key)
uint8 LFGQueue::FindGroups()
{
uint8 proposals = 0;
- LfgGuidList firstNew;
+ GuidList firstNew;
while (!newToQueueStore.empty())
{
- uint64 frontguid = newToQueueStore.front();
- TC_LOG_DEBUG("lfg.queue.match.check.new", "Checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", frontguid, uint32(newToQueueStore.size()), uint32(currentQueueStore.size()));
+ ObjectGuid frontguid = newToQueueStore.front();
+ TC_LOG_DEBUG("lfg.queue.match.check.new", "Checking [%s] newToQueue(%u), currentQueue(%u)", frontguid.ToString().c_str(),
+ uint32(newToQueueStore.size()), uint32(currentQueueStore.size()));
+
firstNew.clear();
firstNew.push_back(frontguid);
RemoveFromNewQueue(frontguid);
- LfgGuidList temporalList = currentQueueStore;
+ GuidList temporalList = currentQueueStore;
LfgCompatibility compatibles = FindNewGroups(firstNew, temporalList);
if (compatibles == LFG_COMPATIBLES_MATCH)
@@ -274,7 +276,7 @@ uint8 LFGQueue::FindGroups()
@param[in] all List of all other guids in main queue to match against
@return LfgCompatibility type of compatibility between groups
*/
-LfgCompatibility LFGQueue::FindNewGroups(LfgGuidList& check, LfgGuidList& all)
+LfgCompatibility LFGQueue::FindNewGroups(GuidList& check, GuidList& all)
{
std::string strGuids = ConcatenateGuids(check);
LfgCompatibility compatibles = GetCompatibles(strGuids);
@@ -312,7 +314,7 @@ LfgCompatibility LFGQueue::FindNewGroups(LfgGuidList& check, LfgGuidList& all)
@param[in] check List of guids to check compatibilities
@return LfgCompatibility type of compatibility
*/
-LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
+LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
{
std::string strGuids = ConcatenateGuids(check);
LfgProposal proposal;
@@ -330,7 +332,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
// Check all-but-new compatiblitity
if (check.size() > 2)
{
- uint64 frontGuid = check.front();
+ ObjectGuid frontGuid = check.front();
check.pop_front();
// Check all-but-new compatibilities (New, A, B, C, D) --> check(A, B, C, D)
@@ -347,20 +349,20 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
// Check if more than one LFG group and number of players joining
uint8 numPlayers = 0;
uint8 numLfgGroups = 0;
- for (LfgGuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it)
+ for (GuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it)
{
- uint64 guid = (*it);
+ ObjectGuid guid = *it;
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
if (itQueue == QueueDataStore.end())
{
- TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guid: [" UI64FMTD "] is not queued but listed as queued!", guid);
+ TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guid: [%s] is not queued but listed as queued!", guid.ToString().c_str());
RemoveFromQueue(guid);
return LFG_COMPATIBILITY_PENDING;
}
// Store group so we don't need to call Mgr to get it later (if it's player group will be 0 otherwise would have joined as group)
for (LfgRolesMap::const_iterator it2 = itQueue->second.roles.begin(); it2 != itQueue->second.roles.end(); ++it2)
- proposalGroups[it2->first] = IS_GROUP_GUID(itQueue->first) ? itQueue->first : 0;
+ proposalGroups[it2->first] = itQueue->first.IsGroup() ? itQueue->first : ObjectGuid::Empty;
numPlayers += itQueue->second.roles.size();
@@ -404,16 +406,16 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
// If it's single group no need to check for duplicate players, ignores, bad roles or bad dungeons as it's been checked before joining
if (check.size() > 1)
{
- for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it)
+ for (GuidList::const_iterator it = check.begin(); it != check.end(); ++it)
{
- const LfgRolesMap &roles = QueueDataStore[(*it)].roles;
+ LfgRolesMap const& roles = QueueDataStore[(*it)].roles;
for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles)
{
LfgRolesMap::const_iterator itPlayer;
for (itPlayer = proposalRoles.begin(); itPlayer != proposalRoles.end(); ++itPlayer)
{
if (itRoles->first == itPlayer->first)
- TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guids: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first);
+ TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guids: ERROR! Player multiple times in queue! [%s]", itRoles->first.ToString().c_str());
else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first))
break;
}
@@ -434,22 +436,22 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
{
std::ostringstream o;
for (LfgRolesMap::const_iterator it = debugRoles.begin(); it != debugRoles.end(); ++it)
- o << ", " << it->first << ": " << GetRolesString(it->second);
+ o << ", " << it->first.GetRawValue() << ": " << GetRolesString(it->second);
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Roles not compatible%s", strGuids.c_str(), o.str().c_str());
SetCompatibles(strGuids, LFG_INCOMPATIBLES_NO_ROLES);
return LFG_INCOMPATIBLES_NO_ROLES;
}
- LfgGuidList::iterator itguid = check.begin();
+ GuidList::iterator itguid = check.begin();
proposalDungeons = QueueDataStore[*itguid].dungeons;
std::ostringstream o;
- o << ", " << *itguid << ": (" << ConcatenateDungeons(proposalDungeons) << ")";
+ o << ", " << itguid->GetRawValue() << ": (" << ConcatenateDungeons(proposalDungeons) << ")";
for (++itguid; itguid != check.end(); ++itguid)
{
LfgDungeonSet temporal;
- LfgDungeonSet &dungeons = QueueDataStore[*itguid].dungeons;
- o << ", " << *itguid << ": (" << ConcatenateDungeons(dungeons) << ")";
+ LfgDungeonSet& dungeons = QueueDataStore[*itguid].dungeons;
+ o << ", " << itguid->GetRawValue() << ": (" << ConcatenateDungeons(dungeons) << ")";
std::set_intersection(proposalDungeons.begin(), proposalDungeons.end(), dungeons.begin(), dungeons.end(), std::inserter(temporal, temporal.begin()));
proposalDungeons = temporal;
}
@@ -463,7 +465,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
}
else
{
- uint64 gguid = *check.begin();
+ ObjectGuid gguid = *check.begin();
const LfgQueueData &queue = QueueDataStore[gguid];
proposalDungeons = queue.dungeons;
proposalRoles = queue.roles;
@@ -477,14 +479,14 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS);
data.roles = proposalRoles;
- for (LfgGuidList::const_iterator itr = check.begin(); itr != check.end(); ++itr)
+ for (GuidList::const_iterator itr = check.begin(); itr != check.end(); ++itr)
UpdateBestCompatibleInQueue(QueueDataStore.find(*itr), strGuids, data.roles);
SetCompatibilityData(strGuids, data);
return LFG_COMPATIBLES_WITH_LESS_PLAYERS;
}
- uint64 gguid = *check.begin();
+ ObjectGuid gguid = *check.begin();
proposal.queues = check;
proposal.isNew = numLfgGroups != 1 || sLFGMgr->GetOldState(gguid) != LFG_STATE_DUNGEON;
@@ -498,7 +500,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
// Create a new proposal
proposal.cancelTime = time(NULL) + LFG_TIME_PROPOSAL;
proposal.state = LFG_PROPOSAL_INITIATING;
- proposal.leader = 0;
+ proposal.leader.Clear();
proposal.dungeonId = Trinity::Containers::SelectRandomContainerElement(proposalDungeons);
bool leader = false;
@@ -523,9 +525,9 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
}
// Mark proposal members as not queued (but not remove queue data)
- for (LfgGuidList::const_iterator itQueue = proposal.queues.begin(); itQueue != proposal.queues.end(); ++itQueue)
+ for (GuidList::const_iterator itQueue = proposal.queues.begin(); itQueue != proposal.queues.end(); ++itQueue)
{
- uint64 guid = (*itQueue);
+ ObjectGuid guid = (*itQueue);
RemoveFromNewQueue(guid);
RemoveFromCurrentQueue(guid);
}
@@ -581,13 +583,13 @@ void LFGQueue::UpdateQueueTimers(uint8 queueId, time_t currTime)
LfgQueueStatusData queueData(queueId, dungeonId, queueinfo.joinTime, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps);
for (LfgRolesMap::const_iterator itPlayer = queueinfo.roles.begin(); itPlayer != queueinfo.roles.end(); ++itPlayer)
{
- uint64 pguid = itPlayer->first;
+ ObjectGuid pguid = itPlayer->first;
LFGMgr::SendLfgQueueStatus(pguid, queueData);
}
}
}
-time_t LFGQueue::GetJoinTime(uint64 guid) const
+time_t LFGQueue::GetJoinTime(ObjectGuid guid) const
{
LfgQueueDataContainer::const_iterator itr = QueueDataStore.find(guid);
if (itr != QueueDataStore.end())
@@ -604,11 +606,11 @@ std::string LFGQueue::DumpQueueInfo() const
for (uint8 i = 0; i < 2; ++i)
{
- LfgGuidList const& queue = i ? newToQueueStore : currentQueueStore;
- for (LfgGuidList::const_iterator it = queue.begin(); it != queue.end(); ++it)
+ GuidList const& queue = i ? newToQueueStore : currentQueueStore;
+ for (GuidList::const_iterator it = queue.begin(); it != queue.end(); ++it)
{
- uint64 guid = *it;
- if (IS_GROUP_GUID(guid))
+ ObjectGuid guid = *it;
+ if (guid.IsGroup())
{
groups++;
playersInGroup += sLFGMgr->GetPlayerCount(guid);
@@ -635,9 +637,9 @@ std::string LFGQueue::DumpCompatibleInfo(bool full /* = false */) const
void LFGQueue::FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue)
{
- TC_LOG_DEBUG("lfg.queue.compatibles.find", "Guid: " UI64FMTD, itrQueue->first);
+ TC_LOG_DEBUG("lfg.queue.compatibles.find", "%s", itrQueue->first.ToString().c_str());
std::ostringstream o;
- o << itrQueue->first;
+ o << itrQueue->first.GetRawValue();
std::string sguid = o.str();
for (LfgCompatibleContainer::const_iterator itr = CompatibleMapStore.begin(); itr != CompatibleMapStore.end(); ++itr)
@@ -660,8 +662,8 @@ void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQu
if (size <= storedSize)
return;
- TC_LOG_DEBUG("lfg.queue.compatibles.update", "Changed (%s) to (%s) as best compatible group for " UI64FMTD,
- queueData.bestCompatible.c_str(), key.c_str(), itrQueue->first);
+ TC_LOG_DEBUG("lfg.queue.compatibles.update", "Changed (%s) to (%s) as best compatible group for %s",
+ queueData.bestCompatible.c_str(), key.c_str(), itrQueue->first.ToString().c_str());
queueData.bestCompatible = key;
queueData.tanks = LFG_TANKS_NEEDED;
diff --git a/src/server/game/DungeonFinding/LFGQueue.h b/src/server/game/DungeonFinding/LFGQueue.h
index 0312c926991..333becd6e9d 100644
--- a/src/server/game/DungeonFinding/LFGQueue.h
+++ b/src/server/game/DungeonFinding/LFGQueue.h
@@ -78,7 +78,7 @@ struct LfgWaitTime
typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer;
typedef std::map<std::string, LfgCompatibilityData> LfgCompatibleContainer;
-typedef std::map<uint64, LfgQueueData> LfgQueueDataContainer;
+typedef std::map<ObjectGuid, LfgQueueData> LfgQueueDataContainer;
/**
Stores all data related to queue
@@ -88,10 +88,10 @@ class LFGQueue
public:
// Add/Remove from queue
- void AddToQueue(uint64 guid);
- void RemoveFromQueue(uint64 guid);
- void AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap);
- void RemoveQueueData(uint64 guid);
+ void AddToQueue(ObjectGuid guid);
+ void RemoveFromQueue(ObjectGuid guid);
+ void AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap);
+ void RemoveQueueData(ObjectGuid guid);
// Update Timers (when proposal success)
void UpdateWaitTimeAvg(int32 waitTime, uint32 dungeonId);
@@ -101,7 +101,7 @@ class LFGQueue
// Update Queue timers
void UpdateQueueTimers(uint8 queueId, time_t currTime);
- time_t GetJoinTime(uint64 guid) const;
+ time_t GetJoinTime(ObjectGuid guid) const;
// Find new group
uint8 FindGroups();
@@ -112,24 +112,23 @@ class LFGQueue
private:
void SetQueueUpdateData(std::string const& strGuids, LfgRolesMap const& proposalRoles);
- LfgRolesMap const& RemoveFromQueueUpdateData(uint64 guid);
- void AddToNewQueue(uint64 guid);
- void AddToCurrentQueue(uint64 guid);
- void RemoveFromNewQueue(uint64 guid);
- void RemoveFromCurrentQueue(uint64 guid);
+ void AddToNewQueue(ObjectGuid guid);
+ void AddToCurrentQueue(ObjectGuid guid);
+ void RemoveFromNewQueue(ObjectGuid guid);
+ void RemoveFromCurrentQueue(ObjectGuid guid);
void SetCompatibles(std::string const& key, LfgCompatibility compatibles);
LfgCompatibility GetCompatibles(std::string const& key);
- void RemoveFromCompatibles(uint64 guid);
+ void RemoveFromCompatibles(ObjectGuid guid);
void SetCompatibilityData(std::string const& key, LfgCompatibilityData const& compatibles);
LfgCompatibilityData* GetCompatibilityData(std::string const& key);
void FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue);
void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, std::string const& key, LfgRolesMap const& roles);
- LfgCompatibility FindNewGroups(LfgGuidList& check, LfgGuidList& all);
- LfgCompatibility CheckCompatibility(LfgGuidList check);
+ LfgCompatibility FindNewGroups(GuidList& check, GuidList& all);
+ LfgCompatibility CheckCompatibility(GuidList check);
// Queue
LfgQueueDataContainer QueueDataStore; ///< Queued groups
@@ -139,8 +138,8 @@ class LFGQueue
LfgWaitTimesContainer waitTimesTankStore; ///< Average wait time to find a group queuing as tank
LfgWaitTimesContainer waitTimesHealerStore; ///< Average wait time to find a group queuing as healer
LfgWaitTimesContainer waitTimesDpsStore; ///< Average wait time to find a group queuing as dps
- LfgGuidList currentQueueStore; ///< Ordered list. Used to find groups
- LfgGuidList newToQueueStore; ///< New groups to add to queue
+ GuidList currentQueueStore; ///< Ordered list. Used to find groups
+ GuidList newToQueueStore; ///< New groups to add to queue
};
} // namespace lfg
diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp
index 6a38afb398d..bac1949d894 100644
--- a/src/server/game/DungeonFinding/LFGScripts.cpp
+++ b/src/server/game/DungeonFinding/LFGScripts.cpp
@@ -52,16 +52,16 @@ void LFGPlayerScript::OnLogin(Player* player, bool /*loginFirst*/)
return;
// Temporal: Trying to determine when group data and LFG data gets desynched
- uint64 guid = player->GetGUID();
- uint64 gguid = sLFGMgr->GetGroup(guid);
+ ObjectGuid guid = player->GetGUID();
+ ObjectGuid gguid = sLFGMgr->GetGroup(guid);
if (Group const* group = player->GetGroup())
{
- uint64 gguid2 = group->GetGUID();
+ ObjectGuid gguid2 = group->GetGUID();
if (gguid != gguid2)
{
TC_LOG_ERROR("lfg", "%s on group %u but LFG has group %u saved... Fixing.",
- player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid));
+ player->GetSession()->GetPlayerInfo().c_str(), gguid2.GetCounter(), gguid.GetCounter());
sLFGMgr->SetupGroupMember(guid, group->GetGUID());
}
}
@@ -104,24 +104,24 @@ void LFGPlayerScript::OnMapChanged(Player* player)
LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript") { }
-void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
+void LFGGroupScript::OnAddMember(Group* group, ObjectGuid guid)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
- uint64 gguid = group->GetGUID();
- uint64 leader = group->GetLeaderGUID();
+ ObjectGuid gguid = group->GetGUID();
+ ObjectGuid leader = group->GetLeaderGUID();
if (leader == guid)
{
- TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader);
+ TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s]", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str());
sLFGMgr->SetLeader(gguid, guid);
}
else
{
LfgState gstate = sLFGMgr->GetState(gguid);
LfgState state = sLFGMgr->GetState(guid);
- TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state);
+ TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s] gstate: %u, state: %u", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str(), gstate, state);
if (state == LFG_STATE_QUEUED)
sLFGMgr->LeaveLfg(guid);
@@ -134,13 +134,14 @@ void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
sLFGMgr->AddPlayerToGroup(gguid, guid);
}
-void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason)
+void LFGGroupScript::OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
- uint64 gguid = group->GetGUID();
- TC_LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : ""));
+ ObjectGuid gguid = group->GetGUID();
+ TC_LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [%s]: remove [%s] Method: %d Kicker: [%s] Reason: %s",
+ gguid.ToString().c_str(), guid.ToString().c_str(), method, kicker.ToString().c_str(), (reason ? reason : ""));
bool isLFG = group->isLFGGroup();
@@ -160,13 +161,13 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
if (state == LFG_STATE_PROPOSAL && method == GROUP_REMOVEMETHOD_DEFAULT)
{
// LfgData: Remove player from group
- sLFGMgr->SetGroup(guid, 0);
+ sLFGMgr->SetGroup(guid, ObjectGuid::Empty);
sLFGMgr->RemovePlayerFromGroup(gguid, guid);
return;
}
sLFGMgr->LeaveLfg(guid);
- sLFGMgr->SetGroup(guid, 0);
+ sLFGMgr->SetGroup(guid, ObjectGuid::Empty);
uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid);
if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -192,31 +193,35 @@ void LFGGroupScript::OnDisband(Group* group)
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
- uint64 gguid = group->GetGUID();
- TC_LOG_DEBUG("lfg", "LFGScripts::OnDisband [" UI64FMTD "]", gguid);
+ ObjectGuid gguid = group->GetGUID();
+ TC_LOG_DEBUG("lfg", "LFGScripts::OnDisband [%s]", gguid.ToString().c_str());
sLFGMgr->RemoveGroupData(gguid);
}
-void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
+void LFGGroupScript::OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
- uint64 gguid = group->GetGUID();
+ ObjectGuid gguid = group->GetGUID();
+
+ TC_LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [%s]: old [%s] new [%s]",
+ gguid.ToString().c_str(), newLeaderGuid.ToString().c_str(), oldLeaderGuid.ToString().c_str());
- TC_LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
sLFGMgr->SetLeader(gguid, newLeaderGuid);
}
-void LFGGroupScript::OnInviteMember(Group* group, uint64 guid)
+void LFGGroupScript::OnInviteMember(Group* group, ObjectGuid guid)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
- uint64 gguid = group->GetGUID();
- uint64 leader = group->GetLeaderGUID();
- TC_LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader);
+ ObjectGuid gguid = group->GetGUID();
+ ObjectGuid leader = group->GetLeaderGUID();
+ TC_LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [%s]: invite [%s] leader [%s]",
+ gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str());
+
// No gguid == new group being formed
// No leader == after group creation first invite is new leader
// leader and no gguid == first invite after leader is added to new group (this is the real invite)
diff --git a/src/server/game/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h
index 3f1dcbb218b..b4a626d5607 100644
--- a/src/server/game/DungeonFinding/LFGScripts.h
+++ b/src/server/game/DungeonFinding/LFGScripts.h
@@ -46,11 +46,11 @@ class LFGGroupScript : public GroupScript
LFGGroupScript();
// Group Hooks
- void OnAddMember(Group* group, uint64 guid) override;
- void OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) override;
+ void OnAddMember(Group* group, ObjectGuid guid) override;
+ void OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason) override;
void OnDisband(Group* group) override;
- void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) override;
- void OnInviteMember(Group* group, uint64 guid) override;
+ void OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) override;
+ void OnInviteMember(Group* group, ObjectGuid guid) override;
};
} // namespace lfg
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index 9c50cec6ab8..65c679af1bf 100644
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -88,7 +88,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner)
WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask());
SetObjectScale(1);
- SetUInt64Value(CORPSE_FIELD_OWNER, owner->GetGUID());
+ SetGuidValue(CORPSE_FIELD_OWNER, owner->GetGUID());
_gridCoord = Trinity::ComputeGridCoord(GetPositionX(), GetPositionY());
@@ -104,7 +104,7 @@ void Corpse::SaveToDB()
uint16 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
stmt->setUInt32(index++, GetGUIDLow()); // corpseGuid
- stmt->setUInt32(index++, GUID_LOPART(GetOwnerGUID())); // guid
+ stmt->setUInt32(index++, GetOwnerGUID().GetCounter()); // guid
stmt->setFloat (index++, GetPositionX()); // posX
stmt->setFloat (index++, GetPositionY()); // posY
stmt->setFloat (index++, GetPositionZ()); // posZ
@@ -152,7 +152,7 @@ void Corpse::DeleteFromDB(SQLTransaction& trans)
{
// all corpses (not bones)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_CORPSES);
- stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID()));
+ stmt->setUInt32(0, GetOwnerGUID().GetCounter());
}
trans->Append(stmt);
}
@@ -177,7 +177,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
SetUInt32Value(CORPSE_FIELD_BYTES_2, fields[8].GetUInt32());
SetUInt32Value(CORPSE_FIELD_FLAGS, fields[9].GetUInt8());
SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, fields[10].GetUInt8());
- SetUInt64Value(CORPSE_FIELD_OWNER, MAKE_NEW_GUID(ownerGuid, 0, HIGHGUID_PLAYER));
+ SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid(HIGHGUID_PLAYER, ownerGuid));
m_time = time_t(fields[11].GetUInt32());
@@ -191,8 +191,8 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
if (!IsPositionValid())
{
- TC_LOG_ERROR("entities.player", "Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
- GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), posX, posY, posZ);
+ TC_LOG_ERROR("entities.player", "Corpse (%s, owner: %s) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
+ GetGUID().ToString().c_str(), GetOwnerGUID().ToString().c_str(), posX, posY, posZ);
return false;
}
diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h
index 5039c85bcb9..4b2e9321a73 100644
--- a/src/server/game/Entities/Corpse/Corpse.h
+++ b/src/server/game/Entities/Corpse/Corpse.h
@@ -64,7 +64,7 @@ class Corpse : public WorldObject, public GridObject<Corpse>
void DeleteBonesFromWorld();
void DeleteFromDB(SQLTransaction& trans);
- uint64 GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
+ ObjectGuid GetOwnerGUID() const { return GetGuidValue(CORPSE_FIELD_OWNER); }
time_t const& GetGhostTime() const { return m_time; }
void ResetGhostTime() { m_time = time(NULL); }
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 8f4788aa79a..7a0ee24aeca 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -143,7 +143,7 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
Creature::Creature(bool isWorldObject): Unit(isWorldObject), MapObject(),
m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0),
-m_lootRecipient(0), m_lootRecipientGroup(0), _skinner(0), _pickpocketLootRestore(0), m_corpseRemoveTime(0), m_respawnTime(0),
+m_lootRecipient(), m_lootRecipientGroup(0), _skinner(), _pickpocketLootRestore(0), m_corpseRemoveTime(0), m_respawnTime(0),
m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE),
m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false),
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
@@ -471,17 +471,17 @@ void Creature::Update(uint32 diff)
if (!allowed) // Will be rechecked on next Update call
break;
- uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_UNIT);
+ ObjectGuid dbtableHighGuid(HIGHGUID_UNIT, GetEntry(), m_DBTableGuid);
time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
if (!linkedRespawntime) // Can respawn
Respawn();
else // the master is dead
{
- uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
+ ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
SetRespawnTime(DAY);
else
- m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime)+urand(5, MINUTE); // else copy time from master and add a little
+ m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // else copy time from master and add a little
SaveRespawnTime(); // also save to DB immediately
}
}
@@ -532,7 +532,7 @@ void Creature::Update(uint32 diff)
if (Unit* charmer = ObjectAccessor::GetUnit(*this, LastCharmerGUID))
i_AI->AttackStart(charmer);
- LastCharmerGUID = 0;
+ LastCharmerGUID.Clear();
}
if (!IsInEvadeMode() && IsAIEnabled)
@@ -893,7 +893,7 @@ void Creature::SetLootRecipient(Unit* unit)
if (!unit)
{
- m_lootRecipient = 0;
+ m_lootRecipient.Clear();
m_lootRecipientGroup = 0;
RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE|UNIT_DYNFLAG_TAPPED);
return;
@@ -1224,7 +1224,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
m_DBTableGuid = guid;
if (map->GetInstanceId() == 0)
{
- if (map->GetCreature(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT)))
+ if (map->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, guid)))
return false;
}
else
@@ -1474,7 +1474,7 @@ void Creature::setDeathState(DeathState s)
if (sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss())
SaveRespawnTime();
- SetTarget(0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
+ SetTarget(ObjectGuid::Empty); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
setActive(false);
@@ -1533,8 +1533,8 @@ void Creature::Respawn(bool force)
if (m_DBTableGuid)
GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid);
- TC_LOG_DEBUG("entities.unit", "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)",
- GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry());
+ TC_LOG_DEBUG("entities.unit", "Respawning creature %s (%s)",
+ GetName().c_str(), GetGUID().ToString().c_str());
m_respawnTime = 0;
ResetPickPocketRefillTimer();
loot.clear();
@@ -2572,10 +2572,10 @@ void Creature::SetDisplayId(uint32 modelId)
}
}
-void Creature::SetTarget(uint64 guid)
+void Creature::SetTarget(ObjectGuid guid)
{
if (!_focusSpell)
- SetUInt64Value(UNIT_FIELD_TARGET, guid);
+ SetGuidValue(UNIT_FIELD_TARGET, guid);
}
void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
@@ -2585,7 +2585,7 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
return;
_focusSpell = focusSpell;
- SetUInt64Value(UNIT_FIELD_TARGET, target->GetGUID());
+ SetGuidValue(UNIT_FIELD_TARGET, target->GetGUID());
if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST)
AddUnitState(UNIT_STATE_ROTATING);
@@ -2601,9 +2601,9 @@ void Creature::ReleaseFocus(Spell const* focusSpell)
_focusSpell = NULL;
if (Unit* victim = GetVictim())
- SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());
+ SetGuidValue(UNIT_FIELD_TARGET, victim->GetGUID());
else
- SetUInt64Value(UNIT_FIELD_TARGET, 0);
+ SetGuidValue(UNIT_FIELD_TARGET, ObjectGuid::Empty);
if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST)
ClearUnitState(UNIT_STATE_ROTATING);
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 5ead323314c..b7c86aebfdf 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -552,11 +552,11 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
void StartPickPocketRefillTimer();
void ResetPickPocketRefillTimer() { _pickpocketLootRestore = 0; }
bool CanGeneratePickPocketLoot() const { return _pickpocketLootRestore <= time(NULL); }
- void SetSkinner(uint64 guid) { _skinner = guid; }
- uint64 GetSkinner() const { return _skinner; } // Returns the player who skinned this creature
+ void SetSkinner(ObjectGuid guid) { _skinner = guid; }
+ ObjectGuid GetSkinner() const { return _skinner; } // Returns the player who skinned this creature
Player* GetLootRecipient() const;
Group* GetLootRecipientGroup() const;
- bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
+ bool hasLootRecipient() const { return !m_lootRecipient.IsEmpty() || m_lootRecipientGroup; }
bool isTappedBy(Player const* player) const; // return true if the creature is tapped by the player or a member of his party.
void SetLootRecipient (Unit* unit);
@@ -674,7 +674,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
bool m_isTempWorldObject; //true when possessed
// Handling caster facing during spellcast
- void SetTarget(uint64 guid) override;
+ void SetTarget(ObjectGuid guid) override;
void FocusTarget(Spell const* focusSpell, WorldObject const* target);
void ReleaseFocus(Spell const* focusSpell);
@@ -687,9 +687,9 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
static float _GetHealthMod(int32 Rank);
- uint64 m_lootRecipient;
+ ObjectGuid m_lootRecipient;
uint32 m_lootRecipientGroup;
- uint64 _skinner;
+ ObjectGuid _skinner;
/// Timers
time_t _pickpocketLootRestore;
@@ -746,15 +746,15 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
class AssistDelayEvent : public BasicEvent
{
public:
- AssistDelayEvent(uint64 victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
+ AssistDelayEvent(ObjectGuid victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
bool Execute(uint64 e_time, uint32 p_time) override;
- void AddAssistant(uint64 guid) { m_assistants.push_back(guid); }
+ void AddAssistant(ObjectGuid guid) { m_assistants.push_back(guid); }
private:
AssistDelayEvent();
- uint64 m_victim;
- std::list<uint64> m_assistants;
+ ObjectGuid m_victim;
+ GuidList m_assistants;
Unit& m_owner;
};
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 9e72a124ae0..f1554fb27b7 100644
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -28,7 +28,7 @@ GossipMenu::GossipMenu()
{
_menuId = 0;
_locale = DEFAULT_LOCALE;
- _senderGUID = 0;
+ _senderGUID.Clear();
}
GossipMenu::~GossipMenu()
@@ -188,7 +188,7 @@ void PlayerMenu::ClearMenus()
_questMenu.ClearMenu();
}
-void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID)
+void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID)
{
_gossipMenu.SetSenderGUID(objectGUID);
@@ -248,7 +248,7 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID)
void PlayerMenu::SendCloseGossip()
{
- _gossipMenu.SetSenderGUID(0);
+ _gossipMenu.SetSenderGUID(ObjectGuid::Empty);
WorldPacket data(SMSG_GOSSIP_COMPLETE, 0);
_session->SendPacket(&data);
@@ -323,7 +323,7 @@ void QuestMenu::ClearMenu()
_questMenuItems.clear();
}
-void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, uint64 npcGUID)
+void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, ObjectGuid npcGUID)
{
WorldPacket data(SMSG_QUESTGIVER_QUEST_LIST, 100); // guess size
data << uint64(npcGUID);
@@ -368,20 +368,20 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string
data.put<uint8>(count_pos, count);
_session->SendPacket(&data);
- TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID));
+ TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC=%s", npcGUID.ToString().c_str());
}
-void PlayerMenu::SendQuestGiverStatus(uint32 questStatus, uint64 npcGUID) const
+void PlayerMenu::SendQuestGiverStatus(uint32 questStatus, ObjectGuid npcGUID) const
{
WorldPacket data(SMSG_QUESTGIVER_STATUS, 8 + 4);
data << uint64(npcGUID);
data << uint32(questStatus);
_session->SendPacket(&data);
- TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus);
+ TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC=%s, status=%u", npcGUID.ToString().c_str(), questStatus);
}
-void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const
+void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const
{
std::string questTitle = quest->GetTitle();
std::string questDetails = quest->GetDetails();
@@ -441,7 +441,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
}
_session->SendPacket(&data);
- TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
+ TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
}
void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
@@ -615,7 +615,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", quest->GetQuestId());
}
-void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const
+void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const
{
std::string questTitle = quest->GetTitle();
std::string questOfferRewardText = quest->GetOfferRewardText();
@@ -676,10 +676,10 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
quest->BuildExtraQuestInfo(data, _session->GetPlayer());
_session->SendPacket(&data);
- TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
+ TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
}
-void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const
+void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const
{
// We can always call to RequestItems, but this packet only goes out if there are actually
// items. Otherwise, we'll skip straight to the OfferReward
@@ -764,7 +764,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
data << uint32(0x40);
_session->SendPacket(&data);
- TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
+ TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
}
void PlayerMenu::AddQuestLevelToTitle(std::string &title, int32 level)
diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h
index 6d42d7c33f7..a2b29b8c29b 100644
--- a/src/server/game/Entities/Creature/GossipDef.h
+++ b/src/server/game/Entities/Creature/GossipDef.h
@@ -20,6 +20,7 @@
#define TRINITYCORE_GOSSIP_H
#include "Common.h"
+#include "ObjectGuid.h"
#include "QuestDef.h"
#include "NPCHandler.h"
@@ -167,8 +168,8 @@ class GossipMenu
void SetMenuId(uint32 menu_id) { _menuId = menu_id; }
uint32 GetMenuId() const { return _menuId; }
- void SetSenderGUID(uint64 guid) { _senderGUID = guid; }
- uint64 GetSenderGUID() const { return _senderGUID; }
+ void SetSenderGUID(ObjectGuid guid) { _senderGUID = guid; }
+ ObjectGuid GetSenderGUID() const { return _senderGUID; }
void SetLocale(LocaleConstant locale) { _locale = locale; }
LocaleConstant GetLocale() const { return _locale; }
@@ -217,7 +218,7 @@ class GossipMenu
GossipMenuItemContainer _menuItems;
GossipMenuItemDataContainer _menuItemData;
uint32 _menuId;
- uint64 _senderGUID;
+ ObjectGuid _senderGUID;
LocaleConstant _locale;
};
@@ -267,22 +268,22 @@ class PlayerMenu
uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
- void SendGossipMenu(uint32 titleTextId, uint64 objectGUID);
+ void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID);
void SendCloseGossip();
void SendPointOfInterest(uint32 poiId) const;
/*********************************************************/
/*** QUEST SYSTEM ***/
/*********************************************************/
- void SendQuestGiverStatus(uint32 questStatus, uint64 npcGUID) const;
+ void SendQuestGiverStatus(uint32 questStatus, ObjectGuid npcGUID) const;
- void SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, uint64 npcGUID);
+ void SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, ObjectGuid npcGUID);
void SendQuestQueryResponse(Quest const* quest) const;
- void SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const;
+ void SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const;
- void SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const;
- void SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const;
+ void SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const;
+ void SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const;
static void AddQuestLevelToTitle(std::string &title, int32 level);
diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp
index b982de1289d..997b956d6a7 100644
--- a/src/server/game/Entities/Creature/TemporarySummon.cpp
+++ b/src/server/game/Entities/Creature/TemporarySummon.cpp
@@ -28,7 +28,9 @@ TempSummon::TempSummon(SummonPropertiesEntry const* properties, Unit* owner, boo
Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN),
m_timer(0), m_lifetime(0)
{
- m_summonerGUID = owner ? owner->GetGUID() : 0;
+ if (owner)
+ m_summonerGUID = owner->GetGUID();
+
m_unitTypeMask |= UNIT_MASK_SUMMON;
}
@@ -274,7 +276,7 @@ void TempSummon::RemoveFromWorld()
if (slot > 0)
if (Unit* owner = GetSummoner())
if (owner->m_SummonSlot[slot] == GetGUID())
- owner->m_SummonSlot[slot] = 0;
+ owner->m_SummonSlot[slot].Clear();
}
//if (GetOwnerGUID())
diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
index 58cc6eb7d0b..4780749899e 100644
--- a/src/server/game/Entities/Creature/TemporarySummon.h
+++ b/src/server/game/Entities/Creature/TemporarySummon.h
@@ -51,7 +51,7 @@ class TempSummon : public Creature
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) override { }
Unit* GetSummoner() const;
Creature* GetSummonerCreatureBase() const;
- uint64 GetSummonerGUID() const { return m_summonerGUID; }
+ ObjectGuid GetSummonerGUID() const { return m_summonerGUID; }
TempSummonType const& GetSummonType() { return m_type; }
uint32 GetTimer() { return m_timer; }
@@ -60,7 +60,7 @@ class TempSummon : public Creature
TempSummonType m_type;
uint32 m_timer;
uint32 m_lifetime;
- uint64 m_summonerGUID;
+ ObjectGuid m_summonerGUID;
};
class Minion : public TempSummon
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
index 00d555c5e9c..2a76bee793e 100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
@@ -94,7 +94,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, SpellInfo
SetEntry(spell->Id);
SetObjectScale(1);
- SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID());
+ SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetGUID());
SetUInt32Value(DYNAMICOBJECT_BYTES, spell->SpellVisual[0] | (type << 28));
SetUInt32Value(DYNAMICOBJECT_SPELLID, spell->Id);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h
index c185c669e7b..89d72bfe5a9 100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.h
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.h
@@ -55,7 +55,7 @@ class DynamicObject : public WorldObject, public GridObject<DynamicObject>, publ
void BindToCaster();
void UnbindFromCaster();
uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); }
- uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
+ ObjectGuid GetCasterGUID() const { return GetGuidValue(DYNAMICOBJECT_CASTER); }
float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
protected:
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index db69e1a5046..d134740d1cd 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -47,19 +47,16 @@ GameObject::GameObject() : WorldObject(false), MapObject(),
m_respawnTime = 0;
m_respawnDelayTime = 300;
m_lootState = GO_NOT_READY;
- m_lootStateUnitGUID = 0;
m_spawnedByDefault = true;
m_usetimes = 0;
m_spellId = 0;
m_cooldownTime = 0;
m_goInfo = NULL;
- m_ritualOwnerGUID = 0;
m_goData = NULL;
m_DBTableGuid = 0;
m_rotation = 0;
- m_lootRecipient = 0;
m_lootRecipientGroup = 0;
m_groupLootTimer = 0;
lootingGroupLowGUID = 0;
@@ -78,8 +75,7 @@ GameObject::~GameObject()
bool GameObject::AIM_Initialize()
{
- if (m_AI)
- delete m_AI;
+ delete m_AI;
m_AI = FactorySelector::SelectGameObjectAI(this);
@@ -108,7 +104,7 @@ void GameObject::CleanupsBeforeDelete(bool finalCleanup)
void GameObject::RemoveFromOwner()
{
- uint64 ownerGUID = GetOwnerGUID();
+ ObjectGuid ownerGUID = GetOwnerGUID();
if (!ownerGUID)
return;
@@ -119,15 +115,9 @@ void GameObject::RemoveFromOwner()
return;
}
- const char * ownerType = "creature";
- if (IS_PLAYER_GUID(ownerGUID))
- ownerType = "player";
- else if (IS_PET_GUID(ownerGUID))
- ownerType = "pet";
-
- TC_LOG_FATAL("misc", "Removed GameObject (GUID: %u Entry: %u SpellId: %u LinkedGO: %u) that just lost any reference to the owner (GUID: %u Type: '%s') GO list",
- GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(ownerGUID), ownerType);
- SetOwnerGUID(0);
+ TC_LOG_FATAL("misc", "Removed GameObject (GUID: %u Entry: %u SpellId: %u LinkedGO: %u) that just lost any reference to the owner (%s) GO list",
+ GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), ownerGUID.ToString().c_str());
+ SetOwnerGUID(ObjectGuid::Empty);
}
void GameObject::AddToWorld()
@@ -384,11 +374,11 @@ void GameObject::Update(uint32 diff)
time_t now = time(NULL);
if (m_respawnTime <= now) // timer expired
{
- uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_GAMEOBJECT);
+ ObjectGuid dbtableHighGuid(HIGHGUID_GAMEOBJECT, GetEntry(), m_DBTableGuid);
time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
if (linkedRespawntime) // Can't respawn, the master is dead
{
- uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
+ ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
SetRespawnTime(DAY);
else
@@ -593,7 +583,7 @@ void GameObject::Update(uint32 diff)
if (spellId)
{
- for (std::set<uint64>::const_iterator it = m_unique_users.begin(); it != m_unique_users.end(); ++it)
+ for (GuidSet::const_iterator it = m_unique_users.begin(); it != m_unique_users.end(); ++it)
// m_unique_users can contain only player GUIDs
if (Player* owner = ObjectAccessor::GetPlayer(*this, *it))
owner->CastSpell(owner, spellId, false);
@@ -990,14 +980,15 @@ bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const
return false;
// Always seen by owner and friendly units
- if (uint64 guid = GetOwnerGUID())
+ if (ObjectGuid guid = GetOwnerGUID())
{
if (seer->GetGUID() == guid)
return true;
Unit* owner = GetOwner();
- if (owner && seer->isType(TYPEMASK_UNIT) && owner->IsFriendlyTo(((Unit*)seer)))
- return true;
+ if (Unit const* unitSeer = seer->ToUnit())
+ if (owner && owner->IsFriendlyTo(unitSeer))
+ return true;
}
return false;
@@ -1248,9 +1239,9 @@ void GameObject::Use(Unit* user)
{
if (info->chair.slots > 0) // sometimes chairs in DB have error in fields and we dont know number of slots
for (uint32 i = 0; i < info->chair.slots; ++i)
- ChairListSlots[i] = 0; // Last user of current slot set to 0 (none sit here yet)
+ ChairListSlots[i].Clear(); // Last user of current slot set to 0 (none sit here yet)
else
- ChairListSlots[0] = 0; // error in DB, make one default slot
+ ChairListSlots[0].Clear(); // error in DB, make one default slot
}
Player* player = user->ToPlayer();
@@ -1283,10 +1274,10 @@ void GameObject::Use(Unit* user)
if (ChairUser->IsSitState() && ChairUser->getStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f)
continue; // This seat is already occupied by ChairUser. NOTE: Not sure if the ChairUser->getStandState() != UNIT_STAND_STATE_SIT check is required.
else
- itr->second = 0; // This seat is unoccupied.
+ itr->second.Clear(); // This seat is unoccupied.
}
else
- itr->second = 0; // The seat may of had an occupant, but they're offline.
+ itr->second.Clear(); // The seat may of had an occupant, but they're offline.
}
found_free_slot = true;
@@ -1566,7 +1557,7 @@ void GameObject::Use(Unit* user)
else
{
// reset ritual for this GO
- m_ritualOwnerGUID = 0;
+ m_ritualOwnerGUID.Clear();
m_unique_users.clear();
m_usetimes = 0;
}
@@ -1807,7 +1798,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId, bool triggered /*= true
trigger->setFaction(14);
// Set owner guid for target if no owner available - needed by trigger auras
// - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell())
- trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, target ? target->GetGUID() : 0);
+ trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, target ? target->GetGUID() : ObjectGuid::Empty);
}
}
@@ -1930,9 +1921,9 @@ void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, u
if (player)
{
WorldPacket data(SMSG_DESTRUCTIBLE_BUILDING_DAMAGE, 8 + 8 + 8 + 4 + 4);
- data.appendPackGUID(GetGUID());
- data.appendPackGUID(attackerOrHealer->GetGUID());
- data.appendPackGUID(player->GetGUID());
+ data << GetPackGUID();
+ data << attackerOrHealer->GetPackGUID();
+ data << player->GetPackGUID();
data << uint32(-change); // change < 0 triggers SPELL_BUILDING_HEAL combat log event
// change >= 0 triggers SPELL_BUILDING_DAMAGE event
data << uint32(spellId);
@@ -2048,7 +2039,11 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
void GameObject::SetLootState(LootState state, Unit* unit)
{
m_lootState = state;
- m_lootStateUnitGUID = unit ? unit->GetGUID() : 0;
+ if (unit)
+ m_lootStateUnitGUID = unit->GetGUID();
+ else
+ m_lootStateUnitGUID.Clear();
+
AI()->OnStateChanged(state, unit);
sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
@@ -2143,7 +2138,7 @@ void GameObject::SetLootRecipient(Unit* unit)
if (!unit)
{
- m_lootRecipient = 0;
+ m_lootRecipient.Clear();
m_lootRecipientGroup = 0;
return;
}
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 89157d07f7c..4d945b54e6b 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -667,7 +667,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
bool LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap = true);
void DeleteFromDB();
- void SetOwnerGUID(uint64 owner)
+ void SetOwnerGUID(ObjectGuid owner)
{
// Owner already found and different than expected owner - remove object from old owner
if (owner && GetOwnerGUID() && GetOwnerGUID() != owner)
@@ -675,9 +675,9 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
ASSERT(false);
}
m_spawnedByDefault = false; // all object with owner is despawned after delay
- SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
+ SetGuidValue(OBJECT_FIELD_CREATED_BY, owner);
}
- uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); }
+ ObjectGuid GetOwnerGUID() const { return GetGuidValue(OBJECT_FIELD_CREATED_BY); }
Unit* GetOwner() const;
void SetSpellId(uint32 id)
@@ -767,7 +767,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
Group* GetLootRecipientGroup() const;
void SetLootRecipient(Unit* unit);
bool IsLootAllowedFor(Player const* player) const;
- bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
+ bool HasLootRecipient() const { return !m_lootRecipient.IsEmpty() || m_lootRecipientGroup; }
uint32 m_groupLootTimer; // (msecs)timer used for group loot
uint32 lootingGroupLowGUID; // used to find group which is looting
@@ -846,17 +846,17 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer
LootState m_lootState;
- uint64 m_lootStateUnitGUID; // GUID of the unit passed with SetLootState(LootState, Unit*)
+ ObjectGuid m_lootStateUnitGUID; // GUID of the unit passed with SetLootState(LootState, Unit*)
bool m_spawnedByDefault;
time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
// For traps this: spell casting cooldown, for doors/buttons: reset time.
std::list<uint32> m_SkillupList;
- uint64 m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
- std::set<uint64> m_unique_users;
+ ObjectGuid m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
+ GuidSet m_unique_users;
uint32 m_usetimes;
- typedef std::map<uint32, uint64> ChairSlotAndUser;
+ typedef std::map<uint32, ObjectGuid> ChairSlotAndUser;
ChairSlotAndUser ChairListSlots;
uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid
@@ -867,7 +867,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
uint64 m_rotation;
Position m_stationaryPosition;
- uint64 m_lootRecipient;
+ ObjectGuid m_lootRecipient;
uint32 m_lootRecipientGroup;
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
private:
diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp
index 39f2c59fc29..3595f6fd9f6 100644
--- a/src/server/game/Entities/Item/Container/Bag.cpp
+++ b/src/server/game/Entities/Item/Container/Bag.cpp
@@ -81,8 +81,11 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
SetEntry(itemid);
SetObjectScale(1.0f);
- SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
- SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
+ if (owner)
+ {
+ SetGuidValue(ITEM_FIELD_OWNER, owner->GetGUID());
+ SetGuidValue(ITEM_FIELD_CONTAINED, owner->GetGUID());
+ }
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability);
SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability);
@@ -94,7 +97,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
// Cleaning 20 slots
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
- SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
+ SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i*2), ObjectGuid::Empty);
m_bagslot[i] = NULL;
}
@@ -106,7 +109,7 @@ void Bag::SaveToDB(SQLTransaction& trans)
Item::SaveToDB(trans);
}
-bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry)
+bool Bag::LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry)
{
if (!Item::LoadFromDB(guid, owner_guid, fields, entry))
return false;
@@ -116,7 +119,7 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
- SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
+ SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i * 2), ObjectGuid::Empty);
delete m_bagslot[i];
m_bagslot[i] = NULL;
}
@@ -151,7 +154,7 @@ void Bag::RemoveItem(uint8 slot, bool /*update*/)
m_bagslot[slot]->SetContainer(NULL);
m_bagslot[slot] = NULL;
- SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), 0);
+ SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), ObjectGuid::Empty);
}
void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/)
@@ -161,9 +164,9 @@ void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/)
if (pItem && pItem->GetGUID() != this->GetGUID())
{
m_bagslot[slot] = pItem;
- SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID());
- pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID());
- pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetOwnerGUID());
+ SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID());
+ pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetGUID());
+ pItem->SetGuidValue(ITEM_FIELD_OWNER, GetOwnerGUID());
pItem->SetContainer(this);
pItem->SetSlot(slot);
}
@@ -225,7 +228,7 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem)
return count;
}
-uint8 Bag::GetSlotByItemGUID(uint64 guid) const
+uint8 Bag::GetSlotByItemGUID(ObjectGuid guid) const
{
for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i] != 0)
diff --git a/src/server/game/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h
index db0c8edf556..65807628067 100644
--- a/src/server/game/Entities/Item/Container/Bag.h
+++ b/src/server/game/Entities/Item/Container/Bag.h
@@ -45,7 +45,7 @@ class Bag : public Item
uint32 GetItemCount(uint32 item, Item* eItem = NULL) const;
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const;
- uint8 GetSlotByItemGUID(uint64 guid) const;
+ uint8 GetSlotByItemGUID(ObjectGuid guid) const;
bool IsEmpty() const;
uint32 GetFreeSlots() const;
uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
@@ -54,7 +54,7 @@ class Bag : public Item
// overwrite virtual Item::SaveToDB
void SaveToDB(SQLTransaction& trans) override;
// overwrite virtual Item::LoadFromDB
- bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry) override;
+ bool LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry) override;
// overwrite virtual Item::DeleteFromDB
void DeleteFromDB(SQLTransaction& trans) override;
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 581678824b2..db257835f23 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -267,8 +267,11 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
SetEntry(itemid);
SetObjectScale(1.0f);
- SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
- SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
+ if (owner)
+ {
+ SetGuidValue(ITEM_FIELD_OWNER, owner->GetGUID());
+ SetGuidValue(ITEM_FIELD_CONTAINED, owner->GetGUID());
+ }
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemid);
if (!itemProto)
@@ -328,9 +331,9 @@ void Item::SaveToDB(SQLTransaction& trans)
uint8 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(uState == ITEM_NEW ? CHAR_REP_ITEM_INSTANCE : CHAR_UPD_ITEM_INSTANCE);
stmt->setUInt32( index, GetEntry());
- stmt->setUInt32(++index, GUID_LOPART(GetOwnerGUID()));
- stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_CREATOR)));
- stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_GIFTCREATOR)));
+ stmt->setUInt32(++index, GetOwnerGUID().GetCounter());
+ stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_CREATOR).GetCounter());
+ stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_GIFTCREATOR).GetCounter());
stmt->setUInt32(++index, GetCount());
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURATION));
@@ -361,7 +364,7 @@ void Item::SaveToDB(SQLTransaction& trans)
if ((uState == ITEM_CHANGED) && HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER);
- stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID()));
+ stmt->setUInt32(0, GetOwnerGUID().GetCounter());
stmt->setUInt32(1, guid);
trans->Append(stmt);
}
@@ -400,7 +403,7 @@ void Item::SaveToDB(SQLTransaction& trans)
CharacterDatabase.CommitTransaction(trans);
}
-bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry)
+bool Item::LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry)
{
// 0 1 2 3 4 5 6 7 8 9 10
//result = CharacterDatabase.PQuery("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text FROM item_instance WHERE guid = '%u'", guid);
@@ -418,12 +421,12 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
return false;
// set owner (not if item is only loaded for gbank/auction/mail
- if (owner_guid != 0)
+ if (owner_guid)
SetOwnerGUID(owner_guid);
bool need_save = false; // need explicit save data at load fixes
- SetUInt64Value(ITEM_FIELD_CREATOR, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
- SetUInt64Value(ITEM_FIELD_GIFTCREATOR, MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER));
+ SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()));
+ SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32()));
SetCount(fields[2].GetUInt32());
uint32 duration = fields[3].GetUInt32();
@@ -658,7 +661,7 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
if (forplayer)
{
RemoveFromUpdateQueueOf(forplayer);
- forplayer->DeleteRefundReference(GetGUIDLow());
+ forplayer->DeleteRefundReference(GetGUID());
}
delete this;
return;
@@ -690,7 +693,8 @@ void Item::AddToUpdateQueueOf(Player* player)
if (player->GetGUID() != GetOwnerGUID())
{
- TC_LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow());
+ TC_LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!",
+ GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
return;
}
@@ -710,7 +714,8 @@ void Item::RemoveFromUpdateQueueOf(Player* player)
if (player->GetGUID() != GetOwnerGUID())
{
- TC_LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow());
+ TC_LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!",
+ GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
return;
}
@@ -862,7 +867,7 @@ bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const
return true;
}
-void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster /*= 0*/)
+void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster /*= ObjectGuid::Empty*/)
{
// Better lost small time at check in comparison lost time at item save to DB.
if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
@@ -872,7 +877,7 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint
if (slot < MAX_INSPECTED_ENCHANTMENT_SLOT)
{
if (uint32 oldEnchant = GetEnchantmentId(slot))
- owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), 0, GetEntry(), oldEnchant);
+ owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), ObjectGuid::Empty, GetEntry(), oldEnchant);
if (id)
owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), caster, GetEntry(), id);
@@ -1056,8 +1061,8 @@ Item* Item::CloneItem(uint32 count, Player const* player) const
if (!newItem)
return NULL;
- newItem->SetUInt32Value(ITEM_FIELD_CREATOR, GetUInt32Value(ITEM_FIELD_CREATOR));
- newItem->SetUInt32Value(ITEM_FIELD_GIFTCREATOR, GetUInt32Value(ITEM_FIELD_GIFTCREATOR));
+ newItem->SetGuidValue(ITEM_FIELD_CREATOR, GetGuidValue(ITEM_FIELD_CREATOR));
+ newItem->SetGuidValue(ITEM_FIELD_GIFTCREATOR, GetGuidValue(ITEM_FIELD_GIFTCREATOR));
newItem->SetUInt32Value(ITEM_FIELD_FLAGS, GetUInt32Value(ITEM_FIELD_FLAGS) & ~(ITEM_FLAG_REFUNDABLE | ITEM_FLAG_BOP_TRADEABLE));
newItem->SetUInt32Value(ITEM_FIELD_DURATION, GetUInt32Value(ITEM_FIELD_DURATION));
// player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
@@ -1138,7 +1143,7 @@ void Item::SetNotRefundable(Player* owner, bool changestate /*=true*/, SQLTransa
SetPaidExtendedCost(0);
DeleteRefundDataFromDB(trans);
- owner->DeleteRefundReference(GetGUIDLow());
+ owner->DeleteRefundReference(GetGUID());
}
void Item::UpdatePlayedTime(Player* owner)
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index 25472ff83ee..dbcf023b842 100644
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -224,8 +224,8 @@ class Item : public Object
ItemTemplate const* GetTemplate() const;
- uint64 GetOwnerGUID() const { return GetUInt64Value(ITEM_FIELD_OWNER); }
- void SetOwnerGUID(uint64 guid) { SetUInt64Value(ITEM_FIELD_OWNER, guid); }
+ ObjectGuid GetOwnerGUID() const { return GetGuidValue(ITEM_FIELD_OWNER); }
+ void SetOwnerGUID(ObjectGuid guid) { SetGuidValue(ITEM_FIELD_OWNER, guid); }
Player* GetOwner()const;
void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND, val); }
@@ -235,7 +235,7 @@ class Item : public Object
bool IsBindedNotWith(Player const* player) const;
bool IsBoundByEnchant() const;
virtual void SaveToDB(SQLTransaction& trans);
- virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry);
+ virtual bool LoadFromDB(uint32 guid, ObjectGuid owner_guid, Field* fields, uint32 entry);
static void DeleteFromDB(SQLTransaction& trans, uint32 itemGuid);
virtual void DeleteFromDB(SQLTransaction& trans);
static void DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid);
@@ -296,7 +296,7 @@ class Item : public Object
void SetItemRandomProperties(int32 randomPropId);
void UpdateItemSuffixFactor();
static int32 GenerateItemRandomPropertyId(uint32 item_id);
- void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster = 0);
+ void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster = ObjectGuid::Empty);
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner);
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges);
void ClearEnchantment(EnchantmentSlot slot);
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 85af475de42..95d4be25630 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -53,25 +53,6 @@
#include "Battleground.h"
#include "Chat.h"
-uint32 GuidHigh2TypeId(uint32 guid_hi)
-{
- switch (guid_hi)
- {
- case HIGHGUID_ITEM: return TYPEID_ITEM;
- //case HIGHGUID_CONTAINER: return TYPEID_CONTAINER; HIGHGUID_CONTAINER == HIGHGUID_ITEM currently
- case HIGHGUID_UNIT: return TYPEID_UNIT;
- case HIGHGUID_PET: return TYPEID_UNIT;
- case HIGHGUID_PLAYER: return TYPEID_PLAYER;
- case HIGHGUID_GAMEOBJECT: return TYPEID_GAMEOBJECT;
- case HIGHGUID_DYNAMICOBJECT:return TYPEID_DYNAMICOBJECT;
- case HIGHGUID_CORPSE: return TYPEID_CORPSE;
- case HIGHGUID_AREATRIGGER: return TYPEID_AREATRIGGER;
- case HIGHGUID_MO_TRANSPORT: return TYPEID_GAMEOBJECT;
- case HIGHGUID_VEHICLE: return TYPEID_UNIT;
- }
- return NUM_CLIENT_OBJECT_TYPES; // unknown
-}
-
Object::Object() : m_PackGUID(sizeof(uint64)+1)
{
m_objectTypeId = TYPEID_OBJECT;
@@ -84,8 +65,6 @@ Object::Object() : m_PackGUID(sizeof(uint64)+1)
m_inWorld = false;
m_objectUpdated = false;
-
- m_PackGUID.appendPackGUID(0);
}
WorldObject::~WorldObject()
@@ -95,8 +74,8 @@ WorldObject::~WorldObject()
{
if (GetTypeId() == TYPEID_CORPSE)
{
- TC_LOG_FATAL("misc", "Object::~Object Corpse guid=" UI64FMTD ", type=%d, entry=%u deleted but still in map!!",
- GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
+ TC_LOG_FATAL("misc", "WorldObject::~WorldObject Corpse Type: %d (%s) deleted but still in map!!",
+ ToCorpse()->GetType(), GetGUID().ToString().c_str());
ASSERT(false);
}
ResetMap();
@@ -107,7 +86,7 @@ Object::~Object()
{
if (IsInWorld())
{
- TC_LOG_FATAL("misc", "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry());
+ TC_LOG_FATAL("misc", "Object::~Object %s deleted but still in world!!", GetGUID().ToString().c_str());
if (isType(TYPEMASK_ITEM))
TC_LOG_FATAL("misc", "Item slot %u", ((Item*)this)->GetSlot());
ASSERT(false);
@@ -116,7 +95,7 @@ Object::~Object()
if (m_objectUpdated)
{
- TC_LOG_FATAL("misc", "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
+ TC_LOG_FATAL("misc", "Object::~Object %s deleted but still in update list!!", GetGUID().ToString().c_str());
ASSERT(false);
sObjectAccessor->RemoveUpdateObject(this);
}
@@ -139,11 +118,10 @@ void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
{
if (!m_uint32Values) _InitValues();
- uint64 guid = MAKE_NEW_GUID(guidlow, entry, guidhigh);
- SetUInt64Value(OBJECT_FIELD_GUID, guid);
+ ObjectGuid guid(guidhigh, entry, guidlow);
+ SetGuidValue(OBJECT_FIELD_GUID, guid);
SetUInt16Value(OBJECT_FIELD_TYPE, 0, m_objectType);
- m_PackGUID.clear();
- m_PackGUID.appendPackGUID(GetGUID());
+ m_PackGUID.Set(guid);
}
std::string Object::_ConcatFields(uint16 startIndex, uint16 size) const
@@ -203,14 +181,14 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
case HIGHGUID_VEHICLE:
{
if (TempSummon const* summon = ToUnit()->ToTempSummon())
- if (IS_PLAYER_GUID(summon->GetSummonerGUID()))
+ if (summon->GetSummonerGUID().IsPlayer())
updateType = UPDATETYPE_CREATE_OBJECT2;
break;
}
case HIGHGUID_GAMEOBJECT:
{
- if (IS_PLAYER_GUID(ToGameObject()->GetOwnerGUID()))
+ if (ToGameObject()->GetOwnerGUID().IsPlayer())
updateType = UPDATETYPE_CREATE_OBJECT2;
break;
}
@@ -248,7 +226,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
ByteBuffer buf(500);
buf << uint8(updateType);
- buf.append(GetPackGUID());
+ buf << GetPackGUID();
buf << uint8(m_objectTypeId);
BuildMovementUpdate(&buf, flags);
@@ -272,7 +250,7 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) c
ByteBuffer buf(500);
buf << uint8(UPDATETYPE_VALUES);
- buf.append(GetPackGUID());
+ buf << GetPackGUID();
BuildValuesUpdate(UPDATETYPE_VALUES, &buf, target);
@@ -347,6 +325,12 @@ uint16 Object::GetUInt16Value(uint16 index, uint8 offset) const
return *(((uint16*)&m_uint32Values[index])+offset);
}
+ObjectGuid Object::GetGuidValue(uint16 index) const
+{
+ ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, false));
+ return *((ObjectGuid*)&(m_uint32Values[index]));
+}
+
void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
{
Unit const* self = NULL;
@@ -861,13 +845,12 @@ void Object::SetUInt64Value(uint16 index, uint64 value)
}
}
-bool Object::AddUInt64Value(uint16 index, uint64 value)
+bool Object::AddGuidValue(uint16 index, ObjectGuid value)
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
- if (value && !*((uint64*)&(m_uint32Values[index])))
+ if (value && !*((ObjectGuid*)&(m_uint32Values[index])))
{
- m_uint32Values[index] = PAIR64_LOPART(value);
- m_uint32Values[index + 1] = PAIR64_HIPART(value);
+ *((ObjectGuid*)&(m_uint32Values[index])) = value;
_changesMask.SetBit(index);
_changesMask.SetBit(index + 1);
@@ -883,10 +866,10 @@ bool Object::AddUInt64Value(uint16 index, uint64 value)
return false;
}
-bool Object::RemoveUInt64Value(uint16 index, uint64 value)
+bool Object::RemoveGuidValue(uint16 index, ObjectGuid value)
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
- if (value && *((uint64*)&(m_uint32Values[index])) == value)
+ if (value && *((ObjectGuid*)&(m_uint32Values[index])) == value)
{
m_uint32Values[index] = 0;
m_uint32Values[index + 1] = 0;
@@ -970,6 +953,23 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value)
}
}
+void Object::SetGuidValue(uint16 index, ObjectGuid value)
+{
+ ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
+ if (*((ObjectGuid*)&(m_uint32Values[index])) != value)
+ {
+ *((ObjectGuid*)&(m_uint32Values[index])) = value;
+ _changesMask.SetBit(index);
+ _changesMask.SetBit(index + 1);
+
+ if (m_inWorld && !m_objectUpdated)
+ {
+ sObjectAccessor->AddUpdateObject(this);
+ m_objectUpdated = true;
+ }
+ }
+}
+
void Object::SetStatFloatValue(uint16 index, float value)
{
if (value < 0)
@@ -1246,7 +1246,7 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st
void MovementInfo::OutDebug()
{
TC_LOG_INFO("misc", "MOVEMENT INFO");
- TC_LOG_INFO("misc", "guid " UI64FMTD, guid);
+ TC_LOG_INFO("misc", "%s", guid.ToString().c_str());
TC_LOG_INFO("misc", "flags %s (%u)", Movement::MovementFlags_ToString(flags).c_str(), flags);
TC_LOG_INFO("misc", "flags2 %s (%u)", Movement::MovementFlagsExtra_ToString(flags2).c_str(), flags2);
TC_LOG_INFO("misc", "time %u current time %u", time, getMSTime());
@@ -1254,7 +1254,7 @@ void MovementInfo::OutDebug()
if (transport.guid)
{
TC_LOG_INFO("misc", "TRANSPORT:");
- TC_LOG_INFO("misc", "guid: " UI64FMTD, transport.guid);
+ TC_LOG_INFO("misc", "%s", transport.guid.ToString().c_str());
TC_LOG_INFO("misc", "position: `%s`", transport.pos.ToString().c_str());
TC_LOG_INFO("misc", "seat: %i", transport.seat);
TC_LOG_INFO("misc", "time: %u", transport.time);
@@ -2079,7 +2079,7 @@ void WorldObject::SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr
VisitNearbyWorldObject(GetVisibilityRange(), notifier);
}
-void WorldObject::SendObjectDeSpawnAnim(uint64 guid)
+void WorldObject::SendObjectDeSpawnAnim(ObjectGuid guid)
{
WorldPacket data(SMSG_GAMEOBJECT_DESPAWN_ANIM, 8);
data << uint64(guid);
@@ -2811,7 +2811,7 @@ struct WorldObjectChangeAccumulator
{
UpdateDataMapType& i_updateDatas;
WorldObject& i_object;
- std::set<uint64> plr_list;
+ GuidSet plr_list;
WorldObjectChangeAccumulator(WorldObject &obj, UpdateDataMapType &d) : i_updateDatas(d), i_object(obj) { }
void Visit(PlayerMapType &m)
{
@@ -2852,13 +2852,13 @@ struct WorldObjectChangeAccumulator
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
source = iter->GetSource();
- uint64 guid = source->GetCasterGUID();
+ ObjectGuid guid = source->GetCasterGUID();
- if (IS_PLAYER_GUID(guid))
+ if (guid.IsPlayer())
{
//Caster may be NULL if DynObj is in removelist
if (Player* caster = ObjectAccessor::FindPlayer(guid))
- if (caster->GetUInt64Value(PLAYER_FARSIGHT) == source->GetGUID())
+ if (caster->GetGuidValue(PLAYER_FARSIGHT) == source->GetGUID())
BuildPacket(caster);
}
}
@@ -2891,9 +2891,9 @@ void WorldObject::BuildUpdate(UpdateDataMapType& data_map)
ClearUpdateMask(false);
}
-uint64 WorldObject::GetTransGUID() const
+ObjectGuid WorldObject::GetTransGUID() const
{
if (GetTransport())
return GetTransport()->GetGUID();
- return 0;
+ return ObjectGuid::Empty;
}
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 01d7b6b000f..b8410ec307c 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -46,37 +46,6 @@
#define NOMINAL_MELEE_RANGE 5.0f
#define MELEE_RANGE (NOMINAL_MELEE_RANGE - MIN_MELEE_REACH * 2) //center to center for players
-enum TypeMask
-{
- TYPEMASK_OBJECT = 0x0001,
- TYPEMASK_ITEM = 0x0002,
- TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004
- TYPEMASK_UNIT = 0x0008, // creature
- TYPEMASK_PLAYER = 0x0010,
- TYPEMASK_GAMEOBJECT = 0x0020,
- TYPEMASK_DYNAMICOBJECT = 0x0040,
- TYPEMASK_CORPSE = 0x0080,
- TYPEMASK_AREATRIGGER = 0x0100,
- TYPEMASK_SEER = TYPEMASK_PLAYER | TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT
-};
-
-enum TypeID
-{
- TYPEID_OBJECT = 0,
- TYPEID_ITEM = 1,
- TYPEID_CONTAINER = 2,
- TYPEID_UNIT = 3,
- TYPEID_PLAYER = 4,
- TYPEID_GAMEOBJECT = 5,
- TYPEID_DYNAMICOBJECT = 6,
- TYPEID_CORPSE = 7,
- TYPEID_AREATRIGGER = 8
-};
-
-#define NUM_CLIENT_OBJECT_TYPES 9
-
-uint32 GuidHigh2TypeId(uint32 guid_hi);
-
enum TempSummonType
{
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN = 1, // despawns after a specified time OR when the creature disappears
@@ -120,62 +89,6 @@ class ZoneScript;
typedef std::unordered_map<Player*, UpdateData> UpdateDataMapType;
-//! Structure to ease conversions from single 64 bit integer guid into individual bytes, for packet sending purposes
-//! Nuke this out when porting ObjectGuid from MaNGOS, but preserve the per-byte storage
-struct ObjectGuid
-{
- public:
- ObjectGuid() { _data.u64 = UI64LIT(0); }
- ObjectGuid(uint64 guid) { _data.u64 = guid; }
- ObjectGuid(ObjectGuid const& other) { _data.u64 = other._data.u64; }
-
- uint8& operator[](uint32 index)
- {
- ASSERT(index < sizeof(uint64));
-
-#if TRINITY_ENDIAN == TRINITY_LITTLEENDIAN
- return _data.byte[index];
-#else
- return _data.byte[7 - index];
-#endif
- }
-
- uint8 const& operator[](uint32 index) const
- {
- ASSERT(index < sizeof(uint64));
-
-#if TRINITY_ENDIAN == TRINITY_LITTLEENDIAN
- return _data.byte[index];
-#else
- return _data.byte[7 - index];
-#endif
- }
-
- operator uint64()
- {
- return _data.u64;
- }
-
- ObjectGuid& operator=(uint64 guid)
- {
- _data.u64 = guid;
- return *this;
- }
-
- ObjectGuid& operator=(ObjectGuid const& other)
- {
- _data.u64 = other._data.u64;
- return *this;
- }
-
- private:
- union
- {
- uint64 u64;
- uint8 byte[8];
- } _data;
-};
-
class Object
{
public:
@@ -186,11 +99,11 @@ class Object
virtual void AddToWorld();
virtual void RemoveFromWorld();
- uint64 GetGUID() const { return GetUInt64Value(0); }
- uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(0)); }
- uint32 GetGUIDMid() const { return GUID_ENPART(GetUInt64Value(0)); }
- uint32 GetGUIDHigh() const { return GUID_HIPART(GetUInt64Value(0)); }
- const ByteBuffer& GetPackGUID() const { return m_PackGUID; }
+ ObjectGuid GetGUID() const { return GetGuidValue(OBJECT_FIELD_GUID); }
+ uint32 GetGUIDLow() const { return GetGuidValue(OBJECT_FIELD_GUID).GetCounter(); }
+ uint32 GetGUIDMid() const { return GetGuidValue(OBJECT_FIELD_GUID).GetEntry(); }
+ uint32 GetGUIDHigh() const { return GetGuidValue(OBJECT_FIELD_GUID).GetHigh(); }
+ PackedGuid const& GetPackGUID() const { return m_PackGUID; }
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
@@ -214,6 +127,7 @@ class Object
float GetFloatValue(uint16 index) const;
uint8 GetByteValue(uint16 index, uint8 offset) const;
uint16 GetUInt16Value(uint16 index, uint8 offset) const;
+ ObjectGuid GetGuidValue(uint16 index) const;
void SetInt32Value(uint16 index, int32 value);
void SetUInt32Value(uint16 index, uint32 value);
@@ -223,11 +137,12 @@ class Object
void SetByteValue(uint16 index, uint8 offset, uint8 value);
void SetUInt16Value(uint16 index, uint8 offset, uint16 value);
void SetInt16Value(uint16 index, uint8 offset, int16 value) { SetUInt16Value(index, offset, (uint16)value); }
+ void SetGuidValue(uint16 index, ObjectGuid value);
void SetStatFloatValue(uint16 index, float value);
void SetStatInt32Value(uint16 index, int32 value);
- bool AddUInt64Value(uint16 index, uint64 value);
- bool RemoveUInt64Value(uint16 index, uint64 value);
+ bool AddGuidValue(uint16 index, ObjectGuid value);
+ bool RemoveGuidValue(uint16 index, ObjectGuid value);
void ApplyModUInt32Value(uint16 index, int32 val, bool apply);
void ApplyModInt32Value(uint16 index, int32 val, bool apply);
@@ -325,7 +240,7 @@ class Object
private:
bool m_inWorld;
- ByteBuffer m_PackGUID;
+ PackedGuid m_PackGUID;
// for output helpfull error messages from asserts
bool PrintIndexError(uint32 index, bool set) const;
@@ -470,7 +385,7 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st
struct MovementInfo
{
// common
- uint64 guid;
+ ObjectGuid guid;
uint32 flags;
uint16 flags2;
Position pos;
@@ -481,7 +396,7 @@ struct MovementInfo
{
void Reset()
{
- guid = 0;
+ guid.Clear();
pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
seat = -1;
time = 0;
@@ -489,7 +404,7 @@ struct MovementInfo
time3 = 0;
}
- uint64 guid;
+ ObjectGuid guid;
Position pos;
int8 seat;
uint32 time;
@@ -519,7 +434,7 @@ struct MovementInfo
float splineElevation;
MovementInfo() :
- guid(0), flags(0), flags2(0), time(0), pitch(0.0f), splineElevation(0.0f)
+ flags(0), flags2(0), time(0), pitch(0.0f), splineElevation(0.0f)
{
pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
transport.Reset();
@@ -734,7 +649,7 @@ class WorldObject : public Object, public WorldLocation
void PlayDistanceSound(uint32 sound_id, Player* target = NULL);
void PlayDirectSound(uint32 sound_id, Player* target = NULL);
- void SendObjectDeSpawnAnim(uint64 guid);
+ void SendObjectDeSpawnAnim(ObjectGuid guid);
virtual void SaveRespawnTime() { }
void AddObjectToRemoveList();
@@ -818,7 +733,7 @@ class WorldObject : public Object, public WorldLocation
float GetTransOffsetO() const { return m_movementInfo.transport.pos.GetOrientation(); }
uint32 GetTransTime() const { return m_movementInfo.transport.time; }
int8 GetTransSeat() const { return m_movementInfo.transport.seat; }
- virtual uint64 GetTransGUID() const;
+ virtual ObjectGuid GetTransGUID() const;
void SetTransport(Transport* t) { m_transport = t; }
MovementInfo m_movementInfo;
diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h
index 03a4f80bf60..3b7709bc1f1 100644
--- a/src/server/game/Entities/Object/ObjectDefines.h
+++ b/src/server/game/Entities/Object/ObjectDefines.h
@@ -20,25 +20,7 @@
#define TRINITY_OBJECTDEFINES_H
#include "Define.h"
-
-enum HighGuid
-{
- HIGHGUID_ITEM = 0x400, // blizz 4000
- HIGHGUID_CONTAINER = 0x400, // blizz 4000
- HIGHGUID_PLAYER = 0x000, // blizz 0000
- HIGHGUID_GAMEOBJECT = 0xF11, // blizz F110
- HIGHGUID_TRANSPORT = 0xF12, // blizz F120 (for GAMEOBJECT_TYPE_TRANSPORT)
- HIGHGUID_UNIT = 0xF13, // blizz F130
- HIGHGUID_PET = 0xF14, // blizz F140
- HIGHGUID_VEHICLE = 0xF15, // blizz F550
- HIGHGUID_DYNAMICOBJECT = 0xF10, // blizz F100
- HIGHGUID_CORPSE = 0xF101, // blizz F100
- HIGHGUID_AREATRIGGER = 0xF102, // blizz F100
- HIGHGUID_BATTLEGROUND = 0x1F1, // new 4.x
- HIGHGUID_MO_TRANSPORT = 0x1FC, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT)
- HIGHGUID_GROUP = 0x1F5,
- HIGHGUID_GUILD = 0x1FF // new 4.x
-};
+#include "ObjectGuid.h"
// used for creating values for respawn for example
inline uint64 MAKE_PAIR64(uint32 l, uint32 h);
@@ -49,37 +31,6 @@ inline uint32 MAKE_PAIR32(uint16 l, uint16 h);
inline uint16 PAIR32_HIPART(uint32 x);
inline uint16 PAIR32_LOPART(uint32 x);
-inline bool IS_EMPTY_GUID(uint64 guid);
-inline bool IS_CREATURE_GUID(uint64 guid);
-inline bool IS_PET_GUID(uint64 guid);
-inline bool IS_VEHICLE_GUID(uint64 guid);
-inline bool IS_CRE_OR_VEH_GUID(uint64 guid);
-inline bool IS_CRE_OR_VEH_OR_PET_GUID(uint64 guid);
-inline bool IS_PLAYER_GUID(uint64 guid);
-inline bool IS_GUILD_GUID(uint64 guid);
-inline bool IS_UNIT_GUID(uint64 guid);
-inline bool IS_ITEM_GUID(uint64 guid);
-inline bool IS_GAMEOBJECT_GUID(uint64 guid);
-inline bool IS_DYNAMICOBJECT_GUID(uint64 guid);
-inline bool IS_CORPSE_GUID(uint64 guid);
-inline bool IS_TRANSPORT_GUID(uint64 guid);
-inline bool IS_MO_TRANSPORT_GUID(uint64 guid);
-inline bool IS_GROUP_GUID(uint64 guid);
-inline bool IS_AREATRIGGER_GUID(uint64 guid);
-
-// l - OBJECT_FIELD_GUID
-// e - OBJECT_FIELD_ENTRY for GO (except GAMEOBJECT_TYPE_MO_TRANSPORT) and creatures or UNIT_FIELD_PETNUMBER for pets
-// h - OBJECT_FIELD_GUID + 1
-inline uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h);
-
-//#define GUID_HIPART(x) (uint32)((uint64(x) >> 52)) & 0x0000FFFF)
-inline uint32 GUID_HIPART(uint64 guid);
-inline uint32 GUID_ENPART(uint64 x);
-inline uint32 GUID_LOPART(uint64 x);
-
-inline bool IsGuidHaveEnPart(uint64 guid);
-inline char const* GetLogNameForGuid(uint64 guid);
-
uint64 MAKE_PAIR64(uint32 l, uint32 h)
{
return uint64(l | (uint64(h) << 32));
@@ -115,158 +66,4 @@ uint16 PAIR32_LOPART(uint32 x)
return (uint16)(x & 0x0000FFFF);
}
-bool IS_EMPTY_GUID(uint64 guid)
-{
- return guid == 0;
-}
-
-bool IS_CREATURE_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_UNIT;
-}
-
-bool IS_PET_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_PET;
-}
-
-bool IS_VEHICLE_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_VEHICLE;
-}
-
-bool IS_CRE_OR_VEH_GUID(uint64 guid)
-{
- return IS_CREATURE_GUID(guid) || IS_VEHICLE_GUID(guid);
-}
-
-bool IS_CRE_OR_VEH_OR_PET_GUID(uint64 guid)
-{
- return IS_CRE_OR_VEH_GUID(guid) || IS_PET_GUID(guid);
-}
-
-bool IS_PLAYER_GUID(uint64 guid)
-{
- return guid != 0 && GUID_HIPART(guid) == HIGHGUID_PLAYER;
-}
-
-bool IS_GUILD_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_GUILD;
-}
-
-bool IS_UNIT_GUID(uint64 guid)
-{
- return IS_CRE_OR_VEH_OR_PET_GUID(guid) || IS_PLAYER_GUID(guid);
-}
-
-bool IS_ITEM_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_ITEM;
-}
-
-bool IS_GAMEOBJECT_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_GAMEOBJECT;
-}
-
-bool IS_DYNAMICOBJECT_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_DYNAMICOBJECT;
-}
-
-bool IS_CORPSE_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_CORPSE;
-}
-
-bool IS_TRANSPORT_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_TRANSPORT;
-}
-
-bool IS_MO_TRANSPORT_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_MO_TRANSPORT;
-}
-
-bool IS_GROUP_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_GROUP;
-}
-
-bool IS_AREATRIGGER_GUID(uint64 guid)
-{
- return GUID_HIPART(guid) == HIGHGUID_AREATRIGGER;
-}
-
-uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h)
-{
- return uint64(uint64(l) | (uint64(e) << 32) | (uint64(h) << ((h == HIGHGUID_CORPSE || h == HIGHGUID_AREATRIGGER) ? 48 : 52)));
-}
-
-uint32 GUID_HIPART(uint64 guid)
-{
- uint32 t = ((uint64(guid) >> 48) & 0x0000FFFF);
- return (t == HIGHGUID_CORPSE || t == HIGHGUID_AREATRIGGER) ? t : ((t >> 4) & 0x00000FFF);
-}
-
-uint32 GUID_ENPART(uint64 x)
-{
- return IsGuidHaveEnPart(x)
- ? ((uint32)((x >> 32) & UI64LIT(0x00000000000FFFFF)))
- : 0;
-}
-
-uint32 GUID_LOPART(uint64 x)
-{
- // _GUID_LOPART_3 and _GUID_LOPART_2 were both equal to PAIR64_LOPART
- return PAIR64_LOPART(x);
-}
-
-bool IsGuidHaveEnPart(uint64 guid)
-{
- switch (GUID_HIPART(guid))
- {
- case HIGHGUID_ITEM:
- case HIGHGUID_PLAYER:
- case HIGHGUID_DYNAMICOBJECT:
- case HIGHGUID_CORPSE:
- case HIGHGUID_GROUP:
- case HIGHGUID_GUILD:
- return false;
- case HIGHGUID_GAMEOBJECT:
- case HIGHGUID_TRANSPORT:
- case HIGHGUID_UNIT:
- case HIGHGUID_PET:
- case HIGHGUID_VEHICLE:
- case HIGHGUID_MO_TRANSPORT:
- case HIGHGUID_AREATRIGGER:
- default:
- return true;
- }
-}
-
-char const* GetLogNameForGuid(uint64 guid)
-{
- switch (GUID_HIPART(guid))
- {
- case HIGHGUID_ITEM: return "item";
- case HIGHGUID_PLAYER: return guid ? "player" : "none";
- case HIGHGUID_GAMEOBJECT: return "gameobject";
- case HIGHGUID_TRANSPORT: return "transport";
- case HIGHGUID_UNIT: return "creature";
- case HIGHGUID_PET: return "pet";
- case HIGHGUID_VEHICLE: return "vehicle";
- case HIGHGUID_DYNAMICOBJECT:return "dynobject";
- case HIGHGUID_CORPSE: return "corpse";
- case HIGHGUID_MO_TRANSPORT: return "mo_transport";
- case HIGHGUID_GROUP: return "group";
- case HIGHGUID_GUILD: return "guild";
- case HIGHGUID_AREATRIGGER: return "areatrigger";
- default:
- return "<unknown>";
- }
-}
-
#endif
diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp
new file mode 100644
index 00000000000..cbd004a21ee
--- /dev/null
+++ b/src/server/game/Entities/Object/ObjectGuid.cpp
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * 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 "ObjectGuid.h"
+#include "World.h"
+#include "ObjectMgr.h"
+#include <sstream>
+#include <iomanip>
+
+ObjectGuid const ObjectGuid::Empty = ObjectGuid();
+
+char const* ObjectGuid::GetTypeName(HighGuid high)
+{
+ switch (high)
+ {
+ case HIGHGUID_ITEM: return "Item";
+ case HIGHGUID_PLAYER: return "Player";
+ case HIGHGUID_GAMEOBJECT: return "Gameobject";
+ case HIGHGUID_TRANSPORT: return "Transport";
+ case HIGHGUID_UNIT: return "Creature";
+ case HIGHGUID_PET: return "Pet";
+ case HIGHGUID_VEHICLE: return "Vehicle";
+ case HIGHGUID_DYNAMICOBJECT: return "DynObject";
+ case HIGHGUID_CORPSE: return "Corpse";
+ case HIGHGUID_AREATRIGGER: return "AreaTrigger";
+ case HIGHGUID_BATTLEGROUND: return "Battleground";
+ case HIGHGUID_MO_TRANSPORT: return "MoTransport";
+ case HIGHGUID_INSTANCE: return "InstanceID";
+ case HIGHGUID_GROUP: return "Group";
+ case HIGHGUID_GUILD: return "Guild";
+ default:
+ return "<unknown>";
+ }
+}
+
+std::string ObjectGuid::ToString() const
+{
+ std::ostringstream str;
+ str << "GUID Full: 0x" << std::hex << std::setw(16) << std::setfill('0') << _data._guid << std::dec;
+ str << " Type: " << GetTypeName();
+ if (HasEntry())
+ str << (IsPet() ? " Pet number: " : " Entry: ") << GetEntry() << " ";
+
+ str << " Low: " << GetCounter();
+ return str.str();
+}
+
+template<HighGuid high>
+uint32 ObjectGuidGenerator<high>::Generate()
+{
+ if (_nextGuid >= ObjectGuid::GetMaxCounter(high) - 1)
+ {
+ TC_LOG_ERROR("", "%s guid overflow!! Can't continue, shutting down server. ", ObjectGuid::GetTypeName(high));
+ World::StopNow(ERROR_EXIT_CODE);
+ }
+ return _nextGuid++;
+}
+
+ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid)
+{
+ buf << uint64(guid.GetRawValue());
+ return buf;
+}
+
+ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid)
+{
+ guid.Set(buf.read<uint64>());
+ return buf;
+}
+
+ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid)
+{
+ buf.append(guid._packedGuid);
+ return buf;
+}
+
+ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid)
+{
+ buf.readPackGUID(*reinterpret_cast<uint64*>(guid.GuidPtr));
+ return buf;
+}
+
+template uint32 ObjectGuidGenerator<HIGHGUID_ITEM>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_PLAYER>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_GAMEOBJECT>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_TRANSPORT>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_UNIT>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_PET>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_VEHICLE>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_DYNAMICOBJECT>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_CORPSE>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_AREATRIGGER>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_BATTLEGROUND>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_INSTANCE>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_GROUP>::Generate();
+template uint32 ObjectGuidGenerator<HIGHGUID_GUILD>::Generate();
diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h
new file mode 100644
index 00000000000..7ad4952993f
--- /dev/null
+++ b/src/server/game/Entities/Object/ObjectGuid.h
@@ -0,0 +1,289 @@
+/*
+ * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * 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 ObjectGuid_h__
+#define ObjectGuid_h__
+
+#include "Common.h"
+#include "ByteBuffer.h"
+
+#include <functional>
+
+enum TypeID
+{
+ TYPEID_OBJECT = 0,
+ TYPEID_ITEM = 1,
+ TYPEID_CONTAINER = 2,
+ TYPEID_UNIT = 3,
+ TYPEID_PLAYER = 4,
+ TYPEID_GAMEOBJECT = 5,
+ TYPEID_DYNAMICOBJECT = 6,
+ TYPEID_CORPSE = 7,
+ TYPEID_AREATRIGGER = 8
+};
+
+#define NUM_CLIENT_OBJECT_TYPES 9
+
+enum TypeMask
+{
+ TYPEMASK_OBJECT = 0x0001,
+ TYPEMASK_ITEM = 0x0002,
+ TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004
+ TYPEMASK_UNIT = 0x0008, // creature
+ TYPEMASK_PLAYER = 0x0010,
+ TYPEMASK_GAMEOBJECT = 0x0020,
+ TYPEMASK_DYNAMICOBJECT = 0x0040,
+ TYPEMASK_CORPSE = 0x0080,
+ TYPEMASK_AREATRIGGER = 0x0100,
+ TYPEMASK_SEER = TYPEMASK_PLAYER | TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT
+};
+
+enum HighGuid
+{
+ HIGHGUID_ITEM = 0x400, // blizz 4000
+ HIGHGUID_CONTAINER = 0x400, // blizz 4000
+ HIGHGUID_PLAYER = 0x000, // blizz 0000
+ HIGHGUID_GAMEOBJECT = 0xF11, // blizz F110
+ HIGHGUID_TRANSPORT = 0xF12, // blizz F120 (for GAMEOBJECT_TYPE_TRANSPORT)
+ HIGHGUID_UNIT = 0xF13, // blizz F130
+ HIGHGUID_PET = 0xF14, // blizz F140
+ HIGHGUID_VEHICLE = 0xF15, // blizz F550
+ HIGHGUID_DYNAMICOBJECT = 0xF10, // blizz F100
+ HIGHGUID_CORPSE = 0xF101, // blizz F100
+ HIGHGUID_AREATRIGGER = 0xF102,
+ HIGHGUID_BATTLEGROUND = 0x1F1,
+ HIGHGUID_MO_TRANSPORT = 0x1FC, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT)
+ HIGHGUID_INSTANCE = 0x1F4, // blizz 1F40
+ HIGHGUID_GROUP = 0x1F5,
+ HIGHGUID_GUILD = 0x1FF
+};
+
+class ObjectGuid;
+class PackedGuid;
+
+struct PackedGuidReader
+{
+ explicit PackedGuidReader(ObjectGuid& guid) : GuidPtr(&guid) { }
+ ObjectGuid* GuidPtr;
+};
+
+class ObjectGuid
+{
+ public:
+ static ObjectGuid const Empty;
+
+ ObjectGuid() { _data._guid = UI64LIT(0); }
+ explicit ObjectGuid(uint64 guid) { _data._guid = guid; }
+ ObjectGuid(HighGuid hi, uint32 entry, uint32 counter) { _data._guid = counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0; }
+ ObjectGuid(HighGuid hi, uint32 counter) { _data._guid = counter ? uint64(counter) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0; }
+
+ operator uint64() const { return _data._guid; }
+ PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); }
+
+ void Set(uint64 guid) { _data._guid = guid; }
+ void Clear() { _data._guid = 0; }
+
+ PackedGuid WriteAsPacked() const;
+
+ uint64 GetRawValue() const { return _data._guid; }
+ HighGuid GetHigh() const
+ {
+ uint32 temp = ((uint64(_data._guid) >> 48) & 0x0000FFFF);
+ return HighGuid((temp == HIGHGUID_CORPSE || temp == HIGHGUID_AREATRIGGER) ? temp : ((temp >> 4) & 0x00000FFF));
+ }
+ uint32 GetEntry() const { return HasEntry() ? uint32((_data._guid >> 32) & UI64LIT(0x00000000000FFFFF)) : 0; }
+ uint32 GetCounter() const
+ {
+ return uint32(_data._guid & UI64LIT(0x00000000FFFFFFFF));
+ }
+
+ static uint32 GetMaxCounter(HighGuid /*high*/)
+ {
+ return uint32(0xFFFFFFFF);
+ }
+
+ uint32 GetMaxCounter() const { return GetMaxCounter(GetHigh()); }
+
+ uint8& operator[](uint32 index)
+ {
+ ASSERT(index < sizeof(uint64));
+ return _data._bytes[index];
+ }
+
+ uint8 const& operator[](uint32 index) const
+ {
+ ASSERT(index < sizeof(uint64));
+ return _data._bytes[index];
+ }
+
+ bool IsEmpty() const { return _data._guid == 0; }
+ bool IsCreature() const { return GetHigh() == HIGHGUID_UNIT; }
+ bool IsPet() const { return GetHigh() == HIGHGUID_PET; }
+ bool IsVehicle() const { return GetHigh() == HIGHGUID_VEHICLE; }
+ bool IsCreatureOrPet() const { return IsCreature() || IsPet(); }
+ bool IsCreatureOrVehicle() const { return IsCreature() || IsVehicle(); }
+ bool IsAnyTypeCreature() const { return IsCreature() || IsPet() || IsVehicle(); }
+ bool IsPlayer() const { return !IsEmpty() && GetHigh() == HIGHGUID_PLAYER; }
+ bool IsUnit() const { return IsAnyTypeCreature() || IsPlayer(); }
+ bool IsItem() const { return GetHigh() == HIGHGUID_ITEM; }
+ bool IsGameObject() const { return GetHigh() == HIGHGUID_GAMEOBJECT; }
+ bool IsDynamicObject() const { return GetHigh() == HIGHGUID_DYNAMICOBJECT; }
+ bool IsCorpse() const { return GetHigh() == HIGHGUID_CORPSE; }
+ bool IsAreaTrigger() const { return GetHigh() == HIGHGUID_AREATRIGGER; }
+ bool IsBattleground() const { return GetHigh() == HIGHGUID_BATTLEGROUND; }
+ bool IsTransport() const { return GetHigh() == HIGHGUID_TRANSPORT; }
+ bool IsMOTransport() const { return GetHigh() == HIGHGUID_MO_TRANSPORT; }
+ bool IsAnyTypeGameObject() const { return IsGameObject() || IsTransport() || IsMOTransport(); }
+ bool IsInstance() const { return GetHigh() == HIGHGUID_INSTANCE; }
+ bool IsGroup() const { return GetHigh() == HIGHGUID_GROUP; }
+ bool IsGuild() const { return GetHigh() == HIGHGUID_GUILD; }
+
+ static TypeID GetTypeId(HighGuid high)
+ {
+ switch (high)
+ {
+ case HIGHGUID_ITEM: return TYPEID_ITEM;
+ //case HIGHGUID_CONTAINER: return TYPEID_CONTAINER; HIGHGUID_CONTAINER==HIGHGUID_ITEM currently
+ case HIGHGUID_UNIT: return TYPEID_UNIT;
+ case HIGHGUID_PET: return TYPEID_UNIT;
+ case HIGHGUID_PLAYER: return TYPEID_PLAYER;
+ case HIGHGUID_GAMEOBJECT: return TYPEID_GAMEOBJECT;
+ case HIGHGUID_DYNAMICOBJECT: return TYPEID_DYNAMICOBJECT;
+ case HIGHGUID_CORPSE: return TYPEID_CORPSE;
+ case HIGHGUID_AREATRIGGER: return TYPEID_AREATRIGGER;
+ case HIGHGUID_MO_TRANSPORT: return TYPEID_GAMEOBJECT;
+ case HIGHGUID_VEHICLE: return TYPEID_UNIT;
+ // unknown
+ case HIGHGUID_INSTANCE:
+ case HIGHGUID_BATTLEGROUND:
+ case HIGHGUID_GROUP:
+ case HIGHGUID_GUILD:
+ default: return TYPEID_OBJECT;
+ }
+ }
+
+ TypeID GetTypeId() const { return GetTypeId(GetHigh()); }
+
+ bool operator!() const { return IsEmpty(); }
+ bool operator== (ObjectGuid const& guid) const { return GetRawValue() == guid.GetRawValue(); }
+ bool operator!= (ObjectGuid const& guid) const { return GetRawValue() != guid.GetRawValue(); }
+ bool operator< (ObjectGuid const& guid) const { return GetRawValue() < guid.GetRawValue(); }
+
+ static char const* GetTypeName(HighGuid high);
+ char const* GetTypeName() const { return !IsEmpty() ? GetTypeName(GetHigh()) : "None"; }
+ std::string ToString() const;
+
+ private:
+ static bool HasEntry(HighGuid high)
+ {
+ switch (high)
+ {
+ case HIGHGUID_ITEM:
+ case HIGHGUID_PLAYER:
+ case HIGHGUID_DYNAMICOBJECT:
+ case HIGHGUID_CORPSE:
+ case HIGHGUID_MO_TRANSPORT:
+ case HIGHGUID_INSTANCE:
+ case HIGHGUID_GROUP:
+ return false;
+ case HIGHGUID_GAMEOBJECT:
+ case HIGHGUID_TRANSPORT:
+ case HIGHGUID_UNIT:
+ case HIGHGUID_PET:
+ case HIGHGUID_VEHICLE:
+ default:
+ return true;
+ }
+ }
+
+ bool HasEntry() const { return HasEntry(GetHigh()); }
+
+ explicit ObjectGuid(uint32 const&) = delete; // no implementation, used to catch wrong type assignment
+ ObjectGuid(HighGuid, uint32, uint64 counter) = delete; // no implementation, used to catch wrong type assignment
+ ObjectGuid(HighGuid, uint64 counter) = delete; // no implementation, used to catch wrong type assignment
+
+ union
+ {
+ uint64 _guid;
+ uint8 _bytes[sizeof(uint64)];
+ } _data;
+};
+
+// Some Shared defines
+typedef std::set<ObjectGuid> GuidSet;
+typedef std::list<ObjectGuid> GuidList;
+typedef std::deque<ObjectGuid> GuidDeque;
+typedef std::vector<ObjectGuid> GuidVector;
+
+// minimum buffer size for packed guid is 9 bytes
+#define PACKED_GUID_MIN_BUFFER_SIZE 9
+
+class PackedGuid
+{
+ friend ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid);
+
+ public:
+ explicit PackedGuid() : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { _packedGuid.appendPackGUID(0); }
+ explicit PackedGuid(uint64 guid) : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { _packedGuid.appendPackGUID(guid); }
+ explicit PackedGuid(ObjectGuid guid) : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { _packedGuid.appendPackGUID(guid.GetRawValue()); }
+
+ void Set(uint64 guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid); }
+ void Set(ObjectGuid guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid.GetRawValue()); }
+
+ size_t size() const { return _packedGuid.size(); }
+
+ private:
+ ByteBuffer _packedGuid;
+};
+
+template<HighGuid high>
+class ObjectGuidGenerator
+{
+ public:
+ explicit ObjectGuidGenerator(uint32 start = 1) : _nextGuid(start) { }
+
+ void Set(uint32 val) { _nextGuid = val; }
+ uint32 Generate();
+ uint32 GetNextAfterMaxUsed() const { return _nextGuid; }
+
+ private:
+ uint32 _nextGuid;
+};
+
+ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid);
+ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid);
+
+ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid);
+ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid);
+
+inline PackedGuid ObjectGuid::WriteAsPacked() const { return PackedGuid(*this); }
+
+namespace std
+{
+ template<>
+ struct hash<ObjectGuid>
+ {
+ public:
+ size_t operator()(ObjectGuid const& key) const
+ {
+ return hash<uint64>()(key.GetRawValue());
+ }
+ };
+}
+
+#endif // ObjectGuid_h__
diff --git a/src/server/game/Entities/Object/Updates/UpdateData.cpp b/src/server/game/Entities/Object/Updates/UpdateData.cpp
index ee84b01e175..eaecbdac3c1 100644
--- a/src/server/game/Entities/Object/Updates/UpdateData.cpp
+++ b/src/server/game/Entities/Object/Updates/UpdateData.cpp
@@ -27,12 +27,12 @@
UpdateData::UpdateData(uint16 map) : m_map(map), m_blockCount(0) { }
-void UpdateData::AddOutOfRangeGUID(std::set<uint64>& guids)
+void UpdateData::AddOutOfRangeGUID(GuidSet& guids)
{
m_outOfRangeGUIDs.insert(guids.begin(), guids.end());
}
-void UpdateData::AddOutOfRangeGUID(uint64 guid)
+void UpdateData::AddOutOfRangeGUID(ObjectGuid guid)
{
m_outOfRangeGUIDs.insert(guid);
}
@@ -56,8 +56,8 @@ bool UpdateData::BuildPacket(WorldPacket* packet)
*packet << uint8(UPDATETYPE_OUT_OF_RANGE_OBJECTS);
*packet << uint32(m_outOfRangeGUIDs.size());
- for (std::set<uint64>::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
- packet->appendPackGUID(*i);
+ for (GuidSet::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
+ *packet << i->WriteAsPacked();
}
packet->append(m_data);
diff --git a/src/server/game/Entities/Object/Updates/UpdateData.h b/src/server/game/Entities/Object/Updates/UpdateData.h
index e0666a1a717..82958229ea0 100644
--- a/src/server/game/Entities/Object/Updates/UpdateData.h
+++ b/src/server/game/Entities/Object/Updates/UpdateData.h
@@ -20,6 +20,7 @@
#define __UPDATEDATA_H
#include "ByteBuffer.h"
+#include "ObjectGuid.h"
#include <set>
class WorldPacket;
@@ -61,19 +62,19 @@ class UpdateData
{
}
- void AddOutOfRangeGUID(std::set<uint64>& guids);
- void AddOutOfRangeGUID(uint64 guid);
+ void AddOutOfRangeGUID(GuidSet& guids);
+ void AddOutOfRangeGUID(ObjectGuid guid);
void AddUpdateBlock(const ByteBuffer &block);
bool BuildPacket(WorldPacket* packet);
bool HasData() const { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
void Clear();
- std::set<uint64> const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; }
+ GuidSet const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; }
protected:
uint16 m_map;
uint32 m_blockCount;
- std::set<uint64> m_outOfRangeGUIDs;
+ GuidSet m_outOfRangeGUIDs;
ByteBuffer m_data;
UpdateData(UpdateData const& right) = delete;
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 46c9e61886a..28ff634a15c 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -302,8 +302,8 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
if (summonSpellId)
{
WorldPacket data(SMSG_SPELL_GO, (8+8+4+4+2));
- data.append(owner->GetPackGUID());
- data.append(owner->GetPackGUID());
+ data << owner->GetPackGUID();
+ data << owner->GetPackGUID();
data << uint8(0);
data << uint32(summonSpellId);
data << uint32(256); // CAST_FLAG_UNKNOWN3
@@ -381,7 +381,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
return;
// not save not player pets
- if (!IS_PLAYER_GUID(GetOwnerGUID()))
+ if (!GetOwnerGUID().IsPlayer())
return;
Player* owner = GetOwner();
@@ -416,7 +416,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
// current/stable/not_in_slot
if (mode >= PET_SAVE_AS_CURRENT)
{
- uint32 ownerLowGUID = GUID_LOPART(GetOwnerGUID());
+ uint32 ownerLowGUID = GetOwnerGUID().GetCounter();
std::string name = m_name;
CharacterDatabase.EscapeString(name);
trans = CharacterDatabase.BeginTransaction();
@@ -1225,7 +1225,7 @@ void Pet::_LoadAuras(uint32 timediff)
int32 damage[3];
int32 baseDamage[3];
Field* fields = result->Fetch();
- uint64 caster_guid = fields[0].GetUInt64();
+ ObjectGuid caster_guid(fields[0].GetUInt64());
// NULL guid stored - pet is the caster of the spell - see Pet::_SaveAuras
if (!caster_guid)
caster_guid = GetGUID();
@@ -1320,13 +1320,13 @@ void Pet::_SaveAuras(SQLTransaction& trans)
}
// don't save guid of caster in case we are caster of the spell - guid for pet is generated every pet load, so it won't match saved guid anyways
- uint64 casterGUID = (itr->second->GetCasterGUID() == GetGUID()) ? 0 : itr->second->GetCasterGUID();
+ ObjectGuid casterGUID = (itr->second->GetCasterGUID() == GetGUID()) ? ObjectGuid::Empty : itr->second->GetCasterGUID();
uint8 index = 0;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_AURA);
stmt->setUInt32(index++, m_charmInfo->GetPetNumber());
- stmt->setUInt64(index++, casterGUID);
+ stmt->setUInt64(index++, casterGUID.GetRawValue());
stmt->setUInt32(index++, itr->second->GetId());
stmt->setUInt8(index++, effMask);
stmt->setUInt8(index++, recalculateMask);
diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h
index 15383d90bf3..8c3cf5e0ecc 100644
--- a/src/server/game/Entities/Pet/Pet.h
+++ b/src/server/game/Entities/Pet/Pet.h
@@ -60,7 +60,7 @@ class Pet : public Guardian
bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner);
bool CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask);
bool LoadPetFromDB(Player* owner, uint32 petentry = 0, uint32 petnumber = 0, bool current = false);
- bool isBeingLoaded() const override { return m_loading;}
+ bool IsLoading() const override { return m_loading;}
void SavePetToDB(PetSaveMode mode);
void Remove(PetSaveMode mode, bool returnreagent = false);
static void DeleteFromDB(uint32 guidlow);
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 608f7a72859..e3101c20a15 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -307,7 +307,7 @@ Item* TradeData::GetItem(TradeSlots slot) const
return m_items[slot] ? m_player->GetItemByGuid(m_items[slot]) : NULL;
}
-bool TradeData::HasItem(uint64 itemGuid) const
+bool TradeData::HasItem(ObjectGuid itemGuid) const
{
for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i)
if (m_items[i] == itemGuid)
@@ -316,7 +316,7 @@ bool TradeData::HasItem(uint64 itemGuid) const
return false;
}
-TradeSlots TradeData::GetTradeSlotForItem(uint64 itemGuid) const
+TradeSlots TradeData::GetTradeSlotForItem(ObjectGuid itemGuid) const
{
for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i)
if (m_items[i] == itemGuid)
@@ -332,7 +332,9 @@ Item* TradeData::GetSpellCastItem() const
void TradeData::SetItem(TradeSlots slot, Item* item)
{
- uint64 itemGuid = item ? item->GetGUID() : 0;
+ ObjectGuid itemGuid;
+ if (item)
+ itemGuid = item->GetGUID();
if (m_items[slot] == itemGuid)
return;
@@ -354,7 +356,7 @@ void TradeData::SetItem(TradeSlots slot, Item* item)
void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= NULL*/)
{
- uint64 itemGuid = castItem ? castItem->GetGUID() : 0;
+ ObjectGuid itemGuid = castItem ? castItem->GetGUID() : ObjectGuid::Empty;
if (m_spell == spell_id && m_spellCastItem == itemGuid)
return;
@@ -465,7 +467,7 @@ KillRewarder::KillRewarder(Player* killer, Unit* victim, bool isBattleGround) :
if (victim->GetTypeId() == TYPEID_PLAYER)
_isPvP = true;
// or if its owned by player and its not a vehicle
- else if (IS_PLAYER_GUID(victim->GetCharmerOrOwnerGUID()))
+ else if (victim->GetCharmerOrOwnerGUID().IsPlayer())
_isPvP = !victim->IsVehicle();
_InitGroupData();
@@ -686,7 +688,6 @@ Player::Player(WorldSession* session): Unit(true)
m_session = session;
- m_divider = 0;
m_ingametime = 0;
m_ExtraFlags = 0;
@@ -698,9 +699,6 @@ Player::Player(WorldSession* session): Unit(true)
if (!GetSession()->HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS))
SetAcceptWhispers(true);
- m_lootGuid = 0;
-
- m_comboTarget = 0;
m_comboPoints = 0;
m_regenTimer = 0;
@@ -793,13 +791,13 @@ Player::Player(WorldSession* session): Unit(true)
m_lastpetnumber = 0;
////////////////////Rest System/////////////////////
- time_inn_enter=0;
- inn_pos_mapid=0;
- inn_pos_x=0;
- inn_pos_y=0;
- inn_pos_z=0;
- m_rest_bonus=0;
- rest_type=REST_TYPE_NO;
+ time_inn_enter = 0;
+ inn_pos_mapid = 0;
+ inn_pos_x = 0.0f;
+ inn_pos_y = 0.0f;
+ inn_pos_z = 0.0f;
+ m_rest_bonus = 0;
+ rest_type = REST_TYPE_NO;
////////////////////Rest System/////////////////////
m_mailsLoaded = false;
@@ -1937,7 +1935,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, ByteBuffer* dataBuffer, B
Field* fields = result->Fetch();
- ObjectGuid guid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ ObjectGuid guid(HIGHGUID_PLAYER, fields[0].GetUInt32());
std::string name = fields[1].GetString();
uint8 plrRace = fields[2].GetUInt8();
uint8 plrClass = fields[3].GetUInt8();
@@ -1954,7 +1952,9 @@ bool Player::BuildEnumData(PreparedQueryResult result, ByteBuffer* dataBuffer, B
float y = fields[11].GetFloat();
float z = fields[12].GetFloat();
uint32 guildId = fields[13].GetUInt32();
- ObjectGuid guildGuid = MAKE_NEW_GUID(guildId, 0, guildId ? uint32(HIGHGUID_GUILD) : 0);
+ ObjectGuid guildGuid;
+ if (guildId)
+ guildGuid = ObjectGuid(HIGHGUID_GUILD, guildId);
uint32 playerFlags = fields[14].GetUInt32();
uint32 atLoginFlags = fields[15].GetUInt16();
Tokenizer equipment(fields[19].GetString(), ' ');
@@ -2187,7 +2187,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// The player was ported to another map and loses the duel immediately.
// We have to perform this check before the teleport, otherwise the
// ObjectAccessor won't find the flag.
- if (duel && GetMapId() != mapid && GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER)))
+ if (duel && GetMapId() != mapid && GetMap()->GetGameObject(GetGuidValue(PLAYER_DUEL_ARBITER)))
DuelComplete(DUEL_FLED);
if (GetMapId() == mapid)
@@ -2269,7 +2269,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
return true;
}
- SetSelection(0);
+ SetSelection(ObjectGuid::Empty);
CombatStop();
@@ -2786,7 +2786,7 @@ bool Player::CanInteractWithQuestGiver(Object* questGiver)
return false;
}
-Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
+Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
{
// unit checks
if (!guid)
@@ -2837,7 +2837,7 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
return creature;
}
-GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const
+GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const
{
if (GameObject* go = GetMap()->GetGameObject(guid))
{
@@ -2992,7 +2992,7 @@ void Player::UninviteFromGroup()
}
}
-void Player::RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method /* = GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /* = 0 */, const char* reason /* = NULL */)
+void Player::RemoveFromGroup(Group* group, ObjectGuid guid, RemoveMethod method /* = GROUP_REMOVEMETHOD_DEFAULT*/, ObjectGuid kicker /* = ObjectGuid::Empty */, const char* reason /* = NULL */)
{
if (!group)
return;
@@ -3003,7 +3003,7 @@ void Player::RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method /* =
void Player::SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 BonusXP, bool recruitAFriend, float /*group_rate*/)
{
WorldPacket data(SMSG_LOG_XPGAIN, 21); // guess size?
- data << uint64(victim ? victim->GetGUID() : 0); // guid
+ data << uint64(victim ? victim->GetGUID() : ObjectGuid::Empty);
data << uint32(GivenXP + BonusXP); // given experience
data << uint8(victim ? 0 : 1); // 00-kill_xp type, 01-non_kill_xp type
@@ -4639,19 +4639,19 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
* @param updateRealmChars when this flag is set, the amount of characters on that realm will be updated in the realmlist
* @param deleteFinally if this flag is set, the config option will be ignored and the character will be permanently removed from the database
*/
-void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars, bool deleteFinally)
+void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRealmChars, bool deleteFinally)
{
// Avoid realm-update for non-existing account
if (accountId == 0)
updateRealmChars = false;
// Convert guid to low GUID for CharacterNameData, but also other methods on success
- uint32 guid = GUID_LOPART(playerguid);
+ uint32 guid = playerguid.GetCounter();
uint32 charDelete_method = sWorld->getIntConfig(CONFIG_CHARDELETE_METHOD);
if (deleteFinally)
charDelete_method = CHAR_DELETE_REMOVE;
- else if (CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid)) // To avoid a query, we select loaded data. If it doesn't exist, return.
+ else if (CharacterNameData const* nameData = sWorld->GetCharacterNameData(playerguid)) // To avoid a query, we select loaded data. If it doesn't exist, return.
{
// Define the required variables
uint32 charDelete_minLvl = sWorld->getIntConfig(nameData->m_class != CLASS_DEATH_KNIGHT ? CONFIG_CHARDELETE_MIN_LEVEL : CONFIG_CHARDELETE_HEROIC_MIN_LEVEL);
@@ -4668,7 +4668,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
if (uint32 guildId = GetGuildIdFromDB(playerguid))
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
- guild->DeleteMember(guid, false, false, true);
+ guild->DeleteMember(playerguid, false, false, true);
// remove from arena teams
LeaveAllArenaTeams(playerguid);
@@ -4757,7 +4757,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
}
Item* pItem = NewItemOrBag(itemProto);
- if (!pItem->LoadFromDB(item_guidlow, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER), itemFields, item_template))
+ if (!pItem->LoadFromDB(item_guidlow, playerguid, itemFields, item_template))
{
pItem->FSetState(ITEM_REMOVED);
pItem->SaveToDB(trans); // it also deletes item object!
@@ -4774,7 +4774,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
stmt->setUInt32(0, mail_id);
trans->Append(stmt);
- uint32 pl_account = sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
+ uint32 pl_account = sObjectMgr->GetPlayerAccountIdByGUID(playerguid);
draft.AddMoney(money).SendReturnToSender(pl_account, guid, sender, trans);
}
@@ -4805,7 +4805,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
{
do
{
- if (Player* pFriend = ObjectAccessor::FindPlayer(MAKE_NEW_GUID((*resultFriends)[0].GetUInt32(), 0, HIGHGUID_PLAYER)))
+ if (Player* pFriend = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, 0, (*resultFriends)[0].GetUInt32())))
{
if (pFriend->IsInWorld())
{
@@ -4978,7 +4978,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
if (updateRealmChars)
sWorld->UpdateRealmCharCount(accountId);
- sWorld->DeleteCharacterNameData(guid);
+ sWorld->DeleteCharacterNameData(playerguid);
}
/**
@@ -5016,7 +5016,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
do
{
Field* fields = result->Fetch();
- Player::DeleteFromDB(fields[0].GetUInt32(), fields[1].GetUInt32(), true, true);
+ Player::DeleteFromDB(ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()), fields[1].GetUInt32(), true, true);
}
while (result->NextRow());
}
@@ -5029,7 +5029,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
void Player::BuildPlayerRepop()
{
WorldPacket data(SMSG_PRE_RESURRECT, GetPackGUID().size());
- data.append(GetPackGUID());
+ data << GetPackGUID();
GetSession()->SendPacket(&data);
if (getRace() == RACE_NIGHTELF)
@@ -5863,7 +5863,7 @@ void Player::ApplyRatingMod(CombatRating combatRating, int32 value, bool apply)
ApplyAttackTimePercentMod(OFF_ATTACK, oldVal, false);
ApplyAttackTimePercentMod(BASE_ATTACK, newVal, true);
ApplyAttackTimePercentMod(OFF_ATTACK, newVal, true);
- if (getClass() == CLASS_DEATH_KNIGHT)
+ if (getClass() == CLASS_DEATH_KNIGHT)
UpdateAllRunesRegen();
break;
case CR_HASTE_RANGED:
@@ -6556,13 +6556,13 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
{
if (button >= MAX_ACTION_BUTTONS)
{
- TC_LOG_ERROR("entities.player", "Action %u not added into button %u for player %s (GUID: %u): button must be < %u", action, button, GetName().c_str(), GUID_LOPART(GetGUID()), MAX_ACTION_BUTTONS );
+ TC_LOG_ERROR("entities.player", "Action %u not added into button %u for player %s (GUID: %u): button must be < %u", action, button, GetName().c_str(), GetGUIDLow(), MAX_ACTION_BUTTONS );
return false;
}
if (action >= MAX_ACTION_BUTTON_ACTION_VALUE)
{
- TC_LOG_ERROR("entities.player", "Action %u not added into button %u for player %s (GUID: %u): action must be < %u", action, button, GetName().c_str(), GUID_LOPART(GetGUID()), MAX_ACTION_BUTTON_ACTION_VALUE);
+ TC_LOG_ERROR("entities.player", "Action %u not added into button %u for player %s (GUID: %u): action must be < %u", action, button, GetName().c_str(), GetGUIDLow(), MAX_ACTION_BUTTON_ACTION_VALUE);
return false;
}
@@ -6571,20 +6571,20 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
case ACTION_BUTTON_SPELL:
if (!sSpellMgr->GetSpellInfo(action))
{
- TC_LOG_ERROR("entities.player", "Spell action %u not added into button %u for player %s (GUID: %u): spell not exist", action, button, GetName().c_str(), GUID_LOPART(GetGUID()));
+ TC_LOG_ERROR("entities.player", "Spell action %u not added into button %u for player %s (GUID: %u): spell not exist", action, button, GetName().c_str(), GetGUIDLow());
return false;
}
if (!HasSpell(action))
{
- TC_LOG_ERROR("entities.player", "Spell action %u not added into button %u for player %s (GUID: %u): player don't known this spell", action, button, GetName().c_str(), GUID_LOPART(GetGUID()));
+ TC_LOG_ERROR("entities.player", "Spell action %u not added into button %u for player %s (GUID: %u): player don't known this spell", action, button, GetName().c_str(), GetGUIDLow());
return false;
}
break;
case ACTION_BUTTON_ITEM:
if (!sObjectMgr->GetItemTemplate(action))
{
- TC_LOG_ERROR("entities.player", "Item action %u not added into button %u for player %s (GUID: %u): item not exist", action, button, GetName().c_str(), GUID_LOPART(GetGUID()));
+ TC_LOG_ERROR("entities.player", "Item action %u not added into button %u for player %s (GUID: %u): item not exist", action, button, GetName().c_str(), GetGUIDLow());
return false;
}
break;
@@ -7057,7 +7057,7 @@ bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvpto
if (HasAura(SPELL_AURA_PLAYER_INACTIVE))
return false;
- uint64 victim_guid = 0;
+ ObjectGuid victim_guid;
uint32 victim_rank = 0;
// need call before fields update to have chance move yesterday data to appropriate fields before today data change.
@@ -7102,13 +7102,13 @@ bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvpto
// title[15..28] -> rank[5..18]
// title[other] -> 0
if (victim_title == 0)
- victim_guid = 0; // Don't show HK: <rank> message, only log.
+ victim_guid.Clear(); // Don't show HK: <rank> message, only log.
else if (victim_title < 15)
victim_rank = victim_title + 4;
else if (victim_title < 29)
victim_rank = victim_title - 14 + 4;
else
- victim_guid = 0; // Don't show HK: <rank> message, only log.
+ victim_guid.Clear(); // Don't show HK: <rank> message, only log.
honor_f = std::ceil(Trinity::Honor::hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey));
@@ -7591,28 +7591,28 @@ void Player::UpdateConquestCurrencyCap(uint32 currency)
void Player::SetInGuild(uint32 guildId)
{
if (guildId)
- SetUInt64Value(OBJECT_FIELD_DATA, MAKE_NEW_GUID(guildId, 0, HIGHGUID_GUILD));
+ SetGuidValue(OBJECT_FIELD_DATA, ObjectGuid(HIGHGUID_GUILD, guildId));
else
- SetUInt64Value(OBJECT_FIELD_DATA, 0);
+ SetGuidValue(OBJECT_FIELD_DATA, ObjectGuid::Empty);
ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_GUILD_LEVEL_ENABLED, guildId != 0 && sWorld->getBoolConfig(CONFIG_GUILD_LEVELING_ENABLED));
SetUInt16Value(OBJECT_FIELD_TYPE, 1, guildId != 0);
}
-uint32 Player::GetGuildIdFromDB(uint64 guid)
+uint32 Player::GetGuildIdFromDB(ObjectGuid guid)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
return result->Fetch()[0].GetUInt32();
return 0;
}
-uint8 Player::GetRankFromDB(uint64 guid)
+uint8 Player::GetRankFromDB(ObjectGuid guid)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
return result->Fetch()[1].GetUInt8();
@@ -7635,10 +7635,10 @@ void Player::SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type)
SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, type);
}
-uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type)
+uint32 Player::GetArenaTeamIdFromDB(ObjectGuid guid, uint8 type)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
stmt->setUInt8(1, type);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -7649,9 +7649,9 @@ uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type)
return id;
}
-uint32 Player::GetZoneIdFromDB(uint64 guid)
+uint32 Player::GetZoneIdFromDB(ObjectGuid guid)
{
- uint32 guidLow = GUID_LOPART(guid);
+ uint32 guidLow = guid.GetCounter();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_ZONE);
stmt->setUInt32(0, guidLow);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -7695,10 +7695,10 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
return zone;
}
-uint32 Player::GetLevelFromDB(uint64 guid)
+uint32 Player::GetLevelFromDB(ObjectGuid guid)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_LEVEL);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
@@ -7862,7 +7862,7 @@ void Player::CheckDuelDistance(time_t currTime)
if (!duel)
return;
- uint64 duelFlagGUID = GetUInt64Value(PLAYER_DUEL_ARBITER);
+ ObjectGuid duelFlagGUID = GetGuidValue(PLAYER_DUEL_ARBITER);
GameObject* obj = GetMap()->GetGameObject(duelFlagGUID);
if (!obj)
return;
@@ -7962,7 +7962,7 @@ void Player::DuelComplete(DuelCompleteType type)
duel->opponent->CastSpell(duel->opponent, 52852, true);
//Remove Duel Flag object
- GameObject* obj = GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER));
+ GameObject* obj = GetMap()->GetGameObject(GetGuidValue(PLAYER_DUEL_ARBITER));
if (obj)
duel->initiator->RemoveGameObject(obj, true);
@@ -7999,9 +7999,9 @@ void Player::DuelComplete(DuelCompleteType type)
duel->opponent->ClearComboPoints();
//cleanups
- SetUInt64Value(PLAYER_DUEL_ARBITER, 0);
+ SetGuidValue(PLAYER_DUEL_ARBITER, ObjectGuid::Empty);
SetUInt32Value(PLAYER_DUEL_TEAM, 0);
- duel->opponent->SetUInt64Value(PLAYER_DUEL_ARBITER, 0);
+ duel->opponent->SetGuidValue(PLAYER_DUEL_ARBITER, ObjectGuid::Empty);
duel->opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 0);
delete duel->opponent->duel;
@@ -8910,23 +8910,23 @@ void Player::RemovedInsignia(Player* looterPlr)
looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA);
}
-void Player::SendLootRelease(uint64 guid)
+void Player::SendLootRelease(ObjectGuid guid)
{
WorldPacket data(SMSG_LOOT_RELEASE_RESPONSE, (8+1));
data << uint64(guid) << uint8(1);
SendDirectMessage(&data);
}
-void Player::SendLoot(uint64 guid, LootType loot_type)
+void Player::SendLoot(ObjectGuid guid, LootType loot_type)
{
- if (uint64 lguid = GetLootGUID())
+ if (ObjectGuid lguid = GetLootGUID())
m_session->DoLootRelease(lguid);
Loot* loot = 0;
PermissionTypes permission = ALL_PERMISSION;
TC_LOG_DEBUG("loot", "Player::SendLoot");
- if (IS_GAMEOBJECT_GUID(guid))
+ if (guid.IsGameObject())
{
TC_LOG_DEBUG("loot", "IS_GAMEOBJECT_GUID(guid)");
GameObject* go = GetMap()->GetGameObject(guid);
@@ -9023,7 +9023,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
permission = ALL_PERMISSION;
}
}
- else if (IS_ITEM_GUID(guid))
+ else if (guid.IsItem())
{
Item* item = GetItemByGuid(guid);
@@ -9068,7 +9068,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
}
}
}
- else if (IS_CORPSE_GUID(guid)) // remove insignia
+ else if (guid.IsCorpse()) // remove insignia
{
Corpse* bones = ObjectAccessor::GetCorpse(*this, guid);
@@ -9248,11 +9248,11 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
else
SendLootError(GetLootGUID(), LOOT_ERROR_DIDNT_KILL);
- if (loot_type == LOOT_CORPSE && !IS_ITEM_GUID(guid))
+ if (loot_type == LOOT_CORPSE && !guid.IsItem())
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
}
-void Player::SendLootError(uint64 guid, LootError error)
+void Player::SendLootError(ObjectGuid guid, LootError error)
{
WorldPacket data(SMSG_LOOT_RESPONSE, 10);
data << uint64(guid);
@@ -9936,14 +9936,14 @@ uint32 Player::GetXPRestBonus(uint32 xp)
return rested_bonus;
}
-void Player::SetBindPoint(uint64 guid)
+void Player::SetBindPoint(ObjectGuid guid)
{
WorldPacket data(SMSG_BINDER_CONFIRM, 8);
data << uint64(guid);
GetSession()->SendPacket(&data);
}
-void Player::SendTalentWipeConfirm(uint64 guid)
+void Player::SendTalentWipeConfirm(ObjectGuid guid)
{
WorldPacket data(MSG_TALENT_WIPE_CONFIRM, 8 + 4);
data << uint64(guid);
@@ -10294,7 +10294,7 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte
return count;
}
-Item* Player::GetItemByGuid(uint64 guid) const
+Item* Player::GetItemByGuid(ObjectGuid guid) const
{
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
@@ -12043,9 +12043,9 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
if (!pBag)
{
m_items[slot] = pItem;
- SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID());
- pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID());
- pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetGUID());
+ SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID());
+ pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetGUID());
+ pItem->SetGuidValue(ITEM_FIELD_OWNER, GetGUID());
pItem->SetSlot(slot);
pItem->SetContainer(NULL);
@@ -12286,9 +12286,9 @@ void Player::VisualizeItem(uint8 slot, Item* pItem)
TC_LOG_DEBUG("entities.player.items", "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry());
m_items[slot] = pItem;
- SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID());
- pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID());
- pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetGUID());
+ SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID());
+ pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetGUID());
+ pItem->SetGuidValue(ITEM_FIELD_OWNER, GetGUID());
pItem->SetSlot(slot);
pItem->SetContainer(NULL);
@@ -12368,7 +12368,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
}
m_items[slot] = NULL;
- SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0);
+ SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid::Empty);
if (slot < EQUIPMENT_SLOT_END)
SetVisibleItemSlot(slot, NULL);
@@ -12376,7 +12376,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
else if (Bag* pBag = GetBagByPos(bag))
pBag->RemoveItem(slot, update);
- pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, 0);
+ pItem->SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid::Empty);
// pItem->SetUInt64Value(ITEM_FIELD_OWNER, 0); not clear owner at remove (it will be set at store). This used in mail and auction code
pItem->SetSlot(NULL_SLOT);
if (IsInWorld() && update)
@@ -12465,7 +12465,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
if (bag == INVENTORY_SLOT_BAG_0)
{
- SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0);
+ SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid::Empty);
// equipment and equipped bags can have applied bonuses
if (slot < INVENTORY_SLOT_BAG_END)
@@ -12522,7 +12522,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
}
//pItem->SetOwnerGUID(0);
- pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, 0);
+ pItem->SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid::Empty);
pItem->SetSlot(NULL_SLOT);
pItem->SetState(ITEM_REMOVED, this);
}
@@ -13288,7 +13288,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem)
uint32 etime = uint32(base - m_logintime + (30 * 3600));
uint32 eslot = slot - BUYBACK_SLOT_START;
- SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID());
+ SetGuidValue(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID());
if (ItemTemplate const* proto = pItem->GetTemplate())
SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, proto->SellPrice * pItem->GetCount());
else
@@ -13325,7 +13325,7 @@ void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del)
m_items[slot] = NULL;
uint32 eslot = slot - BUYBACK_SLOT_START;
- SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), 0);
+ SetGuidValue(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), ObjectGuid::Empty);
SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0);
SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, 0);
@@ -13343,8 +13343,8 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint
if (msg != EQUIP_ERR_OK)
{
- data << uint64(pItem ? pItem->GetGUID() : 0);
- data << uint64(pItem2 ? pItem2->GetGUID() : 0);
+ data << uint64(pItem ? pItem->GetGUID() : ObjectGuid::Empty);
+ data << uint64(pItem2 ? pItem2->GetGUID() : ObjectGuid::Empty);
data << uint8(0); // bag type subclass, used with EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM and EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG2
switch (msg)
@@ -13382,17 +13382,17 @@ void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32
{
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_BUY_FAILED");
WorldPacket data(SMSG_BUY_FAILED, (8+4+4+1));
- data << uint64(creature ? creature->GetGUID() : 0);
+ data << uint64(creature ? creature->GetGUID() : ObjectGuid::Empty);
data << uint32(item);
data << uint8(msg);
GetSession()->SendPacket(&data);
}
-void Player::SendSellError(SellResult msg, Creature* creature, uint64 guid)
+void Player::SendSellError(SellResult msg, Creature* creature, ObjectGuid guid)
{
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_SELL_ITEM");
WorldPacket data(SMSG_SELL_ITEM, (8+8+1)); // last check 4.3.4
- data << uint64(creature ? creature->GetGUID() : 0);
+ data << uint64(creature ? creature->GetGUID() : ObjectGuid::Empty);
data << uint64(guid);
data << uint8(msg);
GetSession()->SendPacket(&data);
@@ -14537,7 +14537,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
return;
uint32 gossipOptionId = item->OptionType;
- uint64 guid = source->GetGUID();
+ ObjectGuid guid = source->GetGUID();
if (source->GetTypeId() == TYPEID_GAMEOBJECT)
{
@@ -14704,7 +14704,7 @@ uint32 Player::GetDefaultGossipMenuForSource(WorldObject* source)
/*** QUEST SYSTEM ***/
/*********************************************************/
-void Player::PrepareQuestMenu(uint64 guid)
+void Player::PrepareQuestMenu(ObjectGuid guid)
{
QuestRelationBounds objectQR;
QuestRelationBounds objectQIR;
@@ -14764,7 +14764,7 @@ void Player::PrepareQuestMenu(uint64 guid)
}
}
-void Player::SendPreparedQuest(uint64 guid)
+void Player::SendPreparedQuest(ObjectGuid guid)
{
QuestMenu& questMenu = PlayerTalkClass->GetQuestMenu();
if (questMenu.Empty())
@@ -14820,7 +14820,7 @@ void Player::SendPreparedQuest(uint64 guid)
{
qe._Delay = 0; //TEXTEMOTE_MESSAGE; //zyg: player emote
qe._Emote = 0; //TEXTEMOTE_HELLO; //zyg: NPC emote
- title = "";
+ title.clear();
}
else
{
@@ -14855,12 +14855,12 @@ bool Player::IsActiveQuest(uint32 quest_id) const
return m_QuestStatus.find(quest_id) != m_QuestStatus.end();
}
-Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest)
+Quest const* Player::GetNextQuest(ObjectGuid guid, Quest const* quest)
{
QuestRelationBounds objectQR;
uint32 nextQuestID = quest->GetNextQuestInChain();
- switch (GUID_HIPART(guid))
+ switch (guid.GetHigh())
{
case HIGHGUID_PLAYER:
ASSERT(quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE));
@@ -16465,7 +16465,7 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count)
UpdateForQuestWorldObjects();
}
-void Player::KilledMonster(CreatureTemplate const* cInfo, uint64 guid)
+void Player::KilledMonster(CreatureTemplate const* cInfo, ObjectGuid guid)
{
ASSERT(cInfo);
@@ -16474,10 +16474,10 @@ void Player::KilledMonster(CreatureTemplate const* cInfo, uint64 guid)
for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
if (cInfo->KillCredit[i])
- KilledMonsterCredit(cInfo->KillCredit[i], 0);
+ KilledMonsterCredit(cInfo->KillCredit[i], ObjectGuid::Empty);
}
-void Player::KilledMonsterCredit(uint32 entry, uint64 guid /*= 0*/)
+void Player::KilledMonsterCredit(uint32 entry, ObjectGuid guid /*= ObjectGuid::Empty*/)
{
uint16 addkillcount = 1;
uint32 real_entry = entry;
@@ -16579,7 +16579,7 @@ void Player::KilledPlayerCredit()
}
}
-void Player::KillCreditGO(uint32 entry, uint64 guid)
+void Player::KillCreditGO(uint32 entry, ObjectGuid guid)
{
uint16 addCastCount = 1;
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
@@ -16633,7 +16633,7 @@ void Player::KillCreditGO(uint32 entry, uint64 guid)
}
}
-void Player::TalkedToCreature(uint32 entry, uint64 guid)
+void Player::TalkedToCreature(uint32 entry, ObjectGuid guid)
{
uint16 addTalkCount = 1;
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
@@ -16945,11 +16945,11 @@ void Player::SendPushToPartyResponse(Player* player, uint8 msg)
}
}
-void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count)
+void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, ObjectGuid guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count)
{
ASSERT(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)");
- int32 entry = quest->RequiredNpcOrGo[ creatureOrGO_idx ];
+ int32 entry = quest->RequiredNpcOrGo[creatureOrGO_idx];
if (entry < 0)
// client expected gameobject template id in form (id|0x80000000)
entry = (-entry) | 0x80000000;
@@ -16965,7 +16965,7 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uin
uint16 log_slot = FindQuestSlot(quest->GetQuestId());
if (log_slot < MAX_QUEST_LOG_SIZE)
- SetQuestSlotCounter(log_slot, creatureOrGO_idx, GetQuestSlotCounter(log_slot, creatureOrGO_idx)+add_count);
+ SetQuestSlotCounter(log_slot, creatureOrGO_idx, GetQuestSlotCounter(log_slot, creatureOrGO_idx) + add_count);
}
void Player::SendQuestUpdateAddPlayer(Quest const* quest, uint16 old_count, uint16 add_count)
@@ -17119,10 +17119,10 @@ void Player::_LoadBGData(PreparedQueryResult result)
m_bgData.mountSpell = fields[9].GetUInt32();
}
-bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid)
+bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, ObjectGuid guid)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
@@ -17174,12 +17174,12 @@ float Player::GetFloatValueFromArray(Tokenizer const& data, uint16 index)
return result;
}
-bool Player::isBeingLoaded() const
+bool Player::IsLoading() const
{
return GetSession()->PlayerLoading();
}
-bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
+bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder)
{
//// 0 1 2 3 4 5 6 7 8 9 10 11
//QueryResult* result = CharacterDatabase.PQuery("SELECT guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, "
@@ -17198,7 +17198,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
{
std::string name = "<unknown>";
sObjectMgr->GetPlayerNameByGUID(guid, name);
- TC_LOG_ERROR("entities.player", "Player %s (GUID: %u) not found in table `characters`, can't load. ", name.c_str(), guid);
+ TC_LOG_ERROR("entities.player", "Player %s %s not found in table `characters`, can't load. ", name.c_str(), guid.ToString().c_str());
return false;
}
@@ -17210,17 +17210,17 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// player should be able to load/delete character only with correct account!
if (dbAccountId != GetSession()->GetAccountId())
{
- TC_LOG_ERROR("entities.player", "Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId);
+ TC_LOG_ERROR("entities.player", "Player %s loading from wrong account (is: %u, should be: %u)", guid.ToString().c_str(), GetSession()->GetAccountId(), dbAccountId);
return false;
}
if (holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BANNED))
{
- TC_LOG_ERROR("entities.player", "Player (GUID: %u) is banned, can't load.", guid);
+ TC_LOG_ERROR("entities.player", "%s is banned, can't load.", guid.ToString().c_str());
return false;
}
- Object::_Create(guid, 0, HIGHGUID_PLAYER);
+ Object::_Create(guid.GetCounter(), 0, HIGHGUID_PLAYER);
m_name = fields[2].GetString();
@@ -17231,18 +17231,18 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
- stmt->setUInt32(1, guid);
+ stmt->setUInt32(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
return false;
}
// overwrite possible wrong/corrupted guid
- SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
+ SetGuidValue(OBJECT_FIELD_GUID, guid);
uint8 gender = fields[5].GetUInt8();
if (!IsValidGender(gender))
{
- TC_LOG_ERROR("entities.player", "Player (GUID: %u) has wrong gender (%u), can't be loaded.", guid, gender);
+ TC_LOG_ERROR("entities.player", "Player %s has wrong gender (%u), can't be loaded.", guid.ToString().c_str(), gender);
return false;
}
@@ -17257,7 +17257,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
if (!info)
{
- TC_LOG_ERROR("entities.player", "Player (GUID: %u) has wrong race/class (%u/%u), can't be loaded.", guid, getRace(), getClass());
+ TC_LOG_ERROR("entities.player", "Player %s has wrong race/class (%u/%u), can't be loaded.", guid.ToString().c_str(), getRace(), getClass());
return false;
}
@@ -17293,7 +17293,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// cleanup inventory related item value fields (its will be filled correctly in _LoadInventory)
for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
{
- SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0);
+ SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid::Empty);
SetVisibleItemSlot(slot, NULL);
delete m_items[slot];
@@ -17367,7 +17367,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || !IsPositionValid())
{
- TC_LOG_ERROR("entities.player", "Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ TC_LOG_ERROR("entities.player", "Player %s have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.",
+ guid.ToString().c_str(), mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
RelocateToHomebind();
}
// Player was saved in Arena or Bg
@@ -17407,7 +17408,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
//if (mapId == MAPID_INVALID) -- code kept for reference
if (int16(mapId) == int16(-1)) // Battleground Entry Point not found (???)
{
- TC_LOG_ERROR("entities.player", "Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", guid);
+ TC_LOG_ERROR("entities.player", "Player %s was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.",
+ guid.ToString().c_str());
RelocateToHomebind();
}
else
@@ -17420,7 +17422,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// currently we do not support transport in bg
else if (transLowGUID)
{
- uint64 transGUID = MAKE_NEW_GUID(transLowGUID, 0, HIGHGUID_MO_TRANSPORT);
+ ObjectGuid transGUID(HIGHGUID_MO_TRANSPORT, transLowGUID);
Transport* transport = NULL;
if (GameObject* go = HashMapHolder<GameObject>::Find(transGUID))
@@ -17438,8 +17440,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
std::fabs(m_movementInfo.transport.pos.GetPositionY()) > 250.0f ||
std::fabs(m_movementInfo.transport.pos.GetPositionZ()) > 250.0f)
{
- TC_LOG_ERROR("entities.player", "Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.",
- guid, x, y, z, o);
+ TC_LOG_ERROR("entities.player", "Player %s have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.",
+ guid.ToString().c_str(), x, y, z, o);
m_movementInfo.transport.Reset();
@@ -17564,7 +17566,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
}
else
{
- TC_LOG_ERROR("entities.player", "Player %s (guid: %d) Map: %u, X: %f, Y: %f, Z: %f, O: %f. Areatrigger not found.", m_name.c_str(), guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ TC_LOG_ERROR("entities.player", "Player %s %s Map: %u, X: %f, Y: %f, Z: %f, O: %f. Areatrigger not found.",
+ m_name.c_str(), guid.ToString().c_str(), mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
map = NULL;
}
}
@@ -17576,7 +17579,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
map = sMapMgr->CreateMap(mapId, this);
if (!map)
{
- TC_LOG_ERROR("entities.player", "Player %s (guid: %d) Map: %u, X: %f, Y: %f, Z: %f, O: %f. Invalid default map coordinates or instance couldn't be created.", m_name.c_str(), guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ TC_LOG_ERROR("entities.player", "Player %s %s Map: %u, X: %f, Y: %f, Z: %f, O: %f. Invalid default map coordinates or instance couldn't be created.",
+ m_name.c_str(), guid.ToString().c_str(), mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
return false;
}
}
@@ -17641,16 +17645,16 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
m_deathExpireTime = now + MAX_DEATH_COUNT * DEATH_EXPIRE_STEP - 1;
// clear channel spell data (if saved at channel spell casting)
- SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0);
+ SetChannelObjectGuid(ObjectGuid::Empty);
SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
// clear charm/summon related fields
- SetOwnerGUID(0);
- SetUInt64Value(UNIT_FIELD_CHARMEDBY, 0);
- SetUInt64Value(UNIT_FIELD_CHARM, 0);
- SetUInt64Value(UNIT_FIELD_SUMMON, 0);
- SetUInt64Value(PLAYER_FARSIGHT, 0);
- SetCreatorGUID(0);
+ SetOwnerGUID(ObjectGuid::Empty);
+ SetGuidValue(UNIT_FIELD_CHARMEDBY, ObjectGuid::Empty);
+ SetGuidValue(UNIT_FIELD_CHARM, ObjectGuid::Empty);
+ SetGuidValue(UNIT_FIELD_SUMMON, ObjectGuid::Empty);
+ SetGuidValue(PLAYER_FARSIGHT, ObjectGuid::Empty);
+ SetCreatorGUID(ObjectGuid::Empty);
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
@@ -17662,7 +17666,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
ClearInCombat();
// make sure the unit is considered not in duel for proper loading
- SetUInt64Value(PLAYER_DUEL_ARBITER, 0);
+ SetGuidValue(PLAYER_DUEL_ARBITER, ObjectGuid::Empty);
SetUInt32Value(PLAYER_DUEL_TEAM, 0);
// reset stats before loading any modifiers
@@ -17950,7 +17954,7 @@ bool Player::isAllowedToLoot(const Creature* creature)
case ROUND_ROBIN:
// may only loot if the player is the loot roundrobin player
// or if there are free/quest/conditional item for the player
- if (loot->roundRobinPlayer == 0 || loot->roundRobinPlayer == GetGUID())
+ if (loot->roundRobinPlayer.IsEmpty() || loot->roundRobinPlayer == GetGUID())
return true;
return loot->hasItemFor(this);
@@ -17959,7 +17963,7 @@ bool Player::isAllowedToLoot(const Creature* creature)
// may only loot if the player is the loot roundrobin player
// or item over threshold (so roll(s) can be launched)
// or if there are free/quest/conditional item for the player
- if (loot->roundRobinPlayer == 0 || loot->roundRobinPlayer == GetGUID())
+ if (loot->roundRobinPlayer.IsEmpty() || loot->roundRobinPlayer == GetGUID())
return true;
if (loot->hasOverThresholdItem())
@@ -18014,7 +18018,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
Field* fields = result->Fetch();
int32 damage[3];
int32 baseDamage[3];
- uint64 caster_guid = fields[0].GetUInt64();
+ ObjectGuid caster_guid(fields[0].GetUInt64());
uint32 spellid = fields[1].GetUInt32();
uint8 effmask = fields[2].GetUInt8();
uint8 recalculatemask = fields[3].GetUInt8();
@@ -18261,7 +18265,7 @@ void Player::_LoadVoidStorage(PreparedQueryResult result)
uint64 itemId = fields[0].GetUInt64();
uint32 itemEntry = fields[1].GetUInt32();
uint8 slot = fields[2].GetUInt8();
- uint32 creatorGuid = fields[3].GetUInt32();
+ ObjectGuid creatorGuid(HIGHGUID_PLAYER, fields[3].GetUInt32());
uint32 randomProperty = fields[4].GetUInt32();
uint32 suffixFactor = fields[5].GetUInt32();
@@ -18287,7 +18291,7 @@ void Player::_LoadVoidStorage(PreparedQueryResult result)
if (creatorGuid && !sObjectMgr->GetPlayerNameByGUID(creatorGuid, name))
{
TC_LOG_ERROR("entities.player", "Player::_LoadVoidStorage - Player (GUID: %u, name: %s) has an item with an invalid creator guid, set to 0 (item id: " UI64FMTD ", entry: %u, creatorGuid: %u).", GetGUIDLow(), GetName().c_str(), itemId, itemEntry, creatorGuid);
- creatorGuid = 0;
+ creatorGuid.Clear();
}
_voidStorageItems[slot] = new VoidStorageItem(itemId, itemEntry, creatorGuid, randomProperty, suffixFactor);
@@ -18345,7 +18349,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
item->SetRefundRecipient((*result)[0].GetUInt32());
item->SetPaidMoney((*result)[1].GetUInt32());
item->SetPaidExtendedCost((*result)[2].GetUInt16());
- AddRefundReference(item->GetGUIDLow());
+ AddRefundReference(item->GetGUID());
}
else
{
@@ -18459,7 +18463,7 @@ void Player::_LoadMailedItems(Mail* mail)
Item* item = NewItemOrBag(proto);
- if (!item->LoadFromDB(itemGuid, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, itemTemplate))
+ if (!item->LoadFromDB(itemGuid, ObjectGuid(HIGHGUID_PLAYER, fields[13].GetUInt32()), fields, itemTemplate))
{
TC_LOG_ERROR("entities.player", "Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid);
@@ -18885,7 +18889,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
}
else if (!perm && group)
{
- TC_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d (%s), %d, %d", GetName().c_str(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, mapname.c_str(), instanceId, difficulty);
+ TC_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d (%s), %d, %d", GetName().c_str(), GetGUIDLow(), group->GetLowGUID(), mapId, mapname.c_str(), instanceId, difficulty);
deleteInstance = true;
}
}
@@ -19190,7 +19194,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
uint32 missingAchievement = 0;
Player* leader = this;
- uint64 leaderGuid = GetGroup() ? GetGroup()->GetLeaderGUID() : GetGUID();
+ ObjectGuid leaderGuid = GetGroup() ? GetGroup()->GetLeaderGUID() : GetGUID();
if (leaderGuid != GetGUID())
leader = ObjectAccessor::FindPlayer(leaderGuid);
@@ -19740,8 +19744,8 @@ void Player::_SaveAuras(SQLTransaction& trans)
uint8 index = 0;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AURA);
stmt->setUInt32(index++, GetGUIDLow());
- stmt->setUInt64(index++, itr->second->GetCasterGUID());
- stmt->setUInt64(index++, itr->second->GetCastItemGUID());
+ stmt->setUInt64(index++, itr->second->GetCasterGUID().GetRawValue());
+ stmt->setUInt64(index++, itr->second->GetCastItemGUID().GetRawValue());
stmt->setUInt32(index++, itr->second->GetId());
stmt->setUInt8(index++, effMask);
stmt->setUInt8(index++, recalculateMask);
@@ -19784,14 +19788,14 @@ void Player::_SaveInventory(SQLTransaction& trans)
// the client auto counts down in real time after having received the initial played time on the first
// SMSG_ITEM_REFUND_INFO_RESPONSE packet.
// Item::UpdatePlayedTime is only called when needed, which is in DB saves, and item refund info requests.
- std::set<uint32>::iterator i_next;
- for (std::set<uint32>::iterator itr = m_refundableItems.begin(); itr!= m_refundableItems.end(); itr = i_next)
+ GuidSet::iterator i_next;
+ for (GuidSet::iterator itr = m_refundableItems.begin(); itr!= m_refundableItems.end(); itr = i_next)
{
// use copy iterator because itr may be invalid after operations in this loop
i_next = itr;
++i_next;
- Item* iPtr = GetItemByGuid(MAKE_NEW_GUID(*itr, 0, HIGHGUID_ITEM));
+ Item* iPtr = GetItemByGuid(*itr);
if (iPtr)
{
iPtr->UpdatePlayedTime(this);
@@ -19799,7 +19803,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
}
else
{
- TC_LOG_ERROR("entities.player", "Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow());
+ TC_LOG_ERROR("entities.player", "Can't find %s but is in refundable storage for player %u ! Removing.", itr->ToString().c_str(), GetGUIDLow());
m_refundableItems.erase(itr);
}
}
@@ -19840,7 +19844,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
// also THIS item should be somewhere else, cheat attempt
item->FSetState(ITEM_REMOVED); // we are IN updateQueue right now, can't use SetState which modifies the queue
- DeleteRefundReference(item->GetGUIDLow());
+ DeleteRefundReference(item->GetGUID());
// don't skip, let the switch delete it
//continue;
}
@@ -19901,7 +19905,7 @@ void Player::_SaveVoidStorage(SQLTransaction& trans)
stmt->setUInt32(1, lowGuid);
stmt->setUInt32(2, _voidStorageItems[i]->ItemEntry);
stmt->setUInt8(3, i);
- stmt->setUInt32(4, _voidStorageItems[i]->CreatorGuid);
+ stmt->setUInt32(4, _voidStorageItems[i]->CreatorGuid.GetCounter());
stmt->setUInt32(5, _voidStorageItems[i]->ItemRandomPropertyId);
stmt->setUInt32(6, _voidStorageItems[i]->ItemSuffixFactor);
}
@@ -20415,7 +20419,7 @@ void Player::SendAttackSwingNotInRange()
GetSession()->SendPacket(&data);
}
-void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid)
+void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_POSITION);
@@ -20425,7 +20429,7 @@ void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o,
stmt->setFloat(3, o);
stmt->setUInt16(4, uint16(mapid));
stmt->setUInt16(5, uint16(zone));
- stmt->setUInt32(6, GUID_LOPART(guid));
+ stmt->setUInt32(6, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -20441,10 +20445,10 @@ void Player::SetUInt32ValueInArray(Tokenizer& Tokenizer, uint16 index, uint32 va
Tokenizer[index] = buf;
}
-void Player::Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair)
+void Player::Customize(ObjectGuid guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PLAYERBYTES2);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
@@ -20461,7 +20465,7 @@ void Player::Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8
stmt->setUInt8(0, gender);
stmt->setUInt32(1, skin | (face << 8) | (hairStyle << 16) | (hairColor << 24));
stmt->setUInt32(2, playerBytes2);
- stmt->setUInt32(3, GUID_LOPART(guid));
+ stmt->setUInt32(3, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -20493,7 +20497,7 @@ void Player::SendAttackSwingBadFacingAttack()
void Player::SendAutoRepeatCancel(Unit* target)
{
WorldPacket data(SMSG_CANCEL_AUTO_REPEAT, target->GetPackGUID().size());
- data.append(target->GetPackGUID()); // may be it's target guid
+ data << target->GetPackGUID(); // may be it's target guid
GetSession()->SendPacket(&data);
}
@@ -20662,9 +20666,9 @@ void Player::UpdateDuelFlag(time_t currTime)
Pet* Player::GetPet() const
{
- if (uint64 pet_guid = GetPetGUID())
+ if (ObjectGuid pet_guid = GetPetGUID())
{
- if (!IS_PET_GUID(pet_guid))
+ if (!pet_guid.IsPet())
return NULL;
Pet* pet = ObjectAccessor::GetPet(*this, pet_guid);
@@ -20778,10 +20782,10 @@ void Player::StopCastingCharm()
if (GetCharmGUID())
{
- TC_LOG_FATAL("entities.player", "Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName().c_str(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId());
+ TC_LOG_FATAL("entities.player", "Player %s (%s) is not able to uncharm unit (%s)", GetName().c_str(), GetGUID().ToString().c_str(), GetCharmGUID().ToString().c_str());
if (charm->GetCharmerGUID())
{
- TC_LOG_FATAL("entities.player", "Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID());
+ TC_LOG_FATAL("entities.player", "Charmed unit has charmer %s", charm->GetCharmerGUID().ToString().c_str());
ASSERT(false);
}
else
@@ -20984,7 +20988,7 @@ void Player::PossessSpellInitialize()
if (!charmInfo)
{
- TC_LOG_ERROR("entities.player", "Player::PossessSpellInitialize(): charm (" UI64FMTD ") has no charminfo!", charm->GetGUID());
+ TC_LOG_ERROR("entities.player", "Player::PossessSpellInitialize(): charm (%s) has no charminfo!", charm->GetGUID().ToString().c_str());
return;
}
@@ -21096,7 +21100,7 @@ void Player::CharmSpellInitialize()
CharmInfo* charmInfo = charm->GetCharmInfo();
if (!charmInfo)
{
- TC_LOG_ERROR("entities.player", "Player::CharmSpellInitialize(): the player's charm (" UI64FMTD ") has no charminfo!", charm->GetGUID());
+ TC_LOG_ERROR("entities.player", "Player::CharmSpellInitialize(): the player's charm (%s) has no charminfo!", charm->GetGUID().ToString().c_str());
return;
}
@@ -21348,7 +21352,7 @@ void Player::SendProficiency(ItemClass itemClass, uint32 itemSubclassMask)
GetSession()->SendPacket(&data);
}
-void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
+void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
{
PreparedStatement* stmt;
@@ -21360,7 +21364,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
stmt->setUInt8(1, uint8(type));
}
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
@@ -21368,8 +21372,8 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
do // this part effectively does nothing, since the deletion / modification only takes place _after_ the PetitionQuery. Though I don't know if the result remains intact if I execute the delete query beforehand.
{ // and SendPetitionQueryOpcode reads data from the DB
Field* fields = result->Fetch();
- uint64 ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
- uint64 petitionguid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_ITEM);
+ ObjectGuid ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
+ ObjectGuid petitionguid = ObjectGuid(HIGHGUID_ITEM, fields[1].GetUInt32());
// send update if charter owner in game
Player* owner = ObjectAccessor::FindPlayer(ownerguid);
@@ -21381,7 +21385,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_PETITION_SIGNATURES);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -21389,7 +21393,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
stmt->setUInt8(1, uint8(type));
CharacterDatabase.Execute(stmt);
@@ -21400,32 +21404,32 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
if (type == 10)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
trans->Append(stmt);
}
else
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER_AND_TYPE);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
stmt->setUInt8(1, uint8(type));
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER_AND_TYPE);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
stmt->setUInt8(1, uint8(type));
trans->Append(stmt);
}
CharacterDatabase.CommitTransaction(trans);
}
-void Player::LeaveAllArenaTeams(uint64 guid)
+void Player::LeaveAllArenaTeams(ObjectGuid guid)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PLAYER_ARENA_TEAMS);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
@@ -21910,13 +21914,13 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
it->SetPaidMoney(price);
it->SetPaidExtendedCost(crItem->ExtendedCost);
it->SaveRefundDataToDB();
- AddRefundReference(it->GetGUIDLow());
+ AddRefundReference(it->GetGUID());
}
}
return true;
}
-bool Player::BuyCurrencyFromVendorSlot(uint64 vendorGuid, uint32 vendorSlot, uint32 currency, uint32 count)
+bool Player::BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot, uint32 currency, uint32 count)
{
// cheating attempt
if (count < 1) count = 1;
@@ -21934,7 +21938,7 @@ bool Player::BuyCurrencyFromVendorSlot(uint64 vendorGuid, uint32 vendorSlot, uin
Creature* creature = GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: BuyCurrencyFromVendorSlot - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(vendorGuid));
+ TC_LOG_DEBUG("network", "WORLD: BuyCurrencyFromVendorSlot - %s not found or you can't interact with him.", vendorGuid.ToString().c_str());
SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, NULL, currency, 0);
return false;
}
@@ -22076,7 +22080,7 @@ bool Player::BuyCurrencyFromVendorSlot(uint64 vendorGuid, uint32 vendorSlot, uin
}
// Return true is the bought item has a max count to force refresh of window by caller
-bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
+bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
{
// cheating attempt
if (count < 1) count = 1;
@@ -22107,7 +22111,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
Creature* creature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)));
+ TC_LOG_DEBUG("network", "WORLD: BuyItemFromVendor - %s not found or you can't interact with him.", vendorguid.ToString().c_str());
SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0);
return false;
}
@@ -22961,7 +22965,7 @@ bool Player::CanAlwaysSee(WorldObject const* obj) const
if (m_mover == obj)
return true;
- if (uint64 guid = GetUInt64Value(PLAYER_FARSIGHT))
+ if (ObjectGuid guid = GetGuidValue(PLAYER_FARSIGHT))
if (obj->GetGUID() == guid)
return true;
@@ -23006,13 +23010,13 @@ bool Player::IsVisibleGloballyFor(Player const* u) const
}
template<class T>
-inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, T* target, std::set<Unit*>& /*v*/)
+inline void UpdateVisibilityOf_helper(GuidSet& s64, T* target, std::set<Unit*>& /*v*/)
{
s64.insert(target->GetGUID());
}
template<>
-inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, GameObject* target, std::set<Unit*>& /*v*/)
+inline void UpdateVisibilityOf_helper(GuidSet& s64, GameObject* target, std::set<Unit*>& /*v*/)
{
// @HACK: This is to prevent objects like deeprun tram from disappearing when player moves far from its spawn point while riding it
if ((target->GetGOInfo()->type != GAMEOBJECT_TYPE_TRANSPORT))
@@ -23020,14 +23024,14 @@ inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, GameObject* target,
}
template<>
-inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, Creature* target, std::set<Unit*>& v)
+inline void UpdateVisibilityOf_helper(GuidSet& s64, Creature* target, std::set<Unit*>& v)
{
s64.insert(target->GetGUID());
v.insert(target);
}
template<>
-inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, Player* target, std::set<Unit*>& v)
+inline void UpdateVisibilityOf_helper(GuidSet& s64, Player* target, std::set<Unit*>& v)
{
s64.insert(target->GetGUID());
v.insert(target);
@@ -23089,9 +23093,9 @@ void Player::UpdateTriggerVisibility()
UpdateData udata(GetMapId());
WorldPacket packet;
- for (ClientGUIDs::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
+ for (GuidSet::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
{
- if (IS_CREATURE_GUID(*itr))
+ if (itr->IsCreature())
{
Creature* creature = GetMap()->GetCreature(*itr);
// Update fields of triggers, transformed units or unselectable units (values dependent on GM state)
@@ -23102,7 +23106,7 @@ void Player::UpdateTriggerVisibility()
creature->BuildValuesUpdateBlockForPlayer(&udata, this);
creature->RemoveFieldNotifyFlag(UF_FLAG_PUBLIC);
}
- else if (IS_GAMEOBJECT_GUID((*itr)))
+ else if (itr->IsGameObject())
{
GameObject* go = GetMap()->GetGameObject(*itr);
if (!go)
@@ -23239,14 +23243,14 @@ bool Player::IsQuestRewarded(uint32 quest_id) const
Unit* Player::GetSelectedUnit() const
{
- if (uint64 selectionGUID = GetUInt64Value(UNIT_FIELD_TARGET))
+ if (ObjectGuid selectionGUID = GetTarget())
return ObjectAccessor::GetUnit(*this, selectionGUID);
return NULL;
}
Player* Player::GetSelectedPlayer() const
{
- if (uint64 selectionGUID = GetUInt64Value(UNIT_FIELD_TARGET))
+ if (ObjectGuid selectionGUID = GetTarget())
return ObjectAccessor::GetPlayer(*this, selectionGUID);
return NULL;
}
@@ -23260,11 +23264,11 @@ void Player::SendComboPoints()
if (m_mover != this)
{
data.Initialize(SMSG_PET_UPDATE_COMBO_POINTS, m_mover->GetPackGUID().size()+combotarget->GetPackGUID().size()+1);
- data.append(m_mover->GetPackGUID());
+ data << m_mover->GetPackGUID();
}
else
data.Initialize(SMSG_UPDATE_COMBO_POINTS, combotarget->GetPackGUID().size()+1);
- data.append(combotarget->GetPackGUID());
+ data << combotarget->GetPackGUID();
data << uint8(m_comboPoints);
GetSession()->SendPacket(&data);
}
@@ -23286,7 +23290,7 @@ void Player::AddComboPoints(Unit* target, int8 count, Spell* spell)
{
if (m_comboTarget)
if (Unit* target2 = ObjectAccessor::GetUnit(*this, m_comboTarget))
- target2->RemoveComboPointHolder(GetGUIDLow());
+ target2->RemoveComboPointHolder(GetGUID());
// Spells will always add value to m_comboPoints eventualy, so it must be cleared first
if (spell)
@@ -23295,7 +23299,7 @@ void Player::AddComboPoints(Unit* target, int8 count, Spell* spell)
m_comboTarget = target->GetGUID();
*comboPoints = count;
- target->AddComboPointHolder(GetGUIDLow());
+ target->AddComboPointHolder(GetGUID());
}
if (*comboPoints > 5)
@@ -23332,9 +23336,9 @@ void Player::ClearComboPoints()
SendComboPoints();
if (Unit* target = ObjectAccessor::GetUnit(*this, m_comboTarget))
- target->RemoveComboPointHolder(GetGUIDLow());
+ target->RemoveComboPointHolder(GetGUID());
- m_comboTarget = 0;
+ m_comboTarget.Clear();
}
void Player::SetGroup(Group* group, int8 subgroup)
@@ -23841,7 +23845,7 @@ void Player::SendAurasForTarget(Unit* target)
target->SetHover(true, true);
WorldPacket data(SMSG_AURA_UPDATE_ALL);
- data.append(target->GetPackGUID());
+ data << target->GetPackGUID();
Unit::VisibleAuraMap const* visibleAuras = target->GetVisibleAuras();
for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
@@ -24149,14 +24153,14 @@ void Player::UpdateForQuestWorldObjects()
UpdateData udata(GetMapId());
WorldPacket packet;
- for (ClientGUIDs::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
+ for (GuidSet::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
{
- if (IS_GAMEOBJECT_GUID(*itr))
+ if (itr->IsGameObject())
{
if (GameObject* obj = HashMapHolder<GameObject>::Find(*itr))
obj->BuildValuesUpdateBlockForPlayer(&udata, this);
}
- else if (IS_CRE_OR_VEH_GUID(*itr))
+ else if (itr->IsCreatureOrVehicle())
{
Creature* obj = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, *itr);
if (!obj)
@@ -24497,7 +24501,8 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
{
if (!pRewardSource)
return;
- uint64 creature_guid = (pRewardSource->GetTypeId() == TYPEID_UNIT) ? pRewardSource->GetGUID() : uint64(0);
+
+ ObjectGuid creature_guid = (pRewardSource->GetTypeId() == TYPEID_UNIT) ? pRewardSource->GetGUID() : ObjectGuid::Empty;
// prepare data for near group iteration
if (Group* group = GetGroup())
@@ -24587,7 +24592,7 @@ void Player::ResurrectUsingRequestData()
void Player::SetClientControl(Unit* target, bool allowMove)
{
WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, target->GetPackGUID().size()+1);
- data.append(target->GetPackGUID());
+ data << target->GetPackGUID();
data << uint8(allowMove ? 1 : 0);
GetSession()->SendPacket(&data);
@@ -24793,7 +24798,7 @@ PartyResult Player::CanUninviteFromGroup() const
if (grp->isLFGGroup())
{
- uint64 gguid = grp->GetGUID();
+ ObjectGuid gguid = grp->GetGUID();
if (!sLFGMgr->GetKicksLeft(gguid))
return ERR_PARTY_LFG_BOOT_LIMIT;
@@ -25001,7 +25006,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
{
TC_LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName().c_str(), target->GetEntry(), target->GetTypeId());
- if (!AddUInt64Value(PLAYER_FARSIGHT, target->GetGUID()))
+ if (!AddGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
{
TC_LOG_FATAL("entities.player", "Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName().c_str());
return;
@@ -25017,7 +25022,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
{
TC_LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s remove seer", GetName().c_str());
- if (!RemoveUInt64Value(PLAYER_FARSIGHT, target->GetGUID()))
+ if (!RemoveGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
{
TC_LOG_FATAL("entities.player", "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName().c_str());
return;
@@ -25036,7 +25041,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
WorldObject* Player::GetViewpoint() const
{
- if (uint64 guid = GetUInt64Value(PLAYER_FARSIGHT))
+ if (ObjectGuid guid = GetGuidValue(PLAYER_FARSIGHT))
return (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_SEER);
return NULL;
}
@@ -25960,7 +25965,7 @@ bool Player::LearnTalent(uint32 talentId, uint32 talentRank)
return true;
}
-void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
+void Player::LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRank)
{
Pet* pet = GetPet();
@@ -26356,7 +26361,7 @@ void Player::BuildEnchantmentsInfoData(WorldPacket* data)
data->put<uint16>(enchantmentMaskPos, enchantmentMask);
*data << uint16(0); // unknown
- data->appendPackGUID(item->GetUInt64Value(ITEM_FIELD_CREATOR)); // item creator
+ *data << item->GetGuidValue(ITEM_FIELD_CREATOR).WriteAsPacked(); // item creator
*data << uint32(0); // seed?
}
@@ -26383,7 +26388,7 @@ void Player::SendEquipmentSetList()
if (itr->second.IgnoreMask & (1 << i))
data.appendPackGUID(uint64(1));
else
- data.appendPackGUID(MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM));
+ data << ObjectGuid(HIGHGUID_ITEM, 0, itr->second.Items[i]).WriteAsPacked();
}
++count; // client have limit but it checked at loading and set
@@ -26546,7 +26551,7 @@ void Player::SendClearCooldown(uint32 spell_id, Unit* target)
void Player::SendClearAllCooldowns(Unit* target)
{
uint32 spellCount = m_spellCooldowns.size();
- ObjectGuid guid = target ? target->GetGUID() : 0;
+ ObjectGuid guid = target ? target->GetGUID() : ObjectGuid::Empty;
WorldPacket data(SMSG_CLEAR_COOLDOWNS, 4+8);
data.WriteBit(guid[1]);
@@ -26950,18 +26955,16 @@ void Player::SendDuelCountdown(uint32 counter)
GetSession()->SendPacket(&data);
}
-void Player::AddRefundReference(uint32 it)
+void Player::AddRefundReference(ObjectGuid it)
{
m_refundableItems.insert(it);
}
-void Player::DeleteRefundReference(uint32 it)
+void Player::DeleteRefundReference(ObjectGuid it)
{
- std::set<uint32>::iterator itr = m_refundableItems.find(it);
+ GuidSet::iterator itr = m_refundableItems.find(it);
if (itr != m_refundableItems.end())
- {
m_refundableItems.erase(itr);
- }
}
void Player::SendRefundInfo(Item* item)
@@ -27305,9 +27308,9 @@ void Player::_SaveInstanceTimeRestrictions(SQLTransaction& trans)
}
}
-bool Player::IsInWhisperWhiteList(uint64 guid)
+bool Player::IsInWhisperWhiteList(ObjectGuid guid)
{
- for (WhisperListContainer::const_iterator itr = WhisperList.begin(); itr != WhisperList.end(); ++itr)
+ for (GuidList::const_iterator itr = WhisperList.begin(); itr != WhisperList.end(); ++itr)
if (*itr == guid)
return true;
@@ -27609,11 +27612,6 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
return pet;
}
-bool Player::IsLoading() const
-{
- return GetSession()->PlayerLoading();
-}
-
bool Player::CanUseMastery() const
{
return HasSpell(MasterySpells[getClass()]);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 26f6945dd52..e2395b6d734 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -181,8 +181,6 @@ typedef std::unordered_map<uint32, PlayerSpell*> PlayerSpellMap;
typedef std::list<SpellModifier*> SpellModList;
typedef std::unordered_map<uint32, PlayerCurrency> PlayerCurrenciesMap;
-typedef std::list<uint64> WhisperListContainer;
-
/// Maximum number of CompactUnitFrames profiles
#define MAX_CUF_PROFILES 5
@@ -1071,7 +1069,7 @@ struct BGData
struct TradeStatusInfo
{
- TradeStatusInfo() : Status(TRADE_STATUS_BUSY), TraderGuid(0), Result(EQUIP_ERR_OK),
+ TradeStatusInfo() : Status(TRADE_STATUS_BUSY), TraderGuid(), Result(EQUIP_ERR_OK),
IsTargetResult(false), ItemLimitCategoryId(0), Slot(0) { }
TradeStatus Status;
@@ -1088,12 +1086,11 @@ struct VoidStorageItem
{
ItemId = 0;
ItemEntry = 0;
- CreatorGuid = 0;
ItemRandomPropertyId = 0;
ItemSuffixFactor = 0;
}
- VoidStorageItem(uint64 id, uint32 entry, uint32 creator, uint32 randomPropertyId, uint32 suffixFactor)
+ VoidStorageItem(uint64 id, uint32 entry, ObjectGuid creator, uint32 randomPropertyId, uint32 suffixFactor)
{
ItemId = id;
ItemEntry = entry;
@@ -1104,7 +1101,7 @@ struct VoidStorageItem
uint64 ItemId;
uint32 ItemEntry;
- uint32 CreatorGuid;
+ ObjectGuid CreatorGuid;
uint32 ItemRandomPropertyId;
uint32 ItemSuffixFactor;
};
@@ -1114,21 +1111,21 @@ class TradeData
public: // constructors
TradeData(Player* player, Player* trader) :
m_player(player), m_trader(trader), m_accepted(false), m_acceptProccess(false),
- m_money(0), m_spell(0), m_spellCastItem(0) { memset(m_items, 0, TRADE_SLOT_COUNT * sizeof(uint64)); }
+ m_money(0), m_spell(0), m_spellCastItem() { }
Player* GetTrader() const { return m_trader; }
TradeData* GetTraderData() const;
Item* GetItem(TradeSlots slot) const;
- bool HasItem(uint64 itemGuid) const;
- TradeSlots GetTradeSlotForItem(uint64 itemGuid) const;
+ bool HasItem(ObjectGuid itemGuid) const;
+ TradeSlots GetTradeSlotForItem(ObjectGuid itemGuid) const;
void SetItem(TradeSlots slot, Item* item);
uint32 GetSpell() const { return m_spell; }
void SetSpell(uint32 spell_id, Item* castItem = NULL);
Item* GetSpellCastItem() const;
- bool HasSpellCastItem() const { return m_spellCastItem != 0; }
+ bool HasSpellCastItem() const { return !m_spellCastItem.IsEmpty(); }
uint64 GetMoney() const { return m_money; }
void SetMoney(uint64 money);
@@ -1154,14 +1151,14 @@ class TradeData
uint64 m_money; // m_player place money to trade
uint32 m_spell; // m_player apply spell to non-traded slot item
- uint64 m_spellCastItem; // applied spell cast by item use
+ ObjectGuid m_spellCastItem; // applied spell cast by item use
- uint64 m_items[TRADE_SLOT_COUNT]; // traded items from m_player side including non-traded slot
+ ObjectGuid m_items[TRADE_SLOT_COUNT]; // traded items from m_player side including non-traded slot
};
struct ResurrectionData
{
- uint64 GUID;
+ ObjectGuid GUID;
WorldLocation Location;
uint32 Health;
uint32 Mana;
@@ -1290,8 +1287,8 @@ class Player : public Unit, public GridObject<Player>
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time);
bool CanInteractWithQuestGiver(Object* questGiver);
- Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
- GameObject* GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const;
+ Creature* GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask);
+ GameObject* GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const;
void ToggleAFK();
void ToggleDND();
@@ -1381,7 +1378,7 @@ class Player : public Unit, public GridObject<Player>
uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const;
uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = NULL) const;
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const;
- Item* GetItemByGuid(uint64 guid) const;
+ Item* GetItemByGuid(ObjectGuid guid) const;
Item* GetItemByEntry(uint32 entry) const;
Item* GetItemByPos(uint16 pos) const;
Item* GetItemByPos(uint8 bag, uint8 slot) const;
@@ -1438,8 +1435,8 @@ class Player : public Unit, public GridObject<Player>
InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL, uint32* itemLimitCategory = NULL) const;
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const;
- void AddRefundReference(uint32 it);
- void DeleteRefundReference(uint32 it);
+ void AddRefundReference(ObjectGuid it);
+ void DeleteRefundReference(ObjectGuid it);
/// send initialization of new currency for client
void SendNewCurrency(uint32 id) const;
@@ -1493,7 +1490,7 @@ class Player : public Unit, public GridObject<Player>
void RemoveItemFromBuyBackSlot(uint32 slot, bool del);
void SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2 = NULL, uint32 itemid = 0);
void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param);
- void SendSellError(SellResult msg, Creature* creature, uint64 guid);
+ void SendSellError(SellResult msg, Creature* creature, ObjectGuid guid);
void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; }
void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; }
uint32 GetWeaponProficiency() const { return m_WeaponProficiency; }
@@ -1501,8 +1498,8 @@ class Player : public Unit, public GridObject<Player>
bool IsUseEquipedWeapon(bool mainhand) const;
bool IsTwoHandUsed() const;
void SendNewItem(Item* item, uint32 count, bool received, bool created, bool broadcast = false);
- bool BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
- bool BuyCurrencyFromVendorSlot(uint64 vendorGuid, uint32 vendorSlot, uint32 currency, uint32 count);
+ bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
+ bool BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot, uint32 currency, uint32 count);
bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
float GetReputationPriceDiscount(Creature const* creature) const;
@@ -1554,10 +1551,10 @@ class Player : public Unit, public GridObject<Player>
int32 GetQuestLevel(Quest const* quest) const { return quest && (quest->GetQuestLevel() > 0) ? quest->GetQuestLevel() : getLevel(); }
- void PrepareQuestMenu(uint64 guid);
- void SendPreparedQuest(uint64 guid);
+ void PrepareQuestMenu(ObjectGuid guid);
+ void SendPreparedQuest(ObjectGuid guid);
bool IsActiveQuest(uint32 quest_id) const;
- Quest const* GetNextQuest(uint64 guid, Quest const* quest);
+ Quest const* GetNextQuest(ObjectGuid guid, Quest const* quest);
bool CanSeeStartQuest(Quest const* quest);
bool CanTakeQuest(Quest const* quest, bool msg);
bool CanAddQuest(Quest const* quest, bool msg);
@@ -1624,11 +1621,11 @@ class Player : public Unit, public GridObject<Player>
void GroupEventHappens(uint32 questId, WorldObject const* pEventObject);
void ItemAddedQuestCheck(uint32 entry, uint32 count);
void ItemRemovedQuestCheck(uint32 entry, uint32 count);
- void KilledMonster(CreatureTemplate const* cInfo, uint64 guid);
- void KilledMonsterCredit(uint32 entry, uint64 guid = 0);
+ void KilledMonster(CreatureTemplate const* cInfo, ObjectGuid guid);
+ void KilledMonsterCredit(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
void KilledPlayerCredit();
- void KillCreditGO(uint32 entry, uint64 guid = 0);
- void TalkedToCreature(uint32 entry, uint64 guid);
+ void KillCreditGO(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
+ void TalkedToCreature(uint32 entry, ObjectGuid guid);
void MoneyChanged(uint32 value);
void ReputationChanged(FactionEntry const* factionEntry);
void ReputationChanged2(FactionEntry const* factionEntry);
@@ -1644,11 +1641,11 @@ class Player : public Unit, public GridObject<Player>
void SendCanTakeQuestResponse(QuestFailedReason msg) const;
void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver);
void SendPushToPartyResponse(Player* player, uint8 msg);
- void SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uint32 creatureOrGOIdx, uint16 oldCount, uint16 addCount);
+ void SendQuestUpdateAddCreatureOrGo(Quest const* quest, ObjectGuid guid, uint32 creatureOrGOIdx, uint16 oldCount, uint16 addCount);
void SendQuestUpdateAddPlayer(Quest const* quest, uint16 oldCount, uint16 addCount);
- uint64 GetDivider() const { return m_divider; }
- void SetDivider(uint64 guid) { m_divider = guid; }
+ ObjectGuid GetDivider() const { return m_divider; }
+ void SetDivider(ObjectGuid guid) { m_divider = guid; }
uint32 GetInGameTime() const { return m_ingametime; }
void SetInGameTime(uint32 time) { m_ingametime = time; }
@@ -1673,15 +1670,15 @@ class Player : public Unit, public GridObject<Player>
/*** LOAD SYSTEM ***/
/*********************************************************/
- bool LoadFromDB(uint32 guid, SQLQueryHolder *holder);
- bool isBeingLoaded() const override;
+ bool LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder);
+ bool IsLoading() const override;
void Initialize(uint32 guid);
static uint32 GetUInt32ValueFromArray(Tokenizer const& data, uint16 index);
static float GetFloatValueFromArray(Tokenizer const& data, uint16 index);
- static uint32 GetZoneIdFromDB(uint64 guid);
- static uint32 GetLevelFromDB(uint64 guid);
- static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid);
+ static uint32 GetZoneIdFromDB(ObjectGuid guid);
+ static uint32 GetLevelFromDB(ObjectGuid guid);
+ static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, ObjectGuid guid);
static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE; }
static bool IsValidClass(uint8 Class) { return ((1 << (Class - 1)) & CLASSMASK_ALL_PLAYABLE) != 0; }
@@ -1697,18 +1694,18 @@ class Player : public Unit, public GridObject<Player>
static void SetUInt32ValueInArray(Tokenizer& data, uint16 index, uint32 value);
static void SetFloatValueInArray(Tokenizer& data, uint16 index, float value);
- static void Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair);
- static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid);
+ static void Customize(ObjectGuid guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair);
+ static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid);
- static void DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars = true, bool deleteFinally = false);
+ static void DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRealmChars = true, bool deleteFinally = false);
static void DeleteOldCharacters();
static void DeleteOldCharacters(uint32 keepDays);
bool m_mailsLoaded;
bool m_mailsUpdated;
- void SetBindPoint(uint64 guid);
- void SendTalentWipeConfirm(uint64 guid);
+ void SetBindPoint(ObjectGuid guid);
+ void SendTalentWipeConfirm(ObjectGuid guid);
void ResetPetTalents();
void CalcRage(uint32 damage, bool attacker);
void RegenerateAll();
@@ -1732,11 +1729,11 @@ class Player : public Unit, public GridObject<Player>
Unit* GetSelectedUnit() const;
Player* GetSelectedPlayer() const;
- void SetTarget(uint64 /*guid*/) override { } /// Used for serverside target changes, does not apply to players
- void SetSelection(uint64 guid) { SetUInt64Value(UNIT_FIELD_TARGET, guid); }
+ void SetTarget(ObjectGuid /*guid*/) override { } /// Used for serverside target changes, does not apply to players
+ void SetSelection(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_TARGET, guid); }
uint8 GetComboPoints() const { return m_comboPoints; }
- uint64 GetComboTarget() const { return m_comboTarget; }
+ ObjectGuid GetComboTarget() const { return m_comboTarget; }
void AddComboPoints(Unit* target, int8 count, Spell* spell = NULL);
void GainSpellComboPoints(int8 count);
@@ -1831,7 +1828,7 @@ class Player : public Unit, public GridObject<Player>
void BuildPetTalentsInfoData(WorldPacket* data);
void SendTalentsInfoData(bool pet);
bool LearnTalent(uint32 talentId, uint32 talentRank);
- void LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank);
+ void LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRank);
bool AddTalent(uint32 spellId, uint8 spec, bool learning);
bool HasTalent(uint32 spell_id, uint8 spec) const;
uint32 CalculateTalentsPoints() const;
@@ -1950,7 +1947,7 @@ class Player : public Unit, public GridObject<Player>
bool IsInSameGroupWith(Player const* p) const;
bool IsInSameRaidWith(Player const* p) const;
void UninviteFromGroup();
- static void RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL);
+ static void RemoveFromGroup(Group* group, ObjectGuid guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker = ObjectGuid::Empty, const char* reason = NULL);
void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); }
void SendUpdateToOutOfRangeGroupMembers();
@@ -1962,16 +1959,16 @@ class Player : public Unit, public GridObject<Player>
void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; }
uint32 GetGuildId() const { return GetUInt32Value(OBJECT_FIELD_DATA); /* return only lower part */ }
Guild* GetGuild();
- static uint32 GetGuildIdFromDB(uint64 guid);
- static uint8 GetRankFromDB(uint64 guid);
+ static uint32 GetGuildIdFromDB(ObjectGuid guid);
+ static uint8 GetRankFromDB(ObjectGuid guid);
int GetGuildIdInvited() { return m_GuildIdInvited; }
- static void RemovePetitionsAndSigns(uint64 guid, uint32 type);
+ static void RemovePetitionsAndSigns(ObjectGuid guid, uint32 type);
// Arena Team
void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type);
void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value);
- static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
- static void LeaveAllArenaTeams(uint64 guid);
+ static uint32 GetArenaTeamIdFromDB(ObjectGuid guid, uint8 slot);
+ static void LeaveAllArenaTeams(ObjectGuid guid);
uint32 GetArenaTeamId(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID); }
uint32 GetArenaPersonalRating(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); }
void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
@@ -2048,8 +2045,8 @@ class Player : public Unit, public GridObject<Player>
void UpdateRuneRegen(RuneType rune);
void UpdateAllRunesRegen();
- uint64 GetLootGUID() const { return m_lootGuid; }
- void SetLootGUID(uint64 guid) { m_lootGuid = guid; }
+ ObjectGuid GetLootGUID() const { return m_lootGuid; }
+ void SetLootGUID(ObjectGuid guid) { m_lootGuid = guid; }
void RemovedInsignia(Player* looterPlr);
@@ -2243,9 +2240,9 @@ class Player : public Unit, public GridObject<Player>
PlayerMenu* PlayerTalkClass;
std::vector<ItemSetEffect*> ItemSetEff;
- void SendLoot(uint64 guid, LootType loot_type);
- void SendLootError(uint64 guid, LootError error);
- void SendLootRelease(uint64 guid);
+ void SendLoot(ObjectGuid guid, LootType loot_type);
+ void SendLootError(ObjectGuid guid, LootError error);
+ void SendLootRelease(ObjectGuid guid);
void SendNotifyLootItemRemoved(uint8 lootSlot);
void SendNotifyLootMoneyRemoved();
@@ -2379,8 +2376,7 @@ class Player : public Unit, public GridObject<Player>
WorldLocation GetStartPosition() const;
// currently visible objects at player client
- typedef std::set<uint64> ClientGUIDs;
- ClientGUIDs m_clientGUIDs;
+ GuidSet m_clientGUIDs;
bool HaveAtClient(WorldObject const* u) const;
@@ -2539,9 +2535,9 @@ class Player : public Unit, public GridObject<Player>
bool isDebugAreaTriggers;
void ClearWhisperWhiteList() { WhisperList.clear(); }
- void AddWhisperWhiteList(uint64 guid) { WhisperList.push_back(guid); }
- bool IsInWhisperWhiteList(uint64 guid);
- void RemoveFromWhisperWhiteList(uint64 guid) { WhisperList.remove(guid); }
+ void AddWhisperWhiteList(ObjectGuid guid) { WhisperList.push_back(guid); }
+ bool IsInWhisperWhiteList(ObjectGuid guid);
+ void RemoveFromWhisperWhiteList(ObjectGuid guid) { WhisperList.remove(guid); }
void ReadMovementInfo(WorldPacket& data, MovementInfo* mi, Movement::ExtraMovementStatusElement* extras = NULL);
@@ -2559,8 +2555,6 @@ class Player : public Unit, public GridObject<Player>
std::string GetMapAreaAndZoneString();
std::string GetCoordsMapAreaAndZoneString();
- bool IsLoading() const;
-
// Void Storage
bool IsVoidStorageUnlocked() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED); }
void UnlockVoidStorage() { SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED); }
@@ -2576,7 +2570,7 @@ class Player : public Unit, public GridObject<Player>
protected:
// Gamemaster whisper whitelist
- WhisperListContainer WhisperList;
+ GuidList WhisperList;
uint32 m_regenTimerCount;
uint32 m_holyPowerRegenTimerCount;
uint32 m_focusRegenTimerCount;
@@ -2614,7 +2608,7 @@ class Player : public Unit, public GridObject<Player>
QuestSet m_monthlyquests;
SeasonalEventQuestMap m_seasonalquests;
- uint64 m_divider;
+ ObjectGuid m_divider;
uint32 m_ingametime;
/*********************************************************/
@@ -2692,7 +2686,7 @@ class Player : public Unit, public GridObject<Player>
time_t m_lastHonorUpdateTime;
void outDebugValues() const;
- uint64 m_lootGuid;
+ ObjectGuid m_lootGuid;
uint32 m_team;
uint32 m_nextSave;
@@ -2735,7 +2729,7 @@ class Player : public Unit, public GridObject<Player>
uint32 m_ExtraFlags;
- uint64 m_comboTarget;
+ ObjectGuid m_comboTarget;
int8 m_comboPoints;
QuestStatusMap m_QuestStatus;
@@ -2864,7 +2858,7 @@ class Player : public Unit, public GridObject<Player>
Item* _StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update);
Item* _LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields);
- std::set<uint32> m_refundableItems;
+ GuidSet m_refundableItems;
void SendRefundInfo(Item* item);
void RefundItem(Item* item);
void SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, uint8 error);
diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp
index c351aeac482..af076b8a5fb 100644
--- a/src/server/game/Entities/Player/SocialMgr.cpp
+++ b/src/server/game/Entities/Player/SocialMgr.cpp
@@ -206,7 +206,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri
friendInfo.Level = 0;
friendInfo.Class = 0;
- Player* target = ObjectAccessor::FindPlayer(friendGUID);
+ Player* target = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, friendGUID));
if (!target)
return;
@@ -291,10 +291,10 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
AccountTypes gmSecLevel = AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST));
for (SocialMap::const_iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr)
{
- PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(player->GetGUID());
+ PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(player->GetGUIDLow());
if (itr2 != itr->second.m_playerSocialMap.end() && (itr2->second.Flags & SOCIAL_FLAG_FRIEND))
{
- Player* target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER));
+ Player* target = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, 0, itr->first));
if (!target || !target->IsInWorld())
continue;
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index 92aa34371f8..be5236fbc2e 100644
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
@@ -111,7 +111,7 @@ void Totem::UnSummon(uint32 msTime)
{
if (GetOwner()->m_SummonSlot[i] == GetGUID())
{
- GetOwner()->m_SummonSlot[i] = 0;
+ GetOwner()->m_SummonSlot[i].Clear();
break;
}
}
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 40e073a1500..52553e5f67b 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -619,7 +619,7 @@ bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl
switch (obj->GetTypeId())
{
case TYPEID_UNIT:
- if (!IS_PLAYER_GUID(obj->ToUnit()->GetOwnerGUID())) // pets should be teleported with player
+ if (!obj->ToUnit()->GetOwnerGUID().IsPlayer()) // pets should be teleported with player
obj->ToCreature()->FarTeleportTo(newMap, destX, destY, destZ, destO);
break;
case TYPEID_GAMEOBJECT:
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 13b2a602d31..01978027ff1 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -159,7 +159,7 @@ ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget,
Unit::Unit(bool isWorldObject) :
WorldObject(isWorldObject), m_movedPlayer(NULL), m_lastSanctuaryTime(0),
- IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(0),
+ IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(),
m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()),
i_AI(NULL), i_disabledAI(NULL), m_AutoRepeatFirstCast(false), m_procDeep(0),
m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this),
@@ -190,10 +190,10 @@ Unit::Unit(bool isWorldObject) :
m_currentSpells[i] = NULL;
for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
- m_SummonSlot[i] = 0;
+ m_SummonSlot[i].Clear();
for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
- m_ObjectSlot[i] = 0;
+ m_ObjectSlot[i].Clear();
m_auraUpdateIterator = m_ownedAuras.end();
@@ -652,7 +652,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
TC_LOG_DEBUG("entities.unit", "DealDamageStart");
uint32 health = victim->GetHealth();
- TC_LOG_DEBUG("entities.unit", "Unit " UI64FMTD " dealt %u damage to unit " UI64FMTD, GetGUID(), damage, victim->GetGUID());
+ TC_LOG_DEBUG("entities.unit", "%s dealt %u damage to %s", GetGUID().ToString().c_str(), damage, victim->GetGUID().ToString().c_str());
// duel ends when player has 1 or less hp
bool duel_hasEnded = false;
@@ -816,7 +816,7 @@ void Unit::CastStop(uint32 except_spellid)
InterruptSpell(CurrentSpellTypes(i), false);
}
-void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
if (!spellInfo)
{
@@ -838,12 +838,12 @@ void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo
spell->prepare(&targets, triggeredByAura);
}
-void Unit::CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
CastSpell(victim, spellId, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags /*= TRIGGER_NONE*/, Item* castItem /*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/)
+void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags /*= TRIGGER_NONE*/, Item* castItem /*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, ObjectGuid originalCaster /*= ObjectGuid::Empty*/)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
@@ -855,19 +855,19 @@ void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags
CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem/*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/)
+void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem/*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, ObjectGuid originalCaster /*= ObjectGuid::Empty*/)
{
CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
SpellCastTargets targets;
targets.SetUnitTarget(victim);
CastSpell(targets, spellInfo, NULL, triggerFlags, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
CustomSpellValues values;
if (bp0)
@@ -879,21 +879,21 @@ void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32
CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
CustomSpellValues values;
values.AddSpellMod(mod, value);
CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
CustomSpellValues values;
values.AddSpellMod(mod, value);
CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
@@ -907,7 +907,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit*
CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
@@ -921,7 +921,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered,
CastSpell(targets, spellInfo, NULL, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem, AuraEffect* triggeredByAura, uint64 originalCaster)
+void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem, AuraEffect* triggeredByAura, ObjectGuid originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
@@ -2122,9 +2122,9 @@ void Unit::SendMeleeAttackStart(Unit* victim)
void Unit::SendMeleeAttackStop(Unit* victim)
{
WorldPacket data(SMSG_ATTACKSTOP, (8+8+4));
- data.append(GetPackGUID());
+ data << GetPackGUID();
if (victim)
- data.append(victim->GetPackGUID());
+ data << victim->GetPackGUID();
else
data << uint8(0);
@@ -2694,7 +2694,7 @@ void Unit::_UpdateSpells(uint32 time)
{
if (!(*itr)->isSpawned())
{
- (*itr)->SetOwnerGUID(0);
+ (*itr)->SetOwnerGUID(ObjectGuid::Empty);
(*itr)->SetRespawnTime(0);
(*itr)->Delete();
m_gameObj.erase(itr++);
@@ -2994,7 +2994,7 @@ void Unit::DeMorph()
SetDisplayId(GetNativeDisplayId());
}
-Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
+Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, ObjectGuid casterGUID /*= 0*/)
{
ASSERT(casterGUID || caster);
@@ -3006,12 +3006,12 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8
if (!newAura->IsMultiSlotAura())
{
// check if cast item changed
- uint64 castItemGUID = 0;
+ ObjectGuid castItemGUID;
if (castItem)
castItemGUID = castItem->GetGUID();
// find current aura from spell and change it's stackamount, or refresh it's duration
- if (Aura* foundAura = GetOwnedAura(newAura->Id, casterGUID, (newAura->AttributesCu & SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : 0, 0))
+ if (Aura* foundAura = GetOwnedAura(newAura->Id, casterGUID, (newAura->AttributesCu & SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : ObjectGuid::Empty, 0))
{
// effect masks do not match
// extremely rare case
@@ -3038,7 +3038,7 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8
// correct cast item guid if needed
if (castItemGUID != foundAura->GetCastItemGUID())
{
- uint64* oldGUID = const_cast<uint64 *>(&foundAura->m_castItemGuid);
+ ObjectGuid* oldGUID = const_cast<ObjectGuid*>(&foundAura->m_castItemGuid);
*oldGUID = castItemGUID;
}
@@ -3065,7 +3065,7 @@ void Unit::_AddAura(UnitAura* aura, Unit* caster)
if (aura->IsSingleTarget())
{
ASSERT((IsInWorld() && !IsDuringRemoveFromWorld()) || (aura->GetCasterGUID() == GetGUID()) ||
- (isBeingLoaded() && aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE)));
+ (IsLoading() && aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE)));
/* @HACK: Player is not in world during loading auras.
* Single target auras are not saved or loaded from database
* but may be created as a result of aura links (player mounts with passengers)
@@ -3347,7 +3347,7 @@ void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode)
i = m_ownedAuras.begin();
}
-void Unit::RemoveOwnedAura(uint32 spellId, uint64 casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
+void Unit::RemoveOwnedAura(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
{
for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);)
if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID))
@@ -3381,7 +3381,7 @@ void Unit::RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode)
ASSERT(false);
}
-Aura* Unit::GetOwnedAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, Aura* except) const
+Aura* Unit::GetOwnedAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask, Aura* except) const
{
AuraMapBounds range = m_ownedAuras.equal_range(spellId);
for (AuraMap::const_iterator itr = range.first; itr != range.second; ++itr)
@@ -3410,7 +3410,7 @@ void Unit::RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode)
aura->Remove(mode);
}
-void Unit::RemoveAura(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode)
+void Unit::RemoveAura(uint32 spellId, ObjectGuid caster, uint8 reqEffMask, AuraRemoveMode removeMode)
{
AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
@@ -3470,7 +3470,7 @@ void Unit::RemoveAura(Aura* aura, AuraRemoveMode mode)
RemoveAura(aurApp, mode);
}
-void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
+void Unit::RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
{
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
{
@@ -3486,7 +3486,7 @@ void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID, uint8 reqEff
}
}
-void Unit::RemoveAuraFromStack(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode)
+void Unit::RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID, AuraRemoveMode removeMode)
{
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
for (AuraMap::iterator iter = range.first; iter != range.second;)
@@ -3503,7 +3503,7 @@ void Unit::RemoveAuraFromStack(uint32 spellId, uint64 casterGUID, AuraRemoveMode
}
}
-void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved/*= 1*/)
+void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit* dispeller, uint8 chargesRemoved/*= 1*/)
{
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
for (AuraMap::iterator iter = range.first; iter != range.second;)
@@ -3531,7 +3531,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId
}
}
-void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer)
+void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, Unit* stealer)
{
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
for (AuraMap::iterator iter = range.first; iter != range.second;)
@@ -3607,7 +3607,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit*
}
}
-void Unit::RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid)
+void Unit::RemoveAurasDueToItemSpell(uint32 spellId, ObjectGuid castItemGuid)
{
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
{
@@ -3621,7 +3621,7 @@ void Unit::RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid)
}
}
-void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura* except, bool negative, bool positive)
+void Unit::RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID, Aura* except, bool negative, bool positive)
{
for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
{
@@ -3724,7 +3724,7 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
UpdateInterruptMask();
}
-void Unit::RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID)
+void Unit::RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
{
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
{
@@ -3916,7 +3916,7 @@ void Unit::RemoveAllAurasExceptType(AuraType type1, AuraType type2)
}
}
-void Unit::DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime)
+void Unit::DelayOwnedAuras(uint32 spellId, ObjectGuid caster, int32 delaytime)
{
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
for (; range.first != range.second; ++range.first)
@@ -3948,7 +3948,7 @@ void Unit::_ApplyAllAuraStatMods()
(*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, true);
}
-AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
+AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster) const
{
AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
@@ -3962,7 +3962,7 @@ AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) c
return NULL;
}
-AuraEffect* Unit::GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 caster) const
+AuraEffect* Unit::GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid caster) const
{
uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
while (rankSpell)
@@ -3988,7 +3988,7 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 ico
return NULL;
}
-AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID) const
+AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID) const
{
AuraEffectList const& auras = GetAuraEffectsByType(type);
for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
@@ -4009,7 +4009,7 @@ AuraEffect* Unit::GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8
return GetAuraEffect(SPELL_AURA_DUMMY, name, iconId, effIndex);
}
-AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, AuraApplication * except) const
+AuraApplication * Unit::GetAuraApplication(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask, AuraApplication * except) const
{
AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
for (; range.first != range.second; ++range.first)
@@ -4028,13 +4028,13 @@ AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, ui
return NULL;
}
-Aura* Unit::GetAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask) const
+Aura* Unit::GetAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const
{
AuraApplication * aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask);
return aurApp ? aurApp->GetBase() : NULL;
}
-AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, AuraApplication* except) const
+AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask, AuraApplication* except) const
{
uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
while (rankSpell)
@@ -4046,7 +4046,7 @@ AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 c
return NULL;
}
-Aura* Unit::GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask) const
+Aura* Unit::GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const
{
AuraApplication * aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask);
return aurApp ? aurApp->GetBase() : NULL;
@@ -4091,7 +4091,7 @@ void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelCharges
}
}
-bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
+bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster) const
{
AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
@@ -4121,7 +4121,7 @@ uint32 Unit::GetAuraCount(uint32 spellId) const
return count;
}
-bool Unit::HasAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask) const
+bool Unit::HasAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const
{
if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask))
return true;
@@ -4133,7 +4133,7 @@ bool Unit::HasAuraType(AuraType auraType) const
return (!m_modAuras[auraType].empty());
}
-bool Unit::HasAuraTypeWithCaster(AuraType auratype, uint64 caster) const
+bool Unit::HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const
{
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
@@ -4169,7 +4169,7 @@ bool Unit::HasAuraTypeWithValue(AuraType auratype, int32 value) const
return false;
}
-bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid) const
+bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, ObjectGuid guid) const
{
if (!(m_interruptMask & flag))
return false;
@@ -4181,7 +4181,7 @@ bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid) const
return false;
}
-bool Unit::HasNegativeAuraWithAttribute(uint32 flag, uint64 guid) const
+bool Unit::HasNegativeAuraWithAttribute(uint32 flag, ObjectGuid guid) const
{
for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
{
@@ -4221,7 +4221,7 @@ AuraEffect* Unit::IsScriptOverriden(SpellInfo const* spell, int32 script) const
return NULL;
}
-uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, bool remove)
+uint32 Unit::GetDiseasesByCaster(ObjectGuid casterGUID, bool remove)
{
static const AuraType diseaseAuraTypes[] =
{
@@ -4254,7 +4254,7 @@ uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, bool remove)
return diseases;
}
-uint32 Unit::GetDoTsByCaster(uint64 casterGUID) const
+uint32 Unit::GetDoTsByCaster(ObjectGuid casterGUID) const
{
static const AuraType diseaseAuraTypes[] =
{
@@ -4630,7 +4630,7 @@ GameObject* Unit::GetGameObject(uint32 spellId) const
void Unit::AddGameObject(GameObject* gameObj)
{
- if (!gameObj || gameObj->GetOwnerGUID() != 0)
+ if (!gameObj || gameObj->GetOwnerGUID())
return;
m_gameObj.push_back(gameObj);
@@ -4651,13 +4651,13 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
if (!gameObj || gameObj->GetOwnerGUID() != GetGUID())
return;
- gameObj->SetOwnerGUID(0);
+ gameObj->SetOwnerGUID(ObjectGuid::Empty);
for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
{
if (m_ObjectSlot[i] == gameObj->GetGUID())
{
- m_ObjectSlot[i] = 0;
+ m_ObjectSlot[i].Clear();
break;
}
}
@@ -4696,7 +4696,7 @@ void Unit::RemoveGameObject(uint32 spellid, bool del)
next = i;
if (spellid == 0 || (*i)->GetSpellId() == spellid)
{
- (*i)->SetOwnerGUID(0);
+ (*i)->SetOwnerGUID(ObjectGuid::Empty);
if (del)
{
(*i)->SetRespawnTime(0);
@@ -4716,7 +4716,7 @@ void Unit::RemoveAllGameObjects()
while (!m_gameObj.empty())
{
GameObjectList::iterator i = m_gameObj.begin();
- (*i)->SetOwnerGUID(0);
+ (*i)->SetOwnerGUID(ObjectGuid::Empty);
(*i)->SetRespawnTime(0);
(*i)->Delete();
m_gameObj.erase(i);
@@ -4726,8 +4726,8 @@ void Unit::RemoveAllGameObjects()
void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage* log)
{
WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16+4+4+4+1+4+4+1+1+4+4+1)); // we guess size
- data.append(log->target->GetPackGUID());
- data.append(log->attacker->GetPackGUID());
+ data << log->target->GetPackGUID();
+ data << log->attacker->GetPackGUID();
data << uint32(log->SpellID);
data << uint32(log->damage); // damage amount
int32 overkill = log->damage - log->target->GetHealth();
@@ -4773,8 +4773,8 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo)
AuraEffect const* aura = pInfo->auraEff;
WorldPacket data(SMSG_PERIODICAURALOG, 30);
- data.append(GetPackGUID());
- data.appendPackGUID(aura->GetCasterGUID());
+ data << GetPackGUID();
+ data << aura->GetCasterGUID().WriteAsPacked();
data << uint32(aura->GetId()); // spellId
data << uint32(1); // count
data << uint32(aura->GetAuraType()); // auraId
@@ -4856,8 +4856,8 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo)
size_t maxsize = 4+5+5+4+4+1+4+4+4+4+4+1+4+4+4+4+4*12;
WorldPacket data(SMSG_ATTACKERSTATEUPDATE, maxsize); // we guess size
data << uint32(damageInfo->HitInfo);
- data.append(damageInfo->attacker->GetPackGUID());
- data.append(damageInfo->target->GetPackGUID());
+ data << damageInfo->attacker->GetPackGUID();
+ data << damageInfo->target->GetPackGUID();
data << uint32(damageInfo->damage); // Full damage
int32 overkill = damageInfo->damage - damageInfo->target->GetHealth();
data << uint32(overkill < 0 ? 0 : overkill); // Overkill
@@ -5072,7 +5072,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// otherwise, it's the triggered_spell_id by default
Unit* target = victim;
int32 basepoints0 = 0;
- uint64 originalCaster = 0;
+ ObjectGuid originalCaster;
switch (dummySpell->SpellFamilyName)
{
@@ -6925,9 +6925,9 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
float averageDmg = 0;
// now compute approximate weapon damage by formula from wowwiki.com
if (procFlags & PROC_FLAG_DONE_OFFHAND_ATTACK)
- averageDmg = (GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE) + GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE)) / 2;
+ averageDmg = (GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE) + GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE)) / 2.f;
else
- averageDmg = (GetFloatValue(UNIT_FIELD_MINDAMAGE) + GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2;
+ averageDmg = (GetFloatValue(UNIT_FIELD_MINDAMAGE) + GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2.f;
basepoints0 = int32(averageDmg);
break;
@@ -7250,19 +7250,12 @@ FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const
FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(getFaction());
if (!entry)
{
- static uint64 guid = 0; // prevent repeating spam same faction problem
-
- if (GetGUID() != guid)
- {
- if (Player const* player = ToPlayer())
- TC_LOG_ERROR("entities.unit", "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction());
- else if (Creature const* creature = ToCreature())
- TC_LOG_ERROR("entities.unit", "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction());
- else
- TC_LOG_ERROR("entities.unit", "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction());
-
- guid = GetGUID();
- }
+ if (Player const* player = ToPlayer())
+ TC_LOG_ERROR("entities.unit", "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction());
+ else if (Creature const* creature = ToCreature())
+ TC_LOG_ERROR("entities.unit", "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction());
+ else
+ TC_LOG_ERROR("entities.unit", "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction());
}
return entry;
}
@@ -7578,7 +7571,7 @@ bool Unit::AttackStop()
m_attacking = NULL;
// Clear our target
- SetTarget(0);
+ SetTarget(ObjectGuid::Empty);
ClearUnitState(UNIT_STATE_MELEE_ATTACKING);
@@ -7747,12 +7740,12 @@ bool Unit::HasAuraState(AuraStateType flag, SpellInfo const* spellProto, Unit co
return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1));
}
-void Unit::SetOwnerGUID(uint64 owner)
+void Unit::SetOwnerGUID(ObjectGuid owner)
{
if (GetOwnerGUID() == owner)
return;
- SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner);
+ SetGuidValue(UNIT_FIELD_SUMMONEDBY, owner);
if (!owner)
return;
@@ -7774,7 +7767,7 @@ void Unit::SetOwnerGUID(uint64 owner)
Unit* Unit::GetOwner() const
{
- if (uint64 ownerGUID = GetOwnerGUID())
+ if (ObjectGuid ownerGUID = GetOwnerGUID())
return ObjectAccessor::GetUnit(*this, ownerGUID);
return NULL;
@@ -7782,7 +7775,7 @@ Unit* Unit::GetOwner() const
Unit* Unit::GetCharmer() const
{
- if (uint64 charmerGUID = GetCharmerGUID())
+ if (ObjectGuid charmerGUID = GetCharmerGUID())
return ObjectAccessor::GetUnit(*this, charmerGUID);
return NULL;
@@ -7790,8 +7783,8 @@ Unit* Unit::GetCharmer() const
Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const
{
- uint64 guid = GetCharmerOrOwnerGUID();
- if (IS_PLAYER_GUID(guid))
+ ObjectGuid guid = GetCharmerOrOwnerGUID();
+ if (guid.IsPlayer())
return ObjectAccessor::GetPlayer(*this, guid);
return const_cast<Unit*>(this)->ToPlayer();
@@ -7810,14 +7803,14 @@ Player* Unit::GetAffectingPlayer() const
Minion* Unit::GetFirstMinion() const
{
- if (uint64 pet_guid = GetMinionGUID())
+ if (ObjectGuid pet_guid = GetMinionGUID())
{
if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
if (pet->HasUnitTypeMask(UNIT_MASK_MINION))
return (Minion*)pet;
- TC_LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid));
- const_cast<Unit*>(this)->SetMinionGUID(0);
+ TC_LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion %s not exist.", pet_guid.ToString().c_str());
+ const_cast<Unit*>(this)->SetMinionGUID(ObjectGuid::Empty);
}
return NULL;
@@ -7825,14 +7818,14 @@ Minion* Unit::GetFirstMinion() const
Guardian* Unit::GetGuardianPet() const
{
- if (uint64 pet_guid = GetPetGUID())
+ if (ObjectGuid pet_guid = GetPetGUID())
{
if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
return (Guardian*)pet;
- TC_LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid);
- const_cast<Unit*>(this)->SetPetGUID(0);
+ TC_LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian %s not exist.", pet_guid.ToString().c_str());
+ const_cast<Unit*>(this)->SetPetGUID(ObjectGuid::Empty);
}
return NULL;
@@ -7840,13 +7833,13 @@ Guardian* Unit::GetGuardianPet() const
Unit* Unit::GetCharm() const
{
- if (uint64 charm_guid = GetCharmGUID())
+ if (ObjectGuid charm_guid = GetCharmGUID())
{
if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
return pet;
- TC_LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid));
- const_cast<Unit*>(this)->SetUInt64Value(UNIT_FIELD_CHARM, 0);
+ TC_LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature %s not exist.", charm_guid.ToString().c_str());
+ const_cast<Unit*>(this)->SetGuidValue(UNIT_FIELD_CHARM, ObjectGuid::Empty);
}
return NULL;
@@ -7900,19 +7893,19 @@ void Unit::SetMinion(Minion *minion, bool apply)
else
oldPet->UnSummon();
SetPetGUID(minion->GetGUID());
- SetMinionGUID(0);
+ SetMinionGUID(ObjectGuid::Empty);
}
}
else
{
SetPetGUID(minion->GetGUID());
- SetMinionGUID(0);
+ SetMinionGUID(ObjectGuid::Empty);
}
}
if (minion->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
{
- if (AddUInt64Value(UNIT_FIELD_SUMMON, minion->GetGUID()))
+ if (AddGuidValue(UNIT_FIELD_SUMMON, minion->GetGUID()))
{
}
}
@@ -7952,15 +7945,13 @@ void Unit::SetMinion(Minion *minion, bool apply)
m_Controlled.erase(minion);
if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
- {
if (GetCritterGUID() == minion->GetGUID())
- SetCritterGUID(0);
- }
+ SetCritterGUID(ObjectGuid::Empty);
if (minion->IsGuardianPet())
{
if (GetPetGUID() == minion->GetGUID())
- SetPetGUID(0);
+ SetPetGUID(ObjectGuid::Empty);
}
else if (minion->IsTotem())
{
@@ -7985,7 +7976,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
//if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
{
- if (RemoveUInt64Value(UNIT_FIELD_SUMMON, minion->GetGUID()))
+ if (RemoveGuidValue(UNIT_FIELD_SUMMON, minion->GetGUID()))
{
// Check if there is another minion
for (ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
@@ -8007,7 +7998,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
if (!(*itr)->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
continue;
- if (AddUInt64Value(UNIT_FIELD_SUMMON, (*itr)->GetGUID()))
+ if (AddGuidValue(UNIT_FIELD_SUMMON, (*itr)->GetGUID()))
{
// show another pet bar if there is no charm bar
if (GetTypeId() == TYPEID_PLAYER && !GetCharmGUID())
@@ -8056,8 +8047,8 @@ void Unit::SetCharm(Unit* charm, bool apply)
{
if (GetTypeId() == TYPEID_PLAYER)
{
- if (!AddUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
- TC_LOG_FATAL("entities.unit", "Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID());
+ if (!AddGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
+ TC_LOG_FATAL("entities.unit", "Player %s is trying to charm unit %u, but it already has a charmed unit %s", GetName().c_str(), charm->GetEntry(), GetCharmGUID().ToString().c_str());
charm->m_ControlledByPlayer = true;
/// @todo maybe we can use this flag to check if controlled by player
@@ -8069,8 +8060,8 @@ void Unit::SetCharm(Unit* charm, bool apply)
// PvP, FFAPvP
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
- if (!charm->AddUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
- TC_LOG_FATAL("entities.unit", "Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
+ if (!charm->AddGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
+ TC_LOG_FATAL("entities.unit", "Unit %u is being charmed, but it already has a charmer %s", charm->GetEntry(), charm->GetCharmerGUID().ToString().c_str());
_isWalkingBeforeCharm = charm->IsWalking();
if (_isWalkingBeforeCharm)
@@ -8082,12 +8073,12 @@ void Unit::SetCharm(Unit* charm, bool apply)
{
if (GetTypeId() == TYPEID_PLAYER)
{
- if (!RemoveUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
- TC_LOG_FATAL("entities.unit", "Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID());
+ if (!RemoveGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
+ TC_LOG_FATAL("entities.unit", "Player %s is trying to uncharm unit %u, but it has another charmed unit %s", GetName().c_str(), charm->GetEntry(), GetCharmGUID().ToString().c_str());
}
- if (!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
- TC_LOG_FATAL("entities.unit", "Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
+ if (!charm->RemoveGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
+ TC_LOG_FATAL("entities.unit", "Unit %u is being uncharmed, but it has another charmer %s", charm->GetEntry(), charm->GetCharmerGUID().ToString().c_str());
if (charm->GetTypeId() == TYPEID_PLAYER)
{
@@ -8207,7 +8198,7 @@ Unit* Unit::GetFirstControlled() const
// Sequence: charmed, pet, other guardians
Unit* unit = GetCharm();
if (!unit)
- if (uint64 guid = GetMinionGUID())
+ if (ObjectGuid guid = GetMinionGUID())
unit = ObjectAccessor::GetUnit(*this, guid);
return unit;
@@ -8231,16 +8222,16 @@ void Unit::RemoveAllControlled()
TC_LOG_ERROR("entities.unit", "Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
}
if (GetPetGUID())
- TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID());
+ TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its pet %s", GetEntry(), GetPetGUID().ToString().c_str());
if (GetMinionGUID())
- TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID());
+ TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its minion %s", GetEntry(), GetMinionGUID().ToString().c_str());
if (GetCharmGUID())
- TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID());
+ TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its charm %s", GetEntry(), GetCharmGUID().ToString().c_str());
}
bool Unit::isPossessedByPlayer() const
{
- return HasUnitState(UNIT_STATE_POSSESSED) && IS_PLAYER_GUID(GetCharmerGUID());
+ return HasUnitState(UNIT_STATE_POSSESSED) && GetCharmerGUID().IsPlayer();
}
bool Unit::isPossessing(Unit* u) const
@@ -8359,8 +8350,8 @@ void Unit::SendHealSpellLog(Unit* victim, uint32 SpellID, uint32 Damage, uint32
{
// we guess size
WorldPacket data(SMSG_SPELLHEALLOG, 8 + 8 + 4 + 4 + 4 + 4 + 1 + 1);
- data.append(victim->GetPackGUID());
- data.append(GetPackGUID());
+ data << victim->GetPackGUID();
+ data << GetPackGUID();
data << uint32(SpellID);
data << uint32(Damage);
data << uint32(OverHeal);
@@ -8384,8 +8375,8 @@ int32 Unit::HealBySpell(Unit* victim, SpellInfo const* spellInfo, uint32 addHeal
void Unit::SendEnergizeSpellLog(Unit* victim, uint32 spellId, int32 damage, Powers powerType)
{
WorldPacket data(SMSG_SPELLENERGIZELOG, (8+8+4+4+4+1));
- data.append(victim->GetPackGUID());
- data.append(GetPackGUID());
+ data << victim->GetPackGUID();
+ data << GetPackGUID();
data << uint32(spellId);
data << uint32(powerType);
data << int32(damage);
@@ -8882,7 +8873,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto
{
//! Mobs can't crit with spells. Player Totems can
//! Fire Elemental (from totem) can too - but this part is a hack and needs more research
- if (IS_CRE_OR_VEH_GUID(GetGUID()) && !(IsTotem() && IS_PLAYER_GUID(GetOwnerGUID())) && GetEntry() != 15438)
+ if (GetGUID().IsCreatureOrVehicle() && !(IsTotem() && GetOwnerGUID().IsPlayer()) && GetEntry() != 15438)
return 0.0f;
// not critting spell
@@ -9925,7 +9916,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
{
// Send others that we now have a vehicle
WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, GetPackGUID().size()+4);
- data.appendPackGUID(GetGUID());
+ data << GetPackGUID();
data << uint32(VehicleId);
SendMessageToSet(&data, true);
@@ -9966,7 +9957,7 @@ void Unit::Dismount()
thisPlayer->SendMovementSetCollisionHeight(thisPlayer->GetCollisionHeight(false));
WorldPacket data(SMSG_DISMOUNT, 8);
- data.appendPackGUID(GetGUID());
+ data << GetPackGUID();
SendMessageToSet(&data, true);
// dismount as a vehicle
@@ -9974,7 +9965,7 @@ void Unit::Dismount()
{
// Send other players that we are no longer a vehicle
data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 8+4);
- data.appendPackGUID(GetGUID());
+ data << GetPackGUID();
data << uint32(0);
ToPlayer()->SendMessageToSet(&data, true);
// Remove vehicle from player
@@ -10542,7 +10533,7 @@ bool Unit::IsAlwaysVisibleFor(WorldObject const* seer) const
return true;
// Always seen by owner
- if (uint64 guid = GetCharmerOrOwnerGUID())
+ if (ObjectGuid guid = GetCharmerOrOwnerGUID())
if (seer->GetGUID() == guid)
return true;
@@ -10850,7 +10841,7 @@ bool Unit::CanHaveThreatList(bool skipAliveCheck) const
// return false;
// summons can not have a threat list, unless they are controlled by a creature
- if (HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && IS_PLAYER_GUID(((Pet*)this)->GetOwnerGUID()))
+ if (HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && ((Pet*)this)->GetOwnerGUID().IsPlayer())
return false;
return true;
@@ -11652,7 +11643,7 @@ float Unit::GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange typ
bool Unit::CanFreeMove() const
{
return !HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING | UNIT_STATE_IN_FLIGHT |
- UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED) && GetOwnerGUID() == 0;
+ UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED) && GetOwnerGUID().IsEmpty();
}
void Unit::SetLevel(uint8 lvl)
@@ -11665,7 +11656,7 @@ void Unit::SetLevel(uint8 lvl)
if (player->GetGroup())
player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL);
- sWorld->UpdateCharacterNameDataLevel(GetGUIDLow(), lvl);
+ sWorld->UpdateCharacterNameDataLevel(GetGUID(), lvl);
}
}
@@ -11762,7 +11753,7 @@ void Unit::SetPower(Powers power, int32 val)
if (IsInWorld())
{
WorldPacket data(SMSG_POWER_UPDATE, 8 + 4 + 1 + 4);
- data.append(GetPackGUID());
+ data << GetPackGUID();
data << uint32(1); //power count
data << uint8(powerIndex);
data << int32(val);
@@ -12806,14 +12797,14 @@ SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const
return SPELL_SCHOOL_MASK_NORMAL;
}
-uint64 Unit::GetCharmerOrOwnerGUID() const
+ObjectGuid Unit::GetCharmerOrOwnerGUID() const
{
return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID();
}
-uint64 Unit::GetCharmerOrOwnerOrOwnGUID() const
+ObjectGuid Unit::GetCharmerOrOwnerOrOwnGUID() const
{
- if (uint64 guid = GetCharmerOrOwnerGUID())
+ if (ObjectGuid guid = GetCharmerOrOwnerGUID())
return guid;
return GetGUID();
}
@@ -12856,7 +12847,7 @@ void Unit::SendPetTalk(uint32 pettalk)
owner->ToPlayer()->GetSession()->SendPacket(&data);
}
-void Unit::SendPetAIReaction(uint64 guid)
+void Unit::SendPetAIReaction(ObjectGuid guid)
{
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
@@ -12970,13 +12961,13 @@ void Unit::ClearComboPointHolders()
{
while (!m_ComboPointHolders.empty())
{
- uint32 lowguid = *m_ComboPointHolders.begin();
+ ObjectGuid guid = *m_ComboPointHolders.begin();
- Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER));
+ Player* player = ObjectAccessor::FindPlayer(guid);
if (player && player->GetComboTarget() == GetGUID()) // recheck for safe
player->ClearComboPoints(); // remove also guid from m_ComboPointHolders;
else
- m_ComboPointHolders.erase(lowguid); // or remove manually
+ m_ComboPointHolders.erase(guid); // or remove manually
}
}
@@ -13500,7 +13491,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura)
// aura can be deleted at casts
SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
int32 heal = triggeredByAura->GetAmount();
- uint64 caster_guid = triggeredByAura->GetCasterGUID();
+ ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
// Currently only Prayer of Mending
if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20))
@@ -13559,7 +13550,7 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
return false;
}
- uint64 caster_guid = triggeredByAura->GetCasterGUID();
+ ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
// jumps
int32 jumps = triggeredByAura->GetBase()->GetCharges()-1;
@@ -13602,7 +13593,7 @@ void Unit::SetAIAnimKitId(uint16 animKitId)
_aiAnimKitId = animKitId;
WorldPacket data(SMSG_SET_AI_ANIM_KIT, 8 + 2);
- data.append(GetPackGUID());
+ data << GetPackGUID();
data << uint16(animKitId);
SendMessageToSet(&data, true);
}
@@ -13615,7 +13606,7 @@ void Unit::SetMovementAnimKitId(uint16 animKitId)
_movementAnimKitId = animKitId;
WorldPacket data(SMSG_SET_MOVEMENT_ANIM_KIT, 8 + 2);
- data.append(GetPackGUID());
+ data << GetPackGUID();
data << uint16(animKitId);
SendMessageToSet(&data, true);
}
@@ -13628,7 +13619,7 @@ void Unit::SetMeleeAnimKitId(uint16 animKitId)
_meleeAnimKitId = animKitId;
WorldPacket data(SMSG_SET_MELEE_ANIM_KIT, 8 + 2);
- data.append(GetPackGUID());
+ data << GetPackGUID();
data << uint16(animKitId);
SendMessageToSet(&data, true);
}
@@ -13636,7 +13627,7 @@ void Unit::SetMeleeAnimKitId(uint16 animKitId)
void Unit::PlayOneShotAnimKit(uint16 animKitId)
{
WorldPacket data(SMSG_PLAY_ONE_SHOT_ANIM_KIT, 7+2);
- data.append(GetPackGUID());
+ data << GetPackGUID();
data << uint16(animKitId);
SendMessageToSet(&data, true);
}
@@ -14041,7 +14032,7 @@ void Unit::SetStunned(bool apply)
{
if (apply)
{
- SetTarget(0);
+ SetTarget(ObjectGuid::Empty);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
// Creature specific
@@ -14095,7 +14086,7 @@ void Unit::SetFeared(bool apply)
{
if (apply)
{
- SetTarget(0);
+ SetTarget(ObjectGuid::Empty);
Unit* caster = NULL;
Unit::AuraEffectList const& fearAuras = GetAuraEffectsByType(SPELL_AURA_MOD_FEAR);
@@ -14125,7 +14116,7 @@ void Unit::SetConfused(bool apply)
{
if (apply)
{
- SetTarget(0);
+ SetTarget(ObjectGuid::Empty);
GetMotionMaster()->MoveConfused();
}
else
@@ -14378,7 +14369,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
if (GetCharmInfo())
GetCharmInfo()->SetPetNumber(0, true);
else
- TC_LOG_ERROR("entities.unit", "Aura::HandleModCharm: target=" UI64FMTD " with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId());
+ TC_LOG_ERROR("entities.unit", "Aura::HandleModCharm: %s has a charm aura but no charm info!", GetGUID().ToString().c_str());
}
}
break;
@@ -14468,14 +14459,14 @@ Creature* Unit::GetVehicleCreatureBase() const
return NULL;
}
-uint64 Unit::GetTransGUID() const
+ObjectGuid Unit::GetTransGUID() const
{
if (GetVehicle())
return GetVehicleBase()->GetGUID();
if (GetTransport())
return GetTransport()->GetGUID();
- return 0;
+ return ObjectGuid::Empty;
}
TransportBase* Unit::GetDirectTransport() const
@@ -15335,7 +15326,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
- uint64 origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();
+ ObjectGuid origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->second.spellId);
// if (!spellEntry) should be checked at npc_spellclick load
@@ -15588,7 +15579,7 @@ void Unit::WriteMovementInfo(WorldPacket& data, Movement::ExtraMovementStatusEle
}
ObjectGuid guid = GetGUID();
- ObjectGuid tguid = hasTransportData ? GetTransGUID() : 0;
+ ObjectGuid tguid = hasTransportData ? GetTransGUID() : ObjectGuid::Empty;
for (; *sequence != MSEEnd; ++sequence)
{
@@ -15927,13 +15918,13 @@ void Unit::SendThreatListUpdate()
TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message");
WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
- data.append(GetPackGUID());
+ data << GetPackGUID();
data << uint32(count);
ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
- data.appendPackGUID((*itr)->getUnitGuid());
- data << uint32((*itr)->getThreat()*100);
+ data << (*itr)->getUnitGuid().WriteAsPacked();
+ data << uint32((*itr)->getThreat() * 100);
}
SendMessageToSet(&data, false);
}
@@ -15947,13 +15938,13 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference)
TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");
WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
- data.append(GetPackGUID());
- data.appendPackGUID(pHostileReference->getUnitGuid());
+ data << GetPackGUID();
+ data << pHostileReference->getUnitGuid().WriteAsPacked();
data << uint32(count);
ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
- data.appendPackGUID((*itr)->getUnitGuid());
+ data << (*itr)->getUnitGuid().WriteAsPacked();
data << uint32((*itr)->getThreat());
}
SendMessageToSet(&data, false);
@@ -15964,7 +15955,7 @@ void Unit::SendClearThreatListOpcode()
{
TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_CLEAR Message");
WorldPacket data(SMSG_THREAT_CLEAR, 8);
- data.append(GetPackGUID());
+ data << GetPackGUID();
SendMessageToSet(&data, false);
}
@@ -15972,8 +15963,8 @@ void Unit::SendRemoveFromThreatListOpcode(HostileReference* pHostileReference)
{
TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_REMOVE Message");
WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8);
- data.append(GetPackGUID());
- data.appendPackGUID(pHostileReference->getUnitGuid());
+ data << GetPackGUID();
+ data << pHostileReference->getUnitGuid().WriteAsPacked();
SendMessageToSet(&data, false);
}
@@ -16040,8 +16031,8 @@ void Unit::StopAttackFaction(uint32 faction_id)
void Unit::OutDebugInfo() const
{
TC_LOG_ERROR("entities.unit", "Unit::OutDebugInfo");
- TC_LOG_INFO("entities.unit", "GUID " UI64FMTD ", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName().c_str());
- TC_LOG_INFO("entities.unit", "OwnerGUID " UI64FMTD ", MinionGUID " UI64FMTD ", CharmerGUID " UI64FMTD ", CharmedGUID " UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID());
+ TC_LOG_INFO("entities.unit", "%s name %s", GetGUID().ToString().c_str(), GetName().c_str());
+ TC_LOG_INFO("entities.unit", "Owner %s, Minion %s, Charmer %s, Charmed %s", GetOwnerGUID().ToString().c_str(), GetMinionGUID().ToString().c_str(), GetCharmerGUID().ToString().c_str(), GetCharmGUID().ToString().c_str());
TC_LOG_INFO("entities.unit", "In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
if (IsInWorld())
TC_LOG_INFO("entities.unit", "Mapid %u", GetMapId());
@@ -16049,14 +16040,14 @@ void Unit::OutDebugInfo() const
std::ostringstream o;
o << "Summon Slot: ";
for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i)
- o << m_SummonSlot[i] << ", ";
+ o << m_SummonSlot[i].ToString() << ", ";
TC_LOG_INFO("entities.unit", "%s", o.str().c_str());
o.str("");
o << "Controlled List: ";
for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
- o << (*itr)->GetGUID() << ", ";
+ o << (*itr)->GetGUID().ToString() << ", ";
TC_LOG_INFO("entities.unit", "%s", o.str().c_str());
o.str("");
@@ -16071,7 +16062,7 @@ void Unit::OutDebugInfo() const
o << "Passenger List: ";
for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr)
if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid))
- o << passenger->GetGUID() << ", ";
+ o << passenger->GetGUID().ToString() << ", ";
TC_LOG_INFO("entities.unit", "%s", o.str().c_str());
}
@@ -16079,7 +16070,7 @@ void Unit::OutDebugInfo() const
TC_LOG_INFO("entities.unit", "On vehicle %u.", GetVehicleBase()->GetEntry());
}
-uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const
+uint32 Unit::GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const
{
uint32 amount = 0;
AuraEffectList const& periodicAuras = GetAuraEffectsByType(auraType);
@@ -16097,7 +16088,7 @@ uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType
void Unit::SendClearTarget()
{
WorldPacket data(SMSG_BREAK_TARGET, GetPackGUID().size());
- data.append(GetPackGUID());
+ data << GetPackGUID();
SendMessageToSet(&data, false);
}
@@ -16427,7 +16418,7 @@ void Unit::SendSetPlayHoverAnim(bool enable)
void Unit::SendMovementSetSplineAnim(Movement::AnimType anim)
{
WorldPacket data(SMSG_SPLINE_MOVE_SET_ANIM, 8 + 4);
- data.append(GetPackGUID());
+ data << GetPackGUID();
data << uint32(anim);
SendMessageToSet(&data, false);
}
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index ee52189b0f5..fd986083bcb 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1009,14 +1009,14 @@ uint32 createProcExtendMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missC
struct RedirectThreatInfo
{
- RedirectThreatInfo() : _targetGUID(0), _threatPct(0) { }
- uint64 _targetGUID;
+ RedirectThreatInfo() : _threatPct(0) { }
+ ObjectGuid _targetGUID;
uint32 _threatPct;
- uint64 GetTargetGUID() const { return _targetGUID; }
+ ObjectGuid GetTargetGUID() const { return _targetGUID; }
uint32 GetThreatPct() const { return _threatPct; }
- void Set(uint64 guid, uint32 pct)
+ void Set(ObjectGuid guid, uint32 pct)
{
_targetGUID = guid;
_threatPct = pct;
@@ -1276,7 +1276,7 @@ class Unit : public WorldObject
typedef std::set<Unit*> AttackerSet;
typedef std::set<Unit*> ControlList;
- typedef std::multimap<uint32, Aura*> AuraMap;
+ typedef std::multimap<uint32, Aura*> AuraMap;
typedef std::pair<AuraMap::const_iterator, AuraMap::const_iterator> AuraMapBounds;
typedef std::pair<AuraMap::iterator, AuraMap::iterator> AuraMapBoundsNonConst;
@@ -1291,7 +1291,6 @@ class Unit : public WorldObject
typedef std::list<Aura*> AuraList;
typedef std::list<AuraApplication *> AuraApplicationList;
typedef std::list<DiminishingReturn> Diminishing;
- typedef std::set<uint32> ComboPointHolderSet;
typedef std::map<uint8, AuraApplication*> VisibleAuraMap;
@@ -1586,17 +1585,17 @@ class Unit : public WorldObject
void EnergizeBySpell(Unit* victim, uint32 SpellID, int32 Damage, Powers powertype);
uint32 SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage);
- void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(Unit* victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);
+ void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);
+ void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);
+ void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);
+ void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);
+ void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);
+ void CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);
+ void CastCustomSpell(Unit* victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);
+ void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);
+ void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);
+ void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);
Aura* AddAura(uint32 spellId, Unit* target);
Aura* AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target);
void SetAuraStack(uint32 spellId, Unit* target, uint32 stack);
@@ -1663,24 +1662,24 @@ class Unit : public WorldObject
DeathState getDeathState() const { return m_deathState; }
virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet
- uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); }
- void SetOwnerGUID(uint64 owner);
- uint64 GetCreatorGUID() const { return GetUInt64Value(UNIT_FIELD_CREATEDBY); }
- void SetCreatorGUID(uint64 creator) { SetUInt64Value(UNIT_FIELD_CREATEDBY, creator); }
- uint64 GetMinionGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); }
- void SetMinionGUID(uint64 guid) { SetUInt64Value(UNIT_FIELD_SUMMON, guid); }
- uint64 GetCharmerGUID() const { return GetUInt64Value(UNIT_FIELD_CHARMEDBY); }
- void SetCharmerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_CHARMEDBY, owner); }
- uint64 GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM); }
- void SetPetGUID(uint64 guid) { m_SummonSlot[SUMMON_SLOT_PET] = guid; }
- uint64 GetPetGUID() const { return m_SummonSlot[SUMMON_SLOT_PET]; }
- void SetCritterGUID(uint64 guid) { SetUInt64Value(UNIT_FIELD_CRITTER, guid); }
- uint64 GetCritterGUID() const { return GetUInt64Value(UNIT_FIELD_CRITTER); }
+ ObjectGuid GetOwnerGUID() const { return GetGuidValue(UNIT_FIELD_SUMMONEDBY); }
+ void SetOwnerGUID(ObjectGuid owner);
+ ObjectGuid GetCreatorGUID() const { return GetGuidValue(UNIT_FIELD_CREATEDBY); }
+ void SetCreatorGUID(ObjectGuid creator) { SetGuidValue(UNIT_FIELD_CREATEDBY, creator); }
+ ObjectGuid GetMinionGUID() const { return GetGuidValue(UNIT_FIELD_SUMMON); }
+ void SetMinionGUID(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_SUMMON, guid); }
+ ObjectGuid GetCharmerGUID() const { return GetGuidValue(UNIT_FIELD_CHARMEDBY); }
+ void SetCharmerGUID(ObjectGuid owner) { SetGuidValue(UNIT_FIELD_CHARMEDBY, owner); }
+ ObjectGuid GetCharmGUID() const { return GetGuidValue(UNIT_FIELD_CHARM); }
+ void SetPetGUID(ObjectGuid guid) { m_SummonSlot[SUMMON_SLOT_PET] = guid; }
+ ObjectGuid GetPetGUID() const { return m_SummonSlot[SUMMON_SLOT_PET]; }
+ void SetCritterGUID(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_CRITTER, guid); }
+ ObjectGuid GetCritterGUID() const { return GetGuidValue(UNIT_FIELD_CRITTER); }
bool IsControlledByPlayer() const { return m_ControlledByPlayer; }
- uint64 GetCharmerOrOwnerGUID() const;
- uint64 GetCharmerOrOwnerOrOwnGUID() const;
- bool IsCharmedOwnedByPlayerOrPlayer() const { return IS_PLAYER_GUID(GetCharmerOrOwnerOrOwnGUID()); }
+ ObjectGuid GetCharmerOrOwnerGUID() const;
+ ObjectGuid GetCharmerOrOwnerOrOwnGUID() const;
+ bool IsCharmedOwnedByPlayerOrPlayer() const { return GetCharmerOrOwnerOrOwnGUID().IsPlayer(); }
Player* GetSpellModOwner() const;
@@ -1707,7 +1706,7 @@ class Unit : public WorldObject
Unit* GetFirstControlled() const;
void RemoveAllControlled();
- bool IsCharmed() const { return GetCharmerGUID() != 0; }
+ bool IsCharmed() const { return !GetCharmerGUID().IsEmpty(); }
bool isPossessed() const { return HasUnitState(UNIT_STATE_POSSESSED); }
bool isPossessedByPlayer() const;
bool isPossessing() const;
@@ -1731,7 +1730,7 @@ class Unit : public WorldObject
bool InitTamedPet(Pet* pet, uint8 level, uint32 spell_id);
// aura apply/remove helpers - you should better not use these
- Aura* _TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0);
+ Aura* _TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, ObjectGuid casterGUID = ObjectGuid::Empty);
void _AddAura(UnitAura* aura, Unit* caster);
AuraApplication * _CreateAuraApplication(Aura* aura, uint8 effMask);
void _ApplyAuraEffect(Aura* aura, uint8 effIndex);
@@ -1748,31 +1747,31 @@ class Unit : public WorldObject
AuraMap const& GetOwnedAuras() const { return m_ownedAuras; }
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
- void RemoveOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
+ void RemoveOwnedAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
- Aura* GetOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, Aura* except = NULL) const;
+ Aura* GetOwnedAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, Aura* except = NULL) const;
// m_appliedAuras container management
AuraApplicationMap & GetAppliedAuras() { return m_appliedAuras; }
AuraApplicationMap const& GetAppliedAuras() const { return m_appliedAuras; }
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
- void RemoveAura(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
+ void RemoveAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
void RemoveAura(Aura* aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
- void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
- void RemoveAuraFromStack(uint32 spellId, uint64 casterGUID = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
- void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved = 1);
- void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer);
- void RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid);
- void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura* except = NULL, bool negative = true, bool positive = true);
+ void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
+ void RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
+ void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit* dispeller, uint8 chargesRemoved = 1);
+ void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, Unit* stealer);
+ void RemoveAurasDueToItemSpell(uint32 spellId, ObjectGuid castItemGuid);
+ void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID = ObjectGuid::Empty, Aura* except = NULL, bool negative = true, bool positive = true);
void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0, bool phaseid = false);
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = 0);
void RemoveAurasWithAttribute(uint32 flags);
- void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID);
- void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except=0);
+ void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID);
+ void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except = 0);
void RemoveMovementImpairingAuras();
void RemoveAreaAurasDueToLeaveWorld();
@@ -1782,7 +1781,7 @@ class Unit : public WorldObject
void RemoveAllAurasRequiringDeadTarget();
void RemoveAllAurasExceptType(AuraType type);
void RemoveAllAurasExceptType(AuraType type1, AuraType type2); /// @todo: once we support variadic templates use them here
- void DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime);
+ void DelayOwnedAuras(uint32 spellId, ObjectGuid caster, int32 delaytime);
void _RemoveAllAuraStatMods();
void _ApplyAllAuraStatMods();
@@ -1791,35 +1790,35 @@ class Unit : public WorldObject
AuraList & GetSingleCastAuras() { return m_scAuras; }
AuraList const& GetSingleCastAuras() const { return m_scAuras; }
- AuraEffect* GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const;
- AuraEffect* GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const;
+ AuraEffect* GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID = ObjectGuid::Empty) const;
+ AuraEffect* GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID = ObjectGuid::Empty) const;
AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; // spell mustn't have familyflags
- AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0) const;
+ AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID = ObjectGuid::Empty) const;
AuraEffect* GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const;
- AuraApplication * GetAuraApplication(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const;
- Aura* GetAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const;
+ AuraApplication * GetAuraApplication(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraApplication * except = NULL) const;
+ Aura* GetAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0) const;
- AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const;
- Aura* GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const;
+ AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraApplication * except = NULL) const;
+ Aura* GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0) const;
void GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList);
- bool HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster = 0) const;
+ bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster = ObjectGuid::Empty) const;
uint32 GetAuraCount(uint32 spellId) const;
- bool HasAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const;
+ bool HasAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0) const;
bool HasAuraType(AuraType auraType) const;
- bool HasAuraTypeWithCaster(AuraType auratype, uint64 caster) const;
+ bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const;
bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const;
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const;
bool HasAuraTypeWithValue(AuraType auratype, int32 value) const;
- bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0) const;
- bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0) const;
+ bool HasNegativeAuraWithInterruptFlag(uint32 flag, ObjectGuid guid = ObjectGuid::Empty) const;
+ bool HasNegativeAuraWithAttribute(uint32 flag, ObjectGuid guid = ObjectGuid::Empty) const;
bool HasAuraWithMechanic(uint32 mechanicMask) const;
AuraEffect* IsScriptOverriden(SpellInfo const* spell, int32 script) const;
- uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false);
- uint32 GetDoTsByCaster(uint64 casterGUID) const;
+ uint32 GetDiseasesByCaster(ObjectGuid casterGUID, bool remove = false);
+ uint32 GetDoTsByCaster(ObjectGuid casterGUID) const;
int32 GetTotalAuraModifier(AuraType auratype) const;
float GetTotalAuraMultiplier(AuraType auratype) const;
@@ -1859,6 +1858,9 @@ class Unit : public WorldObject
float GetNegStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_NEGSTAT0+stat); }
float GetCreateStat(Stats stat) const { return m_createStats[stat]; }
+ ObjectGuid GetChannelObjectGuid() const { return GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT); }
+ void SetChannelObjectGuid(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, guid); }
+
void SetCurrentCastSpell(Spell* pSpell);
virtual void ProhibitSpellSchool(SpellSchoolMask /*idSchoolMask*/, uint32 /*unTimeMs*/) { }
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed = true, bool withInstant = true);
@@ -1878,8 +1880,8 @@ class Unit : public WorldObject
Spell* FindCurrentSpellBySpellId(uint32 spell_id) const;
int32 GetCurrentSpellCastTime(uint32 spell_id) const;
- uint64 m_SummonSlot[MAX_SUMMON_SLOT];
- uint64 m_ObjectSlot[MAX_GAMEOBJECT_SLOT];
+ ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT];
+ ObjectGuid m_ObjectSlot[MAX_GAMEOBJECT_SLOT];
ShapeshiftForm GetShapeshiftForm() const { return ShapeshiftForm(GetByteValue(UNIT_FIELD_BYTES_2, 3)); }
void SetShapeshiftForm(ShapeshiftForm form);
@@ -2015,7 +2017,7 @@ class Unit : public WorldObject
uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const;
float CalculateDefaultCoefficient(SpellInfo const* spellInfo, DamageEffectType damagetype) const;
- uint32 GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const;
+ uint32 GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const;
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
void ApplySpellDispelImmunity(const SpellInfo* spellProto, DispelType type, bool apply);
@@ -2069,14 +2071,14 @@ class Unit : public WorldObject
void SetControlled(bool apply, UnitState state);
- void AddComboPointHolder(uint32 lowguid) { m_ComboPointHolders.insert(lowguid); }
- void RemoveComboPointHolder(uint32 lowguid) { m_ComboPointHolders.erase(lowguid); }
+ void AddComboPointHolder(ObjectGuid lowguid) { m_ComboPointHolders.insert(lowguid); }
+ void RemoveComboPointHolder(ObjectGuid lowguid) { m_ComboPointHolders.erase(lowguid); }
void ClearComboPointHolders();
///----------Pet responses methods-----------------
void SendPetActionFeedback (uint8 msg);
void SendPetTalk (uint32 pettalk);
- void SendPetAIReaction(uint64 guid);
+ void SendPetAIReaction(ObjectGuid guid);
///----------End of Pet responses methods----------
void propagateSpeedChange() { GetMotionMaster()->propagateSpeedChange(); }
@@ -2103,15 +2105,15 @@ class Unit : public WorldObject
uint32 GetModelForTotem(PlayerTotemType totemType);
// Redirect Threat
- void SetRedirectThreat(uint64 guid, uint32 pct) { _redirectThreadInfo.Set(guid, pct); }
- void ResetRedirectThreat() { SetRedirectThreat(0, 0); }
+ void SetRedirectThreat(ObjectGuid guid, uint32 pct) { _redirectThreadInfo.Set(guid, pct); }
+ void ResetRedirectThreat() { SetRedirectThreat(ObjectGuid::Empty, 0); }
void ModifyRedirectThreat(int32 amount) { _redirectThreadInfo.ModifyThreatPct(amount); }
uint32 GetRedirectThreatPercent() const { return _redirectThreadInfo.GetThreatPct(); }
Unit* GetRedirectThreatTarget();
friend class VehicleJoinEvent;
bool IsAIEnabled, NeedChangeAI;
- uint64 LastCharmerGUID;
+ ObjectGuid LastCharmerGUID;
bool CreateVehicleKit(uint32 id, uint32 creatureEntry);
void RemoveVehicleKit();
Vehicle* GetVehicleKit()const { return m_vehicleKit; }
@@ -2120,7 +2122,7 @@ class Unit : public WorldObject
bool IsOnVehicle(const Unit* vehicle) const;
Unit* GetVehicleBase() const;
Creature* GetVehicleCreatureBase() const;
- uint64 GetTransGUID() const override;
+ ObjectGuid GetTransGUID() const override;
/// Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
TransportBase* GetDirectTransport() const;
@@ -2148,7 +2150,7 @@ class Unit : public WorldObject
virtual float GetFollowAngle() const { return static_cast<float>(M_PI/2); }
void OutDebugInfo() const;
- virtual bool isBeingLoaded() const { return false;}
+ virtual bool IsLoading() const { return false; }
bool IsDuringRemoveFromWorld() const {return m_duringRemoveFromWorld;}
Pet* ToPet() { if (IsPet()) return reinterpret_cast<Pet*>(this); else return NULL; }
@@ -2160,8 +2162,8 @@ class Unit : public WorldObject
TempSummon* ToTempSummon() { if (IsSummon()) return reinterpret_cast<TempSummon*>(this); else return NULL; }
TempSummon const* ToTempSummon() const { if (IsSummon()) return reinterpret_cast<TempSummon const*>(this); else return NULL; }
- uint64 GetTarget() const { return GetUInt64Value(UNIT_FIELD_TARGET); }
- virtual void SetTarget(uint64 /*guid*/) = 0;
+ ObjectGuid GetTarget() const { return GetGuidValue(UNIT_FIELD_TARGET); }
+ virtual void SetTarget(ObjectGuid /*guid*/) = 0;
// Movement info
Movement::MoveSpline * movespline;
@@ -2297,7 +2299,7 @@ class Unit : public WorldObject
FollowerRefManager m_FollowingRefManager;
- ComboPointHolderSet m_ComboPointHolders;
+ GuidSet m_ComboPointHolders;
RedirectThreatInfo _redirectThreadInfo;
diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h
index be008330f0c..ffed8e2b677 100644
--- a/src/server/game/Entities/Vehicle/Vehicle.h
+++ b/src/server/game/Entities/Vehicle/Vehicle.h
@@ -29,8 +29,6 @@ struct VehicleEntry;
class Unit;
class VehicleJoinEvent;
-typedef std::set<uint64> GuidSet;
-
class Vehicle : public TransportBase
{
protected:
diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h
index 2a800008e8b..afd4b96e260 100644
--- a/src/server/game/Entities/Vehicle/VehicleDefines.h
+++ b/src/server/game/Entities/Vehicle/VehicleDefines.h
@@ -77,12 +77,12 @@ enum VehicleSpells
struct PassengerInfo
{
- uint64 Guid;
+ ObjectGuid Guid;
bool IsUnselectable;
void Reset()
{
- Guid = 0;
+ Guid.Clear();
IsUnselectable = false;
}
};
@@ -94,7 +94,7 @@ struct VehicleSeat
Passenger.Reset();
}
- bool IsEmpty() const { return !Passenger.Guid; }
+ bool IsEmpty() const { return Passenger.Guid.IsEmpty(); }
VehicleSeatEntry const* SeatInfo;
PassengerInfo Passenger;
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index 217919ff574..92cc3181486 100644
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -1123,7 +1123,7 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id)
// get the creature data from the low guid to get the entry, to be able to find out the whole guid
if (CreatureData const* data = sObjectMgr->GetCreatureData(itr->first))
{
- Creature* cr = HashMapHolder<Creature>::Find(MAKE_NEW_GUID(itr->first, data->id, HIGHGUID_UNIT));
+ Creature* cr = HashMapHolder<Creature>::Find(ObjectGuid(HIGHGUID_UNIT, data->id, itr->first));
// if we found the creature, modify its npcflag
if (cr)
{
@@ -1254,7 +1254,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
{
sObjectMgr->RemoveCreatureFromGrid(*itr, data);
- if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL))
+ if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, data->id, *itr), (Creature*)NULL))
creature->AddObjectToRemoveList();
}
}
@@ -1276,7 +1276,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
{
sObjectMgr->RemoveGameobjectFromGrid(*itr, data);
- if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL))
+ if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, *itr), (GameObject*)NULL))
pGameobject->AddObjectToRemoveList();
}
}
@@ -1302,7 +1302,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
continue;
// Update if spawned
- Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id, HIGHGUID_UNIT), (Creature*)NULL);
+ Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, data->id, itr->first), (Creature*)NULL);
if (creature)
{
if (activate)
diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp
index a464d0c57eb..16dabe4fcad 100644
--- a/src/server/game/Globals/ObjectAccessor.cpp
+++ b/src/server/game/Globals/ObjectAccessor.cpp
@@ -46,7 +46,7 @@ ObjectAccessor::ObjectAccessor() { }
ObjectAccessor::~ObjectAccessor() { }
-template<class T> T* ObjectAccessor::GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/)
+template<class T> T* ObjectAccessor::GetObjectInWorld(uint32 mapid, float x, float y, ObjectGuid guid, T* /*fake*/)
{
T* obj = HashMapHolder<T>::Find(guid);
if (!obj || obj->GetMapId() != mapid)
@@ -75,15 +75,15 @@ template<class T> T* ObjectAccessor::GetObjectInWorld(uint32 mapid, float x, flo
return NULL;
}
-Player* ObjectAccessor::GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/)
+Player* ObjectAccessor::GetObjectInWorld(ObjectGuid guid, Player* /*typeSpecifier*/)
{
Player* player = HashMapHolder<Player>::Find(guid);
return player && player->IsInWorld() ? player : NULL;
}
-WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, uint64 guid)
+WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, ObjectGuid guid)
{
- switch (GUID_HIPART(guid))
+ switch (guid.GetHigh())
{
case HIGHGUID_PLAYER: return GetPlayer(p, guid);
case HIGHGUID_TRANSPORT:
@@ -99,9 +99,9 @@ WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, uint64 guid)
}
}
-Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, uint64 guid, uint32 typemask)
+Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, ObjectGuid guid, uint32 typemask)
{
- switch (GUID_HIPART(guid))
+ switch (guid.GetHigh())
{
case HIGHGUID_ITEM:
if (typemask & TYPEMASK_ITEM && p.GetTypeId() == TYPEID_PLAYER)
@@ -135,82 +135,84 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, uint64 guid, u
return GetAreaTrigger(p, guid);
case HIGHGUID_CORPSE:
break;
+ default:
+ break;
}
return NULL;
}
-Corpse* ObjectAccessor::GetCorpse(WorldObject const& u, uint64 guid)
+Corpse* ObjectAccessor::GetCorpse(WorldObject const& u, ObjectGuid guid)
{
return GetObjectInMap(guid, u.GetMap(), (Corpse*)NULL);
}
-GameObject* ObjectAccessor::GetGameObject(WorldObject const& u, uint64 guid)
+GameObject* ObjectAccessor::GetGameObject(WorldObject const& u, ObjectGuid guid)
{
return GetObjectInMap(guid, u.GetMap(), (GameObject*)NULL);
}
-Transport* ObjectAccessor::GetTransport(WorldObject const& u, uint64 guid)
+Transport* ObjectAccessor::GetTransport(WorldObject const& u, ObjectGuid guid)
{
- if (GUID_HIPART(guid) != HIGHGUID_MO_TRANSPORT)
+ if (!guid.IsMOTransport())
return NULL;
GameObject* go = GetGameObject(u, guid);
return go ? go->ToTransport() : NULL;
}
-DynamicObject* ObjectAccessor::GetDynamicObject(WorldObject const& u, uint64 guid)
+DynamicObject* ObjectAccessor::GetDynamicObject(WorldObject const& u, ObjectGuid guid)
{
return GetObjectInMap(guid, u.GetMap(), (DynamicObject*)NULL);
}
-AreaTrigger* ObjectAccessor::GetAreaTrigger(WorldObject const& u, uint64 guid)
+AreaTrigger* ObjectAccessor::GetAreaTrigger(WorldObject const& u, ObjectGuid guid)
{
return GetObjectInMap(guid, u.GetMap(), (AreaTrigger*)NULL);
}
-Unit* ObjectAccessor::GetUnit(WorldObject const& u, uint64 guid)
+Unit* ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid guid)
{
return GetObjectInMap(guid, u.GetMap(), (Unit*)NULL);
}
-Creature* ObjectAccessor::GetCreature(WorldObject const& u, uint64 guid)
+Creature* ObjectAccessor::GetCreature(WorldObject const& u, ObjectGuid guid)
{
return GetObjectInMap(guid, u.GetMap(), (Creature*)NULL);
}
-Pet* ObjectAccessor::GetPet(WorldObject const& u, uint64 guid)
+Pet* ObjectAccessor::GetPet(WorldObject const& u, ObjectGuid guid)
{
return GetObjectInMap(guid, u.GetMap(), (Pet*)NULL);
}
-Player* ObjectAccessor::GetPlayer(WorldObject const& u, uint64 guid)
+Player* ObjectAccessor::GetPlayer(WorldObject const& u, ObjectGuid guid)
{
return GetObjectInMap(guid, u.GetMap(), (Player*)NULL);
}
-Creature* ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const& u, uint64 guid)
+Creature* ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const& u, ObjectGuid guid)
{
- if (IS_PET_GUID(guid))
+ if (guid.IsPet())
return GetPet(u, guid);
- if (IS_CRE_OR_VEH_GUID(guid))
+ if (guid.IsCreatureOrVehicle())
return GetCreature(u, guid);
return NULL;
}
-Pet* ObjectAccessor::FindPet(uint64 guid)
+Pet* ObjectAccessor::FindPet(ObjectGuid guid)
{
return GetObjectInWorld(guid, (Pet*)NULL);
}
-Player* ObjectAccessor::FindPlayer(uint64 guid)
+Player* ObjectAccessor::FindPlayer(ObjectGuid guid)
{
return GetObjectInWorld(guid, (Player*)NULL);
}
-Unit* ObjectAccessor::FindUnit(uint64 guid)
+Unit* ObjectAccessor::FindUnit(ObjectGuid guid)
{
return GetObjectInWorld(guid, (Unit*)NULL);
}
@@ -244,7 +246,7 @@ void ObjectAccessor::SaveAllPlayers()
itr->second->SaveToDB();
}
-Corpse* ObjectAccessor::GetCorpseForPlayerGUID(uint64 guid)
+Corpse* ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid)
{
boost::shared_lock<boost::shared_mutex> lock(_corpseLock);
@@ -289,7 +291,7 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse)
// build mapid*cellid -> guid_set map
CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY());
- sObjectMgr->DeleteCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), GUID_LOPART(corpse->GetOwnerGUID()));
+ sObjectMgr->DeleteCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), corpse->GetOwnerGUID().GetCounter());
i_player2corpse.erase(iter);
}
@@ -308,7 +310,7 @@ void ObjectAccessor::AddCorpse(Corpse* corpse)
// build mapid*cellid -> guid_set map
CellCoord cellCoord = Trinity::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY());
- sObjectMgr->AddCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), GUID_LOPART(corpse->GetOwnerGUID()), corpse->GetInstanceId());
+ sObjectMgr->AddCorpseCellData(corpse->GetMapId(), cellCoord.GetId(), corpse->GetOwnerGUID().GetCounter(), corpse->GetInstanceId());
}
}
@@ -336,7 +338,7 @@ void ObjectAccessor::AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid,
}
}
-Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia /*=false*/)
+Corpse* ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia /*=false*/)
{
Corpse* corpse = GetCorpseForPlayerGUID(player_guid);
if (!corpse)
@@ -380,7 +382,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation());
bones->SetUInt32Value(CORPSE_FIELD_FLAGS, CORPSE_FLAG_UNK2 | CORPSE_FLAG_BONES);
- bones->SetUInt64Value(CORPSE_FIELD_OWNER, 0);
+ bones->SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid::Empty);
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
@@ -446,7 +448,7 @@ void ObjectAccessor::UnloadAll()
/// Define the static members of HashMapHolder
-template <class T> std::unordered_map< uint64, T* > HashMapHolder<T>::_objectMap;
+template <class T> typename HashMapHolder<T>::MapType HashMapHolder<T>::_objectMap;
template <class T> boost::shared_mutex HashMapHolder<T>::_lock;
/// Global definitions for the hashmap storage
@@ -458,9 +460,9 @@ template class HashMapHolder<DynamicObject>;
template class HashMapHolder<Creature>;
template class HashMapHolder<Corpse>;
-template Player* ObjectAccessor::GetObjectInWorld<Player>(uint32 mapid, float x, float y, uint64 guid, Player* /*fake*/);
-template Pet* ObjectAccessor::GetObjectInWorld<Pet>(uint32 mapid, float x, float y, uint64 guid, Pet* /*fake*/);
-template Creature* ObjectAccessor::GetObjectInWorld<Creature>(uint32 mapid, float x, float y, uint64 guid, Creature* /*fake*/);
-template Corpse* ObjectAccessor::GetObjectInWorld<Corpse>(uint32 mapid, float x, float y, uint64 guid, Corpse* /*fake*/);
-template GameObject* ObjectAccessor::GetObjectInWorld<GameObject>(uint32 mapid, float x, float y, uint64 guid, GameObject* /*fake*/);
-template DynamicObject* ObjectAccessor::GetObjectInWorld<DynamicObject>(uint32 mapid, float x, float y, uint64 guid, DynamicObject* /*fake*/);
+template Player* ObjectAccessor::GetObjectInWorld<Player>(uint32 mapid, float x, float y, ObjectGuid guid, Player* /*fake*/);
+template Pet* ObjectAccessor::GetObjectInWorld<Pet>(uint32 mapid, float x, float y, ObjectGuid guid, Pet* /*fake*/);
+template Creature* ObjectAccessor::GetObjectInWorld<Creature>(uint32 mapid, float x, float y, ObjectGuid guid, Creature* /*fake*/);
+template Corpse* ObjectAccessor::GetObjectInWorld<Corpse>(uint32 mapid, float x, float y, ObjectGuid guid, Corpse* /*fake*/);
+template GameObject* ObjectAccessor::GetObjectInWorld<GameObject>(uint32 mapid, float x, float y, ObjectGuid guid, GameObject* /*fake*/);
+template DynamicObject* ObjectAccessor::GetObjectInWorld<DynamicObject>(uint32 mapid, float x, float y, ObjectGuid guid, DynamicObject* /*fake*/);
diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h
index f466d8bd328..a23932fb702 100644
--- a/src/server/game/Globals/ObjectAccessor.h
+++ b/src/server/game/Globals/ObjectAccessor.h
@@ -47,7 +47,7 @@ class HashMapHolder
{
public:
- typedef std::unordered_map<uint64, T*> MapType;
+ typedef std::unordered_map<ObjectGuid, T*> MapType;
static void Insert(T* o)
{
@@ -63,7 +63,7 @@ class HashMapHolder
_objectMap.erase(o->GetGUID());
}
- static T* Find(uint64 guid)
+ static T* Find(ObjectGuid guid)
{
boost::shared_lock<boost::shared_mutex> lock(_lock);
@@ -100,44 +100,44 @@ class ObjectAccessor
return &instance;
}
- template<class T> static T* GetObjectInOrOutOfWorld(uint64 guid, T* /*typeSpecifier*/)
+ template<class T> static T* GetObjectInOrOutOfWorld(ObjectGuid guid, T* /*typeSpecifier*/)
{
return HashMapHolder<T>::Find(guid);
}
- static Unit* GetObjectInOrOutOfWorld(uint64 guid, Unit* /*typeSpecifier*/)
+ static Unit* GetObjectInOrOutOfWorld(ObjectGuid guid, Unit* /*typeSpecifier*/)
{
- if (IS_PLAYER_GUID(guid))
+ if (guid.IsPlayer())
return (Unit*)GetObjectInOrOutOfWorld(guid, (Player*)NULL);
- if (IS_PET_GUID(guid))
+ if (guid.IsPet())
return (Unit*)GetObjectInOrOutOfWorld(guid, (Pet*)NULL);
return (Unit*)GetObjectInOrOutOfWorld(guid, (Creature*)NULL);
}
// returns object if is in world
- template<class T> static T* GetObjectInWorld(uint64 guid, T* /*typeSpecifier*/)
+ template<class T> static T* GetObjectInWorld(ObjectGuid guid, T* /*typeSpecifier*/)
{
return HashMapHolder<T>::Find(guid);
}
// Player may be not in world while in ObjectAccessor
- static Player* GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/);
+ static Player* GetObjectInWorld(ObjectGuid guid, Player* /*typeSpecifier*/);
- static Unit* GetObjectInWorld(uint64 guid, Unit* /*typeSpecifier*/)
+ static Unit* GetObjectInWorld(ObjectGuid guid, Unit* /*typeSpecifier*/)
{
- if (IS_PLAYER_GUID(guid))
+ if (guid.IsPlayer())
return (Unit*)GetObjectInWorld(guid, (Player*)NULL);
- if (IS_PET_GUID(guid))
+ if (guid.IsPet())
return (Unit*)GetObjectInWorld(guid, (Pet*)NULL);
return (Unit*)GetObjectInWorld(guid, (Creature*)NULL);
}
// returns object if is in map
- template<class T> static T* GetObjectInMap(uint64 guid, Map* map, T* /*typeSpecifier*/)
+ template<class T> static T* GetObjectInMap(ObjectGuid guid, Map* map, T* /*typeSpecifier*/)
{
ASSERT(map);
if (T * obj = GetObjectInWorld(guid, (T*)NULL))
@@ -146,28 +146,28 @@ class ObjectAccessor
return NULL;
}
- template<class T> static T* GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/);
+ template<class T> static T* GetObjectInWorld(uint32 mapid, float x, float y, ObjectGuid guid, T* /*fake*/);
// these functions return objects only if in map of specified object
- static WorldObject* GetWorldObject(WorldObject const&, uint64);
- static Object* GetObjectByTypeMask(WorldObject const&, uint64, uint32 typemask);
- static Corpse* GetCorpse(WorldObject const& u, uint64 guid);
- static GameObject* GetGameObject(WorldObject const& u, uint64 guid);
- static Transport* GetTransport(WorldObject const& u, uint64 guid);
- static DynamicObject* GetDynamicObject(WorldObject const& u, uint64 guid);
- static AreaTrigger* GetAreaTrigger(WorldObject const& u, uint64 guid);
- static Unit* GetUnit(WorldObject const&, uint64 guid);
- static Creature* GetCreature(WorldObject const& u, uint64 guid);
- static Pet* GetPet(WorldObject const&, uint64 guid);
- static Player* GetPlayer(WorldObject const&, uint64 guid);
- static Creature* GetCreatureOrPetOrVehicle(WorldObject const&, uint64);
+ static WorldObject* GetWorldObject(WorldObject const&, ObjectGuid);
+ static Object* GetObjectByTypeMask(WorldObject const&, ObjectGuid, uint32 typemask);
+ static Corpse* GetCorpse(WorldObject const& u, ObjectGuid guid);
+ static GameObject* GetGameObject(WorldObject const& u, ObjectGuid guid);
+ static Transport* GetTransport(WorldObject const& u, ObjectGuid guid);
+ static DynamicObject* GetDynamicObject(WorldObject const& u, ObjectGuid guid);
+ static AreaTrigger* GetAreaTrigger(WorldObject const& u, ObjectGuid guid);
+ static Unit* GetUnit(WorldObject const&, ObjectGuid guid);
+ static Creature* GetCreature(WorldObject const& u, ObjectGuid guid);
+ static Pet* GetPet(WorldObject const&, ObjectGuid guid);
+ static Player* GetPlayer(WorldObject const&, ObjectGuid guid);
+ static Creature* GetCreatureOrPetOrVehicle(WorldObject const&, ObjectGuid);
// these functions return objects if found in whole world
// ACCESS LIKE THAT IS NOT THREAD SAFE
- static Pet* FindPet(uint64);
- static Player* FindPlayer(uint64);
- static Creature* FindCreature(uint64);
- static Unit* FindUnit(uint64);
+ static Pet* FindPet(ObjectGuid);
+ static Player* FindPlayer(ObjectGuid);
+ static Creature* FindCreature(ObjectGuid);
+ static Unit* FindUnit(ObjectGuid);
static Player* FindPlayerByName(std::string const& name);
// when using this, you must use the hashmapholder's lock
@@ -214,11 +214,11 @@ class ObjectAccessor
}
//Thread safe
- Corpse* GetCorpseForPlayerGUID(uint64 guid);
+ Corpse* GetCorpseForPlayerGUID(ObjectGuid guid);
void RemoveCorpse(Corpse* corpse);
void AddCorpse(Corpse* corpse);
void AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid, Map* map);
- Corpse* ConvertCorpseForPlayer(uint64 player_guid, bool insignia = false);
+ Corpse* ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia = false);
//Thread unsafe
void Update(uint32 diff);
@@ -230,7 +230,7 @@ class ObjectAccessor
static void _buildPacket(Player*, Object*, UpdateDataMapType&);
void _update();
- typedef std::unordered_map<uint64, Corpse*> Player2CorpsesMapType;
+ typedef std::unordered_map<ObjectGuid, Corpse*> Player2CorpsesMapType;
typedef std::unordered_map<Player*, UpdateData>::value_type UpdateDataValueType;
std::set<Object*> i_objects;
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index d44c11f886a..2bdfb57adb4 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1290,7 +1290,7 @@ void ObjectMgr::LoadCreatureModelInfo()
// Checks
if (!sCreatureDisplayInfoStore.LookupEntry(modelId))
- TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has model for not existed display id (%u).", modelId);
+ TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has model for nonexistent display id (%u).", modelId);
if (modelInfo.gender > GENDER_NONE)
{
@@ -1300,7 +1300,7 @@ void ObjectMgr::LoadCreatureModelInfo()
if (modelInfo.modelid_other_gender && !sCreatureDisplayInfoStore.LookupEntry(modelInfo.modelid_other_gender))
{
- TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId);
+ TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has nonexistent alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId);
modelInfo.modelid_other_gender = 0;
}
@@ -1336,7 +1336,7 @@ void ObjectMgr::LoadLinkedRespawn()
uint32 linkedGuidLow = fields[1].GetUInt32();
uint8 linkType = fields[2].GetUInt8();
- uint64 guid = 0, linkedGuid = 0;
+ ObjectGuid guid, linkedGuid;
bool error = false;
switch (linkType)
{
@@ -1373,8 +1373,8 @@ void ObjectMgr::LoadLinkedRespawn()
break;
}
- guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_UNIT);
- linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_UNIT);
+ guid = ObjectGuid(HIGHGUID_UNIT, slave->id, guidLow);
+ linkedGuid = ObjectGuid(HIGHGUID_UNIT, master->id, linkedGuidLow);
break;
}
case CREATURE_TO_GO:
@@ -1410,8 +1410,8 @@ void ObjectMgr::LoadLinkedRespawn()
break;
}
- guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_UNIT);
- linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_GAMEOBJECT);
+ guid = ObjectGuid(HIGHGUID_UNIT, slave->id, guidLow);
+ linkedGuid = ObjectGuid(HIGHGUID_GAMEOBJECT, master->id, linkedGuidLow);
break;
}
case GO_TO_GO:
@@ -1447,8 +1447,8 @@ void ObjectMgr::LoadLinkedRespawn()
break;
}
- guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_GAMEOBJECT);
- linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_GAMEOBJECT);
+ guid = ObjectGuid(HIGHGUID_GAMEOBJECT, slave->id, guidLow);
+ linkedGuid = ObjectGuid(HIGHGUID_GAMEOBJECT, master->id, linkedGuidLow);
break;
}
case GO_TO_CREATURE:
@@ -1484,8 +1484,8 @@ void ObjectMgr::LoadLinkedRespawn()
break;
}
- guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_GAMEOBJECT);
- linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_UNIT);
+ guid = ObjectGuid(HIGHGUID_GAMEOBJECT, slave->id, guidLow);
+ linkedGuid = ObjectGuid(HIGHGUID_UNIT, master->id, linkedGuidLow);
break;
}
}
@@ -1503,9 +1503,9 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
if (!guidLow)
return false;
- const CreatureData* master = GetCreatureData(guidLow);
+ CreatureData const* master = GetCreatureData(guidLow);
ASSERT(master);
- uint64 guid = MAKE_NEW_GUID(guidLow, master->id, HIGHGUID_UNIT);
+ ObjectGuid guid(HIGHGUID_UNIT, master->id, guidLow);
if (!linkedGuidLow) // we're removing the linking
{
@@ -1516,14 +1516,14 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
return true;
}
- const CreatureData* slave = GetCreatureData(linkedGuidLow);
+ CreatureData const* slave = GetCreatureData(linkedGuidLow);
if (!slave)
{
TC_LOG_ERROR("sql.sql", "Creature '%u' linking to non-existent creature '%u'.", guidLow, linkedGuidLow);
return false;
}
- const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
+ MapEntry const* map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
TC_LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
@@ -1536,7 +1536,7 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
return false;
}
- uint64 linkedGuid = MAKE_NEW_GUID(linkedGuidLow, slave->id, HIGHGUID_UNIT);
+ ObjectGuid linkedGuid(HIGHGUID_UNIT, slave->id, linkedGuidLow);
_linkedRespawnStore[guid] = linkedGuid;
PreparedStatement *stmt = WorldDatabase.GetPreparedStatement(WORLD_REP_CREATURE_LINKED_RESPAWN);
@@ -1704,20 +1704,20 @@ void ObjectMgr::LoadCreatures()
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
if (!mapEntry)
{
- TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) that spawned at not existed map (Id: %u), skipped.", guid, data.id, data.mapid);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u) that spawned at nonexistent map (Id: %u), skipped.", guid, data.mapid);
continue;
}
// Skip spawnMask check for transport maps
if (!IsTransportMap(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid])
- TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u) spawnMasks[data.mapid]: %u.", guid, data.id, data.spawnMask, data.mapid, spawnMasks[data.mapid]);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u) that have wrong spawn mask %u including unsupported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid);
bool ok = true;
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
{
if (_difficultyEntries[diff].find(data.id) != _difficultyEntries[diff].end())
{
- TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u) that is listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
guid, diff + 1, data.id);
ok = false;
}
@@ -1730,7 +1730,7 @@ void ObjectMgr::LoadCreatures()
{
if (!GetEquipmentInfo(data.id, data.equipmentId))
{
- TC_LOG_ERROR("sql.sql", "Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId);
data.equipmentId = 0;
}
}
@@ -1738,19 +1738,19 @@ void ObjectMgr::LoadCreatures()
if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
{
if (!mapEntry || !mapEntry->IsDungeon())
- TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature is not in instance.", guid, data.id);
}
if (data.spawndist < 0.0f)
{
- TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id);
data.spawndist = 0.0f;
}
else if (data.movementType == RANDOM_MOTION_TYPE)
{
if (data.spawndist == 0.0f)
{
- TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).", guid, data.id);
data.movementType = IDLE_MOTION_TYPE;
}
}
@@ -1758,14 +1758,14 @@ void ObjectMgr::LoadCreatures()
{
if (data.spawndist != 0.0f)
{
- TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id);
data.spawndist = 0.0f;
}
}
if (data.phaseMask == 0)
{
- TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
data.phaseMask = 1;
}
@@ -2051,7 +2051,7 @@ void ObjectMgr::LoadGameobjects()
data.spawnMask = fields[14].GetUInt8();
if (!IsTransportMap(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid])
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including unsupported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid);
data.phaseMask = fields[15].GetUInt32();
int16 gameEvent = fields[16].GetInt8();
@@ -2127,15 +2127,13 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data
Player* ObjectMgr::GetPlayerByLowGUID(uint32 lowguid) const
{
- uint64 guid = MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER);
+ ObjectGuid guid(HIGHGUID_PLAYER, lowguid);
return ObjectAccessor::FindPlayer(guid);
}
// name must be checked to correctness (if received) before call this function
-uint64 ObjectMgr::GetPlayerGUIDByName(std::string const& name) const
+ObjectGuid ObjectMgr::GetPlayerGUIDByName(std::string const& name) const
{
- uint64 guid = 0;
-
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME);
stmt->setString(0, name);
@@ -2143,12 +2141,12 @@ uint64 ObjectMgr::GetPlayerGUIDByName(std::string const& name) const
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
- guid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ return ObjectGuid(HIGHGUID_PLAYER, (*result)[0].GetUInt32());
- return guid;
+ return ObjectGuid::Empty;
}
-bool ObjectMgr::GetPlayerNameByGUID(uint64 guid, std::string& name) const
+bool ObjectMgr::GetPlayerNameByGUID(ObjectGuid guid, std::string& name) const
{
// prevent DB access for online player
if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -2159,7 +2157,7 @@ bool ObjectMgr::GetPlayerNameByGUID(uint64 guid, std::string& name) const
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -2172,7 +2170,7 @@ bool ObjectMgr::GetPlayerNameByGUID(uint64 guid, std::string& name) const
return false;
}
-uint32 ObjectMgr::GetPlayerTeamByGUID(uint64 guid) const
+uint32 ObjectMgr::GetPlayerTeamByGUID(ObjectGuid guid) const
{
// prevent DB access for online player
if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -2182,7 +2180,7 @@ uint32 ObjectMgr::GetPlayerTeamByGUID(uint64 guid) const
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_RACE);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -2195,7 +2193,7 @@ uint32 ObjectMgr::GetPlayerTeamByGUID(uint64 guid) const
return 0;
}
-uint32 ObjectMgr::GetPlayerAccountIdByGUID(uint64 guid) const
+uint32 ObjectMgr::GetPlayerAccountIdByGUID(ObjectGuid guid) const
{
// prevent DB access for online player
if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -2205,7 +2203,7 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(uint64 guid) const
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_BY_GUID);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -4775,7 +4773,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
info->type == GAMEOBJECT_TYPE_BUTTON ||
info->type == GAMEOBJECT_TYPE_TRAP)
{
- TC_LOG_ERROR("sql.sql", "Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
+ TC_LOG_ERROR("sql.sql", "Table `%s` has gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
tableName.c_str(), info->entry, tmp.id);
continue;
}
@@ -4821,7 +4819,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (info->type != GAMEOBJECT_TYPE_DOOR)
{
- TC_LOG_ERROR("sql.sql", "Table `%s` has gameobject type (%u) non supported by command %s for script id %u",
+ TC_LOG_ERROR("sql.sql", "Table `%s` has gameobject type (%u) unsupported by command %s for script id %u",
tableName.c_str(), info->entry, GetScriptCommandName(tmp.command).c_str(), tmp.id);
continue;
}
@@ -5537,7 +5535,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
Player* player = NULL;
if (serverUp)
- player = ObjectAccessor::FindPlayer((uint64)m->receiver);
+ player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, m->receiver));
if (player && player->m_mailsLoaded)
{ // this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail
@@ -6344,7 +6342,7 @@ void ObjectMgr::SetHighestGuids()
if (result)
_hiItemGuid = (*result)[0].GetUInt32()+1;
- // Cleanup other tables from not existed guids ( >= _hiItemGuid)
+ // Cleanup other tables from nonexistent guids ( >= _hiItemGuid)
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '%u'", _hiItemGuid); // One-time query
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '%u'", _hiItemGuid); // One-time query
CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE itemguid >= '%u'", _hiItemGuid); // One-time query
@@ -7047,7 +7045,7 @@ void ObjectMgr::LoadReputationOnKill()
if (!GetCreatureTemplate(creature_id))
{
- TC_LOG_ERROR("sql.sql", "Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id);
+ TC_LOG_ERROR("sql.sql", "Table `creature_onkill_reputation` has data for nonexistent creature entry (%u), skipped", creature_id);
continue;
}
@@ -7473,9 +7471,9 @@ void ObjectMgr::LoadGameobjectQuestStarters()
{
GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first);
if (!goInfo)
- TC_LOG_ERROR("sql.sql", "Table `gameobject_queststarter` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject_queststarter` has data for nonexistent gameobject entry (%u) and existed quest %u", itr->first, itr->second);
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
- TC_LOG_ERROR("sql.sql", "Table `gameobject_queststarter` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject_queststarter` has data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
@@ -7487,9 +7485,9 @@ void ObjectMgr::LoadGameobjectQuestEnders()
{
GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first);
if (!goInfo)
- TC_LOG_ERROR("sql.sql", "Table `gameobject_questender` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject_questender` has data for nonexistent gameobject entry (%u) and existed quest %u", itr->first, itr->second);
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
- TC_LOG_ERROR("sql.sql", "Table `gameobject_questender` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject_questender` has data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
@@ -7501,7 +7499,7 @@ void ObjectMgr::LoadCreatureQuestStarters()
{
CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first);
if (!cInfo)
- TC_LOG_ERROR("sql.sql", "Table `creature_queststarter` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second);
+ TC_LOG_ERROR("sql.sql", "Table `creature_queststarter` has data for nonexistent creature entry (%u) and existed quest %u", itr->first, itr->second);
else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
TC_LOG_ERROR("sql.sql", "Table `creature_queststarter` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
@@ -7515,7 +7513,7 @@ void ObjectMgr::LoadCreatureQuestEnders()
{
CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first);
if (!cInfo)
- TC_LOG_ERROR("sql.sql", "Table `creature_questender` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second);
+ TC_LOG_ERROR("sql.sql", "Table `creature_questender` has data for nonexistent creature entry (%u) and existed quest %u", itr->first, itr->second);
else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
TC_LOG_ERROR("sql.sql", "Table `creature_questender` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
@@ -7546,7 +7544,7 @@ void ObjectMgr::LoadReservedPlayersNames()
std::wstring wstr;
if (!Utf8toWStr (name, wstr))
{
- TC_LOG_ERROR("misc", "Table `reserved_name` have invalid name: %s", name.c_str());
+ TC_LOG_ERROR("misc", "Table `reserved_name` has invalid name: %s", name.c_str());
continue;
}
@@ -7770,112 +7768,48 @@ void ObjectMgr::LoadGameObjectForQuests()
TC_LOG_INFO("server.loading", ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
-bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value)
+bool ObjectMgr::LoadTrinityStrings()
{
uint32 oldMSTime = getMSTime();
- int32 start_value = min_value;
- int32 end_value = max_value;
- // some string can have negative indexes range
- if (start_value < 0)
- {
- if (end_value >= start_value)
- {
- TC_LOG_ERROR("sql.sql", "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
- return false;
- }
-
- // real range (max+1, min+1) exaple: (-10, -1000) -> -999...-10+1
- std::swap(start_value, end_value);
- ++start_value;
- ++end_value;
- }
- else
- {
- if (start_value >= end_value)
- {
- TC_LOG_ERROR("sql.sql", "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
- return false;
- }
- }
-
- // cleanup affected map part for reloading case
- for (TrinityStringLocaleContainer::iterator itr = _trinityStringLocaleStore.begin(); itr != _trinityStringLocaleStore.end();)
- {
- if (itr->first >= start_value && itr->first < end_value)
- _trinityStringLocaleStore.erase(itr++);
- else
- ++itr;
- }
-
- QueryResult result = WorldDatabase.PQuery("SELECT entry, content_default, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8 FROM %s", table);
+ _trinityStringStore.clear(); // for reload case
+ QueryResult result = WorldDatabase.Query("SELECT entry, content_default, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8 FROM trinity_string");
if (!result)
{
- if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings
- TC_LOG_ERROR("server.loading", ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
- else
- TC_LOG_INFO("server.loading", ">> Loaded 0 string templates. DB table `%s` is empty.", table);
-
+ TC_LOG_ERROR("server.loading", ">> Loaded 0 trinity strings. DB table `trinity_string` is empty.");
return false;
}
- uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
- int32 entry = fields[0].GetInt32();
+ uint32 entry = fields[0].GetUInt32();
- if (entry == 0)
- {
- TC_LOG_ERROR("sql.sql", "Table `%s` contain reserved entry 0, ignored.", table);
- continue;
- }
- else if (entry < start_value || entry >= end_value)
- {
- TC_LOG_ERROR("sql.sql", "Table `%s` contain entry %i out of allowed range (%d - %d), ignored.", table, entry, min_value, max_value);
- continue;
- }
+ TrinityString& data = _trinityStringStore[entry];
- TrinityStringLocale& data = _trinityStringLocaleStore[entry];
-
- if (!data.Content.empty())
- {
- TC_LOG_ERROR("sql.sql", "Table `%s` contain data for already loaded entry %i (from another table?), ignored.", table, entry);
- continue;
- }
-
- data.Content.resize(1);
- ++count;
+ data.Content.resize(DEFAULT_LOCALE + 1);
for (int8 i = TOTAL_LOCALES - 1; i >= 0; --i)
AddLocaleString(fields[i + 1].GetString(), LocaleConstant(i), data.Content);
- } while (result->NextRow());
-
- if (min_value == MIN_TRINITY_STRING_ID)
- TC_LOG_INFO("server.loading", ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
- else
- TC_LOG_INFO("server.loading", ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
+ }
+ while (result->NextRow());
+ TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " trinity strings in %u ms", _trinityStringStore.size(), GetMSTimeDiffToNow(oldMSTime));
return true;
}
-const char *ObjectMgr::GetTrinityString(int32 entry, LocaleConstant locale_idx) const
+char const* ObjectMgr::GetTrinityString(uint32 entry, LocaleConstant locale) const
{
- if (TrinityStringLocale const* msl = GetTrinityStringLocale(entry))
+ if (TrinityString const* ts = GetTrinityString(entry))
{
- if (msl->Content.size() > size_t(locale_idx) && !msl->Content[locale_idx].empty())
- return msl->Content[locale_idx].c_str();
-
- return msl->Content[DEFAULT_LOCALE].c_str();
+ if (ts->Content.size() > size_t(locale) && !ts->Content[locale].empty())
+ return ts->Content[locale].c_str();
+ return ts->Content[DEFAULT_LOCALE].c_str();
}
- if (entry > 0)
- TC_LOG_ERROR("sql.sql", "Entry %i not found in `trinity_string` table.", entry);
- else
- TC_LOG_ERROR("sql.sql", "Trinity string entry %i not found in DB.", entry);
+ TC_LOG_ERROR("sql.sql", "Trinity string entry %u not found in DB.", entry);
return "<error>";
}
@@ -8183,25 +8117,25 @@ void ObjectMgr::LoadMailLevelRewards()
if (level > MAX_LEVEL)
{
- TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL);
+ TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` has data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL);
continue;
}
if (!(raceMask & RACEMASK_ALL_PLAYABLE))
{
- TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level);
+ TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` has raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level);
continue;
}
if (!sMailTemplateStore.LookupEntry(mailTemplateId))
{
- TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level);
+ TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` has invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level);
continue;
}
if (!GetCreatureTemplate(senderEntry))
{
- TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level);
+ TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` has nonexistent sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level);
continue;
}
@@ -8596,7 +8530,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 id, int32 maxcount
if (player)
ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
else
- TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry);
+ TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has data for nonexistent creature template (Entry: %u), ignore", vendor_entry);
return false;
}
@@ -8607,7 +8541,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 id, int32 maxcount
if (player)
ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
else
- TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
+ TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has data for creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
if (skip_vendors)
skip_vendors->insert(vendor_entry);
@@ -8630,7 +8564,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 id, int32 maxcount
if (player)
ChatHandler(player->GetSession()).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
else
- TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", id, ExtendedCost, vendor_entry);
+ TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", id, ExtendedCost, vendor_entry);
return false;
}
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 0931ab9616a..abd452eaeb0 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -490,19 +490,15 @@ struct CellObjectGuids
typedef std::unordered_map<uint32/*cell_id*/, CellObjectGuids> CellObjectGuidsMap;
typedef std::unordered_map<uint32/*(mapid, spawnMode) pair*/, CellObjectGuidsMap> MapObjectGuids;
-// Trinity string ranges
-#define MIN_TRINITY_STRING_ID 1 // 'trinity_string'
-#define MAX_TRINITY_STRING_ID 2000000000
-
// Trinity Trainer Reference start range
#define TRINITY_TRAINER_START_REF 200000
-struct TrinityStringLocale
+struct TrinityString
{
StringVector Content;
};
-typedef std::map<uint64, uint64> LinkedRespawnContainer;
+typedef std::map<ObjectGuid, ObjectGuid> LinkedRespawnContainer;
typedef std::unordered_map<uint32, CreatureData> CreatureDataContainer;
typedef std::unordered_map<uint32, GameObjectData> GameObjectDataContainer;
typedef std::map<TempSummonGroupKey, std::vector<TempSummonData> > TempSummonDataContainer;
@@ -512,10 +508,11 @@ typedef std::unordered_map<uint32, ItemLocale> ItemLocaleContainer;
typedef std::unordered_map<uint32, QuestLocale> QuestLocaleContainer;
typedef std::unordered_map<uint32, NpcTextLocale> NpcTextLocaleContainer;
typedef std::unordered_map<uint32, PageTextLocale> PageTextLocaleContainer;
-typedef std::unordered_map<int32, TrinityStringLocale> TrinityStringLocaleContainer;
typedef std::unordered_map<uint32, GossipMenuItemsLocale> GossipMenuItemsLocaleContainer;
typedef std::unordered_map<uint32, PointOfInterestLocale> PointOfInterestLocaleContainer;
+typedef std::unordered_map<uint32, TrinityString> TrinityStringContainer;
+
typedef std::multimap<uint32, uint32> QuestRelations; // unit/go -> quest
typedef std::multimap<uint32, uint32> QuestRelationsReverse; // quest -> unit/go
typedef std::pair<QuestRelations::const_iterator, QuestRelations::const_iterator> QuestRelationBounds;
@@ -785,7 +782,7 @@ class ObjectMgr
void GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, PlayerLevelInfo* info) const;
- uint64 GetPlayerGUIDByName(std::string const& name) const;
+ ObjectGuid GetPlayerGUIDByName(std::string const& name) const;
/**
* Retrieves the player name by guid.
@@ -800,9 +797,9 @@ class ObjectMgr
*
* @return true if player was found, false otherwise
*/
- bool GetPlayerNameByGUID(uint64 guid, std::string& name) const;
- uint32 GetPlayerTeamByGUID(uint64 guid) const;
- uint32 GetPlayerAccountIdByGUID(uint64 guid) const;
+ bool GetPlayerNameByGUID(ObjectGuid guid, std::string& name) const;
+ uint32 GetPlayerTeamByGUID(ObjectGuid guid) const;
+ uint32 GetPlayerAccountIdByGUID(ObjectGuid guid) const;
uint32 GetPlayerAccountIdByPlayerName(std::string const& name) const;
uint32 GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team);
@@ -977,6 +974,8 @@ class ObjectMgr
return _creatureQuestInvolvedRelationsReverse.equal_range(questId);
}
+ bool LoadTrinityStrings();
+
void LoadEventScripts();
void LoadSpellScripts();
void LoadWaypointScripts();
@@ -986,8 +985,6 @@ class ObjectMgr
void LoadBroadcastTexts();
void LoadBroadcastTextLocales();
- bool LoadTrinityStrings(char const* table, int32 min_value, int32 max_value);
- bool LoadTrinityStrings() { return LoadTrinityStrings("trinity_string", MIN_TRINITY_STRING_ID, MAX_TRINITY_STRING_ID); }
void LoadCreatureClassLevelStats();
void LoadCreatureLocales();
void LoadGraveyardOrientations();
@@ -1144,10 +1141,10 @@ class ObjectMgr
}
CreatureData& NewOrExistCreatureData(uint32 guid) { return _creatureDataStore[guid]; }
void DeleteCreatureData(uint32 guid);
- uint64 GetLinkedRespawnGuid(uint64 guid) const
+ ObjectGuid GetLinkedRespawnGuid(ObjectGuid guid) const
{
LinkedRespawnContainer::const_iterator itr = _linkedRespawnStore.find(guid);
- if (itr == _linkedRespawnStore.end()) return 0;
+ if (itr == _linkedRespawnStore.end()) return ObjectGuid::Empty;
return itr->second;
}
CreatureLocale const* GetCreatureLocale(uint32 entry) const
@@ -1208,14 +1205,15 @@ class ObjectMgr
GameObjectData& NewGOData(uint32 guid) { return _gameObjectDataStore[guid]; }
void DeleteGOData(uint32 guid);
- TrinityStringLocale const* GetTrinityStringLocale(int32 entry) const
+ TrinityString const* GetTrinityString(uint32 entry) const
{
- TrinityStringLocaleContainer::const_iterator itr = _trinityStringLocaleStore.find(entry);
- if (itr == _trinityStringLocaleStore.end()) return NULL;
+ TrinityStringContainer::const_iterator itr = _trinityStringStore.find(entry);
+ if (itr == _trinityStringStore.end())
+ return nullptr;
return &itr->second;
}
- const char *GetTrinityString(int32 entry, LocaleConstant locale_idx) const;
- const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry, DBCLocaleIndex); }
+ char const* GetTrinityString(uint32 entry, LocaleConstant locale) const;
+ char const* GetTrinityStringForDBCLocale(uint32 entry) const { return GetTrinityString(entry, DBCLocaleIndex); }
LocaleConstant GetDBCLocaleIndex() const { return DBCLocaleIndex; }
void SetDBCLocaleIndex(LocaleConstant locale) { DBCLocaleIndex = locale; }
@@ -1485,10 +1483,11 @@ class ObjectMgr
QuestLocaleContainer _questLocaleStore;
NpcTextLocaleContainer _npcTextLocaleStore;
PageTextLocaleContainer _pageTextLocaleStore;
- TrinityStringLocaleContainer _trinityStringLocaleStore;
GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore;
PointOfInterestLocaleContainer _pointOfInterestLocaleStore;
+ TrinityStringContainer _trinityStringStore;
+
CacheVendorItemContainer _cacheVendorItemStore;
CacheTrainerSpellContainer _cacheTrainerSpellStore;
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
index 8040728133f..d5b1022b351 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
@@ -65,12 +65,12 @@ void VisibleNotifier::SendToSelf()
}
}
- for (Player::ClientGUIDs::const_iterator it = vis_guids.begin();it != vis_guids.end(); ++it)
+ for (GuidSet::const_iterator it = vis_guids.begin(); it != vis_guids.end(); ++it)
{
i_player.m_clientGUIDs.erase(*it);
i_data.AddOutOfRangeGUID(*it);
- if (IS_PLAYER_GUID(*it))
+ if (it->IsPlayer())
{
Player* player = ObjectAccessor::FindPlayer(*it);
if (player && player->IsInWorld() && !player->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index d4b75b026f6..d78f7c2e44f 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -44,7 +44,7 @@ namespace Trinity
Player &i_player;
UpdateData i_data;
std::set<Unit*> i_visibleNow;
- Player::ClientGUIDs vis_guids;
+ GuidSet vis_guids;
VisibleNotifier(Player &player) : i_player(player), i_data(player.GetMapId()), vis_guids(player.m_clientGUIDs) { }
template<class T> void Visit(GridRefManager<T> &m);
@@ -1367,14 +1367,14 @@ namespace Trinity
class ObjectGUIDCheck
{
public:
- ObjectGUIDCheck(uint64 GUID) : _GUID(GUID) { }
+ ObjectGUIDCheck(ObjectGuid GUID) : _GUID(GUID) { }
bool operator()(WorldObject* object)
{
return object->GetGUID() == _GUID;
}
private:
- uint64 _GUID;
+ ObjectGuid _GUID;
};
class HeightDifferenceCheck
@@ -1399,7 +1399,7 @@ namespace Trinity
class UnitAuraCheck
{
public:
- UnitAuraCheck(bool present, uint32 spellId, uint64 casterGUID = 0) : _present(present), _spellId(spellId), _casterGUID(casterGUID) { }
+ UnitAuraCheck(bool present, uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty) : _present(present), _spellId(spellId), _casterGUID(casterGUID) { }
bool operator()(Unit* unit) const
{
return unit->HasAura(_spellId, _casterGUID) == _present;
@@ -1413,7 +1413,7 @@ namespace Trinity
private:
bool _present;
uint32 _spellId;
- uint64 _casterGUID;
+ ObjectGuid _casterGUID;
};
// Player checks and do
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp
index ab7a0e20512..7fde9e8b6da 100644
--- a/src/server/game/Grids/ObjectGridLoader.cpp
+++ b/src/server/game/Grids/ObjectGridLoader.cpp
@@ -141,7 +141,7 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellCoord &cell, CorpseMapTyp
if (itr->second != map->GetInstanceId())
continue;
- uint32 player_guid = itr->first;
+ ObjectGuid player_guid(HIGHGUID_PLAYER, itr->first);
Corpse* obj = sObjectAccessor->GetCorpseForPlayerGUID(player_guid);
if (!obj)
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index fd89ed80429..53c5139e20f 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -36,7 +36,7 @@
#include "LFGMgr.h"
#include "UpdateFieldFlags.h"
-Roll::Roll(uint64 _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid),
+Roll::Roll(ObjectGuid _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid),
itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0),
rollVoteMask(ROLL_ALL_TYPE_NO_DISENCHANT) { }
@@ -53,13 +53,13 @@ Loot* Roll::getLoot()
return getTarget();
}
-Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
+Group::Group() : m_leaderGuid(), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
-m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
-m_masterLooterGuid(0), m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0)
+m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(),
+m_masterLooterGuid(), m_subGroupsCounts(NULL), m_guid(), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0)
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
- m_targetIcons[i] = 0;
+ m_targetIcons[i].Clear();
}
Group::~Group()
@@ -91,10 +91,10 @@ Group::~Group()
bool Group::Create(Player* leader)
{
- uint64 leaderGuid = leader->GetGUID();
+ ObjectGuid leaderGuid = leader->GetGUID();
uint32 lowguid = sGroupMgr->GenerateGroupId();
- m_guid = MAKE_NEW_GUID(lowguid, 0, HIGHGUID_GROUP);
+ m_guid = ObjectGuid(HIGHGUID_GROUP, lowguid);
m_leaderGuid = leaderGuid;
m_leaderName = leader->GetName();
leader->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
@@ -110,7 +110,7 @@ bool Group::Create(Player* leader)
m_lootThreshold = ITEM_QUALITY_UNCOMMON;
m_looterGuid = leaderGuid;
- m_masterLooterGuid = 0;
+ m_masterLooterGuid.Clear();
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
@@ -130,22 +130,22 @@ bool Group::Create(Player* leader)
uint8 index = 0;
stmt->setUInt32(index++, m_dbStoreId);
- stmt->setUInt32(index++, GUID_LOPART(m_leaderGuid));
+ stmt->setUInt32(index++, m_leaderGuid.GetCounter());
stmt->setUInt8(index++, uint8(m_lootMethod));
- stmt->setUInt32(index++, GUID_LOPART(m_looterGuid));
+ stmt->setUInt32(index++, m_looterGuid.GetCounter());
stmt->setUInt8(index++, uint8(m_lootThreshold));
- stmt->setUInt32(index++, uint32(m_targetIcons[0]));
- stmt->setUInt32(index++, uint32(m_targetIcons[1]));
- stmt->setUInt32(index++, uint32(m_targetIcons[2]));
- stmt->setUInt32(index++, uint32(m_targetIcons[3]));
- stmt->setUInt32(index++, uint32(m_targetIcons[4]));
- stmt->setUInt32(index++, uint32(m_targetIcons[5]));
- stmt->setUInt32(index++, uint32(m_targetIcons[6]));
- stmt->setUInt32(index++, uint32(m_targetIcons[7]));
+ stmt->setUInt64(index++, m_targetIcons[0].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[1].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[2].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[3].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[4].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[5].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[6].GetRawValue());
+ stmt->setUInt64(index++, m_targetIcons[7].GetRawValue());
stmt->setUInt8(index++, uint8(m_groupType));
stmt->setUInt32(index++, uint8(m_dungeonDifficulty));
stmt->setUInt32(index++, uint8(m_raidDifficulty));
- stmt->setUInt32(index++, GUID_LOPART(m_masterLooterGuid));
+ stmt->setUInt32(index++, m_masterLooterGuid.GetCounter());
CharacterDatabase.Execute(stmt);
@@ -163,19 +163,19 @@ bool Group::Create(Player* leader)
void Group::LoadGroupFromDB(Field* fields)
{
m_dbStoreId = fields[16].GetUInt32();
- m_guid = MAKE_NEW_GUID(sGroupMgr->GenerateGroupId(), 0, HIGHGUID_GROUP);
- m_leaderGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ m_guid = ObjectGuid(HIGHGUID_GROUP, sGroupMgr->GenerateGroupId());
+ m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
// group leader not exist
- if (!sObjectMgr->GetPlayerNameByGUID(fields[0].GetUInt32(), m_leaderName))
+ if (!sObjectMgr->GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
return;
m_lootMethod = LootMethod(fields[1].GetUInt8());
- m_looterGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
+ m_looterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32());
m_lootThreshold = ItemQualities(fields[3].GetUInt8());
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
- m_targetIcons[i] = fields[4+i].GetUInt32();
+ m_targetIcons[i].Set(fields[4 + i].GetUInt64());
m_groupType = GroupType(fields[12].GetUInt8());
if (m_groupType & GROUPTYPE_RAID)
@@ -193,7 +193,7 @@ void Group::LoadGroupFromDB(Field* fields)
else
m_raidDifficulty = Difficulty(r_diff);
- m_masterLooterGuid = MAKE_NEW_GUID(fields[15].GetUInt32(), 0, HIGHGUID_PLAYER);
+ m_masterLooterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[15].GetUInt32());
if (m_groupType & GROUPTYPE_LFG)
sLFGMgr->_LoadFromDB(fields, GetGUID());
@@ -202,7 +202,7 @@ void Group::LoadGroupFromDB(Field* fields)
void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles)
{
MemberSlot member;
- member.guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
+ member.guid = ObjectGuid(HIGHGUID_PLAYER, guidLow);
// skip non-existed member
if (!sObjectMgr->GetPlayerNameByGUID(member.guid, member.name))
@@ -345,7 +345,7 @@ void Group::RemoveAllInvites()
m_invitees.clear();
}
-Player* Group::GetInvited(uint64 guid) const
+Player* Group::GetInvited(ObjectGuid guid) const
{
for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
{
@@ -414,7 +414,7 @@ bool Group::AddMember(Player* player)
if (!isRaidGroup()) // reset targetIcons for non-raid-groups
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
- m_targetIcons[i] = 0;
+ m_targetIcons[i].Clear();
}
// insert into the table if we're not a battleground group
@@ -423,7 +423,7 @@ bool Group::AddMember(Player* player)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GROUP_MEMBER);
stmt->setUInt32(0, m_dbStoreId);
- stmt->setUInt32(1, GUID_LOPART(member.guid));
+ stmt->setUInt32(1, member.guid.GetCounter());
stmt->setUInt8(2, member.flags);
stmt->setUInt8(3, member.group);
stmt->setUInt8(4, member.roles);
@@ -513,7 +513,7 @@ bool Group::AddMember(Player* player)
return true;
}
-bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /*= 0*/, const char* reason /*= NULL*/)
+bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_REMOVEMETHOD_DEFAULT*/, ObjectGuid kicker /*= 0*/, const char* reason /*= NULL*/)
{
BroadcastGroupUpdate();
@@ -565,7 +565,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOV
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
CharacterDatabase.Execute(stmt);
DelinkMember(guid);
}
@@ -644,7 +644,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOV
}
}
-void Group::ChangeLeader(uint64 newLeaderGuid)
+void Group::ChangeLeader(ObjectGuid newLeaderGuid)
{
member_witerator slot = _getMemberWSlot(newLeaderGuid);
@@ -850,7 +850,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p,
p->GetSession()->SendPacket(&data);
}
-void Group::SendLootRoll(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
+void Group::SendLootRoll(ObjectGuid sourceGuid, ObjectGuid targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1+1));
data << uint64(sourceGuid); // guid of the item rolled
@@ -874,7 +874,7 @@ void Group::SendLootRoll(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber,
}
}
-void Group::SendLootRollWon(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
+void Group::SendLootRollWon(ObjectGuid sourceGuid, ObjectGuid targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ROLL_WON, (8+4+4+4+4+8+1+1));
data << uint64(sourceGuid); // guid of the item rolled
@@ -926,12 +926,12 @@ void Group::SendLooter(Creature* creature, Player* groupLooter)
data << uint64(creature->GetGUID());
if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem())
- data.appendPackGUID(GetMasterLooterGuid());
+ data << GetMasterLooterGuid().WriteAsPacked();
else
data << uint8(0);
if (groupLooter)
- data.append(groupLooter->GetPackGUID());
+ data << groupLooter->GetPackGUID();
else
data << uint8(0);
@@ -959,7 +959,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
//roll for over-threshold item if it's one-player loot
if (item->Quality >= uint32(m_lootThreshold))
{
- uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
Roll* r = new Roll(newitemGUID, *i);
//a vector is filled with only near party members
@@ -1043,7 +1043,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
continue;
}
- uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
Roll* r = new Roll(newitemGUID, *i);
//a vector is filled with only near party members
@@ -1104,7 +1104,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
//roll for over-threshold item if it's one-player loot
if (item->Quality >= uint32(m_lootThreshold))
{
- uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
Roll* r = new Roll(newitemGUID, *i);
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
@@ -1179,7 +1179,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
continue;
item = sObjectMgr->GetItemTemplate(i->itemid);
- uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
Roll* r = new Roll(newitemGUID, *i);
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
@@ -1282,7 +1282,7 @@ void Group::MasterLoot(Loot* loot, WorldObject* pLootedObject)
}
}
-void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice)
+void Group::CountRollVote(ObjectGuid playerGUID, ObjectGuid Guid, uint8 Choice)
{
Rolls::iterator rollI = GetRoll(Guid);
if (rollI == RollId.end())
@@ -1301,22 +1301,22 @@ void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice)
switch (Choice)
{
case ROLL_PASS: // Player choose pass
- SendLootRoll(0, playerGUID, 128, ROLL_PASS, *roll);
+ SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_PASS, *roll);
++roll->totalPass;
itr->second = PASS;
break;
case ROLL_NEED: // player choose Need
- SendLootRoll(0, playerGUID, 0, 0, *roll);
+ SendLootRoll(ObjectGuid::Empty, playerGUID, 0, 0, *roll);
++roll->totalNeed;
itr->second = NEED;
break;
case ROLL_GREED: // player choose Greed
- SendLootRoll(0, playerGUID, 128, ROLL_GREED, *roll);
+ SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_GREED, *roll);
++roll->totalGreed;
itr->second = GREED;
break;
case ROLL_DISENCHANT: // player choose Disenchant
- SendLootRoll(0, playerGUID, 128, ROLL_DISENCHANT, *roll);
+ SendLootRoll(ObjectGuid::Empty, playerGUID, 128, ROLL_DISENCHANT, *roll);
++roll->totalGreed;
itr->second = DISENCHANT;
break;
@@ -1356,7 +1356,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
if (!roll->playerVote.empty())
{
uint8 maxresul = 0;
- uint64 maxguid = (*roll->playerVote.begin()).first;
+ ObjectGuid maxguid = (*roll->playerVote.begin()).first;
Player* player;
for (Roll::PlayerVote::const_iterator itr=roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
@@ -1365,14 +1365,14 @@ void Group::CountTheRoll(Rolls::iterator rollI)
continue;
uint8 randomN = urand(1, 100);
- SendLootRoll(0, itr->first, randomN, ROLL_NEED, *roll);
+ SendLootRoll(ObjectGuid::Empty, itr->first, randomN, ROLL_NEED, *roll);
if (maxresul < randomN)
{
maxguid = itr->first;
maxresul = randomN;
}
}
- SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll);
+ SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, ROLL_NEED, *roll);
player = ObjectAccessor::FindPlayer(maxguid);
if (player && player->GetSession())
@@ -1402,7 +1402,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
if (!roll->playerVote.empty())
{
uint8 maxresul = 0;
- uint64 maxguid = (*roll->playerVote.begin()).first;
+ ObjectGuid maxguid = (*roll->playerVote.begin()).first;
Player* player;
RollVote rollvote = NOT_VALID;
@@ -1413,7 +1413,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
continue;
uint8 randomN = urand(1, 100);
- SendLootRoll(0, itr->first, randomN, itr->second, *roll);
+ SendLootRoll(ObjectGuid::Empty, itr->first, randomN, itr->second, *roll);
if (maxresul < randomN)
{
maxguid = itr->first;
@@ -1421,7 +1421,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
rollvote = itr->second;
}
}
- SendLootRollWon(0, maxguid, maxresul, rollvote, *roll);
+ SendLootRollWon(ObjectGuid::Empty, maxguid, maxresul, rollvote, *roll);
player = ObjectAccessor::FindPlayer(maxguid);
if (player && player->GetSession())
@@ -1490,16 +1490,16 @@ void Group::CountTheRoll(Rolls::iterator rollI)
delete roll;
}
-void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid)
+void Group::SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid)
{
if (id >= TARGETICONCOUNT)
return;
// clean other icons
- if (targetGuid != 0)
+ if (targetGuid)
for (int i=0; i<TARGETICONCOUNT; ++i)
if (m_targetIcons[i] == targetGuid)
- SetTargetIcon(i, 0, 0);
+ SetTargetIcon(i, ObjectGuid::Empty, ObjectGuid::Empty);
m_targetIcons[id] = targetGuid;
@@ -1521,7 +1521,7 @@ void Group::SendTargetIconList(WorldSession* session)
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
{
- if (m_targetIcons[i] == 0)
+ if (m_targetIcons[i].IsEmpty())
continue;
data << uint8(i);
@@ -1537,7 +1537,7 @@ void Group::SendUpdate()
SendUpdateToPlayer(witr->guid, &(*witr));
}
-void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
+void Group::SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot* slot)
{
Player* player = ObjectAccessor::FindPlayer(playerGUID);
@@ -1639,12 +1639,12 @@ void Group::BroadcastAddonMessagePacket(WorldPacket* packet, const std::string&
}
}
-void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group, uint64 ignore)
+void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group, ObjectGuid ignoredPlayer)
{
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* player = itr->GetSource();
- if (!player || (ignore != 0 && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this))
+ if (!player || (!ignoredPlayer.IsEmpty() && player->GetGUID() == ignoredPlayer) || (ignorePlayersInBGRaid && player->GetGroup() != this))
continue;
if (player->GetSession() && (group == -1 || itr->getSubGroup() == group))
@@ -1678,7 +1678,7 @@ void Group::OfflineReadyCheck()
}
}
-bool Group::_setMembersGroup(uint64 guid, uint8 group)
+bool Group::_setMembersGroup(ObjectGuid guid, uint8 group)
{
member_witerator slot = _getMemberWSlot(guid);
if (slot == m_memberSlots.end())
@@ -1693,7 +1693,7 @@ bool Group::_setMembersGroup(uint64 guid, uint8 group)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
stmt->setUInt8(0, group);
- stmt->setUInt32(1, GUID_LOPART(guid));
+ stmt->setUInt32(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -1713,7 +1713,7 @@ bool Group::SameSubGroup(Player const* member1, Player const* member2) const
}
// Allows setting sub groups both for online or offline members
-void Group::ChangeMembersGroup(uint64 guid, uint8 group)
+void Group::ChangeMembersGroup(ObjectGuid guid, uint8 group)
{
// Only raid groups have sub groups
if (!isRaidGroup())
@@ -1744,7 +1744,7 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
stmt->setUInt8(0, group);
- stmt->setUInt32(1, GUID_LOPART(guid));
+ stmt->setUInt32(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -1784,7 +1784,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
if (GetLootMethod() == FREE_FOR_ALL)
return;
- uint64 oldLooterGUID = GetLooterGuid();
+ ObjectGuid oldLooterGUID = GetLooterGuid();
member_citerator guid_itr = _getMemberCSlot(oldLooterGUID);
if (guid_itr != m_memberSlots.end())
{
@@ -1834,7 +1834,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
}
else
{
- SetLooterGuid(0);
+ SetLooterGuid(ObjectGuid::Empty);
SendUpdate();
}
}
@@ -2136,8 +2136,8 @@ InstanceGroupBind* Group::BindToInstance(InstanceSave* save, bool permanent, boo
bind.save = save;
bind.perm = permanent;
if (!load)
- TC_LOG_DEBUG("maps", "Group::BindToInstance: Group (guid: %u, storage id: %u) is now bound to map %d, instance %d, difficulty %d",
- GUID_LOPART(GetGUID()), m_dbStoreId, save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
+ TC_LOG_DEBUG("maps", "Group::BindToInstance: %s, storage id: %u is now bound to map %d, instance %d, difficulty %d",
+ GetGUID().ToString().c_str(), m_dbStoreId, save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
return &bind;
}
@@ -2201,12 +2201,12 @@ void Group::SetLootMethod(LootMethod method)
m_lootMethod = method;
}
-void Group::SetLooterGuid(uint64 guid)
+void Group::SetLooterGuid(ObjectGuid guid)
{
m_looterGuid = guid;
}
-void Group::SetMasterLooterGuid(uint64 guid)
+void Group::SetMasterLooterGuid(ObjectGuid guid)
{
m_masterLooterGuid = guid;
}
@@ -2216,7 +2216,7 @@ void Group::SetLootThreshold(ItemQualities threshold)
m_lootThreshold = threshold;
}
-void Group::SetLfgRoles(uint64 guid, const uint8 roles)
+void Group::SetLfgRoles(ObjectGuid guid, uint8 roles)
{
member_witerator slot = _getMemberWSlot(guid);
if (slot == m_memberSlots.end())
@@ -2256,19 +2256,19 @@ bool Group::IsCreated() const
return GetMembersCount() > 0;
}
-uint64 Group::GetLeaderGUID() const
+ObjectGuid Group::GetLeaderGUID() const
{
return m_leaderGuid;
}
-uint64 Group::GetGUID() const
+ObjectGuid Group::GetGUID() const
{
return m_guid;
}
uint32 Group::GetLowGUID() const
{
- return GUID_LOPART(m_guid);
+ return m_guid.GetCounter();
}
char const* Group::GetLeaderName() const
@@ -2281,12 +2281,12 @@ LootMethod Group::GetLootMethod() const
return m_lootMethod;
}
-uint64 Group::GetLooterGuid() const
+ObjectGuid Group::GetLooterGuid() const
{
return m_looterGuid;
}
-uint64 Group::GetMasterLooterGuid() const
+ObjectGuid Group::GetMasterLooterGuid() const
{
return m_masterLooterGuid;
}
@@ -2296,25 +2296,25 @@ ItemQualities Group::GetLootThreshold() const
return m_lootThreshold;
}
-bool Group::IsMember(uint64 guid) const
+bool Group::IsMember(ObjectGuid guid) const
{
return _getMemberCSlot(guid) != m_memberSlots.end();
}
-bool Group::IsLeader(uint64 guid) const
+bool Group::IsLeader(ObjectGuid guid) const
{
return (GetLeaderGUID() == guid);
}
-uint64 Group::GetMemberGUID(const std::string& name)
+ObjectGuid Group::GetMemberGUID(const std::string& name)
{
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
if (itr->name == name)
return itr->guid;
- return 0;
+ return ObjectGuid::Empty;
}
-bool Group::IsAssistant(uint64 guid) const
+bool Group::IsAssistant(ObjectGuid guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
if (mslot == m_memberSlots.end())
@@ -2322,7 +2322,7 @@ bool Group::IsAssistant(uint64 guid) const
return mslot->flags & MEMBER_FLAG_ASSISTANT;
}
-bool Group::SameSubGroup(uint64 guid1, uint64 guid2) const
+bool Group::SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const
{
member_citerator mslot2 = _getMemberCSlot(guid2);
if (mslot2 == m_memberSlots.end())
@@ -2330,7 +2330,7 @@ bool Group::SameSubGroup(uint64 guid1, uint64 guid2) const
return SameSubGroup(guid1, &*mslot2);
}
-bool Group::SameSubGroup(uint64 guid1, MemberSlot const* slot2) const
+bool Group::SameSubGroup(ObjectGuid guid1, MemberSlot const* slot2) const
{
member_citerator mslot1 = _getMemberCSlot(guid1);
if (mslot1 == m_memberSlots.end() || !slot2)
@@ -2344,7 +2344,7 @@ bool Group::HasFreeSlotSubGroup(uint8 subgroup) const
}
-uint8 Group::GetMemberGroup(uint64 guid) const
+uint8 Group::GetMemberGroup(ObjectGuid guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
if (mslot == m_memberSlots.end())
@@ -2362,7 +2362,7 @@ void Group::SetBattlefieldGroup(Battlefield *bg)
m_bfGroup = bg;
}
-void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
+void Group::SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag)
{
// Assistants, main assistants and main tanks are only available in raid groups
if (!isRaidGroup())
@@ -2394,7 +2394,7 @@ void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_FLAG);
stmt->setUInt8(0, slot->flags);
- stmt->setUInt32(1, GUID_LOPART(guid));
+ stmt->setUInt32(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
@@ -2422,7 +2422,7 @@ bool Group::isRollLootActive() const
return !RollId.empty();
}
-Group::Rolls::iterator Group::GetRoll(uint64 Guid)
+Group::Rolls::iterator Group::GetRoll(ObjectGuid Guid)
{
Rolls::iterator iter;
for (iter=RollId.begin(); iter != RollId.end(); ++iter)
@@ -2436,7 +2436,7 @@ void Group::LinkMember(GroupReference* pRef)
m_memberMgr.insertFirst(pRef);
}
-void Group::DelinkMember(uint64 guid)
+void Group::DelinkMember(ObjectGuid guid)
{
GroupReference* ref = m_memberMgr.getFirst();
while (ref)
@@ -2468,7 +2468,7 @@ void Group::_initRaidSubGroupsCounter()
++m_subGroupsCounts[itr->group];
}
-Group::member_citerator Group::_getMemberCSlot(uint64 Guid) const
+Group::member_citerator Group::_getMemberCSlot(ObjectGuid Guid) const
{
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
if (itr->guid == Guid)
@@ -2476,7 +2476,7 @@ Group::member_citerator Group::_getMemberCSlot(uint64 Guid) const
return m_memberSlots.end();
}
-Group::member_witerator Group::_getMemberWSlot(uint64 Guid)
+Group::member_witerator Group::_getMemberWSlot(ObjectGuid Guid)
{
for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
if (itr->guid == Guid)
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index 84e3a5454cd..a7807a6567c 100644
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -28,7 +28,6 @@
class Battlefield;
class Battleground;
class Creature;
-class GroupReference;
class InstanceSave;
class Map;
class Player;
@@ -131,18 +130,18 @@ enum GroupUpdateFlags
class Roll : public LootValidatorRef
{
public:
- Roll(uint64 _guid, LootItem const& li);
+ Roll(ObjectGuid _guid, LootItem const& li);
~Roll();
void setLoot(Loot* pLoot);
Loot* getLoot();
void targetObjectBuildLink() override;
- uint64 itemGUID;
+ ObjectGuid itemGUID;
uint32 itemid;
int32 itemRandomPropId;
uint32 itemRandomSuffix;
uint8 itemCount;
- typedef std::map<uint64, RollVote> PlayerVote;
+ typedef std::map<ObjectGuid, RollVote> PlayerVote;
PlayerVote playerVote; //vote position correspond with player position (in group)
uint8 totalPlayersRolling;
uint8 totalNeed;
@@ -168,7 +167,7 @@ class Group
public:
struct MemberSlot
{
- uint64 guid;
+ ObjectGuid guid;
std::string name;
uint8 group;
uint8 flags;
@@ -197,15 +196,15 @@ class Group
void RemoveAllInvites();
bool AddLeaderInvite(Player* player);
bool AddMember(Player* player);
- bool RemoveMember(uint64 guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL);
- void ChangeLeader(uint64 guid);
+ bool RemoveMember(ObjectGuid guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker = ObjectGuid::Empty, const char* reason = NULL);
+ void ChangeLeader(ObjectGuid guid);
void SetLootMethod(LootMethod method);
- void SetLooterGuid(uint64 guid);
- void SetMasterLooterGuid(uint64 guid);
+ void SetLooterGuid(ObjectGuid guid);
+ void SetMasterLooterGuid(ObjectGuid guid);
void UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed = false);
void SetLootThreshold(ItemQualities threshold);
- void Disband(bool hideDestroy=false);
- void SetLfgRoles(uint64 guid, const uint8 roles);
+ void Disband(bool hideDestroy = false);
+ void SetLfgRoles(ObjectGuid guid, uint8 roles);
// properties accessories
bool IsFull() const;
@@ -214,28 +213,28 @@ class Group
bool isBGGroup() const;
bool isBFGroup() const;
bool IsCreated() const;
- uint64 GetLeaderGUID() const;
- uint64 GetGUID() const;
+ ObjectGuid GetLeaderGUID() const;
+ ObjectGuid GetGUID() const;
uint32 GetLowGUID() const;
const char * GetLeaderName() const;
LootMethod GetLootMethod() const;
- uint64 GetLooterGuid() const;
- uint64 GetMasterLooterGuid() const;
+ ObjectGuid GetLooterGuid() const;
+ ObjectGuid GetMasterLooterGuid() const;
ItemQualities GetLootThreshold() const;
uint32 GetDbStoreId() const { return m_dbStoreId; };
// member manipulation methods
- bool IsMember(uint64 guid) const;
- bool IsLeader(uint64 guid) const;
- uint64 GetMemberGUID(const std::string& name);
- bool IsAssistant(uint64 guid) const;
+ bool IsMember(ObjectGuid guid) const;
+ bool IsLeader(ObjectGuid guid) const;
+ ObjectGuid GetMemberGUID(const std::string& name);
+ bool IsAssistant(ObjectGuid guid) const;
- Player* GetInvited(uint64 guid) const;
+ Player* GetInvited(ObjectGuid guid) const;
Player* GetInvited(const std::string& name) const;
- bool SameSubGroup(uint64 guid1, uint64 guid2) const;
- bool SameSubGroup(uint64 guid1, MemberSlot const* slot2) const;
+ bool SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const;
+ bool SameSubGroup(ObjectGuid guid1, MemberSlot const* slot2) const;
bool SameSubGroup(Player const* member1, Player const* member2) const;
bool HasFreeSlotSubGroup(uint8 subgroup) const;
@@ -245,7 +244,7 @@ class Group
uint32 GetMembersCount() const { return m_memberSlots.size(); }
GroupType GetGroupType() const { return m_groupType; }
- uint8 GetMemberGroup(uint64 guid) const;
+ uint8 GetMemberGroup(ObjectGuid guid) const;
void ConvertToLFG();
void ConvertToRaid();
@@ -255,10 +254,9 @@ class Group
void SetBattlefieldGroup(Battlefield* bf);
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
- void ChangeMembersGroup(uint64 guid, uint8 group);
- void ChangeMembersGroup(Player* player, uint8 group);
- void SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid);
- void SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag);
+ void ChangeMembersGroup(ObjectGuid guid, uint8 group);
+ void SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid);
+ void SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag);
void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag);
Difficulty GetDifficulty(bool isRaid) const;
@@ -274,10 +272,24 @@ class Group
//void SendInit(WorldSession* session);
void SendTargetIconList(WorldSession* session);
void SendUpdate();
- void SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot = NULL);
+ void SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot* slot = NULL);
void UpdatePlayerOutOfRange(Player* player);
- // ignore: GUID of player that will be ignored
- void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group = -1, uint64 ignore = 0);
+
+ template<class Worker>
+ void BroadcastWorker(Worker& worker)
+ {
+ for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
+ worker(itr->GetSource());
+ }
+
+ template<class Worker>
+ void BroadcastWorker(Worker const& worker) const
+ {
+ for (GroupReference const* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
+ worker(itr->GetSource());
+ }
+
+ void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignoredPlayer = ObjectGuid::Empty);
void BroadcastAddonMessagePacket(WorldPacket* packet, const std::string& prefix, bool ignorePlayersInBGRaid, int group = -1, uint64 ignore = 0);
void BroadcastReadyCheck(WorldPacket* packet);
void OfflineReadyCheck();
@@ -289,23 +301,23 @@ class Group
bool isRollLootActive() const;
void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r);
void SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, bool canNeed, Roll const& r);
- void SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
- void SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
+ void SendLootRoll(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
+ void SendLootRollWon(ObjectGuid SourceGuid, ObjectGuid TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
void SendLootAllPassed(Roll const& roll);
void SendLooter(Creature* creature, Player* pLooter);
void GroupLoot(Loot* loot, WorldObject* pLootedObject);
void NeedBeforeGreed(Loot* loot, WorldObject* pLootedObject);
void MasterLoot(Loot* loot, WorldObject* pLootedObject);
- Rolls::iterator GetRoll(uint64 Guid);
+ Rolls::iterator GetRoll(ObjectGuid Guid);
void CountTheRoll(Rolls::iterator roll);
- void CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choise);
+ void CountRollVote(ObjectGuid playerGUID, ObjectGuid Guid, uint8 Choise);
void EndRoll(Loot* loot);
// related to disenchant rolls
void ResetMaxEnchantingLevel();
void LinkMember(GroupReference* pRef);
- void DelinkMember(uint64 guid);
+ void DelinkMember(ObjectGuid guid);
InstanceGroupBind* BindToInstance(InstanceSave* save, bool permanent, bool load = false);
void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false);
@@ -319,12 +331,12 @@ class Group
void BroadcastGroupUpdate(void);
protected:
- bool _setMembersGroup(uint64 guid, uint8 group);
+ bool _setMembersGroup(ObjectGuid guid, uint8 group);
void _homebindIfInstance(Player* player);
void _initRaidSubGroupsCounter();
- member_citerator _getMemberCSlot(uint64 Guid) const;
- member_witerator _getMemberWSlot(uint64 Guid);
+ member_citerator _getMemberCSlot(ObjectGuid Guid) const;
+ member_witerator _getMemberWSlot(ObjectGuid Guid);
void SubGroupCounterIncrease(uint8 subgroup);
void SubGroupCounterDecrease(uint8 subgroup);
void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply);
@@ -332,22 +344,22 @@ class Group
MemberSlotList m_memberSlots;
GroupRefManager m_memberMgr;
InvitesList m_invitees;
- uint64 m_leaderGuid;
+ ObjectGuid m_leaderGuid;
std::string m_leaderName;
GroupType m_groupType;
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
Battleground* m_bgGroup;
Battlefield* m_bfGroup;
- uint64 m_targetIcons[TARGETICONCOUNT];
+ ObjectGuid m_targetIcons[TARGETICONCOUNT];
LootMethod m_lootMethod;
ItemQualities m_lootThreshold;
- uint64 m_looterGuid;
- uint64 m_masterLooterGuid;
+ ObjectGuid m_looterGuid;
+ ObjectGuid m_masterLooterGuid;
Rolls RollId;
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY];
uint8* m_subGroupsCounts;
- uint64 m_guid;
+ ObjectGuid m_guid;
uint32 m_counter; // used only in SMSG_GROUP_LIST
uint32 m_maxEnchantingLevel;
uint32 m_dbStoreId; // Represents the ID used in database (Can be reused by other groups if group was disbanded)
diff --git a/src/server/game/Groups/GroupRefManager.h b/src/server/game/Groups/GroupRefManager.h
index d286a19cbfd..8c7e302cf5e 100644
--- a/src/server/game/Groups/GroupRefManager.h
+++ b/src/server/game/Groups/GroupRefManager.h
@@ -19,11 +19,11 @@
#ifndef _GROUPREFMANAGER
#define _GROUPREFMANAGER
+#include "GroupReference.h"
#include "RefManager.h"
class Group;
class Player;
-class GroupReference;
class GroupRefManager : public RefManager<Group, Player>
{
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 2b0c2be4bbd..7048fd3ee9d 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -199,8 +199,8 @@ void Guild::EventLogEntry::SaveToDB(SQLTransaction& trans) const
void Guild::EventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& content) const
{
- ObjectGuid guid1 = MAKE_NEW_GUID(m_playerGuid1, 0, HIGHGUID_PLAYER);
- ObjectGuid guid2 = MAKE_NEW_GUID(m_playerGuid2, 0, HIGHGUID_PLAYER);
+ ObjectGuid guid1 = ObjectGuid(HIGHGUID_PLAYER, m_playerGuid1);
+ ObjectGuid guid2 = ObjectGuid(HIGHGUID_PLAYER, m_playerGuid2);
data.WriteBit(guid1[2]);
data.WriteBit(guid1[4]);
@@ -276,7 +276,7 @@ void Guild::BankEventLogEntry::SaveToDB(SQLTransaction& trans) const
void Guild::BankEventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& content) const
{
- ObjectGuid logGuid = MAKE_NEW_GUID(m_playerGuid, 0, HIGHGUID_PLAYER);
+ ObjectGuid logGuid = ObjectGuid(HIGHGUID_PLAYER, m_playerGuid);
bool hasItem = m_eventType == GUILD_BANK_LOG_DEPOSIT_ITEM || m_eventType == GUILD_BANK_LOG_WITHDRAW_ITEM ||
m_eventType == GUILD_BANK_LOG_MOVE_ITEM || m_eventType == GUILD_BANK_LOG_MOVE_ITEM2;
@@ -329,7 +329,7 @@ void Guild::NewsLogEntry::SaveToDB(SQLTransaction& trans) const
stmt->setUInt32( index, m_guildId);
stmt->setUInt32(++index, GetGUID());
stmt->setUInt8 (++index, GetType());
- stmt->setUInt32(++index, GetPlayerGuid());
+ stmt->setUInt32(++index, GetPlayerGuid().GetCounter());
stmt->setUInt32(++index, GetFlags());
stmt->setUInt32(++index, GetValue());
stmt->setUInt64(++index, GetTimestamp());
@@ -513,7 +513,7 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields)
}
Item* pItem = NewItemOrBag(proto);
- if (!pItem->LoadFromDB(itemGuid, 0, fields, itemEntry))
+ if (!pItem->LoadFromDB(itemGuid, ObjectGuid::Empty, fields, itemEntry))
{
TC_LOG_ERROR("guild", "Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry);
@@ -601,8 +601,8 @@ bool Guild::BankTab::SetItem(SQLTransaction& trans, uint8 slotId, Item* item)
stmt->setUInt32(3, item->GetGUIDLow());
CharacterDatabase.ExecuteOrAppend(trans, stmt);
- item->SetUInt64Value(ITEM_FIELD_CONTAINED, 0);
- item->SetUInt64Value(ITEM_FIELD_OWNER, 0);
+ item->SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid::Empty);
+ item->SetGuidValue(ITEM_FIELD_OWNER, ObjectGuid::Empty);
item->FSetState(ITEM_NEW);
item->SaveToDB(trans); // Not in inventory and can be saved standalone
}
@@ -659,7 +659,7 @@ void Guild::Member::SetPublicNote(std::string const& publicNote)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_PNOTE);
stmt->setString(0, publicNote);
- stmt->setUInt32(1, GUID_LOPART(m_guid));
+ stmt->setUInt32(1, m_guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -672,7 +672,7 @@ void Guild::Member::SetOfficerNote(std::string const& officerNote)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_OFFNOTE);
stmt->setString(0, officerNote);
- stmt->setUInt32(1, GUID_LOPART(m_guid));
+ stmt->setUInt32(1, m_guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -686,7 +686,7 @@ void Guild::Member::ChangeRank(uint8 newRank)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_RANK);
stmt->setUInt8 (0, newRank);
- stmt->setUInt32(1, GUID_LOPART(m_guid));
+ stmt->setUInt32(1, m_guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -694,7 +694,7 @@ void Guild::Member::SaveToDB(SQLTransaction& trans) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER);
stmt->setUInt32(0, m_guildId);
- stmt->setUInt32(1, GUID_LOPART(m_guid));
+ stmt->setUInt32(1, m_guid.GetCounter());
stmt->setUInt8 (2, m_rankId);
stmt->setString(3, m_publicNote);
stmt->setString(4, m_officerNote);
@@ -728,7 +728,7 @@ bool Guild::Member::LoadFromDB(Field* fields)
if (!m_zoneId)
{
- TC_LOG_DEBUG("guild", "Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid));
+ TC_LOG_DEBUG("guild", "%s has broken zone-data", m_guid.ToString().c_str());
m_zoneId = Player::GetZoneIdFromDB(m_guid);
}
@@ -741,13 +741,13 @@ bool Guild::Member::CheckStats() const
{
if (m_level < 1)
{
- TC_LOG_ERROR("guild", "Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid));
+ TC_LOG_ERROR("guild", "%s has a broken data in field `characters`.`level`, deleting him from guild!", m_guid.ToString().c_str());
return false;
}
if (m_class < CLASS_WARRIOR || m_class >= MAX_CLASSES)
{
- TC_LOG_ERROR("guild", "Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid));
+ TC_LOG_ERROR("guild", "%s has a broken data in field `characters`.`class`, deleting him from guild!", m_guid.ToString().c_str());
return false;
}
return true;
@@ -761,7 +761,7 @@ void Guild::Member::UpdateBankWithdrawValue(SQLTransaction& trans, uint8 tabId,
m_bankWithdraw[tabId] += amount;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER_WITHDRAW);
- stmt->setUInt32(0, GUID_LOPART(m_guid));
+ stmt->setUInt32(0, m_guid.GetCounter());
for (uint8 i = 0; i <= GUILD_BANK_MAX_TABS;)
{
uint32 withdraw = m_bankWithdraw[i++];
@@ -1159,7 +1159,7 @@ InventoryResult Guild::BankMoveItemData::CanStore(Item* pItem, bool swap)
// Guild
Guild::Guild():
m_id(0),
- m_leaderGuid(0),
+ m_leaderGuid(),
m_createdDate(0),
m_accountsNumber(0),
m_bankMoney(0),
@@ -1221,7 +1221,7 @@ bool Guild::Create(Player* pLeader, std::string const& name)
_CreateLogHolders();
TC_LOG_DEBUG("guild", "GUILD: creating guild [%s] for leader %s (%u)",
- name.c_str(), pLeader->GetName().c_str(), GUID_LOPART(m_leaderGuid));
+ name.c_str(), pLeader->GetName().c_str(), m_leaderGuid.GetCounter());
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -1233,7 +1233,7 @@ bool Guild::Create(Player* pLeader, std::string const& name)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD);
stmt->setUInt32( index, m_id);
stmt->setString(++index, name);
- stmt->setUInt32(++index, GUID_LOPART(m_leaderGuid));
+ stmt->setUInt32(++index, m_leaderGuid.GetCounter());
stmt->setString(++index, m_info);
stmt->setString(++index, m_motd);
stmt->setUInt64(++index, uint32(m_createdDate));
@@ -1251,7 +1251,7 @@ bool Guild::Create(Player* pLeader, std::string const& name)
if (ret)
{
- _BroadcastEvent(GE_FOUNDER, 0);
+ _BroadcastEvent(GE_FOUNDER, ObjectGuid::Empty);
sScriptMgr->OnGuildCreate(this, pLeader, name);
}
@@ -1264,7 +1264,7 @@ void Guild::Disband()
// Call scripts before guild data removed from database
sScriptMgr->OnGuildDisband(this);
- _BroadcastEvent(GE_DISBANDED, 0);
+ _BroadcastEvent(GE_DISBANDED, ObjectGuid::Empty);
// Remove all members
while (!m_members.empty())
{
@@ -1587,7 +1587,7 @@ void Guild::HandleSetMOTD(WorldSession* session, std::string const& motd)
stmt->setUInt32(1, m_id);
CharacterDatabase.Execute(stmt);
- _BroadcastEvent(GE_MOTD, 0, motd.c_str());
+ _BroadcastEvent(GE_MOTD, ObjectGuid::Empty, motd.c_str());
}
}
@@ -1644,7 +1644,7 @@ void Guild::HandleSetNewGuildMaster(WorldSession* session, std::string const& na
{
_SetLeaderGUID(newGuildMaster);
oldGuildMaster->ChangeRank(GR_INITIATE);
- _BroadcastEvent(GE_LEADER_CHANGED, 0, player->GetName().c_str(), name.c_str());
+ _BroadcastEvent(GE_LEADER_CHANGED, ObjectGuid::Empty, player->GetName().c_str(), name.c_str());
}
}
}
@@ -1663,10 +1663,10 @@ void Guild::HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string
sprintf(aux, "%u", tabId);
tab->SetInfo(name, icon);
- _BroadcastEvent(GE_BANK_TAB_UPDATED, 0, aux, name.c_str(), icon.c_str());
+ _BroadcastEvent(GE_BANK_TAB_UPDATED, ObjectGuid::Empty, aux, name.c_str(), icon.c_str());
}
-void Guild::HandleSetMemberNote(WorldSession* session, std::string const& note, uint64 guid, bool isPublic)
+void Guild::HandleSetMemberNote(WorldSession* session, std::string const& note, ObjectGuid guid, bool isPublic)
{
// Player must have rights to set public/officer note
if (!_HasRankRight(session->GetPlayer(), isPublic ? GR_RIGHT_EPNOTE : GR_RIGHT_EOFFNOTE))
@@ -1700,7 +1700,7 @@ void Guild::HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string c
char aux[2];
sprintf(aux, "%u", rankId);
- _BroadcastEvent(GE_RANK_UPDATED, 0, aux);
+ _BroadcastEvent(GE_RANK_UPDATED, ObjectGuid::Empty, aux);
}
}
@@ -1735,7 +1735,7 @@ void Guild::HandleBuyBankTab(WorldSession* session, uint8 tabId)
}
_CreateNewBankTab();
- _BroadcastEvent(GE_BANK_TAB_PURCHASED, 0);
+ _BroadcastEvent(GE_BANK_TAB_PURCHASED, ObjectGuid::Empty);
SendPermissions(session); /// Hack to force client to update permissions
}
@@ -1794,7 +1794,10 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name)
data << uint32(m_emblemInfo.GetBackgroundColor());
data << uint32(m_emblemInfo.GetColor());
- ObjectGuid oldGuildGuid = MAKE_NEW_GUID(pInvitee->GetGuildId(), 0, pInvitee->GetGuildId() ? uint32(HIGHGUID_GUILD) : 0);
+ ObjectGuid oldGuildGuid;
+ if (uint32 oldId = pInvitee->GetGuildId())
+ oldGuildGuid = ObjectGuid(HIGHGUID_GUILD, pInvitee->GetGuildId());
+
ObjectGuid newGuildGuid = GetGUID();
data.WriteBit(newGuildGuid[3]);
@@ -1895,7 +1898,7 @@ void Guild::HandleLeaveMember(WorldSession* session)
delete this;
}
-void Guild::HandleRemoveMember(WorldSession* session, uint64 guid)
+void Guild::HandleRemoveMember(WorldSession* session, ObjectGuid guid)
{
Player* player = session->GetPlayer();
@@ -1919,15 +1922,15 @@ void Guild::HandleRemoveMember(WorldSession* session, uint64 guid)
{
// After call to DeleteMember pointer to member becomes invalid
DeleteMember(guid, false, true);
- _LogEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, player->GetGUIDLow(), GUID_LOPART(guid));
- _BroadcastEvent(GE_REMOVED, 0, name.c_str(), player->GetName().c_str());
+ _LogEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, player->GetGUIDLow(), guid.GetCounter());
+ _BroadcastEvent(GE_REMOVED, ObjectGuid::Empty, name.c_str(), player->GetName().c_str());
SendCommandResult(session, GUILD_COMMAND_REMOVE, ERR_GUILD_COMMAND_SUCCESS, name);
}
}
}
}
-void Guild::HandleUpdateMemberRank(WorldSession* session, uint64 guid, bool demote)
+void Guild::HandleUpdateMemberRank(WorldSession* session, ObjectGuid guid, bool demote)
{
Player* player = session->GetPlayer();
GuildCommandType type = demote ? GUILD_COMMAND_DEMOTE : GUILD_COMMAND_PROMOTE;
@@ -1975,12 +1978,12 @@ void Guild::HandleUpdateMemberRank(WorldSession* session, uint64 guid, bool demo
uint32 newRankId = member->GetRankId() + (demote ? 1 : -1);
member->ChangeRank(newRankId);
- _LogEvent(demote ? GUILD_EVENT_LOG_DEMOTE_PLAYER : GUILD_EVENT_LOG_PROMOTE_PLAYER, player->GetGUIDLow(), GUID_LOPART(member->GetGUID()), newRankId);
- _BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, 0, player->GetName().c_str(), name.c_str(), _GetRankName(newRankId).c_str());
+ _LogEvent(demote ? GUILD_EVENT_LOG_DEMOTE_PLAYER : GUILD_EVENT_LOG_PROMOTE_PLAYER, player->GetGUIDLow(), member->GetGUID().GetCounter(), newRankId);
+ _BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, ObjectGuid::Empty, player->GetName().c_str(), name.c_str(), _GetRankName(newRankId).c_str());
}
}
-void Guild::HandleSetMemberRank(WorldSession* session, uint64 targetGuid, uint64 setterGuid, uint32 rank)
+void Guild::HandleSetMemberRank(WorldSession* session, ObjectGuid targetGuid, ObjectGuid setterGuid, uint32 rank)
{
Player* player = session->GetPlayer();
Member* member = GetMember(targetGuid);
@@ -2019,7 +2022,7 @@ void Guild::HandleAddNewRank(WorldSession* session, std::string const& name)
// Only leader can add new rank
if (_IsLeader(session->GetPlayer()))
if (_CreateRank(name, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK))
- _BroadcastEvent(GE_RANK_CREATED, 0);
+ _BroadcastEvent(GE_RANK_CREATED, ObjectGuid::Empty);
}
void Guild::HandleRemoveRank(WorldSession* session, uint8 rankId)
@@ -2041,7 +2044,7 @@ void Guild::HandleRemoveRank(WorldSession* session, uint8 rankId)
m_ranks.erase(m_ranks.begin() + rankId);
- _BroadcastEvent(GE_RANK_DELETED, rankId);
+ _BroadcastEvent(GE_RANK_DELETED, ObjectGuid::Empty, std::to_string(rankId).c_str());
}
void Guild::HandleMemberDepositMoney(WorldSession* session, uint64 amount, bool cashFlow /*=false*/)
@@ -2063,7 +2066,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint64 amount, bool
CharacterDatabase.CommitTransaction(trans);
std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true);
- _BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str());
+ _BroadcastEvent(GE_BANK_MONEY_SET, ObjectGuid::Empty, aux.c_str());
if (player->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
{
@@ -2113,7 +2116,7 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint64 amount, bool
CharacterDatabase.CommitTransaction(trans);
std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true);
- _BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str());
+ _BroadcastEvent(GE_BANK_MONEY_SET, ObjectGuid::Empty, aux.c_str());
return true;
}
@@ -2368,7 +2371,7 @@ bool Guild::LoadFromDB(Field* fields)
{
m_id = fields[0].GetUInt32();
m_name = fields[1].GetString();
- m_leaderGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
+ m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32());
m_emblemInfo.LoadFromDB(fields);
m_info = fields[8].GetString();
m_motd = fields[9].GetString();
@@ -2402,7 +2405,7 @@ void Guild::LoadRankFromDB(Field* fields)
bool Guild::LoadMemberFromDB(Field* fields)
{
uint32 lowguid = fields[1].GetUInt32();
- Member *member = new Member(m_id, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER), fields[2].GetUInt8());
+ Member *member = new Member(m_id, ObjectGuid(HIGHGUID_PLAYER, lowguid), fields[2].GetUInt8());
if (!member->LoadFromDB(fields))
{
_DeleteMemberFromDB(lowguid);
@@ -2484,13 +2487,13 @@ void Guild::LoadGuildNewsLogFromDB(Field* fields)
return;
m_newsLog->LoadEvent(new NewsLogEntry(
- m_id, // guild id
- fields[1].GetUInt32(), // guid
- fields[6].GetUInt32(), // timestamp //64 bits?
- GuildNews(fields[2].GetUInt8()), // type
- fields[3].GetUInt32(), // player guid
- fields[4].GetUInt32(), // Flags
- fields[5].GetUInt32())); // value
+ m_id, // guild id
+ fields[1].GetUInt32(), // guid
+ fields[6].GetUInt32(), // timestamp //64 bits?
+ GuildNews(fields[2].GetUInt8()), // type
+ ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt32()), // player guid
+ fields[4].GetUInt32(), // Flags
+ fields[5].GetUInt32())); // value
}
void Guild::LoadBankTabFromDB(Field* fields)
@@ -2661,7 +2664,7 @@ void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 max
if (member->GetGUID() != session->GetPlayer()->GetGUID() && level >= minLevel && level <= maxLevel && member->IsRankNotLower(minRank))
{
- data.appendPackGUID(member->GetGUID());
+ data.appendPackGUID(member->GetGUID().GetRawValue());
data << uint8(0); // unk
++count;
}
@@ -2673,7 +2676,7 @@ void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 max
}
// Members handling
-bool Guild::AddMember(uint64 guid, uint8 rankId)
+bool Guild::AddMember(ObjectGuid guid, uint8 rankId)
{
Player* player = ObjectAccessor::FindPlayer(guid);
// Player cannot be in guild
@@ -2689,7 +2692,7 @@ bool Guild::AddMember(uint64 guid, uint8 rankId)
// This will be prevent attempt to join many guilds and corrupt guild data integrity
Player::RemovePetitionsAndSigns(guid, GUILD_CHARTER_TYPE);
- uint32 lowguid = GUID_LOPART(guid);
+ uint32 lowguid = guid.GetCounter();
// If rank was not passed, assign lowest possible rank
if (rankId == GUILD_RANK_NONE)
@@ -2752,9 +2755,9 @@ bool Guild::AddMember(uint64 guid, uint8 rankId)
return true;
}
-void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool canDeleteGuild)
+void Guild::DeleteMember(ObjectGuid guid, bool isDisbanding, bool isKicked, bool canDeleteGuild)
{
- uint32 lowguid = GUID_LOPART(guid);
+ uint32 lowguid = guid.GetCounter();
Player* player = ObjectAccessor::FindPlayer(guid);
// Guild master can be deleted when loading guild and guid doesn't exist in characters table
@@ -2788,7 +2791,7 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool can
// If leader does not exist (at guild loading with deleted leader) do not send broadcasts
if (oldLeader)
{
- _BroadcastEvent(GE_LEADER_CHANGED, 0, oldLeader->GetName().c_str(), newLeader->GetName().c_str());
+ _BroadcastEvent(GE_LEADER_CHANGED, ObjectGuid::Empty, oldLeader->GetName().c_str(), newLeader->GetName().c_str());
_BroadcastEvent(GE_LEFT, guid, oldLeader->GetName().c_str());
}
}
@@ -2817,7 +2820,7 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool can
_UpdateAccountsNumber();
}
-bool Guild::ChangeMemberRank(uint64 guid, uint8 newRank)
+bool Guild::ChangeMemberRank(ObjectGuid guid, uint8 newRank)
{
if (newRank <= _GetLowestRankId()) // Validate rank (allow only existing ranks)
if (Member* member = GetMember(guid))
@@ -2828,9 +2831,9 @@ bool Guild::ChangeMemberRank(uint64 guid, uint8 newRank)
return false;
}
-bool Guild::IsMember(uint64 guid) const
+bool Guild::IsMember(ObjectGuid guid) const
{
- Members::const_iterator itr = m_members.find(GUID_LOPART(guid));
+ Members::const_iterator itr = m_members.find(guid.GetCounter());
return itr != m_members.end();
}
@@ -3003,7 +3006,7 @@ void Guild::_SetLeaderGUID(Member* pLeader)
pLeader->ChangeRank(GR_GUILDMASTER);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_LEADER);
- stmt->setUInt32(0, GUID_LOPART(m_leaderGuid));
+ stmt->setUInt32(0, m_leaderGuid.GetCounter());
stmt->setUInt32(1, m_id);
CharacterDatabase.Execute(stmt);
}
@@ -3094,7 +3097,7 @@ inline int32 Guild::_GetMemberRemainingMoney(Member const* member) const
return 0;
}
-inline void Guild::_UpdateMemberWithdrawSlots(SQLTransaction& trans, uint64 guid, uint8 tabId)
+inline void Guild::_UpdateMemberWithdrawSlots(SQLTransaction& trans, ObjectGuid guid, uint8 tabId)
{
if (Member* member = GetMember(guid))
{
@@ -3105,7 +3108,7 @@ inline void Guild::_UpdateMemberWithdrawSlots(SQLTransaction& trans, uint64 guid
}
}
-inline bool Guild::_MemberHasTabRights(uint64 guid, uint8 tabId, uint32 rights) const
+inline bool Guild::_MemberHasTabRights(ObjectGuid guid, uint8 tabId, uint32 rights) const
{
if (const Member* member = GetMember(guid))
{
@@ -3365,7 +3368,7 @@ void Guild::_SendBankContentUpdate(uint8 tabId, SlotIds slots) const
}
}
-void Guild::_BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* param1, const char* param2, const char* param3) const
+void Guild::_BroadcastEvent(GuildEvents guildEvent, ObjectGuid guid, const char* param1, const char* param2, const char* param3) const
{
uint8 count = !param3 ? (!param2 ? (!param1 ? 0 : 1) : 2) : 3;
@@ -3478,58 +3481,55 @@ void Guild::SendBankList(WorldSession* session, uint8 tabId, bool withContent, b
TC_LOG_DEBUG("guild", "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
}
-void Guild::SendGuildRanksUpdate(uint64 setterGuid, uint64 targetGuid, uint32 rank)
+void Guild::SendGuildRanksUpdate(ObjectGuid setterGuid, ObjectGuid targetGuid, uint32 rank)
{
- ObjectGuid tarGuid = targetGuid;
- ObjectGuid setGuid = setterGuid;
-
Member* member = GetMember(targetGuid);
ASSERT(member);
WorldPacket data(SMSG_GUILD_RANKS_UPDATE, 100);
- data.WriteBit(setGuid[7]);
- data.WriteBit(setGuid[2]);
- data.WriteBit(tarGuid[2]);
- data.WriteBit(setGuid[1]);
- data.WriteBit(tarGuid[1]);
- data.WriteBit(tarGuid[7]);
- data.WriteBit(tarGuid[0]);
- data.WriteBit(tarGuid[5]);
- data.WriteBit(tarGuid[4]);
+ data.WriteBit(setterGuid[7]);
+ data.WriteBit(setterGuid[2]);
+ data.WriteBit(targetGuid[2]);
+ data.WriteBit(setterGuid[1]);
+ data.WriteBit(targetGuid[1]);
+ data.WriteBit(targetGuid[7]);
+ data.WriteBit(targetGuid[0]);
+ data.WriteBit(targetGuid[5]);
+ data.WriteBit(targetGuid[4]);
data.WriteBit(rank < member->GetRankId()); // 1 == higher, 0 = lower?
- data.WriteBit(setGuid[5]);
- data.WriteBit(setGuid[0]);
- data.WriteBit(tarGuid[6]);
- data.WriteBit(setGuid[3]);
- data.WriteBit(setGuid[6]);
- data.WriteBit(tarGuid[3]);
- data.WriteBit(setGuid[4]);
+ data.WriteBit(setterGuid[5]);
+ data.WriteBit(setterGuid[0]);
+ data.WriteBit(targetGuid[6]);
+ data.WriteBit(setterGuid[3]);
+ data.WriteBit(setterGuid[6]);
+ data.WriteBit(targetGuid[3]);
+ data.WriteBit(setterGuid[4]);
data.FlushBits();
data << uint32(rank);
- data.WriteByteSeq(setGuid[3]);
- data.WriteByteSeq(tarGuid[7]);
- data.WriteByteSeq(setGuid[6]);
- data.WriteByteSeq(setGuid[2]);
- data.WriteByteSeq(tarGuid[5]);
- data.WriteByteSeq(tarGuid[0]);
- data.WriteByteSeq(setGuid[7]);
- data.WriteByteSeq(setGuid[5]);
- data.WriteByteSeq(tarGuid[2]);
- data.WriteByteSeq(tarGuid[1]);
- data.WriteByteSeq(setGuid[0]);
- data.WriteByteSeq(setGuid[4]);
- data.WriteByteSeq(setGuid[1]);
- data.WriteByteSeq(tarGuid[3]);
- data.WriteByteSeq(tarGuid[6]);
- data.WriteByteSeq(tarGuid[4]);
+ data.WriteByteSeq(setterGuid[3]);
+ data.WriteByteSeq(targetGuid[7]);
+ data.WriteByteSeq(setterGuid[6]);
+ data.WriteByteSeq(setterGuid[2]);
+ data.WriteByteSeq(targetGuid[5]);
+ data.WriteByteSeq(targetGuid[0]);
+ data.WriteByteSeq(setterGuid[7]);
+ data.WriteByteSeq(setterGuid[5]);
+ data.WriteByteSeq(targetGuid[2]);
+ data.WriteByteSeq(targetGuid[1]);
+ data.WriteByteSeq(setterGuid[0]);
+ data.WriteByteSeq(setterGuid[4]);
+ data.WriteByteSeq(setterGuid[1]);
+ data.WriteByteSeq(targetGuid[3]);
+ data.WriteByteSeq(targetGuid[6]);
+ data.WriteByteSeq(targetGuid[4]);
BroadcastPacket(&data);
member->ChangeRank(rank);
- TC_LOG_DEBUG("network", "SMSG_GUILD_RANKS_UPDATE [Broadcast] Target: %u, Issuer: %u, RankId: %u",
- GUID_LOPART(targetGuid), GUID_LOPART(setterGuid), rank);
+ TC_LOG_DEBUG("network", "SMSG_GUILD_RANKS_UPDATE [Broadcast] Target: %s, Issuer: %s, RankId: %u",
+ targetGuid.ToString().c_str(), setterGuid.ToString().c_str(), rank);
}
void Guild::GiveXP(uint32 xp, Player* source)
@@ -3581,7 +3581,7 @@ void Guild::GiveXP(uint32 xp, Player* source)
}
}
- AddGuildNews(GUILD_NEWS_LEVEL_UP, 0, 0, _level);
+ AddGuildNews(GUILD_NEWS_LEVEL_UP, ObjectGuid::Empty, 0, _level);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_GUILD_LEVEL, GetLevel(), 0, 0, NULL, source);
++oldLevel;
@@ -3626,10 +3626,9 @@ void Guild::ResetTimes(bool weekly)
}
}
-void Guild::AddGuildNews(uint8 type, uint64 guid, uint32 flags, uint32 value)
+void Guild::AddGuildNews(uint8 type, ObjectGuid guid, uint32 flags, uint32 value)
{
- uint32 lowGuid = GUID_LOPART(guid);
- NewsLogEntry* news = new NewsLogEntry(m_id, m_newsLog->GetNextGUID(), GuildNews(type), lowGuid, flags, value);
+ NewsLogEntry* news = new NewsLogEntry(m_id, m_newsLog->GetNextGUID(), GuildNews(type), guid, flags, value);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
m_newsLog->AddEvent(trans, news);
diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h
index 730626e0675..a4e2f9bc5ad 100644
--- a/src/server/game/Guilds/Guild.h
+++ b/src/server/game/Guilds/Guild.h
@@ -340,7 +340,7 @@ private:
class Member
{
public:
- Member(uint32 guildId, uint64 guid, uint8 rankId):
+ Member(uint32 guildId, ObjectGuid guid, uint8 rankId) :
m_guildId(guildId),
m_guid(guid),
m_zoneId(0),
@@ -378,7 +378,7 @@ private:
bool LoadFromDB(Field* fields);
void SaveToDB(SQLTransaction& trans) const;
- uint64 GetGUID() const { return m_guid; }
+ ObjectGuid GetGUID() const { return m_guid; }
std::string const& GetName() const { return m_name; }
uint32 GetAccountId() const { return m_accountId; }
uint8 GetRankId() const { return m_rankId; }
@@ -405,7 +405,7 @@ private:
inline void UpdateLogoutTime() { m_logoutTime = ::time(NULL); }
inline bool IsRank(uint8 rankId) const { return m_rankId == rankId; }
inline bool IsRankNotLower(uint8 rankId) const { return m_rankId <= rankId; }
- inline bool IsSamePlayer(uint64 guid) const { return m_guid == guid; }
+ inline bool IsSamePlayer(ObjectGuid guid) const { return m_guid == guid; }
void UpdateBankWithdrawValue(SQLTransaction& trans, uint8 tabId, uint32 amount);
int32 GetBankWithdrawValue(uint8 tabId) const;
@@ -416,7 +416,7 @@ private:
private:
uint32 m_guildId;
// Fields from characters table
- uint64 m_guid;
+ ObjectGuid m_guid;
std::string m_name;
uint32 m_zoneId;
uint8 m_level;
@@ -525,16 +525,16 @@ private:
class NewsLogEntry : public LogEntry
{
public:
- NewsLogEntry(uint32 guildId, uint32 guid, GuildNews type, uint32 playerGuid, uint32 flags, uint32 value) :
+ NewsLogEntry(uint32 guildId, uint32 guid, GuildNews type, ObjectGuid playerGuid, uint32 flags, uint32 value) :
LogEntry(guildId, guid), m_type(type), m_playerGuid(playerGuid), m_flags(flags), m_value(value) { }
- NewsLogEntry(uint32 guildId, uint32 guid, time_t timestamp, GuildNews type, uint32 playerGuid, uint32 flags, uint32 value) :
+ NewsLogEntry(uint32 guildId, uint32 guid, time_t timestamp, GuildNews type, ObjectGuid playerGuid, uint32 flags, uint32 value) :
LogEntry(guildId, guid, timestamp), m_type(type), m_playerGuid(playerGuid), m_flags(flags), m_value(value) { }
~NewsLogEntry() { }
GuildNews GetType() const { return m_type; }
- uint64 GetPlayerGuid() const { return m_playerGuid ? MAKE_NEW_GUID(m_playerGuid, 0, HIGHGUID_PLAYER) : 0; }
+ ObjectGuid GetPlayerGuid() const { return m_playerGuid; }
uint32 GetValue() const { return m_value; }
uint32 GetFlags() const { return m_flags; }
void SetSticky(bool sticky)
@@ -550,7 +550,7 @@ private:
private:
GuildNews m_type;
- uint32 m_playerGuid;
+ ObjectGuid m_playerGuid;
uint32 m_flags;
uint32 m_value;
};
@@ -775,8 +775,8 @@ public:
// Getters
uint32 GetId() const { return m_id; }
- uint64 GetGUID() const { return MAKE_NEW_GUID(m_id, 0, HIGHGUID_GUILD); }
- uint64 GetLeaderGUID() const { return m_leaderGuid; }
+ ObjectGuid GetGUID() const { return ObjectGuid(HIGHGUID_GUILD, m_id); }
+ ObjectGuid GetLeaderGUID() const { return m_leaderGuid; }
std::string const& GetName() const { return m_name; }
std::string const& GetMOTD() const { return m_motd; }
std::string const& GetInfo() const { return m_info; }
@@ -795,15 +795,15 @@ public:
void HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo);
void HandleSetNewGuildMaster(WorldSession* session, std::string const& name);
void HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string const& name, std::string const& icon);
- void HandleSetMemberNote(WorldSession* session, std::string const& note, uint64 guid, bool isPublic);
+ void HandleSetMemberNote(WorldSession* session, std::string const& note, ObjectGuid guid, bool isPublic);
void HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec const& rightsAndSlots);
void HandleBuyBankTab(WorldSession* session, uint8 tabId);
void HandleInviteMember(WorldSession* session, std::string const& name);
void HandleAcceptMember(WorldSession* session);
void HandleLeaveMember(WorldSession* session);
- void HandleRemoveMember(WorldSession* session, uint64 guid);
- void HandleUpdateMemberRank(WorldSession* session, uint64 guid, bool demote);
- void HandleSetMemberRank(WorldSession* session, uint64 guid, uint64 setterGuid, uint32 rank);
+ void HandleRemoveMember(WorldSession* session, ObjectGuid guid);
+ void HandleUpdateMemberRank(WorldSession* session, ObjectGuid guid, bool demote);
+ void HandleSetMemberRank(WorldSession* session, ObjectGuid guid, ObjectGuid setterGuid, uint32 rank);
void HandleAddNewRank(WorldSession* session, std::string const& name);
void HandleRemoveRank(WorldSession* session, uint8 rankId);
void HandleMemberDepositMoney(WorldSession* session, uint64 amount, bool cashFlow = false);
@@ -861,10 +861,10 @@ public:
// Members
// Adds member to guild. If rankId == GUILD_RANK_NONE, lowest rank is assigned.
- bool AddMember(uint64 guid, uint8 rankId = GUILD_RANK_NONE);
- void DeleteMember(uint64 guid, bool isDisbanding = false, bool isKicked = false, bool canDeleteGuild = false);
- bool ChangeMemberRank(uint64 guid, uint8 newRank);
- bool IsMember(uint64 guid) const;
+ bool AddMember(ObjectGuid guid, uint8 rankId = GUILD_RANK_NONE);
+ void DeleteMember(ObjectGuid guid, bool isDisbanding = false, bool isKicked = false, bool canDeleteGuild = false);
+ bool ChangeMemberRank(ObjectGuid guid, uint8 newRank);
+ bool IsMember(ObjectGuid guid) const;
uint32 GetMembersCount() { return m_members.size(); }
// Bank
@@ -883,7 +883,7 @@ public:
uint64 GetExperience() const { return _experience; }
uint64 GetTodayExperience() const { return _todayExperience; }
- void AddGuildNews(uint8 type, uint64 guid, uint32 flags, uint32 value);
+ void AddGuildNews(uint8 type, ObjectGuid guid, uint32 flags, uint32 value);
EmblemInfo const& GetEmblemInfo() const { return m_emblemInfo; }
void ResetTimes(bool weekly);
@@ -894,7 +894,7 @@ public:
protected:
uint32 m_id;
std::string m_name;
- uint64 m_leaderGuid;
+ ObjectGuid m_leaderGuid;
std::string m_motd;
std::string m_info;
time_t m_createdDate;
@@ -935,15 +935,15 @@ private:
inline BankTab* GetBankTab(uint8 tabId) { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; }
inline const BankTab* GetBankTab(uint8 tabId) const { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; }
- inline const Member* GetMember(uint64 guid) const
+ inline const Member* GetMember(ObjectGuid guid) const
{
- Members::const_iterator itr = m_members.find(GUID_LOPART(guid));
+ Members::const_iterator itr = m_members.find(guid.GetCounter());
return itr != m_members.end() ? itr->second : NULL;
}
- inline Member* GetMember(uint64 guid)
+ inline Member* GetMember(ObjectGuid guid)
{
- Members::iterator itr = m_members.find(GUID_LOPART(guid));
+ Members::iterator itr = m_members.find(guid.GetCounter());
return itr != m_members.end() ? itr->second : NULL;
}
@@ -988,8 +988,8 @@ private:
int32 _GetMemberRemainingSlots(Member const* member, uint8 tabId) const;
int32 _GetMemberRemainingMoney(Member const* member) const;
- void _UpdateMemberWithdrawSlots(SQLTransaction& trans, uint64 guid, uint8 tabId);
- bool _MemberHasTabRights(uint64 guid, uint8 tabId, uint32 rights) const;
+ void _UpdateMemberWithdrawSlots(SQLTransaction& trans, ObjectGuid guid, uint8 tabId);
+ bool _MemberHasTabRights(ObjectGuid guid, uint8 tabId, uint32 rights) const;
void _LogEvent(GuildEventLogTypes eventType, uint32 playerGuid1, uint32 playerGuid2 = 0, uint8 newRank = 0);
void _LogBankEvent(SQLTransaction& trans, GuildBankEventLogTypes eventType, uint8 tabId, uint32 playerGuid, uint32 itemOrMoney, uint16 itemStackCount = 0, uint8 destTabId = 0);
@@ -1002,8 +1002,8 @@ private:
void _SendBankContentUpdate(MoveItemData* pSrc, MoveItemData* pDest) const;
void _SendBankContentUpdate(uint8 tabId, SlotIds slots) const;
void SendGuildReputationWeeklyCap(WorldSession* session, uint32 reputation) const;
- void SendGuildRanksUpdate(uint64 setterGuid, uint64 targetGuid, uint32 rank);
+ void SendGuildRanksUpdate(ObjectGuid setterGuid, ObjectGuid targetGuid, uint32 rank);
- void _BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* param1 = NULL, const char* param2 = NULL, const char* param3 = NULL) const;
+ void _BroadcastEvent(GuildEvents guildEvent, ObjectGuid guid, const char* param1 = NULL, const char* param2 = NULL, const char* param3 = NULL) const;
};
#endif
diff --git a/src/server/game/Guilds/GuildFinderMgr.cpp b/src/server/game/Guilds/GuildFinderMgr.cpp
index 024f4f4bd38..d0c564ee6ba 100644
--- a/src/server/game/Guilds/GuildFinderMgr.cpp
+++ b/src/server/game/Guilds/GuildFinderMgr.cpp
@@ -102,7 +102,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(ObjectGuid(HIGHGUID_PLAYER, playerId), guildId, availability, classRoles, interests, comment, time_t(submitTime));
_membershipRequests[guildId].push_back(request);
@@ -129,7 +129,7 @@ void GuildFinderMgr::AddMembershipRequest(uint32 guildGuid, MembershipRequest co
CharacterDatabase.CommitTransaction(trans);
// Notify the applicant his submittion has been added
- if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(request.GetPlayerGUID(), 0, HIGHGUID_PLAYER)))
+ if (Player* player = ObjectAccessor::FindPlayer(request.GetPlayerGUID()))
SendMembershipRequestListUpdate(*player);
// Notify the guild master and officers the list changed
@@ -178,7 +178,7 @@ void GuildFinderMgr::RemoveMembershipRequest(uint32 playerId, uint32 guildId)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_FINDER_APPLICANT);
stmt->setUInt32(0, itr->GetGuildId());
- stmt->setUInt32(1, itr->GetPlayerGUID());
+ stmt->setUInt32(1, itr->GetPlayerGUID().GetCounter());
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
@@ -186,7 +186,7 @@ void GuildFinderMgr::RemoveMembershipRequest(uint32 playerId, uint32 guildId)
_membershipRequests[guildId].erase(itr);
// Notify the applicant his submittion has been removed
- if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(playerId, 0, HIGHGUID_PLAYER)))
+ if (Player* player = ObjectAccessor::FindPlayer(itr->GetPlayerGUID()))
SendMembershipRequestListUpdate(*player);
// Notify the guild master and officers the list changed
@@ -304,7 +304,7 @@ void GuildFinderMgr::DeleteGuild(uint32 guildId)
CharacterDatabase.CommitTransaction(trans);
// Notify the applicant his submition has been removed
- if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(applicant, 0, HIGHGUID_PLAYER)))
+ if (Player* player = ObjectAccessor::FindPlayer(itr->GetPlayerGUID()))
SendMembershipRequestListUpdate(*player);
++itr;
diff --git a/src/server/game/Guilds/GuildFinderMgr.h b/src/server/game/Guilds/GuildFinderMgr.h
index 9fc62d43935..f3bda3612a1 100644
--- a/src/server/game/Guilds/GuildFinderMgr.h
+++ b/src/server/game/Guilds/GuildFinderMgr.h
@@ -19,6 +19,7 @@
#define __TRINITY_GUILDFINDER_H
#include "Common.h"
+#include "ObjectGuid.h"
#include "World.h"
#include "GuildMgr.h"
@@ -68,15 +69,15 @@ struct MembershipRequest
_time = settings.GetSubmitTime();
}
- MembershipRequest(uint32 playerGUID, uint32 guildId, uint32 availability, uint32 classRoles, uint32 interests, std::string& comment, time_t submitTime) :
+ MembershipRequest(ObjectGuid playerGUID, uint32 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() : _guildId(0), _playerGUID(0), _availability(0), _classRoles(0),
+ MembershipRequest() : _guildId(0), _availability(0), _classRoles(0),
_interests(0), _time(time(NULL)) {}
uint32 GetGuildId() const { return _guildId; }
- uint32 GetPlayerGUID() const { return _playerGUID; }
+ ObjectGuid GetPlayerGUID() const { return _playerGUID; }
uint8 GetAvailability() const { return _availability; }
uint8 GetClassRoles() const { return _classRoles; }
uint8 GetInterests() const { return _interests; }
@@ -90,7 +91,7 @@ struct MembershipRequest
std::string _comment;
uint32 _guildId;
- uint32 _playerGUID;
+ ObjectGuid _playerGUID;
uint8 _availability;
uint8 _classRoles;
diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp
index bdb0b7dce52..3277f5bbbae 100644
--- a/src/server/game/Guilds/GuildMgr.cpp
+++ b/src/server/game/Guilds/GuildMgr.cpp
@@ -63,12 +63,12 @@ Guild* GuildMgr::GetGuildById(uint32 guildId) const
return NULL;
}
-Guild* GuildMgr::GetGuildByGuid(uint64 guid) const
+Guild* GuildMgr::GetGuildByGuid(ObjectGuid guid) const
{
// Full guids are only used when receiving/sending data to client
// everywhere else guild id is used
- if (IS_GUILD_GUID(guid))
- if (uint32 guildId = GUID_LOPART(guid))
+ if (guid.IsGuild())
+ if (uint32 guildId = guid.GetCounter())
return GetGuildById(guildId);
return NULL;
@@ -96,7 +96,7 @@ std::string GuildMgr::GetGuildNameById(uint32 guildId) const
return "";
}
-Guild* GuildMgr::GetGuildByLeader(uint64 guid) const
+Guild* GuildMgr::GetGuildByLeader(ObjectGuid guid) const
{
for (GuildContainer::const_iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr)
if (itr->second->GetLeaderGUID() == guid)
diff --git a/src/server/game/Guilds/GuildMgr.h b/src/server/game/Guilds/GuildMgr.h
index 5df59f7e8ea..6e643edcb54 100644
--- a/src/server/game/Guilds/GuildMgr.h
+++ b/src/server/game/Guilds/GuildMgr.h
@@ -33,9 +33,9 @@ public:
return &instance;
}
- Guild* GetGuildByLeader(uint64 guid) const;
+ Guild* GetGuildByLeader(ObjectGuid guid) const;
Guild* GetGuildById(uint32 guildId) const;
- Guild* GetGuildByGuid(uint64 guid) const;
+ Guild* GetGuildByGuid(ObjectGuid guid) const;
Guild* GetGuildByName(std::string const& guildName) const;
std::string GetGuildNameById(uint32 guildId) const;
diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp
index 11c889fa726..d9303d0295a 100644
--- a/src/server/game/Handlers/ArenaTeamHandler.cpp
+++ b/src/server/game/Handlers/ArenaTeamHandler.cpp
@@ -33,9 +33,9 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "MSG_INSPECT_ARENA_TEAMS");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)));
+ TC_LOG_DEBUG("network", "Inspect Arena stats %s", guid.ToString().c_str());
Player* player = ObjectAccessor::FindPlayer(guid);
@@ -119,7 +119,7 @@ void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket & recvData)
}
ArenaTeam* arenaTeam = new ArenaTeam;
- if (!arenaTeam->Create(GUID_LOPART(_player->GetGUID()), type, name, background, icon, iconcolor, border, bordercolor))
+ if (!arenaTeam->Create(_player->GetGUID(), type, name, background, icon, iconcolor, border, bordercolor))
{
TC_LOG_ERROR("bg.arena", "Arena team create failed.");
delete arenaTeam;
@@ -373,7 +373,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData)
arenaTeam->DelMember(member->Guid, true);
// Broadcast event
- arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName());
+ arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, ObjectGuid::Empty, 3, name, arenaTeam->GetName(), _player->GetName());
}
void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData)
@@ -416,7 +416,7 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData)
arenaTeam->SetCaptain(member->Guid);
// Broadcast event
- arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 0, 3, _player->GetName(), name, arenaTeam->GetName());
+ arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, ObjectGuid::Empty, 3, _player->GetName(), name, arenaTeam->GetName());
}
void WorldSession::SendArenaTeamCommandResult(uint32 teamAction, const std::string& team, const std::string& player, uint32 errorId)
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index 12bc18298b7..ca1787462ba 100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -33,13 +33,13 @@
//void called when player click on auctioneer npc
void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData)
{
- uint64 guid; //NPC guid
+ ObjectGuid guid; //NPC guid
recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionHelloOpcode - Unit (%s) not found or you can't interact with him.", guid.ToString().c_str());
return;
}
@@ -51,7 +51,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData)
}
//this void causes that auction window is opened
-void WorldSession::SendAuctionHello(uint64 guid, Creature* unit)
+void WorldSession::SendAuctionHello(ObjectGuid guid, Creature* unit)
{
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ))
{
@@ -98,7 +98,7 @@ void WorldSession::SendAuctionCommandResult(AuctionEntry* auction, uint32 action
}
//this function sends notification, if bidder is online
-void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 itemEntry)
+void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 itemEntry)
{
WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8*4));
data << uint32(location);
@@ -137,13 +137,13 @@ void WorldSession::SendAuctionRemovedNotification(uint32 auctionId, uint32 itemE
//this void creates new auction and adds auction to some auctionhouse
void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
{
- uint64 auctioneer, bid, buyout;
+ ObjectGuid auctioneer;
+ uint64 bid, buyout;
uint32 itemsCount, etime;
recvData >> auctioneer;
recvData >> itemsCount;
- uint64 itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot
- memset(itemGUIDs, 0, sizeof(itemGUIDs));
+ ObjectGuid itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot
uint32 count[MAX_AUCTION_ITEMS];
memset(count, 0, sizeof(count));
@@ -184,14 +184,14 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(auctioneer));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) not found or you can't interact with him.", auctioneer.ToString().c_str());
return;
}
AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(creature->getFaction());
if (!auctionHouseEntry)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", GUID_LOPART(auctioneer));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) has wrong faction.", auctioneer.ToString().c_str());
return;
}
@@ -287,7 +287,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
AH->auctioneer = 23442; ///@TODO - HARDCODED DB GUID, BAD BAD BAD
else
- AH->auctioneer = GUID_LOPART(auctioneer);
+ AH->auctioneer = auctioneer.GetCounter();
// Required stack size of auction matches to current item stack size, just move item to auctionhouse
if (itemsCount == 1 && item->GetCount() == count[0])
@@ -311,10 +311,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
AH->deposit = deposit;
AH->auctionHouseEntry = auctionHouseEntry;
- TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) "
- "to auctioneer %u with count %u with initial bid " UI64FMTD " with buyout " UI64FMTD " and with time %u (in sec) in auctionhouse %u",
- _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(),
- AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
+ TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u",
+ _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
sAuctionMgr->AddAItem(item);
auctionHouse->AddAuction(AH);
@@ -361,10 +359,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
AH->deposit = deposit;
AH->auctionHouseEntry = auctionHouseEntry;
- TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to "
- "auctioneer %u with count %u with initial bid " UI64FMTD " with buyout " UI64FMTD " and with time %u (in sec) in auctionhouse %u",
- _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(),
- newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
+ TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u",
+ _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
sAuctionMgr->AddAItem(newItem);
auctionHouse->AddAuction(AH);
@@ -415,7 +411,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_PLACE_BID");
- uint64 auctioneer;
+ ObjectGuid auctioneer;
uint32 auctionId;
uint64 price;
recvData >> auctioneer;
@@ -428,7 +424,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - %s not found or you can't interact with him.", auctioneer.ToString().c_str());
return;
}
@@ -449,13 +445,14 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
}
// impossible have online own another character (use this for speedup check in case online owner)
- /*Player* auction_owner = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
- if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == player->GetSession()->GetAccountId())
+ ObjectGuid ownerGuid(HIGHGUID_PLAYER, auction->owner);
+ Player* auction_owner = ObjectAccessor::FindPlayer(ownerGuid);
+ if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(ownerGuid) == player->GetSession()->GetAccountId())
{
//you cannot bid your another character auction:
SendAuctionCommandResult(NULL, AUCTION_PLACE_BID, ERR_AUCTION_BID_OWN);
return;
- }*/
+ }
// cheating
if (price <= auction->bid || price < auction->startbid)
@@ -544,7 +541,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_REMOVE_ITEM");
- uint64 auctioneer;
+ ObjectGuid auctioneer;
uint32 auctionId;
recvData >> auctioneer;
recvData >> auctionId;
@@ -552,7 +549,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - %s not found or you can't interact with him.", auctioneer.ToString().c_str());
return;
}
@@ -619,7 +616,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
- uint64 guid; //NPC guid
+ ObjectGuid guid; //NPC guid
uint32 listfrom; //page of auctions
uint32 outbiddedCount; //count of outbidded auctions
@@ -635,7 +632,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - %s not found or you can't interact with him.", guid.ToString().c_str());
recvData.rfinish();
return;
}
@@ -677,7 +674,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
uint32 listfrom;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
recvData >> listfrom; // not used in fact (this list not have page control in client)
@@ -685,7 +682,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
@@ -716,7 +713,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
std::string searchedname;
uint8 levelmin, levelmax, usable;
uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
recvData >> listfrom; // start, used for page control listing by 50 elements
@@ -736,7 +733,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
@@ -746,8 +743,8 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
- //TC_LOG_DEBUG("misc", "Auctionhouse search (GUID: %u TypeId: %u)",, list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u",
- // GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
+ TC_LOG_DEBUG("auctionHouse", "Auctionhouse search (%s) list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u",
+ guid.ToString().c_str(), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4+4+4));
uint32 count = 0;
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index 9d641649b8d..bb67b220d7c 100644
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -37,9 +37,9 @@
void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from %s", guid.ToString().c_str());
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
if (!unit)
@@ -63,7 +63,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
SendBattleGroundList(guid, bgTypeId);
}
-void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId)
+void WorldSession::SendBattleGroundList(ObjectGuid guid, BattlegroundTypeId bgTypeId)
{
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundListPacket(&data, guid, _player, bgTypeId);
@@ -100,7 +100,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
recvData.ReadByteSeq(guid[1]);
//extract from guid
- bgTypeId_ = GUID_LOPART(guid);
+ bgTypeId_ = guid.GetCounter();
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
{
@@ -115,7 +115,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
}
BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_);
- //TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID:"UI64FMTD" TypeId:%u)", guid, bgTypeId_);
+ TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from %s", guid.ToString().c_str());
// can do this, since it's battleground, not arena
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, 0);
@@ -279,22 +279,22 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvDa
Player* aplr = NULL;
Player* hplr = NULL;
- if (uint64 guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE))
+ if (ObjectGuid guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE))
{
aplr = ObjectAccessor::FindPlayer(guid);
if (aplr)
++acount;
}
- if (uint64 guid = bg->GetFlagPickerGUID(TEAM_HORDE))
+ if (ObjectGuid guid = bg->GetFlagPickerGUID(TEAM_HORDE))
{
hplr = ObjectAccessor::FindPlayer(guid);
if (hplr)
++hcount;
}
- ObjectGuid aguid = aplr ? aplr->GetGUID() : 0;
- ObjectGuid hguid = hplr ? hplr->GetGUID() : 0;
+ ObjectGuid aguid = aplr ? aplr->GetGUID() : ObjectGuid::Empty;
+ ObjectGuid hguid = hplr ? hplr->GetGUID() : ObjectGuid::Empty;
WorldPacket data(SMSG_BATTLEFIELD_PLAYER_POSITIONS);
@@ -391,7 +391,7 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket& recvData)
}
WorldPacket data;
- sBattlegroundMgr->BuildBattlegroundListPacket(&data, 0, _player, BattlegroundTypeId(bgTypeId));
+ sBattlegroundMgr->BuildBattlegroundListPacket(&data, ObjectGuid::Empty, _player, BattlegroundTypeId(bgTypeId));
SendPacket(&data);
}
@@ -567,7 +567,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ginfo.Team);
if (at)
{
- TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating);
+ TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %s by opponents rating: %u, because he has left queue!", _player->GetGUID().ToString().c_str(), ginfo.OpponentsTeamRating);
at->MemberLost(_player, ginfo.OpponentsMatchmakerRating);
at->SaveToDB();
}
@@ -772,7 +772,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
void WorldSession::HandleReportPvPAFK(WorldPacket& recvData)
{
- uint64 playerGuid;
+ ObjectGuid playerGuid;
recvData >> playerGuid;
Player* reportedPlayer = ObjectAccessor::FindPlayer(playerGuid);
diff --git a/src/server/game/Handlers/BattlefieldHandler.cpp b/src/server/game/Handlers/BattlefieldHandler.cpp
index 632cf83cd8f..f68c6ddd38d 100644
--- a/src/server/game/Handlers/BattlefieldHandler.cpp
+++ b/src/server/game/Handlers/BattlefieldHandler.cpp
@@ -35,31 +35,29 @@
* @param zoneId The zone where the battle is (4197 for wg)
* @param acceptTime Time in second that the player have for accept
*/
-void WorldSession::SendBfInvitePlayerToWar(uint64 guid, uint32 zoneId, uint32 acceptTime)
+void WorldSession::SendBfInvitePlayerToWar(ObjectGuid guid, uint32 zoneId, uint32 acceptTime)
{
- ObjectGuid guidBytes = guid;
-
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 16);
- data.WriteBit(guidBytes[5]);
- data.WriteBit(guidBytes[3]);
- data.WriteBit(guidBytes[7]);
- data.WriteBit(guidBytes[2]);
- data.WriteBit(guidBytes[6]);
- data.WriteBit(guidBytes[4]);
- data.WriteBit(guidBytes[1]);
- data.WriteBit(guidBytes[0]);
+ data.WriteBit(guid[5]);
+ data.WriteBit(guid[3]);
+ data.WriteBit(guid[7]);
+ data.WriteBit(guid[2]);
+ data.WriteBit(guid[6]);
+ data.WriteBit(guid[4]);
+ data.WriteBit(guid[1]);
+ data.WriteBit(guid[0]);
- data.WriteByteSeq(guidBytes[6]);
+ data.WriteByteSeq(guid[6]);
data << uint32(zoneId); // Zone Id
- data.WriteByteSeq(guidBytes[1]);
- data.WriteByteSeq(guidBytes[3]);
- data.WriteByteSeq(guidBytes[4]);
- data.WriteByteSeq(guidBytes[2]);
- data.WriteByteSeq(guidBytes[0]);
+ data.WriteByteSeq(guid[1]);
+ data.WriteByteSeq(guid[3]);
+ data.WriteByteSeq(guid[4]);
+ data.WriteByteSeq(guid[2]);
+ data.WriteByteSeq(guid[0]);
data << uint32(time(NULL) + acceptTime); // Invite lasts until
- data.WriteByteSeq(guidBytes[7]);
- data.WriteByteSeq(guidBytes[5]);
+ data.WriteByteSeq(guid[7]);
+ data.WriteByteSeq(guid[5]);
SendPacket(&data);
}
@@ -70,39 +68,37 @@ void WorldSession::SendBfInvitePlayerToWar(uint64 guid, uint32 zoneId, uint32 ac
*
* @param guid The guid of Bf
*/
-void WorldSession::SendBfInvitePlayerToQueue(uint64 guid)
+void WorldSession::SendBfInvitePlayerToQueue(ObjectGuid guid)
{
- ObjectGuid guidBytes = guid;
-
WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, 5);
data.WriteBit(1); // unk
data.WriteBit(0); // Has Warmup
data.WriteBit(1); // unk
- data.WriteBit(guidBytes[0]);
+ data.WriteBit(guid[0]);
data.WriteBit(1); // unk
- data.WriteBit(guidBytes[2]);
- data.WriteBit(guidBytes[6]);
- data.WriteBit(guidBytes[3]);
+ data.WriteBit(guid[2]);
+ data.WriteBit(guid[6]);
+ data.WriteBit(guid[3]);
data.WriteBit(1); // unk
data.WriteBit(0); // unk
- data.WriteBit(guidBytes[1]);
- data.WriteBit(guidBytes[5]);
- data.WriteBit(guidBytes[4]);
+ data.WriteBit(guid[1]);
+ data.WriteBit(guid[5]);
+ data.WriteBit(guid[4]);
data.WriteBit(1); // unk
- data.WriteBit(guidBytes[7]);
+ data.WriteBit(guid[7]);
data.FlushBits();
- data.WriteByteSeq(guidBytes[2]);
- data.WriteByteSeq(guidBytes[3]);
- data.WriteByteSeq(guidBytes[6]);
+ data.WriteByteSeq(guid[2]);
+ data.WriteByteSeq(guid[3]);
+ data.WriteByteSeq(guid[6]);
data << uint8(1); // Warmup
- data.WriteByteSeq(guidBytes[5]);
- data.WriteByteSeq(guidBytes[0]);
- data.WriteByteSeq(guidBytes[4]);
- data.WriteByteSeq(guidBytes[1]);
- data.WriteByteSeq(guidBytes[7]);
+ data.WriteByteSeq(guid[5]);
+ data.WriteByteSeq(guid[0]);
+ data.WriteByteSeq(guid[4]);
+ data.WriteByteSeq(guid[1]);
+ data.WriteByteSeq(guid[7]);
SendPacket(&data);
}
@@ -116,27 +112,26 @@ void WorldSession::SendBfInvitePlayerToQueue(uint64 guid)
* @param canQueue if able to queue
* @param full on log in is full
*/
-void WorldSession::SendBfQueueInviteResponse(uint64 guid, uint32 zoneId, bool canQueue, bool full)
+void WorldSession::SendBfQueueInviteResponse(ObjectGuid guid, uint32 zoneId, bool canQueue, bool full)
{
const bool hasSecondGuid = false;
const bool warmup = true;
- ObjectGuid guidBytes = guid;
WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 16);
- data.WriteBit(guidBytes[1]);
- data.WriteBit(guidBytes[6]);
- data.WriteBit(guidBytes[5]);
- data.WriteBit(guidBytes[7]);
+ data.WriteBit(guid[1]);
+ data.WriteBit(guid[6]);
+ data.WriteBit(guid[5]);
+ data.WriteBit(guid[7]);
data.WriteBit(full); // Logging In, VERIFYME
- data.WriteBit(guidBytes[0]);
+ data.WriteBit(guid[0]);
data.WriteBit(!hasSecondGuid);
- data.WriteBit(guidBytes[4]);
+ data.WriteBit(guid[4]);
// if (hasSecondGuid) 7 3 0 4 2 6 1 5
- data.WriteBit(guidBytes[3]);
- data.WriteBit(guidBytes[2]);
+ data.WriteBit(guid[3]);
+ data.WriteBit(guid[2]);
// if (hasSecondGuid) 2 5 3 0 4 6 1 7
@@ -144,17 +139,17 @@ void WorldSession::SendBfQueueInviteResponse(uint64 guid, uint32 zoneId, bool ca
data << uint8(canQueue); // Accepted
- data.WriteByteSeq(guidBytes[1]);
- data.WriteByteSeq(guidBytes[3]);
- data.WriteByteSeq(guidBytes[6]);
- data.WriteByteSeq(guidBytes[7]);
- data.WriteByteSeq(guidBytes[0]);
+ data.WriteByteSeq(guid[1]);
+ data.WriteByteSeq(guid[3]);
+ data.WriteByteSeq(guid[6]);
+ data.WriteByteSeq(guid[7]);
+ data.WriteByteSeq(guid[0]);
data << uint8(warmup);
- data.WriteByteSeq(guidBytes[2]);
- data.WriteByteSeq(guidBytes[4]);
- data.WriteByteSeq(guidBytes[5]);
+ data.WriteByteSeq(guid[2]);
+ data.WriteByteSeq(guid[4]);
+ data.WriteByteSeq(guid[5]);
data << uint32(zoneId);
@@ -168,35 +163,34 @@ void WorldSession::SendBfQueueInviteResponse(uint64 guid, uint32 zoneId, bool ca
*
* @param guid The guid of Bf
*/
-void WorldSession::SendBfEntered(uint64 guid)
+void WorldSession::SendBfEntered(ObjectGuid guid)
{
uint8 isAFK = _player->isAFK() ? 1 : 0;
- ObjectGuid guidBytes = guid;
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 11);
data.WriteBit(0); // unk
data.WriteBit(isAFK); // Clear AFK
- data.WriteBit(guidBytes[1]);
- data.WriteBit(guidBytes[4]);
- data.WriteBit(guidBytes[5]);
- data.WriteBit(guidBytes[0]);
- data.WriteBit(guidBytes[3]);
+ data.WriteBit(guid[1]);
+ data.WriteBit(guid[4]);
+ data.WriteBit(guid[5]);
+ data.WriteBit(guid[0]);
+ data.WriteBit(guid[3]);
data.WriteBit(0); // unk
- data.WriteBit(guidBytes[6]);
- data.WriteBit(guidBytes[7]);
- data.WriteBit(guidBytes[2]);
+ data.WriteBit(guid[6]);
+ data.WriteBit(guid[7]);
+ data.WriteBit(guid[2]);
data.FlushBits();
- data.WriteByteSeq(guidBytes[5]);
- data.WriteByteSeq(guidBytes[3]);
- data.WriteByteSeq(guidBytes[0]);
- data.WriteByteSeq(guidBytes[4]);
- data.WriteByteSeq(guidBytes[1]);
- data.WriteByteSeq(guidBytes[7]);
- data.WriteByteSeq(guidBytes[2]);
- data.WriteByteSeq(guidBytes[6]);
+ data.WriteByteSeq(guid[5]);
+ data.WriteByteSeq(guid[3]);
+ data.WriteByteSeq(guid[0]);
+ data.WriteByteSeq(guid[4]);
+ data.WriteByteSeq(guid[1]);
+ data.WriteByteSeq(guid[7]);
+ data.WriteByteSeq(guid[2]);
+ data.WriteByteSeq(guid[6]);
SendPacket(&data);
}
@@ -209,34 +203,32 @@ void WorldSession::SendBfEntered(uint64 guid)
* @param guid The guid of Bf
* @param reason Reason why player left battlefield
*/
-void WorldSession::SendBfLeaveMessage(uint64 guid, BFLeaveReason reason /*= BF_LEAVE_REASON_EXITED*/)
+void WorldSession::SendBfLeaveMessage(ObjectGuid guid, BFLeaveReason reason /*= BF_LEAVE_REASON_EXITED*/)
{
- ObjectGuid guidBytes = guid;
-
WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 11);
- data.WriteBit(guidBytes[2]);
- data.WriteBit(guidBytes[5]);
- data.WriteBit(guidBytes[1]);
- data.WriteBit(guidBytes[0]);
- data.WriteBit(guidBytes[3]);
- data.WriteBit(guidBytes[6]);
+ data.WriteBit(guid[2]);
+ data.WriteBit(guid[5]);
+ data.WriteBit(guid[1]);
+ data.WriteBit(guid[0]);
+ data.WriteBit(guid[3]);
+ data.WriteBit(guid[6]);
data.WriteBit(0); // Relocated
- data.WriteBit(guidBytes[7]);
- data.WriteBit(guidBytes[4]);
+ data.WriteBit(guid[7]);
+ data.WriteBit(guid[4]);
data.FlushBits();
data << uint8(2); // BattleStatus
- data.WriteByteSeq(guidBytes[1]);
- data.WriteByteSeq(guidBytes[7]);
- data.WriteByteSeq(guidBytes[4]);
- data.WriteByteSeq(guidBytes[2]);
- data.WriteByteSeq(guidBytes[3]);
+ data.WriteByteSeq(guid[1]);
+ data.WriteByteSeq(guid[7]);
+ data.WriteByteSeq(guid[4]);
+ data.WriteByteSeq(guid[2]);
+ data.WriteByteSeq(guid[3]);
data << uint8(reason); // Reason
- data.WriteByteSeq(guidBytes[6]);
- data.WriteByteSeq(guidBytes[0]);
- data.WriteByteSeq(guidBytes[5]);
+ data.WriteByteSeq(guid[6]);
+ data.WriteByteSeq(guid[0]);
+ data.WriteByteSeq(guid[5]);
SendPacket(&data);
}
@@ -270,7 +262,7 @@ void WorldSession::HandleBfQueueInviteResponse(WorldPacket& recvData)
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[5]);
- TC_LOG_ERROR("misc", "HandleQueueInviteResponse: GUID: " UI64FMTD ", accepted: %u", uint64(guid), accepted);
+ TC_LOG_ERROR("misc", "HandleQueueInviteResponse: %s, accepted: %u", guid.ToString().c_str(), accepted);
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid);
if (!bf)
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index a7de4491a85..954b4483f62 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -50,8 +50,8 @@ Copied events should probably have a new owner
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
{
- uint64 guid = _player->GetGUID();
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid);
+ ObjectGuid guid = _player->GetGUID();
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [%s]", guid.ToString().c_str());
time_t currTime = time(NULL);
@@ -69,12 +69,12 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent((*itr)->GetEventId()))
{
data << uint8(calendarEvent->IsGuildEvent());
- data.appendPackGUID(calendarEvent->GetCreatorGUID());
+ data << calendarEvent->GetCreatorGUID().WriteAsPacked();
}
else
{
data << uint8(0);
- data.appendPackGUID((*itr)->GetSenderGUID());
+ data << (*itr)->GetSenderGUID().WriteAsPacked();
}
}
@@ -184,8 +184,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData)
uint64 eventId;
recvData >> eventId;
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player ["
- UI64FMTD "] Event [" UI64FMTD "]", _player->GetGUID(), eventId);
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [%s] Event [" UI64FMTD "]", _player->GetGUID().ToString().c_str(), eventId);
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
sCalendarMgr->SendCalendarEvent(_player->GetGUID(), *calendarEvent, CALENDAR_SENDTYPE_GET);
@@ -195,7 +194,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData)
void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData)
{
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [" UI64FMTD "]", _player->GetGUID());
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [%s]", _player->GetGUID().ToString().c_str());
uint32 minLevel;
uint32 maxLevel;
@@ -211,7 +210,7 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData)
void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData)
{
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID());
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [%s]", _player->GetGUID().ToString().c_str());
uint32 arenaTeamId;
recvData >> arenaTeamId;
@@ -222,7 +221,7 @@ void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData)
void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
std::string title;
std::string description;
@@ -257,7 +256,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
if (calendarEvent->IsGuildAnnouncement())
{
// 946684800 is 01/01/2000 00:00:00 - default response time
- CalendarInvite invite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
+ CalendarInvite invite(0, calendarEvent->GetEventId(), ObjectGuid::Empty, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
// WARNING: By passing pointer to a local variable, the underlying method(s) must NOT perform any kind
// of storage of the pointer as it will lead to memory corruption
sCalendarMgr->AddInvite(calendarEvent, &invite);
@@ -268,11 +267,10 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
const uint32 MaxPlayerInvites = 100;
uint32 inviteCount;
- uint64 invitee[MaxPlayerInvites];
+ ObjectGuid invitee[MaxPlayerInvites];
uint8 status[MaxPlayerInvites];
uint8 rank[MaxPlayerInvites];
- memset(invitee, 0, sizeof(invitee));
memset(status, 0, sizeof(status));
memset(rank, 0, sizeof(rank));
@@ -282,7 +280,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i)
{
- recvData.readPackGUID(invitee[i]);
+ recvData >> invitee[i].ReadAsPacked();
recvData >> status[i] >> rank[i];
}
}
@@ -313,7 +311,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
time_t oldEventTime;
uint64 eventId;
@@ -341,10 +339,10 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
return;
}
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [%s] EventId [" UI64FMTD
"], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
"Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u "
- "Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(),
+ "Time2 %u, Flags %u", guid.ToString().c_str(), eventId, inviteId, title.c_str(),
description.c_str(), type, repetitionType, maxInvites, dungeonId,
eventPackedTime, timeZoneTime, flags);
@@ -369,7 +367,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint64 eventId;
recvData >> eventId;
@@ -380,15 +378,15 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData)
void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
uint32 eventTime;
recvData >> eventId >> inviteId;
recvData.ReadPackedTime(eventTime);
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD
- "] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, eventTime);
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [%s], EventId [" UI64FMTD
+ "] inviteId [" UI64FMTD "] Time: %u", guid.ToString().c_str(), eventId, inviteId, eventTime);
// prevent events in the past
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
@@ -424,7 +422,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_INVITE");
- uint64 playerGuid = _player->GetGUID();
+ ObjectGuid playerGuid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
@@ -432,7 +430,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
bool isPreInvite;
bool isGuildEvent;
- uint64 inviteeGuid = 0;
+ ObjectGuid inviteeGuid;
uint32 inviteeTeam = 0;
uint32 inviteeGuildId = 0;
@@ -453,7 +451,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
- inviteeGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ inviteeGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
inviteeTeam = Player::TeamForRace(fields[1].GetUInt8());
inviteeGuildId = Player::GetGuildIdFromDB(inviteeGuid);
}
@@ -471,7 +469,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
return;
}
- if (QueryResult result = CharacterDatabase.PQuery("SELECT flags FROM character_social WHERE guid = " UI64FMTD " AND friend = " UI64FMTD, inviteeGuid, playerGuid))
+ if (QueryResult result = CharacterDatabase.PQuery("SELECT flags FROM character_social WHERE guid = %u AND friend = %u", inviteeGuid.GetCounter(), playerGuid.GetCounter()))
{
Field* fields = result->Fetch();
if (fields[0].GetUInt8() & SOCIAL_FLAG_IGNORED)
@@ -515,12 +513,12 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint64 eventId;
bool tentative;
recvData >> eventId >> tentative;
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId [" UI64FMTD "] Tentative %u", guid, eventId, tentative);
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_SIGNUP [%s] EventId [" UI64FMTD "] Tentative %u", guid.ToString().c_str(), eventId, tentative);
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
{
@@ -541,14 +539,14 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData)
void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
uint32 status;
recvData >> eventId >> inviteId >> status;
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD "] EventId ["
- UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid, eventId,
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_RSVP [%s] EventId ["
+ UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid.ToString().c_str(), eventId,
inviteId, status);
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
@@ -578,19 +576,18 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
- uint64 invitee;
+ ObjectGuid guid = _player->GetGUID();
+ ObjectGuid invitee;
uint64 eventId;
uint64 ownerInviteId; // isn't it sender's inviteId?
uint64 inviteId;
- recvData.readPackGUID(invitee);
+ recvData >> invitee.ReadAsPacked();
recvData >> inviteId >> ownerInviteId >> eventId;
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE ["
- UI64FMTD "] EventId [" UI64FMTD "], ownerInviteId ["
- UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])",
- guid, eventId, ownerInviteId, invitee, inviteId);
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE [%s] EventId [" UI64FMTD
+ "], ownerInviteId [" UI64FMTD "], Invitee ([%s] id: [" UI64FMTD "])",
+ guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId);
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
{
@@ -608,18 +605,18 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData)
void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
- uint64 invitee;
+ ObjectGuid guid = _player->GetGUID();
+ ObjectGuid invitee;
uint64 eventId;
uint64 inviteId;
uint64 ownerInviteId; // isn't it sender's inviteId?
uint8 status;
- recvData.readPackGUID(invitee);
+ recvData >> invitee.ReadAsPacked();
recvData >> eventId >> inviteId >> ownerInviteId >> status;
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId ["
- UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
- UI64FMTD "], status %u", guid, eventId, ownerInviteId, invitee, inviteId, status);
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [%s] EventId ["
+ UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([%s] id: ["
+ UI64FMTD "], status %u", guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId, status);
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
{
@@ -642,18 +639,18 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
- uint64 invitee;
+ ObjectGuid guid = _player->GetGUID();
+ ObjectGuid invitee;
uint64 eventId;
uint64 inviteId;
uint64 ownerInviteId; // isn't it sender's inviteId?
uint8 rank;
- recvData.readPackGUID(invitee);
- recvData >> eventId >> inviteId >> ownerInviteId >> rank;
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId ["
- UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
- UI64FMTD "], rank %u", guid, eventId, ownerInviteId, invitee, inviteId, rank);
+ recvData >> invitee.ReadAsPacked();
+ recvData >> eventId >> inviteId >> ownerInviteId >> rank;
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [%s] EventId ["
+ UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([%s] id: ["
+ UI64FMTD "], rank %u", guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId, rank);
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
{
@@ -672,25 +669,24 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
void WorldSession::HandleCalendarComplain(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint64 eventId;
- uint64 complainGUID;
+ ObjectGuid complainGUID;
uint64 inviteId;
recvData >> complainGUID >> eventId >> inviteId;
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId ["
- UI64FMTD "] guid [" UI64FMTD "] InviteId [" UI64FMTD "]", guid, eventId, complainGUID, inviteId);
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [%s] EventId ["
+ UI64FMTD "] guid [%s] InviteId [" UI64FMTD "]", guid.ToString().c_str(), eventId, complainGUID.ToString().c_str(), inviteId);
// what to do with complains?
}
void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint32 pending = sCalendarMgr->GetPlayerNumPending(guid);
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD
- "] Pending: %u", guid, pending);
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [%s] Pending: %u", guid.ToString().c_str(), pending);
WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4);
data << uint32(pending);
@@ -741,9 +737,9 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save)
if (!save)
return;
- uint64 guid = _player->GetGUID();
- TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD
- "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty());
+ ObjectGuid guid = _player->GetGUID();
+ TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [%s] Map: %u, Difficulty %u",
+ guid.ToString().c_str(), save->GetMapId(), save->GetDifficulty());
time_t currTime = time(NULL);
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index f917b3970c8..feefaec83ab 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -52,11 +52,11 @@ class LoginQueryHolder : public SQLQueryHolder
{
private:
uint32 m_accountId;
- uint64 m_guid;
+ ObjectGuid m_guid;
public:
- LoginQueryHolder(uint32 accountId, uint64 guid)
+ LoginQueryHolder(uint32 accountId, ObjectGuid guid)
: m_accountId(accountId), m_guid(guid) { }
- uint64 GetGuid() const { return m_guid; }
+ ObjectGuid GetGuid() const { return m_guid; }
uint32 GetAccountId() const { return m_accountId; }
bool Initialize();
};
@@ -66,7 +66,7 @@ bool LoginQueryHolder::Initialize()
SetSize(MAX_PLAYER_LOGIN_QUERY);
bool res = true;
- uint32 lowGuid = GUID_LOPART(m_guid);
+ uint32 lowGuid = m_guid.GetCounter();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER);
stmt->setUInt32(0, lowGuid);
@@ -239,18 +239,18 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
do
{
- uint32 guidLow = (*result)[0].GetUInt32();
+ ObjectGuid guid(HIGHGUID_PLAYER, (*result)[0].GetUInt32());
- TC_LOG_INFO("network", "Loading char guid %u from account %u.", guidLow, GetAccountId());
+ TC_LOG_INFO("network", "Loading char guid %s from account %u.", guid.ToString().c_str(), GetAccountId());
Player::BuildEnumData(result, &dataBuffer, &bitBuffer);
// Do not allow banned characters to log in
if (!(*result)[20].GetUInt32())
- _legitCharacters.insert(guidLow);
+ _legitCharacters.insert(guid);
- if (!sWorld->HasCharacterNameData(guidLow)) // This can happen if characters are inserted into the database manually. Core hasn't loaded name data yet.
- sWorld->AddCharacterNameData(guidLow, (*result)[1].GetString(), (*result)[4].GetUInt8(), (*result)[2].GetUInt8(), (*result)[3].GetUInt8(), (*result)[7].GetUInt8());
+ if (!sWorld->HasCharacterNameData(guid)) // This can happen if characters are inserted into the database manually. Core hasn't loaded name data yet.
+ sWorld->AddCharacterNameData(guid, (*result)[1].GetString(), (*result)[4].GetUInt8(), (*result)[2].GetUInt8(), (*result)[3].GetUInt8(), (*result)[7].GetUInt8());
} while (result->NextRow());
}
else
@@ -707,7 +707,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
std::string IP_str = GetRemoteAddress();
TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
sScriptMgr->OnPlayerCreate(&newChar);
- sWorld->AddCharacterNameData(newChar.GetGUIDLow(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel());
+ sWorld->AddCharacterNameData(newChar.GetGUID(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel());
newChar.CleanupsBeforeDelete();
delete createInfo;
@@ -719,7 +719,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
// Initiating
uint32 initAccountId = GetAccountId();
@@ -756,7 +756,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_DATA_BY_GUID);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
@@ -774,7 +774,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
}
std::string IP_str = GetRemoteAddress();
- TC_LOG_INFO("entities.player.character", "Account: %d, IP: %s deleted character: %s, GUID: %u, Level: %u", accountId, IP_str.c_str(), name.c_str(), GUID_LOPART(guid), level);
+ TC_LOG_INFO("entities.player.character", "Account: %d, IP: %s deleted character: %s, %s, Level: %u", accountId, IP_str.c_str(), name.c_str(), guid.ToString().c_str(), level);
// To prevent hook failure, place hook before removing reference from DB
sScriptMgr->OnPlayerDelete(guid, initAccountId); // To prevent race conditioning, but as it also makes sense, we hand the accountId over for successful delete.
@@ -783,8 +783,8 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
if (sLog->ShouldLog("entities.player.dump", LOG_LEVEL_INFO)) // optimize GetPlayerDump call
{
std::string dump;
- if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump))
- sLog->outCharDump(dump.c_str(), accountId, GUID_LOPART(guid), name.c_str());
+ if (PlayerDumpWriter().GetDump(guid.GetCounter(), dump))
+ sLog->outCharDump(dump.c_str(), accountId, guid.GetCounter(), name.c_str());
}
sGuildFinderMgr->RemoveAllMembershipRequestsFromPlayer(guid);
@@ -827,11 +827,11 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
recvData.ReadByteSeq(playerGuid[1]);
recvData.ReadByteSeq(playerGuid[4]);
- TC_LOG_DEBUG("network", "Character (Guid: %u) logging in", GUID_LOPART(playerGuid));
+ TC_LOG_DEBUG("network", "Character %s logging in", playerGuid.ToString().c_str());
- if (!IsLegitCharacterForAccount(GUID_LOPART(playerGuid)))
+ if (!IsLegitCharacterForAccount(playerGuid))
{
- TC_LOG_ERROR("network", "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
+ TC_LOG_ERROR("network", "Account (%u) can't login with that character (%s).", GetAccountId(), playerGuid.ToString().c_str());
KickPlayer();
return;
}
@@ -844,7 +844,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
return;
}
- _charLoginCallback = CharacterDatabase.DelayQueryHolder((SQLQueryHolder*)holder);
+ _charLoginCallback = CharacterDatabase.DelayQueryHolder(holder);
}
void WorldSession::HandleLoadScreenOpcode(WorldPacket& recvPacket)
@@ -860,14 +860,14 @@ void WorldSession::HandleLoadScreenOpcode(WorldPacket& recvPacket)
void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
{
- uint64 playerGuid = holder->GetGuid();
+ ObjectGuid playerGuid = holder->GetGuid();
Player* pCurrChar = new Player(this);
// for send server info and strings (config)
ChatHandler chH = ChatHandler(pCurrChar->GetSession());
// "GetAccountId() == db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
- if (!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
+ if (!pCurrChar->LoadFromDB(playerGuid, holder))
{
SetPlayer(NULL);
KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick
@@ -1224,7 +1224,7 @@ void WorldSession::HandleShowingCloakOpcode(WorldPacket& recvData)
void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
std::string newName;
recvData >> guid;
@@ -1265,7 +1265,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_FREE_NAME);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
stmt->setUInt32(1, GetAccountId());
stmt->setUInt16(2, AT_LOGIN_RENAME);
stmt->setUInt16(3, AT_LOGIN_RENAME);
@@ -1289,7 +1289,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
uint32 guidLow = fields[0].GetUInt32();
std::string oldName = fields[1].GetString();
- uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
+ ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, guidLow);
// Update name and at_login flag in the db
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME);
@@ -1307,7 +1307,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
CharacterDatabase.Execute(stmt);
- TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
+ TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] (%s) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guid.ToString().c_str(), newName.c_str());
WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
data << uint8(RESPONSE_SUCCESS);
@@ -1315,12 +1315,12 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
data << newName;
SendPacket(&data);
- sWorld->UpdateCharacterNameData(guidLow, newName);
+ sWorld->UpdateCharacterNameData(guid, newName);
}
void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
@@ -1390,11 +1390,11 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_DECLINED_NAME);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
for (uint8 i = 0; i < 5; i++)
stmt->setString(i+1, declinedname.name[i]);
@@ -1505,14 +1505,14 @@ void WorldSession::HandleRemoveGlyph(WorldPacket& recvData)
void WorldSession::HandleCharCustomize(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
std::string newName;
recvData >> guid;
- if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
+ if (!IsLegitCharacterForAccount(guid))
{
- TC_LOG_ERROR("network", "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!",
- GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "Account %u, IP: %s tried to customise %s, but it does not belong to their account!",
+ GetAccountId(), GetRemoteAddress().c_str(), guid.ToString().c_str());
recvData.rfinish();
KickPlayer();
return;
@@ -1524,7 +1524,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
// TODO: Make async with callback
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -1575,7 +1575,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
}
// character with this name already exist
- if (uint64 newguid = sObjectMgr->GetPlayerGUIDByName(newName))
+ if (ObjectGuid newguid = sObjectMgr->GetPlayerGUIDByName(newName))
{
if (newguid != guid)
{
@@ -1587,13 +1587,13 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
}
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
result = CharacterDatabase.Query(stmt);
if (result)
{
std::string oldname = result->Fetch()[0].GetString();
- TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
+ TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s), Character[%s] (%s) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), guid.ToString().c_str(), newName.c_str());
}
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
@@ -1602,17 +1602,17 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
stmt->setString(0, newName);
stmt->setUInt16(1, uint16(AT_LOGIN_CUSTOMIZE));
- stmt->setUInt32(2, GUID_LOPART(guid));
+ stmt->setUInt32(2, guid.GetCounter());
CharacterDatabase.Execute(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
CharacterDatabase.Execute(stmt);
- sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newName, gender);
+ sWorld->UpdateCharacterNameData(guid, newName, gender);
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1+8+(newName.size()+1)+6);
data << uint8(RESPONSE_SUCCESS);
@@ -1654,11 +1654,11 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket& recvData)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
- uint64 itemGuid;
- recvData.readPackGUID(itemGuid);
+ ObjectGuid itemGuid;
+ recvData >> itemGuid.ReadAsPacked();
// equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set)
- if (itemGuid == 1)
+ if (itemGuid.GetRawValue() == 1)
{
// ignored slots saved as bit mask because we have no free special values for Items[i]
eqSet.IgnoreMask |= 1 << i;
@@ -1673,7 +1673,7 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket& recvData)
if (item && item->GetGUID() != itemGuid) // cheating check 2
return;
- eqSet.Items[i] = GUID_LOPART(itemGuid);
+ eqSet.Items[i] = itemGuid.GetCounter();
}
_player->SetEquipmentSet(index, eqSet);
@@ -1695,16 +1695,16 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket& recvData)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
- uint64 itemGuid;
- recvData.readPackGUID(itemGuid);
+ ObjectGuid itemGuid;
+ recvData >> itemGuid.ReadAsPacked();
uint8 srcbag, srcslot;
recvData >> srcbag >> srcslot;
- TC_LOG_DEBUG("entities.player.items", "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot);
+ TC_LOG_DEBUG("entities.player.items", "%s: srcbag %u, srcslot %u", itemGuid.ToString().c_str(), srcbag, srcslot);
// check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
- if (itemGuid == 1)
+ if (itemGuid.GetRawValue() == 1)
continue;
// Only equip weapons in combat
@@ -1747,15 +1747,15 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket& recvData)
void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
std::string newname;
uint8 gender, skin, face, hairStyle, hairColor, facialHair, race;
recvData >> guid;
- if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
+ if (!IsLegitCharacterForAccount(guid))
{
- TC_LOG_ERROR("network", "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!",
- GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "Account %u, IP: %s tried to factionchange character %s, but it does not belong to their account!",
+ GetAccountId(), GetRemoteAddress().c_str(), guid.ToString().c_str());
recvData.rfinish();
KickPlayer();
return;
@@ -1764,10 +1764,10 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
recvData >> newname;
recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race;
- uint32 lowGuid = GUID_LOPART(guid);
+ uint32 lowGuid = guid.GetCounter();
// get the players old (at this moment current) race
- CharacterNameData const* nameData = sWorld->GetCharacterNameData(lowGuid);
+ CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid);
if (!nameData)
{
WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
@@ -1854,7 +1854,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
}
// character with this name already exist
- if (uint64 newguid = sObjectMgr->GetPlayerGUIDByName(newname))
+ if (ObjectGuid newguid = sObjectMgr->GetPlayerGUIDByName(newname))
{
if (newguid != guid)
{
@@ -1883,7 +1883,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
stmt->setUInt32(0, lowGuid);
trans->Append(stmt);
- sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newname, gender, race);
+ sWorld->UpdateCharacterNameData(guid, newname, gender, race);
if (oldRace != race)
{
@@ -2029,7 +2029,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
if (Guild* guild = sGuildMgr->GetGuildById((result->Fetch()[0]).GetUInt32()))
- guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER), false, false, true);
+ guild->DeleteMember(guid, false, false, true);
Player::LeaveAllArenaTeams(guid);
}
@@ -2060,7 +2060,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
stmt->setFloat (3, -8867.68f);
stmt->setFloat (4, 673.373f);
stmt->setFloat (5, 97.9034f);
- Player::SavePositionInDB(0, -8867.68f, 673.373f, 97.9034f, 0.0f, 1519, lowGuid);
+ Player::SavePositionInDB(0, -8867.68f, 673.373f, 97.9034f, 0.0f, 1519, guid);
}
else
{
@@ -2069,7 +2069,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
stmt->setFloat (3, 1633.33f);
stmt->setFloat (4, -4439.11f);
stmt->setFloat (5, 15.7588f);
- Player::SavePositionInDB(1, 1633.33f, -4439.11f, 15.7588f, 0.0f, 1637, lowGuid);
+ Player::SavePositionInDB(1, 1633.33f, -4439.11f, 15.7588f, 0.0f, 1637, guid);
}
trans->Append(stmt);
@@ -2100,13 +2100,13 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE);
stmt->setUInt32(0, (team == TEAM_ALLIANCE ? item_alliance : item_horde));
stmt->setUInt32(1, (team == TEAM_ALLIANCE ? item_horde : item_alliance));
- stmt->setUInt32(2, guid);
+ stmt->setUInt32(2, lowGuid);
trans->Append(stmt);
}
// Delete all current quests
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, lowGuid);
trans->Append(stmt);
// Quest conversion
@@ -2330,7 +2330,7 @@ void WorldSession::HandleRandomizeCharNameOpcode(WorldPacket& recvData)
void WorldSession::HandleReorderCharacters(WorldPacket& recvData)
{
- uint32 charactersCount = recvData.ReadBits(10);
+ uint32 charactersCount = std::min<uint32>(recvData.ReadBits(10), sWorld->getIntConfig(CONFIG_CHARACTERS_PER_REALM));
std::vector<ObjectGuid> guids(charactersCount);
uint8 position;
@@ -2364,7 +2364,7 @@ void WorldSession::HandleReorderCharacters(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_LIST_SLOT);
stmt->setUInt8(0, position);
- stmt->setUInt32(1, GUID_LOPART(guids[i]));
+ stmt->setUInt32(1, guids[i].GetCounter());
trans->Append(stmt);
}
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index 2119aa47d2d..a65c03b25a1 100644
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
@@ -725,7 +725,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
}
uint32 text_emote, emoteNum;
- uint64 guid;
+ ObjectGuid guid;
recvData >> text_emote;
recvData >> emoteNum;
diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp
index e4d749d9ab0..152d6994949 100644
--- a/src/server/game/Handlers/CombatHandler.cpp
+++ b/src/server/game/Handlers/CombatHandler.cpp
@@ -30,10 +30,10 @@
void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid));
+ TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.ToString().c_str());
Unit* pEnemy = ObjectAccessor::GetUnit(*_player, guid);
@@ -92,9 +92,9 @@ void WorldSession::HandleSetSheathedOpcode(WorldPacket& recvData)
void WorldSession::SendAttackStop(Unit const* enemy)
{
WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); // we guess size
- data.append(GetPlayer()->GetPackGUID());
+ data << GetPlayer()->GetPackGUID();
if (enemy)
- data.append(enemy->GetPackGUID());
+ data << enemy->GetPackGUID();
else
data << uint8(0);
diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp
index b07df587fbf..f93fc7e8ce0 100644
--- a/src/server/game/Handlers/DuelHandler.cpp
+++ b/src/server/game/Handlers/DuelHandler.cpp
@@ -26,7 +26,7 @@
void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
Player* player;
Player* plTarget;
@@ -35,7 +35,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
if (!GetPlayer()->duel) // ignore accept from duel-sender
return;
- player = GetPlayer();
+ player = GetPlayer();
plTarget = player->duel->opponent;
if (player == player->duel->initiator || !plTarget || player == plTarget || player->duel->startTime != 0 || plTarget->duel->startTime != 0)
@@ -56,7 +56,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_DUEL_CANCELLED");
- uint64 guid;
+ ObjectGuid guid;
recvPacket >> guid;
// no duel requested
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index 0e30f17d71f..149d309f995 100644
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -403,7 +403,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_UNINVITE_GUID");
- uint64 guid;
+ ObjectGuid guid;
std::string reason;
recvData >> guid;
recvData >> reason;
@@ -478,7 +478,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData)
if (!grp)
return;
- if (uint64 guid = grp->GetMemberGUID(membername))
+ if (ObjectGuid guid = grp->GetMemberGUID(membername))
{
Player::RemoveFromGroup(grp, guid, GROUP_REMOVEMETHOD_KICK, GetPlayer()->GetGUID());
return;
@@ -497,7 +497,7 @@ void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_SET_LEADER");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Player* player = ObjectAccessor::FindPlayer(guid);
@@ -620,7 +620,7 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "WORLD: Received CMSG_LOOT_METHOD");
uint32 lootMethod;
- uint64 lootMaster;
+ ObjectGuid lootMaster;
uint32 lootThreshold;
recvData >> lootMethod >> lootMaster >> lootThreshold;
@@ -651,7 +651,7 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData)
void WorldSession::HandleLootRoll(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 itemSlot;
uint8 rollType;
recvData >> guid; // guid of the item rolled
@@ -750,10 +750,10 @@ void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData)
if (group->isRaidGroup() && !group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- if (IS_PLAYER_GUID(guid))
+ if (guid.IsPlayer())
{
Player* target = ObjectAccessor::FindPlayer(guid);
@@ -824,7 +824,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
if (groupNr >= MAX_RAID_SUBGROUPS)
return;
- uint64 senderGuid = GetPlayer()->GetGUID();
+ ObjectGuid senderGuid = GetPlayer()->GetGUID();
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
return;
@@ -832,7 +832,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
return;
Player* movedPlayer = sObjectAccessor->FindPlayerByName(name);
- uint64 guid;
+ ObjectGuid guid;
if (movedPlayer)
guid = movedPlayer->GetGUID();
@@ -866,7 +866,7 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData)
if (!group->IsLeader(GetPlayer()->GetGUID()))
return;
- uint64 guid;
+ ObjectGuid guid;
bool apply;
recvData >> guid;
recvData >> apply;
@@ -882,13 +882,13 @@ void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData)
if (!group)
return;
- uint64 senderGuid = GetPlayer()->GetGUID();
+ ObjectGuid senderGuid = GetPlayer()->GetGUID();
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
return;
uint8 assignment;
bool apply;
- uint64 guid;
+ ObjectGuid guid;
recvData >> assignment >> apply;
recvData >> guid;
@@ -971,7 +971,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
mask |= (GROUP_UPDATE_FLAG_PET_CUR_POWER | GROUP_UPDATE_FLAG_PET_MAX_POWER);
data->Initialize(SMSG_PARTY_MEMBER_STATS, 80); // average value
- data->append(player->GetPackGUID());
+ *data << player->GetPackGUID();
*data << uint32(mask);
if (mask & GROUP_UPDATE_FLAG_STATUS)
@@ -1197,15 +1197,15 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
- uint64 guid;
- recvData >> guid;
+ ObjectGuid Guid;
+ recvData >> Guid;
- Player* player = HashMapHolder<Player>::Find(guid);
+ Player* player = HashMapHolder<Player>::Find(Guid);
if (!player)
{
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
- data.appendPackGUID(guid);
+ data << Guid.WriteAsPacked();
data << uint32(GROUP_UPDATE_FLAG_STATUS);
data << uint16(MEMBER_STATUS_OFFLINE);
SendPacket(&data);
@@ -1218,7 +1218,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
- data.append(player->GetPackGUID());
+ data << player->GetPackGUID();
uint32 updateFlags = GROUP_UPDATE_FLAG_STATUS | GROUP_UPDATE_FLAG_CUR_HP | GROUP_UPDATE_FLAG_MAX_HP
| GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER | GROUP_UPDATE_FLAG_LEVEL
diff --git a/src/server/game/Handlers/GuildFinderHandler.cpp b/src/server/game/Handlers/GuildFinderHandler.cpp
index f4baafd1d6f..2dea43dcad1 100644
--- a/src/server/game/Handlers/GuildFinderHandler.cpp
+++ b/src/server/game/Handlers/GuildFinderHandler.cpp
@@ -58,9 +58,9 @@ void WorldSession::HandleGuildFinderAddRecruit(WorldPacket& recvPacket)
recvPacket.ReadByteSeq(guid[1]);
recvPacket.ReadByteSeq(guid[3]);
- uint32 guildLowGuid = GUID_LOPART(uint64(guid));
+ uint32 guildLowGuid = guid.GetCounter();
- if (!IS_GUILD_GUID(guid))
+ if (!guid.IsGuild())
return;
if (!(classRoles & GUILDFINDER_ALL_ROLES) || classRoles > GUILDFINDER_ALL_ROLES)
return;
@@ -69,7 +69,7 @@ void WorldSession::HandleGuildFinderAddRecruit(WorldPacket& recvPacket)
if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
return;
- MembershipRequest request = MembershipRequest(GetPlayer()->GetGUIDLow(), guildLowGuid, availability, classRoles, guildInterests, comment, time(NULL));
+ MembershipRequest request = MembershipRequest(GetPlayer()->GetGUID(), guildLowGuid, availability, classRoles, guildInterests, comment, time(NULL));
sGuildFinderMgr->AddMembershipRequest(guildLowGuid, request);
}
@@ -198,10 +198,10 @@ void WorldSession::HandleGuildFinderDeclineRecruit(WorldPacket& recvPacket)
recvPacket.ReadByteSeq(playerGuid[0]);
recvPacket.ReadByteSeq(playerGuid[6]);
- if (!IS_PLAYER_GUID(playerGuid))
+ if (!playerGuid.IsPlayer())
return;
- sGuildFinderMgr->RemoveMembershipRequest(GUID_LOPART(playerGuid), GetPlayer()->GetGuildId());
+ sGuildFinderMgr->RemoveMembershipRequest(playerGuid.GetCounter(), GetPlayer()->GetGuildId());
}
void WorldSession::HandleGuildFinderGetApplications(WorldPacket& /*recvPacket*/)
@@ -287,7 +287,7 @@ void WorldSession::HandleGuildFinderGetRecruits(WorldPacket& recvPacket)
for (std::vector<MembershipRequest>::const_iterator itr = recruitsList.begin(); itr != recruitsList.end(); ++itr)
{
MembershipRequest request = *itr;
- ObjectGuid playerGuid(MAKE_NEW_GUID(request.GetPlayerGUID(), 0, HIGHGUID_PLAYER));
+ ObjectGuid playerGuid = request.GetPlayerGUID();
data.WriteBits(request.GetComment().size(), 11);
data.WriteBit(playerGuid[2]);
@@ -394,10 +394,10 @@ void WorldSession::HandleGuildFinderRemoveRecruit(WorldPacket& recvPacket)
recvPacket.ReadByteSeq(guildGuid[2]);
recvPacket.ReadByteSeq(guildGuid[7]);
- if (!IS_GUILD_GUID(guildGuid))
+ if (!guildGuid.IsGuild())
return;
- sGuildFinderMgr->RemoveMembershipRequest(GetPlayer()->GetGUIDLow(), GUID_LOPART(guildGuid));
+ sGuildFinderMgr->RemoveMembershipRequest(GetPlayer()->GetGUIDLow(), guildGuid.GetCounter());
}
// Sent any time a guild master sets an option in the interface and when listing / unlisting his guild
diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp
index 3bc88e1eeb8..3762e9aa90e 100644
--- a/src/server/game/Handlers/GuildHandler.cpp
+++ b/src/server/game/Handlers/GuildHandler.cpp
@@ -30,11 +30,11 @@
void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket)
{
- uint64 guildGuid, playerGuid;
+ ObjectGuid guildGuid, playerGuid;
recvPacket >> guildGuid >> playerGuid;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_QUERY [%s]: Guild: %u Target: %u",
- GetPlayerInfo().c_str(), GUID_LOPART(guildGuid), GUID_LOPART(playerGuid));
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_QUERY [%s]: Guild: %s Target: %s",
+ GetPlayerInfo().c_str(), guildGuid.ToString().c_str(), playerGuid.ToString().c_str());
if (Guild* guild = sGuildMgr->GetGuildByGuid(guildGuid))
if (guild->IsMember(playerGuid))
@@ -74,7 +74,7 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
recvPacket.ReadByteSeq(playerGuid[3]);
recvPacket.ReadByteSeq(playerGuid[0]);
- TC_LOG_DEBUG("guild", "CMSG_GUILD_REMOVE [%s]: Target: %u", GetPlayerInfo().c_str(), GUID_LOPART(playerGuid));
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_REMOVE [%s]: Target: %s", GetPlayerInfo().c_str(), playerGuid.ToString().c_str());
if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleRemoveMember(this, playerGuid);
@@ -130,7 +130,7 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
recvPacket.ReadByteSeq(targetGuid[1]);
recvPacket.ReadByteSeq(targetGuid[7]);
- TC_LOG_DEBUG("guild", "CMSG_GUILD_PROMOTE [%s]: Target: %u", GetPlayerInfo().c_str(), GUID_LOPART(targetGuid));
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_PROMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), targetGuid.ToString().c_str());
if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleUpdateMemberRank(this, targetGuid, false);
@@ -158,7 +158,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
recvPacket.ReadByteSeq(targetGuid[4]);
recvPacket.ReadByteSeq(targetGuid[3]);
- TC_LOG_DEBUG("guild", "CMSG_GUILD_DEMOTE [%s]: Target: %u", GetPlayerInfo().c_str(), GUID_LOPART(targetGuid));
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_DEMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), targetGuid.ToString().c_str());
if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleUpdateMemberRank(this, targetGuid, true);
@@ -206,8 +206,8 @@ void WorldSession::HandleGuildAssignRankOpcode(WorldPacket& recvPacket)
recvPacket.ReadByteSeq(targetGuid[6]);
recvPacket.ReadByteSeq(setterGuid[7]);
- TC_LOG_DEBUG("guild", "CMSG_GUILD_ASSIGN_MEMBER_RANK [%s]: Target: %u Rank: %u, Issuer: %u",
- GetPlayerInfo().c_str(), GUID_LOPART(targetGuid), rankId, GUID_LOPART(setterGuid));
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_ASSIGN_MEMBER_RANK [%s]: Target: %s Rank: %u, Issuer: %s",
+ GetPlayerInfo().c_str(), targetGuid.ToString().c_str(), rankId, setterGuid.ToString().c_str());
if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleSetMemberRank(this, targetGuid, setterGuid, rankId);
@@ -264,8 +264,8 @@ void WorldSession::HandleGuildSetNoteOpcode(WorldPacket& recvPacket)
std::string note = recvPacket.ReadString(noteLength);
recvPacket.ReadByteSeq(playerGuid[2]);
- TC_LOG_DEBUG("guild", "CMSG_GUILD_SET_NOTE [%s]: Target: %u, Note: %s, Public: %u",
- GetPlayerInfo().c_str(), GUID_LOPART(playerGuid), note.c_str(), ispublic);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_SET_NOTE [%s]: Target: %s, Note: %s, Public: %u",
+ GetPlayerInfo().c_str(), playerGuid.ToString().c_str(), note.c_str(), ispublic);
if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleSetMemberNote(this, note, playerGuid, ispublic);
@@ -293,8 +293,8 @@ void WorldSession::HandleGuildQueryRanksOpcode(WorldPacket& recvPacket)
recvPacket.ReadByteSeq(guildGuid[6]);
recvPacket.ReadByteSeq(guildGuid[2]);
- TC_LOG_DEBUG("guild", "CMSG_GUILD_QUERY_RANKS [%s]: Guild: %u",
- GetPlayerInfo().c_str(), GUID_LOPART(guildGuid));
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_QUERY_RANKS [%s]: Guild: %s",
+ GetPlayerInfo().c_str(), guildGuid.ToString().c_str());
if (Guild* guild = sGuildMgr->GetGuildByGuid(guildGuid))
if (guild->IsMember(_player->GetGUID()))
@@ -339,15 +339,14 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket)
void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
{
- uint64 vendorGuid;
+ ObjectGuid vendorGuid;
recvPacket >> vendorGuid;
EmblemInfo emblemInfo;
emblemInfo.ReadPacket(recvPacket);
- TC_LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [" UI64FMTD
- "] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d"
- , GetPlayerInfo().c_str(), vendorGuid, emblemInfo.GetStyle()
+ TC_LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [%s] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d"
+ , GetPlayerInfo().c_str(), vendorGuid.ToString().c_str(), emblemInfo.GetStyle()
, emblemInfo.GetColor(), emblemInfo.GetBorderStyle()
, emblemInfo.GetBorderColor(), emblemInfo.GetBackgroundColor());
@@ -393,12 +392,12 @@ void WorldSession::HandleGuildPermissions(WorldPacket& /* recvPacket */)
// Called when clicking on Guild bank gameobject
void WorldSession::HandleGuildBankerActivate(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
bool sendAllSlots;
recvPacket >> guid >> sendAllSlots;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [" UI64FMTD "] AllSlots: %u"
- , GetPlayerInfo().c_str(), guid, sendAllSlots);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: [%s] AllSlots: %u"
+ , GetPlayerInfo().c_str(), guid.ToString().c_str(), sendAllSlots);
GameObject const* const go = GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK);
if (!go)
@@ -417,14 +416,14 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket& recvPacket)
// Called when opening guild bank tab only (first one)
void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
uint8 tabId;
- bool sendAllSlots;
+ bool full;
- recvPacket >> guid >> tabId >> sendAllSlots;
+ recvPacket >> guid >> tabId >> full;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, AllSlots: %u"
- , GetPlayerInfo().c_str(), guid, tabId, sendAllSlots);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [%s]: %s, TabId: %u, ShowTabs: %u"
+ , GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId, full);
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -433,12 +432,12 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvPacket)
void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
uint64 money;
recvPacket >> guid >> money;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [" UI64FMTD "], money: " UI64FMTD,
- GetPlayerInfo().c_str(), guid, money);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: [%s], money: " UI64FMTD,
+ GetPlayerInfo().c_str(), guid.ToString().c_str(), money);
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (money && GetPlayer()->HasEnoughMoney(money))
@@ -448,12 +447,12 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvPacket)
void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
uint64 money;
recvPacket >> guid >> money;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [" UI64FMTD "], money: " UI64FMTD,
- GetPlayerInfo().c_str(), guid, money);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: [%s], money: " UI64FMTD,
+ GetPlayerInfo().c_str(), guid.ToString().c_str(), money);
if (money && GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -464,7 +463,7 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_SWAP_ITEMS [%s]", GetPlayerInfo().c_str());
- uint64 GoGuid;
+ ObjectGuid GoGuid;
recvPacket >> GoGuid;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
@@ -544,13 +543,13 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvPacket)
void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
recvPacket >> guid;
uint8 tabId;
recvPacket >> tabId;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_BUY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u", GetPlayerInfo().c_str(), guid, tabId);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_BUY_TAB [%s]: [%s[, TabId: %u", GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId);
if (!guid || GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -559,14 +558,14 @@ void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvPacket)
void WorldSession::HandleGuildBankUpdateTab(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
uint8 tabId;
std::string name, icon;
recvPacket >> guid >> tabId >> name >> icon;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, Name: %s, Icon: %s"
- , GetPlayerInfo().c_str(), guid, tabId, name.c_str(), icon.c_str());
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: [%s], TabId: %u, Name: %s, Icon: %s"
+ , GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId, name.c_str(), icon.c_str());
if (!name.empty() && !icon.empty())
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -633,7 +632,7 @@ void WorldSession::HandleGuildQueryXPOpcode(WorldPacket& recvPacket)
recvPacket.ReadByteSeq(guildGuid[0]);
recvPacket.ReadByteSeq(guildGuid[4]);
- TC_LOG_DEBUG("guild", "CMSG_QUERY_GUILD_XP [%s]: Guild: %u", GetPlayerInfo().c_str(), GUID_LOPART(guildGuid));
+ TC_LOG_DEBUG("guild", "CMSG_QUERY_GUILD_XP [%s]: Guild: %s", GetPlayerInfo().c_str(), guildGuid.ToString().c_str());
if (Guild* guild = sGuildMgr->GetGuildByGuid(guildGuid))
if (guild->IsMember(_player->GetGUID()))
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 355317856d5..eae9e37ebe8 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -89,13 +89,13 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, srcslot) && !CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, dstslot) && !CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
@@ -107,7 +107,7 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData)
{
- uint64 itemguid;
+ ObjectGuid itemguid;
uint8 dstslot;
recvData >> itemguid >> dstslot;
@@ -153,13 +153,13 @@ void WorldSession::HandleSwapItem(WorldPacket& recvData)
if (_player->IsBankPos(srcbag, srcslot) && !CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
if (_player->IsBankPos(dstbag, dstslot) && !CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
@@ -336,7 +336,7 @@ void WorldSession::HandleReadItem(WorldPacket& recvData)
void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_SELL_ITEM");
- uint64 vendorguid, itemguid;
+ ObjectGuid vendorguid, itemguid;
uint32 count;
recvData >> vendorguid >> itemguid >> count;
@@ -347,7 +347,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - %s not found or you can not interact with him.", vendorguid.ToString().c_str());
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, itemguid);
return;
}
@@ -448,7 +448,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
void WorldSession::HandleBuybackItem(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUYBACK_ITEM");
- uint64 vendorguid;
+ ObjectGuid vendorguid;
uint32 slot;
recvData >> vendorguid >> slot;
@@ -456,8 +456,8 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid)));
- _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0);
+ TC_LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (%s) not found or you can not interact with him.", vendorguid.ToString().c_str());
+ _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, ObjectGuid::Empty);
return;
}
@@ -496,7 +496,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM_IN_SLOT");
- uint64 vendorguid, bagguid;
+ ObjectGuid vendorguid, bagguid;
uint32 item, slot, count;
uint8 bagslot;
@@ -529,7 +529,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM");
- uint64 vendorguid, bagGuid;
+ ObjectGuid vendorguid, bagGuid;
uint32 item, slot, count;
uint8 itemType; // 1 = item, 2 = currency
uint8 bagSlot;
@@ -562,7 +562,7 @@ void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
@@ -574,15 +574,15 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
SendListInventory(guid);
}
-void WorldSession::SendListInventory(uint64 vendorGuid)
+void WorldSession::SendListInventory(ObjectGuid vendorGuid)
{
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_LIST_INVENTORY");
Creature* vendor = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR);
if (!vendor)
{
- TC_LOG_DEBUG("network", "WORLD: SendListInventory - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorGuid)));
- _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0);
+ TC_LOG_DEBUG("network", "WORLD: SendListInventory - %s not found or you can not interact with him.", vendorGuid.ToString().c_str());
+ _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, ObjectGuid::Empty);
return;
}
@@ -801,7 +801,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_BUY_BANK_SLOT");
- uint64 guid;
+ ObjectGuid guid;
recvPacket >> guid;
WorldPacket data(SMSG_BUY_BANK_SLOT_RESULT, 4);
@@ -809,7 +809,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
{
data << uint32(ERR_BANKSLOT_NOTBANKER);
SendPacket(&data);
- TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
@@ -857,7 +857,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
if (!CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
@@ -894,7 +894,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
if (!CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
@@ -931,17 +931,17 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
}
}
-void WorldSession::SendEnchantmentLog(uint64 target, uint64 caster, uint32 itemId, uint32 enchantId)
+void WorldSession::SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId)
{
WorldPacket data(SMSG_ENCHANTMENTLOG, (8+8+4+4));
- data.appendPackGUID(target);
- data.appendPackGUID(caster);
+ data << target.WriteAsPacked();
+ data << caster.WriteAsPacked();
data << uint32(itemId);
data << uint32(enchantId);
GetPlayer()->SendMessageToSet(&data, true);
}
-void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid, uint32 slot, uint32 Duration)
+void WorldSession::SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration)
{
// last check 2.0.10
WorldPacket data(SMSG_ITEM_ENCHANT_TIME_UPDATE, (8+4+4+8));
@@ -996,7 +996,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
return;
}
- if (item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
+ if (!item->GetGuidValue(ITEM_FIELD_GIFTCREATOR).IsEmpty()) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
{
_player->SendEquipError(EQUIP_ERR_CANT_WRAP_WRAPPED, item, NULL);
return;
@@ -1030,7 +1030,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GIFT);
- stmt->setUInt32(0, GUID_LOPART(item->GetOwnerGUID()));
+ stmt->setUInt32(0, item->GetOwnerGUID().GetCounter());
stmt->setUInt32(1, item->GetGUIDLow());
stmt->setUInt32(2, item->GetEntry());
stmt->setUInt32(3, item->GetUInt32Value(ITEM_FIELD_FLAGS));
@@ -1047,7 +1047,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
case 17307: item->SetEntry(17308); break;
case 21830: item->SetEntry(21831); break;
}
- item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
+ item->SetGuidValue(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED);
item->SetState(ITEM_CHANGED, _player);
@@ -1067,8 +1067,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_SOCKET_GEMS");
- uint64 item_guid;
- uint64 gem_guids[MAX_GEM_SOCKETS];
+ ObjectGuid item_guid;
+ ObjectGuid gem_guids[MAX_GEM_SOCKETS];
recvData >> item_guid;
if (!item_guid)
@@ -1300,7 +1300,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND_INFO");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid; // item guid
Item* item = _player->GetItemByGuid(guid);
@@ -1316,7 +1316,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData)
void WorldSession::HandleItemRefund(WorldPacket &recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid; // item guid
Item* item = _player->GetItemByGuid(guid);
@@ -1340,10 +1340,10 @@ void WorldSession::HandleItemRefund(WorldPacket &recvData)
*/
void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
{
- uint64 itemGuid;
+ ObjectGuid itemGuid;
recvData >> itemGuid;
- TC_LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid));
+ TC_LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY %s", itemGuid.ToString().c_str());
WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, 14); // guess size
@@ -1376,7 +1376,7 @@ void WorldSession::HandleTransmogrifyItems(WorldPacket& recvData)
return;
}
- std::vector<ObjectGuid> itemGuids(count, ObjectGuid(0));
+ std::vector<ObjectGuid> itemGuids(count, ObjectGuid());
std::vector<uint32> newEntries(count, 0);
std::vector<uint32> slots(count, 0);
@@ -1433,7 +1433,7 @@ void WorldSession::HandleTransmogrifyItems(WorldPacket& recvData)
if (!player->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_TRANSMOGRIFIER))
{
- TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - Unit (GUID: %u) not found or player can't interact with it.", GUID_LOPART(npcGuid));
+ TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - %s not found or player can't interact with it.", npcGuid.ToString().c_str());
return;
}
@@ -1446,7 +1446,7 @@ void WorldSession::HandleTransmogrifyItems(WorldPacket& recvData)
// slot of the transmogrified item
if (slots[i] >= EQUIPMENT_SLOT_END)
{
- TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - Player (GUID: %u, name: %s) tried to transmogrify an item (lowguid: %u) with a wrong slot (%u) when transmogrifying items.", player->GetGUIDLow(), player->GetName().c_str(), GUID_LOPART(itemGuids[i]), slots[i]);
+ TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - Player (GUID: %u, name: %s) tried to transmogrify %s with a wrong slot (%u) when transmogrifying items.", player->GetGUIDLow(), player->GetName().c_str(), itemGuids[i].ToString().c_str(), slots[i]);
return;
}
@@ -1474,14 +1474,14 @@ void WorldSession::HandleTransmogrifyItems(WorldPacket& recvData)
itemTransmogrifier = player->GetItemByGuid(itemGuids[i]);
if (!itemTransmogrifier)
{
- TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - Player (GUID: %u, name: %s) tried to transmogrify with an invalid item (lowguid: %u).", player->GetGUIDLow(), player->GetName().c_str(), GUID_LOPART(itemGuids[i]));
+ TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - Player (GUID: %u, name: %s) tried to transmogrify with an invalid item (%s).", player->GetGUIDLow(), player->GetName().c_str(), itemGuids[i].ToString().c_str());
return;
}
// entry of transmogrifier and from packet
if (itemTransmogrifier->GetEntry() != newEntries[i])
{
- TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - Player (GUID: %u, name: %s) tried to transmogrify with an invalid entry (entry: %u) for item (lowguid: %u).", player->GetGUIDLow(), player->GetName().c_str(), newEntries[i], GUID_LOPART(itemGuids[i]));
+ TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - Player (GUID: %u, name: %s) tried to transmogrify with an invalid entry (entry: %u) for %s.", player->GetGUIDLow(), player->GetName().c_str(), newEntries[i], itemGuids[i].ToString().c_str());
return;
}
@@ -1576,7 +1576,7 @@ void WorldSession::HandleReforgeItemOpcode(WorldPacket& recvData)
if (!player->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_REFORGER))
{
- TC_LOG_DEBUG("network", "WORLD: HandleReforgeItemOpcode - Unit (GUID: %u) not found or player can't interact with it.", GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "WORLD: HandleReforgeItemOpcode - %s not found or player can't interact with it.", guid.ToString().c_str());
SendReforgeResult(false);
return;
}
@@ -1644,7 +1644,7 @@ void WorldSession::HandleReforgeItemOpcode(WorldPacket& recvData)
player->ApplyReforgeEnchantment(item, true);
}
-bool WorldSession::CanUseBank(uint64 bankerGUID) const
+bool WorldSession::CanUseBank(ObjectGuid bankerGUID) const
{
// bankerGUID parameter is optional, set to 0 by default.
if (!bankerGUID)
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index 8f38a940d21..ea8f86e2adf 100644
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -128,8 +128,8 @@ void WorldSession::HandleLfgLeaveOpcode(WorldPacket& recvData)
{
ObjectGuid leaveGuid;
Group* group = GetPlayer()->GetGroup();
- uint64 guid = GetPlayer()->GetGUID();
- uint64 gguid = group ? group->GetGUID() : guid;
+ ObjectGuid guid = GetPlayer()->GetGUID();
+ ObjectGuid gguid = group ? group->GetGUID() : guid;
recvData.read_skip<uint32>(); // Always 8
recvData.read_skip<uint32>(); // Join date
@@ -221,7 +221,7 @@ void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData)
{
uint8 roles;
recvData >> roles; // Player Group Roles
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
Group* group = GetPlayer()->GetGroup();
if (!group)
{
@@ -229,9 +229,9 @@ void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData)
GetPlayerInfo().c_str());
return;
}
- uint64 gguid = group->GetGUID();
+ ObjectGuid gguid = group->GetGUID();
TC_LOG_DEBUG("lfg", "CMSG_LFG_SET_ROLES: Group %u, Player %s, Roles: %u",
- GUID_LOPART(gguid), GetPlayerInfo().c_str(), roles);
+ gguid.GetCounter(), GetPlayerInfo().c_str(), roles);
sLFGMgr->UpdateRoleCheck(gguid, guid, roles);
}
@@ -251,7 +251,7 @@ void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recvData)
bool agree; // Agree to kick player
recvData >> agree;
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
TC_LOG_DEBUG("lfg", "CMSG_LFG_SET_BOOT_VOTE %s agree: %u",
GetPlayerInfo().c_str(), agree ? 1 : 0);
sLFGMgr->UpdateBoot(guid, agree);
@@ -280,7 +280,7 @@ void WorldSession::HandleLfgGetLockInfoOpcode(WorldPacket& recvData)
void WorldSession::SendLfgPlayerLockInfo()
{
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
// Get Random dungeons that can be done at a certain level and expansion
uint8 level = GetPlayer()->getLevel();
@@ -352,7 +352,7 @@ void WorldSession::SendLfgPlayerLockInfo()
void WorldSession::SendLfgPartyLockInfo()
{
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
@@ -365,7 +365,7 @@ void WorldSession::SendLfgPartyLockInfo()
if (!plrg)
continue;
- uint64 pguid = plrg->GetGUID();
+ ObjectGuid pguid = plrg->GetGUID();
if (pguid == guid)
continue;
@@ -407,7 +407,7 @@ void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/)
if (!GetPlayer()->isUsingLfg())
return;
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
lfg::LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid);
if (GetPlayer()->GetGroup())
@@ -495,10 +495,10 @@ void WorldSession::SendLfgUpdateStatus(lfg::LfgUpdateData const& updateData, boo
SendPacket(&data);
}
-void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles)
+void WorldSession::SendLfgRoleChosen(ObjectGuid guid, uint8 roles)
{
TC_LOG_DEBUG("lfg", "SMSG_LFG_ROLE_CHOSEN %s guid: %u roles: %u",
- GetPlayerInfo().c_str(), GUID_LOPART(guid), roles);
+ GetPlayerInfo().c_str(), guid.GetCounter(), roles);
WorldPacket data(SMSG_LFG_ROLE_CHOSEN, 8 + 1 + 4);
data << uint64(guid); // Guid
@@ -529,7 +529,7 @@ void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck)
if (!roleCheck.roles.empty())
{
// Leader info MUST be sent 1st :S
- uint64 guid = roleCheck.leader;
+ ObjectGuid guid = roleCheck.leader;
uint8 roles = roleCheck.roles.find(guid)->second;
Player* player = ObjectAccessor::FindPlayer(guid);
data << uint64(guid); // Guid
@@ -694,7 +694,7 @@ void WorldSession::SendLfgPlayerReward(lfg::LfgPlayerRewardData const& rewardDat
void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
{
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
lfg::LfgAnswer playerVote = boot.votes.find(guid)->second;
uint8 votesNum = 0;
uint8 agreeNum = 0;
@@ -712,7 +712,7 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
"didVote: %u - agree: %u - victim: %u votes: %u - agrees: %u - left: %u - "
"needed: %u - reason %s",
GetPlayerInfo().c_str(), uint8(boot.inProgress), uint8(playerVote != lfg::LFG_ANSWER_PENDING),
- uint8(playerVote == lfg::LFG_ANSWER_AGREE), GUID_LOPART(boot.victim), votesNum, agreeNum,
+ uint8(playerVote == lfg::LFG_ANSWER_AGREE), boot.victim.GetCounter(), votesNum, agreeNum,
secsleft, lfg::LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str());
WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length());
data << uint8(boot.inProgress); // Vote in progress
@@ -730,8 +730,8 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
void WorldSession::SendLfgUpdateProposal(lfg::LfgProposal const& proposal)
{
- uint64 guid = GetPlayer()->GetGUID();
- uint64 gguid = proposal.players.find(guid)->second.group;
+ ObjectGuid guid = GetPlayer()->GetGUID();
+ ObjectGuid gguid = proposal.players.find(guid)->second.group;
bool silent = !proposal.isNew && gguid == proposal.group;
uint32 dungeonEntry = proposal.dungeonId;
uint32 queueId = sLFGMgr->GetQueueId(_player->GetGUID());
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index 692f5b80953..7adbdccd061 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -36,13 +36,13 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
Player* player = GetPlayer();
- uint64 lguid = player->GetLootGUID();
+ ObjectGuid lguid = player->GetLootGUID();
Loot* loot = NULL;
uint8 lootSlot = 0;
recvData >> lootSlot;
- if (IS_GAMEOBJECT_GUID(lguid))
+ if (lguid.IsGameObject())
{
GameObject* go = player->GetMap()->GetGameObject(lguid);
@@ -55,7 +55,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
loot = &go->loot;
}
- else if (IS_ITEM_GUID(lguid))
+ else if (lguid.IsItem())
{
Item* pItem = player->GetItemByGuid(lguid);
@@ -67,7 +67,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
loot = &pItem->loot;
}
- else if (IS_CORPSE_GUID(lguid))
+ else if (lguid.IsCorpse())
{
Corpse* bones = ObjectAccessor::GetCorpse(*player, lguid);
if (!bones)
@@ -95,7 +95,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
player->StoreLootItem(lootSlot, loot);
// If player is removing the last LootItem, delete the empty container.
- if (loot->isLooted() && IS_ITEM_GUID(lguid))
+ if (loot->isLooted() && lguid.IsItem())
player->GetSession()->DoLootRelease(lguid);
}
@@ -104,14 +104,14 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
TC_LOG_DEBUG("network", "WORLD: CMSG_LOOT_MONEY");
Player* player = GetPlayer();
- uint64 guid = player->GetLootGUID();
+ ObjectGuid guid = player->GetLootGUID();
if (!guid)
return;
Loot* loot = NULL;
bool shareMoney = true;
- switch (GUID_HIPART(guid))
+ switch (guid.GetHigh())
{
case HIGHGUID_GAMEOBJECT:
{
@@ -220,7 +220,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
loot->DeleteLootMoneyFromContainerItemDB();
// Delete container if empty
- if (loot->isLooted() && IS_ITEM_GUID(guid))
+ if (loot->isLooted() && guid.IsItem())
player->GetSession()->DoLootRelease(guid);
}
}
@@ -229,11 +229,11 @@ void WorldSession::HandleLootOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_LOOT");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
// Check possible cheat
- if (!GetPlayer()->IsAlive() || !IS_CRE_OR_VEH_GUID(guid))
+ if (!GetPlayer()->IsAlive() || !guid.IsCreatureOrVehicle())
return;
GetPlayer()->SendLoot(guid, LOOT_CORPSE);
@@ -249,20 +249,20 @@ void WorldSession::HandleLootReleaseOpcode(WorldPacket& recvData)
// cheaters can modify lguid to prevent correct apply loot release code and re-loot
// use internal stored guid
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- if (uint64 lguid = GetPlayer()->GetLootGUID())
+ if (ObjectGuid lguid = GetPlayer()->GetLootGUID())
if (lguid == guid)
DoLootRelease(lguid);
}
-void WorldSession::DoLootRelease(uint64 lguid)
+void WorldSession::DoLootRelease(ObjectGuid lguid)
{
Player *player = GetPlayer();
Loot *loot;
- player->SetLootGUID(0);
+ player->SetLootGUID(ObjectGuid::Empty);
player->SendLootRelease(lguid);
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
@@ -270,7 +270,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
if (!player->IsInWorld())
return;
- if (IS_GAMEOBJECT_GUID(lguid))
+ if (lguid.IsGameObject())
{
GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid);
@@ -307,10 +307,10 @@ void WorldSession::DoLootRelease(uint64 lguid)
// if the round robin player release, reset it.
if (player->GetGUID() == loot->roundRobinPlayer)
- loot->roundRobinPlayer = 0;
+ loot->roundRobinPlayer.Clear();
}
}
- else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG
+ else if (lguid.IsCorpse()) // ONLY remove insignia at BG
{
Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid);
if (!corpse || !corpse->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
@@ -324,7 +324,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE);
}
}
- else if (IS_ITEM_GUID(lguid))
+ else if (lguid.IsItem())
{
Item* pItem = player->GetItemByGuid(lguid);
if (!pItem)
@@ -378,7 +378,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
// if the round robin player release, reset it.
if (player->GetGUID() == loot->roundRobinPlayer)
{
- loot->roundRobinPlayer = 0;
+ loot->roundRobinPlayer.Clear();
if (Group* group = player->GetGroup())
{
@@ -398,7 +398,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
{
uint8 slotid;
- uint64 lootguid, target_playerguid;
+ ObjectGuid lootguid, target_playerguid;
recvData >> lootguid >> slotid >> target_playerguid;
@@ -408,7 +408,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
return;
}
- Player* target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER));
+ Player* target = ObjectAccessor::FindPlayer(target_playerguid);
if (!target)
{
_player->SendLootError(lootguid, LOOT_ERROR_PLAYER_NOT_FOUND);
@@ -432,7 +432,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
Loot* loot = NULL;
- if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID()))
+ if (GetPlayer()->GetLootGUID().IsCreatureOrVehicle())
{
Creature* creature = GetPlayer()->GetMap()->GetCreature(lootguid);
if (!creature)
@@ -440,7 +440,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
loot = &creature->loot;
}
- else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
+ else if (GetPlayer()->GetLootGUID().IsGameObject())
{
GameObject* pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
if (!pGO)
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index 1359032080b..adf70223db9 100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -31,7 +31,7 @@
#include "BattlenetAccountMgr.h"
#include "GuildMgr.h"
-bool WorldSession::CanOpenMailBox(uint64 guid)
+bool WorldSession::CanOpenMailBox(ObjectGuid guid)
{
if (guid == _player->GetGUID())
{
@@ -41,12 +41,12 @@ bool WorldSession::CanOpenMailBox(uint64 guid)
return false;
}
}
- else if (IS_GAMEOBJECT_GUID(guid))
+ else if (guid.IsGameObject())
{
if (!_player->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_MAILBOX))
return false;
}
- else if (IS_CRE_OR_VEH_OR_PET_GUID(guid))
+ else if (guid.IsAnyTypeCreature())
{
if (!_player->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_MAILBOX))
return false;
@@ -63,10 +63,10 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
uint64 money, COD;
std::string receiverName, subject, body;
uint32 bodyLength, subjectLength, receiverLength;
- uint32 unk1, unk2;
+ uint32 package, stationery;
- recvData >> unk1;
- recvData >> unk2; // Stationery?
+ recvData >> package;
+ recvData >> stationery;
recvData >> COD >> money; // money and cod
bodyLength = recvData.ReadBits(12);
@@ -152,7 +152,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
return;
}
- uint64 receiverGuid = 0;
+ ObjectGuid receiverGuid;
if (normalizePlayerName(receiverName))
receiverGuid = sObjectMgr->GetPlayerGUIDByName(receiverName);
@@ -161,15 +161,15 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
TC_LOG_INFO("network", "Player %u is sending mail to %s (GUID: not existed!) with subject %s "
"and body %s includes %u items, " UI64FMTD " copper and " UI64FMTD " COD copper with unk1 = %u, unk2 = %u",
player->GetGUIDLow(), receiverName.c_str(), subject.c_str(), body.c_str(),
- items_count, money, COD, unk1, unk2);
+ items_count, money, COD, stationery, package);
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
return;
}
- TC_LOG_INFO("network", "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s "
+ TC_LOG_INFO("network", "Player %u is sending mail to %s (%s) with subject %s and body %s "
"includes %u items, " UI64FMTD " copper and " UI64FMTD " COD copper with unk1 = %u, unk2 = %u",
- player->GetGUIDLow(), receiverName.c_str(), GUID_LOPART(receiverGuid), subject.c_str(),
- body.c_str(), items_count, money, COD, unk1, unk2);
+ player->GetGUIDLow(), receiverName.c_str(), receiverGuid.ToString().c_str(), subject.c_str(),
+ body.c_str(), items_count, money, COD, stationery, package);
if (player->GetGUID() == receiverGuid)
{
@@ -215,7 +215,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
receiverTeam = sObjectMgr->GetPlayerTeamByGUID(receiverGuid);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT);
- stmt->setUInt32(0, GUID_LOPART(receiverGuid));
+ stmt->setUInt32(0, receiverGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
@@ -225,7 +225,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
}
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_LEVEL);
- stmt->setUInt32(0, GUID_LOPART(receiverGuid));
+ stmt->setUInt32(0, receiverGuid.GetCounter());
result = CharacterDatabase.Query(stmt);
if (result)
@@ -349,9 +349,9 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
if (log)
{
sLog->outCommand(GetAccountId(), "GM %s (GUID: %u) (Account: %u) mail item: %s (Entry: %u Count: %u) "
- "to player: %s (GUID: %u) (Account: %u)", GetPlayerName().c_str(), GetGuidLow(), GetAccountId(),
+ "to: %s (%s) (Account: %u)", GetPlayerName().c_str(), GetGuidLow(), GetAccountId(),
item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(),
- receiverName.c_str(), GUID_LOPART(receiverGuid), receiverAccountId);
+ receiverName.c_str(), receiverGuid.ToString().c_str(), receiverAccountId);
}
item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable
@@ -370,8 +370,8 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
if (log && money > 0)
{
- sLog->outCommand(GetAccountId(), "GM %s (GUID: %u) (Account: %u) mail money: " UI64FMTD " to player: %s (GUID: %u) (Account: %u)",
- GetPlayerName().c_str(), GetGuidLow(), GetAccountId(), money, receiverName.c_str(), GUID_LOPART(receiverGuid), receiverAccountId);
+ sLog->outCommand(GetAccountId(), "GM %s (GUID: %u) (Account: %u) mail money: " UI64FMTD " to: %s (%s) (Account: %u)",
+ GetPlayerName().c_str(), GetGuidLow(), GetAccountId(), money, receiverName.c_str(), receiverGuid.ToString().c_str(), receiverAccountId);
}
}
@@ -391,7 +391,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
draft
.AddMoney(money)
.AddCOD(COD)
- .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
+ .SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
@@ -400,7 +400,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
//called when mail is read
void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint32 mailId;
recvData >> mailbox;
recvData >> mailId;
@@ -423,7 +423,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData)
//called when client deletes mail
void WorldSession::HandleMailDelete(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint32 mailId;
recvData >> mailbox;
recvData >> mailId;
@@ -451,7 +451,7 @@ void WorldSession::HandleMailDelete(WorldPacket& recvData)
void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint32 mailId;
recvData >> mailbox;
recvData >> mailId;
@@ -508,7 +508,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
//called when player takes item attached in mail
void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint32 mailId;
uint32 itemId;
recvData >> mailbox;
@@ -553,7 +553,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
if (m->COD > 0) //if there is COD, take COD money from player and send them to sender by mail
{
- uint64 sender_guid = MAKE_NEW_GUID(m->sender, 0, HIGHGUID_PLAYER);
+ ObjectGuid sender_guid(HIGHGUID_PLAYER, m->sender);
Player* receiver = ObjectAccessor::FindPlayer(sender_guid);
uint32 sender_accId = 0;
@@ -611,7 +611,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint64 money;
uint32 mailId;
@@ -654,7 +654,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
//called when player lists his received mails
void WorldSession::HandleGetMailList(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
recvData >> mailbox;
if (!CanOpenMailBox(mailbox))
@@ -707,7 +707,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
switch ((*itr)->messageType)
{
case MAIL_NORMAL: // sender guid
- data << uint64(MAKE_NEW_GUID((*itr)->sender, 0, HIGHGUID_PLAYER));
+ data << ObjectGuid(HIGHGUID_PLAYER, (*itr)->sender);
break;
case MAIL_CREATURE:
case MAIL_GAMEOBJECT:
@@ -775,7 +775,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
//used when player copies mail body to his inventory
void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint32 mailId;
recvData >> mailbox;
@@ -815,7 +815,9 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
else
bodyItem->SetText(m->body);
- bodyItem->SetUInt32Value(ITEM_FIELD_CREATOR, m->sender);
+ if (m->messageType == MAIL_NORMAL)
+ bodyItem->SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HIGHGUID_PLAYER, m->sender));
+
bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_MAIL_TEXT_MASK);
TC_LOG_INFO("network", "HandleMailCreateTextItem mailid=%u", mailId);
@@ -869,7 +871,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket& /*recvData*/)
if (sentSenders.count(m->sender))
continue;
- data << uint64(m->messageType == MAIL_NORMAL ? m->sender : 0); // player guid
+ data << uint64(m->messageType == MAIL_NORMAL ? ObjectGuid(HIGHGUID_PLAYER, m->sender) : ObjectGuid::Empty); // player guid
data << uint32(m->messageType != MAIL_NORMAL ? m->sender : 0); // non-player entries
data << uint32(m->messageType);
data << uint32(m->stationery);
@@ -891,10 +893,3 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket& /*recvData*/)
SendPacket(&data);
}
-
-void WorldSession::SendShowMailBox(uint64 guid)
-{
- WorldPacket data(SMSG_SHOW_MAILBOX, 8);
- data << guid;
- SendPacket(&data);
-}
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 81c08b4c35b..279b06e2cef 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -93,7 +93,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
uint32 gossipListId;
uint32 menuId;
- uint64 guid;
+ ObjectGuid guid;
std::string code = "";
recvData >> guid >> menuId >> gossipListId;
@@ -113,27 +113,27 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
Creature* unit = NULL;
GameObject* go = NULL;
- if (IS_CRE_OR_VEH_GUID(guid))
+ if (guid.IsCreatureOrVehicle())
{
unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
}
- else if (IS_GAMEOBJECT_GUID(guid))
+ else if (guid.IsGameObject())
{
go = _player->GetMap()->GetGameObject(guid);
if (!go)
{
- TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - %s not found.", guid.ToString().c_str());
return;
}
}
else
{
- TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported %s.", guid.ToString().c_str());
return;
}
@@ -377,7 +377,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/)
{
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity());
- if (uint64 lguid = GetPlayer()->GetLootGUID())
+ if (ObjectGuid lguid = GetPlayer()->GetLootGUID())
DoLootRelease(lguid);
bool instantLogout = (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat()) ||
@@ -541,7 +541,7 @@ void WorldSession::HandleRequestCemeteryList(WorldPacket& /*recvPacket*/)
void WorldSession::HandleSetSelectionOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
_player->SetSelection(guid);
@@ -593,19 +593,18 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std
if (!GetPlayer())
return;
- uint64 friendGuid;
+ ObjectGuid friendGuid;
uint32 friendAccountId;
uint32 team;
FriendsResult friendResult;
friendResult = FRIEND_NOT_FOUND;
- friendGuid = 0;
if (result)
{
Field* fields = result->Fetch();
- friendGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ friendGuid = ObjectGuid(HIGHGUID_PLAYER, 0, fields[0].GetUInt32());
team = Player::TeamForRace(fields[1].GetUInt8());
friendAccountId = fields[2].GetUInt32();
@@ -617,7 +616,7 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std
friendResult = FRIEND_SELF;
else if (GetPlayer()->GetTeam() != team && !HasPermission(rbac::RBAC_PERM_TWO_SIDE_ADD_FRIEND))
friendResult = FRIEND_ENEMY;
- else if (GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid)))
+ else if (GetPlayer()->GetSocial()->HasFriend(friendGuid.GetCounter()))
friendResult = FRIEND_ALREADY;
else
{
@@ -626,33 +625,33 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std
friendResult = FRIEND_ADDED_ONLINE;
else
friendResult = FRIEND_ADDED_OFFLINE;
- if (!GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false))
+ if (!GetPlayer()->GetSocial()->AddToSocialList(friendGuid.GetCounter(), false))
{
friendResult = FRIEND_LIST_FULL;
TC_LOG_DEBUG("network", "WORLD: %s's friend list is full.", GetPlayer()->GetName().c_str());
}
}
- GetPlayer()->GetSocial()->SetFriendNote(GUID_LOPART(friendGuid), friendNote);
+ GetPlayer()->GetSocial()->SetFriendNote(friendGuid.GetCounter(), friendNote);
}
}
}
- sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, GUID_LOPART(friendGuid), false);
+ sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, friendGuid.GetCounter(), false);
TC_LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)");
}
void WorldSession::HandleDelFriendOpcode(WorldPacket& recvData)
{
- uint64 FriendGUID;
+ ObjectGuid FriendGUID;
TC_LOG_DEBUG("network", "WORLD: Received CMSG_DEL_FRIEND");
recvData >> FriendGUID;
- _player->GetSocial()->RemoveFromSocialList(GUID_LOPART(FriendGUID), false);
+ _player->GetSocial()->RemoveFromSocialList(FriendGUID.GetCounter(), false);
- sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, GUID_LOPART(FriendGUID), false);
+ sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, FriendGUID.GetCounter(), false);
TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)");
}
@@ -683,49 +682,48 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(PreparedQueryResult result)
if (!GetPlayer())
return;
- uint64 IgnoreGuid;
+ ObjectGuid IgnoreGuid;
FriendsResult ignoreResult;
ignoreResult = FRIEND_IGNORE_NOT_FOUND;
- IgnoreGuid = 0;
if (result)
{
- IgnoreGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ IgnoreGuid = ObjectGuid(HIGHGUID_PLAYER, (*result)[0].GetUInt32());
if (IgnoreGuid)
{
if (IgnoreGuid == GetPlayer()->GetGUID()) //not add yourself
ignoreResult = FRIEND_IGNORE_SELF;
- else if (GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid)))
+ else if (GetPlayer()->GetSocial()->HasIgnore(IgnoreGuid.GetCounter()))
ignoreResult = FRIEND_IGNORE_ALREADY;
else
{
ignoreResult = FRIEND_IGNORE_ADDED;
// ignore list full
- if (!GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true))
+ if (!GetPlayer()->GetSocial()->AddToSocialList(IgnoreGuid.GetCounter(), true))
ignoreResult = FRIEND_IGNORE_FULL;
}
}
}
- sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, GUID_LOPART(IgnoreGuid), false);
+ sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, IgnoreGuid.GetCounter(), false);
TC_LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)");
}
void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recvData)
{
- uint64 IgnoreGUID;
+ ObjectGuid IgnoreGUID;
TC_LOG_DEBUG("network", "WORLD: Received CMSG_DEL_IGNORE");
recvData >> IgnoreGUID;
- _player->GetSocial()->RemoveFromSocialList(GUID_LOPART(IgnoreGUID), true);
+ _player->GetSocial()->RemoveFromSocialList(IgnoreGUID.GetCounter(), true);
- sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, GUID_LOPART(IgnoreGUID), false);
+ sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, IgnoreGUID.GetCounter(), false);
TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)");
}
@@ -733,10 +731,10 @@ void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recvData)
void WorldSession::HandleSetContactNotesOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_SET_CONTACT_NOTES");
- uint64 guid;
+ ObjectGuid guid;
std::string note;
recvData >> guid >> note;
- _player->GetSocial()->SetFriendNote(GUID_LOPART(guid), note);
+ _player->GetSocial()->SetFriendNote(guid.GetCounter(), note);
}
void WorldSession::HandleBugOpcode(WorldPacket& recvData)
@@ -770,7 +768,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_RECLAIM_CORPSE");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
if (_player->IsAlive())
@@ -807,7 +805,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_RESURRECT_RESPONSE");
- uint64 guid;
+ ObjectGuid guid;
uint8 status;
recvData >> guid;
recvData >> status;
@@ -946,10 +944,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData)
if (Battleground* bg = player->GetBattleground())
if (bg->GetStatus() == STATUS_IN_PROGRESS)
- {
bg->HandleAreaTrigger(player, triggerId);
- return;
- }
if (OutdoorPvP* pvp = player->GetOutdoorPvP())
if (pvp->HandleAreaTrigger(_player, triggerId))
@@ -1059,7 +1054,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recvData)
dest.resize(destSize);
WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize);
- data << uint64(_player ? _player->GetGUID() : 0); // player guid
+ data << uint64(_player ? _player->GetGUID() : ObjectGuid::Empty);
data << uint32(type); // type (0-7)
data << uint32(adata->Time); // unix time
data << uint32(size); // decompressed length
@@ -1227,7 +1222,7 @@ void WorldSession::HandlePlayedTime(WorldPacket& recvData)
void WorldSession::HandleInspectOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
TC_LOG_DEBUG("network", "WORLD: Received CMSG_INSPECT");
@@ -1235,7 +1230,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recvData)
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
{
- TC_LOG_DEBUG("network", "CMSG_INSPECT: No player found from GUID: " UI64FMTD, guid);
+ TC_LOG_DEBUG("network", "CMSG_INSPECT: No player found from %s", guid.ToString().c_str());
return;
}
@@ -1292,7 +1287,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recvData)
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
{
- TC_LOG_DEBUG("network", "CMSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, (uint64)guid);
+ TC_LOG_DEBUG("network", "CMSG_INSPECT_HONOR_STATS: No player found from %s", guid.ToString().c_str());
return;
}
@@ -1427,7 +1422,7 @@ void WorldSession::HandleComplainOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "WORLD: CMSG_COMPLAIN");
uint8 spam_type; // 0 - mail, 1 - chat
- uint64 spammer_guid;
+ ObjectGuid spammer_guid;
uint32 unk1 = 0;
uint32 unk2 = 0;
uint32 unk3 = 0;
@@ -1460,7 +1455,8 @@ void WorldSession::HandleComplainOpcode(WorldPacket& recvData)
data << uint8(0); // value 0xC generates a "CalendarError" in client.
SendPacket(&data);
- TC_LOG_DEBUG("network", "REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str());
+ TC_LOG_DEBUG("network", "REPORT SPAM: type %u, %s, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s",
+ spam_type, spammer_guid.ToString().c_str(), unk1, unk2, unk3, unk4, description.c_str());
}
void WorldSession::HandleRealmSplitOpcode(WorldPacket& recvData)
@@ -1492,11 +1488,11 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData)
if (apply)
{
- TC_LOG_DEBUG("network", "Added FarSight " UI64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow());
+ TC_LOG_DEBUG("network", "Added FarSight %s to player %u", _player->GetGuidValue(PLAYER_FARSIGHT).ToString().c_str(), _player->GetGUIDLow());
if (WorldObject* target = _player->GetViewpoint())
_player->SetSeer(target);
else
- TC_LOG_ERROR("network", "Player %s (GUID: %u) requests non-existing seer " UI64FMTD, _player->GetName().c_str(), GUID_LOPART(_player->GetGUID()), _player->GetUInt64Value(PLAYER_FARSIGHT));
+ TC_LOG_ERROR("network", "Player %s (%s) requests non-existing seer %s", _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), _player->GetGuidValue(PLAYER_FARSIGHT).ToString().c_str());
}
else
{
@@ -1729,10 +1725,10 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket& recvData)
void WorldSession::HandleQueryInspectAchievements(WorldPacket& recvData)
{
- uint64 guid;
- recvData.readPackGUID(guid);
+ ObjectGuid guid;
+ recvData >> guid.ReadAsPacked();
- TC_LOG_DEBUG("network", "CMSG_QUERY_INSPECT_ACHIEVEMENTS [" UI64FMTD "] Inspected Player [" UI64FMTD "]", _player->GetGUID(), guid);
+ TC_LOG_DEBUG("network", "CMSG_QUERY_INSPECT_ACHIEVEMENTS [%s] Inspected Player [%s]", _player->GetGUID().ToString().c_str(), guid.ToString().c_str());
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
return;
@@ -1828,7 +1824,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recvData)
Battleground* bg = _player->GetBattleground();
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
@@ -1851,7 +1847,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recvData)
Battleground* bg = _player->GetBattleground();
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
@@ -1980,7 +1976,7 @@ void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY");
- uint64 guid;
+ ObjectGuid guid;
uint32 spellId;
float elevation, speed;
float curX, curY, curZ;
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 139be4e9d4c..7eb8744c658 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -72,7 +72,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
if (GetPlayer()->IsInWorld())
{
- TC_LOG_ERROR("network", "Player %s (GUID: %u) is still in world when teleported from map %s (%u) to new map %s (%u)", GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.GetMapId());
+ TC_LOG_ERROR("network", "%s %s is still in world when teleported from map %s (%u) to new map %s (%u)", GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str(), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.GetMapId());
oldMap->RemovePlayerFromMap(GetPlayer(), false);
}
@@ -341,7 +341,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvPacket)
{
GameObject* go = mover->GetMap()->GetGameObject(movementInfo.transport.guid);
if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT)
- movementInfo.transport.guid = 0;
+ movementInfo.transport.guid.Clear();
}
}
else if (plrMover && plrMover->GetTransport()) // if we were on a transport, leave
@@ -423,8 +423,6 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvPacket)
void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
{
- uint32 opcode = recvData.GetOpcode();
-
/* extract packet */
MovementInfo movementInfo;
static MovementStatusElements const speedElement = MSEExtraFloat;
@@ -458,7 +456,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
"PitchRate"
};
- switch (opcode)
+ switch (recvData.GetOpcode())
{
case CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; break;
case CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; break;
@@ -470,7 +468,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
case CMSG_MOVE_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; break;
case CMSG_MOVE_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; break;
default:
- TC_LOG_ERROR("network", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
+ TC_LOG_ERROR("network", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", recvData.GetOpcode());
return;
}
@@ -525,10 +523,8 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket& recvPacket)
recvPacket.ReadByteSeq(guid[7]);
if (GetPlayer()->IsInWorld())
- {
if (_player->m_mover->GetGUID() != guid)
- TC_LOG_DEBUG("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, uint64(guid), GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID());
- }
+ TC_LOG_DEBUG("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is %s and should be %s" , guid.ToString().c_str(), _player->m_mover->GetGUID().ToString().c_str());
}
void WorldSession::HandleMoveNotActiveMover(WorldPacket &recvData)
@@ -569,30 +565,30 @@ void WorldSession::HandleMoveHoverAck(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_MOVE_HOVER_ACK");
- uint64 guid; // guid - unused
- recvData.readPackGUID(guid);
+ ObjectGuid guid; // guid - unused
+ recvData >> guid.ReadAsPacked();
- recvData.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // unk
MovementInfo movementInfo;
GetPlayer()->ReadMovementInfo(recvData, &movementInfo);
- recvData.read_skip<uint32>(); // unk2
+ recvData.read_skip<uint32>(); // unk2
}
void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_MOVE_WATER_WALK_ACK");
- uint64 guid; // guid - unused
- recvData.readPackGUID(guid);
+ ObjectGuid guid; // guid - unused
+ recvData >> guid.ReadAsPacked();
- recvData.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // unk
MovementInfo movementInfo;
GetPlayer()->ReadMovementInfo(recvData, &movementInfo);
- recvData.read_skip<uint32>(); // unk2
+ recvData.read_skip<uint32>(); // unk2
}
void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
@@ -600,9 +596,9 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
if (!_player->IsAlive() || _player->IsInCombat())
return;
- uint64 summonerGuid;
+ ObjectGuid summoner_guid;
bool agree;
- recvData >> summonerGuid;
+ recvData >> summoner_guid;
recvData >> agree;
_player->SummonIfPossible(agree);
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index 02651a1af09..6e4ae69c7b9 100644
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -51,13 +51,13 @@ enum StableResultCode
void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TABARDDESIGNER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -68,7 +68,7 @@ void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
SendTabardVendorActivate(guid);
}
-void WorldSession::SendTabardVendorActivate(uint64 guid)
+void WorldSession::SendTabardVendorActivate(ObjectGuid guid)
{
WorldPacket data(MSG_TABARDVENDOR_ACTIVATE, 8);
data << guid;
@@ -77,7 +77,7 @@ void WorldSession::SendTabardVendorActivate(uint64 guid)
void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE");
@@ -86,7 +86,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -97,7 +97,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
SendShowBank(guid);
}
-void WorldSession::SendShowBank(uint64 guid)
+void WorldSession::SendShowBank(ObjectGuid guid)
{
WorldPacket data(SMSG_SHOW_BANK, 8);
data << guid;
@@ -105,28 +105,35 @@ void WorldSession::SendShowBank(uint64 guid)
SendPacket(&data);
}
+void WorldSession::SendShowMailBox(ObjectGuid guid)
+{
+ WorldPacket data(SMSG_SHOW_MAILBOX, 8);
+ data << guid;
+ SendPacket(&data);
+}
+
void WorldSession::HandleTrainerListOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
SendTrainerList(guid);
}
-void WorldSession::SendTrainerList(uint64 guid)
+void WorldSession::SendTrainerList(ObjectGuid guid)
{
std::string str = GetTrinityString(LANG_NPC_TAINER_HELLO);
SendTrainerList(guid, str);
}
-void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
+void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
{
TC_LOG_DEBUG("network", "WORLD: SendTrainerList");
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: SendTrainerList - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -134,19 +141,10 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- CreatureTemplate const* ci = unit->GetCreatureTemplate();
-
- if (!ci)
- {
- TC_LOG_DEBUG("network", "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid));
- return;
- }
-
TrainerSpellData const* trainer_spells = unit->GetTrainerSpells();
if (!trainer_spells)
{
- TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)",
- GUID_LOPART(guid), unit->GetEntry());
+ TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for %s", guid.ToString().c_str());
return;
}
@@ -237,17 +235,17 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 spellId;
uint32 trainerId;
recvData >> guid >> trainerId >> spellId;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL %s, learn spell id is: %u", guid.ToString().c_str(), spellId);
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -318,13 +316,13 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_GOSSIP_HELLO");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -406,13 +404,13 @@ void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_SPIRITHEALER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -457,7 +455,7 @@ void WorldSession::SendSpiritResurrect()
void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData)
{
- uint64 npcGUID;
+ ObjectGuid npcGUID;
recvData >> npcGUID;
if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive())
@@ -466,7 +464,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData)
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_INNKEEPER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - %s not found or you can not interact with him.", npcGUID.ToString().c_str());
return;
}
@@ -499,7 +497,7 @@ void WorldSession::SendBindPoint(Creature* npc)
void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS");
- uint64 npcGUID;
+ ObjectGuid npcGUID;
recvData >> npcGUID;
@@ -517,7 +515,7 @@ void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData)
SendStablePet(npcGUID);
}
-void WorldSession::SendStablePet(uint64 guid)
+void WorldSession::SendStablePet(ObjectGuid guid)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOTS_DETAIL);
@@ -529,7 +527,7 @@ void WorldSession::SendStablePet(uint64 guid)
_sendStabledPetCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
}
-void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid)
+void WorldSession::SendStablePetCallback(PreparedQueryResult result, ObjectGuid guid)
{
if (!GetPlayer())
return;
@@ -538,7 +536,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid
WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
- data << uint64 (guid);
+ data << uint64(guid);
Pet* pet = _player->GetPet();
@@ -594,7 +592,7 @@ void WorldSession::SendStableResult(uint8 res)
void WorldSession::HandleStablePet(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_PET");
- uint64 npcGUID;
+ ObjectGuid npcGUID;
recvData >> npcGUID;
@@ -668,7 +666,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result)
void WorldSession::HandleUnstablePet(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv CMSG_UNSTABLE_PET.");
- uint64 npcGUID;
+ ObjectGuid npcGUID;
uint32 petnumber;
recvData >> npcGUID >> petnumber;
@@ -749,7 +747,7 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32
void WorldSession::HandleBuyStableSlot(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv CMSG_BUY_STABLE_SLOT.");
- uint64 npcGUID;
+ ObjectGuid npcGUID;
recvData >> npcGUID;
@@ -787,7 +785,7 @@ void WorldSession::HandleStableRevivePet(WorldPacket &/* recvData */)
void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_SWAP_PET.");
- uint64 npcGUID;
+ ObjectGuid npcGUID;
uint32 petId;
recvData >> npcGUID >> petId;
@@ -882,7 +880,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_REPAIR_ITEM");
- uint64 npcGUID, itemGUID;
+ ObjectGuid npcGUID, itemGUID;
uint8 guildBank; // new in 2.3.2, bool that means from guild bank money
recvData >> npcGUID >> itemGUID >> guildBank;
@@ -890,7 +888,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_REPAIR);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - %s not found or you can not interact with him.", npcGUID.ToString().c_str());
return;
}
@@ -903,7 +901,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
if (itemGUID)
{
- TC_LOG_DEBUG("network", "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID));
+ TC_LOG_DEBUG("network", "ITEM: Repair %s, at %s", itemGUID.ToString().c_str(), npcGUID.ToString().c_str());
Item* item = _player->GetItemByGuid(itemGUID);
if (item)
@@ -911,7 +909,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
}
else
{
- TC_LOG_DEBUG("network", "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID));
+ TC_LOG_DEBUG("network", "ITEM: Repair all items at %s", npcGUID.ToString().c_str());
_player->DurabilityRepairAll(true, discountMod, guildBank != 0);
}
}
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index f3dc24a8c01..d03d57e49e0 100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -35,17 +35,17 @@
void WorldSession::HandleDismissCritter(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for %s", guid.ToString().c_str());
Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
if (!pet)
{
- TC_LOG_DEBUG("network", "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)",
- uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId());
+ TC_LOG_DEBUG("network", "Vanitypet (%s) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)",
+ guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId());
return;
}
@@ -58,9 +58,9 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData)
void WorldSession::HandlePetAction(WorldPacket& recvData)
{
- uint64 guid1;
+ ObjectGuid guid1;
uint32 data;
- uint64 guid2;
+ ObjectGuid guid2;
float x, y, z;
recvData >> guid1; //pet guid
recvData >> data;
@@ -74,18 +74,18 @@ void WorldSession::HandlePetAction(WorldPacket& recvData)
uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1
// used also for charmed creature
- Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
- TC_LOG_INFO("network", "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)));
+ Unit* pet = ObjectAccessor::GetUnit(*_player, guid1);
+ TC_LOG_INFO("network", "HandlePetAction: %s - flag: %u, spellid: %u, target: %s.", guid1.ToString().c_str(), uint32(flag), spellid, guid2.ToString().c_str());
if (!pet)
{
- TC_LOG_DEBUG("network", "HandlePetAction: Pet (GUID: %u) doesn't exist for player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
+ TC_LOG_DEBUG("network", "HandlePetAction: %s doesn't exist for %s %s", guid1.ToString().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str());
return;
}
if (pet != GetPlayer()->GetFirstControlled())
{
- TC_LOG_DEBUG("network", "HandlePetAction: Pet (GUID: %u) does not belong to player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
+ TC_LOG_DEBUG("network", "HandlePetAction: %s does not belong to %s %s", guid1.ToString().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str());
return;
}
@@ -118,23 +118,23 @@ void WorldSession::HandlePetAction(WorldPacket& recvData)
void WorldSession::HandlePetStopAttack(WorldPacket &recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for %s", guid.ToString().c_str());
Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
if (!pet)
{
- TC_LOG_ERROR("network", "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid)));
+ TC_LOG_ERROR("network", "HandlePetStopAttack: %s does not exist", guid.ToString().c_str());
return;
}
if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm())
{
- TC_LOG_ERROR("network", "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s",
- uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
+ TC_LOG_ERROR("network", "HandlePetStopAttack: %s isn't a pet or charmed creature of player %s",
+ guid.ToString().c_str(), GetPlayer()->GetName().c_str());
return;
}
@@ -144,13 +144,13 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recvData)
pet->AttackStop();
}
-void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid, uint16 flag, uint64 guid2, float x, float y, float z)
+void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2, float x, float y, float z)
{
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
- TC_LOG_DEBUG("network", "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (GUID: %u Entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
- guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetEntry(), pet->GetTypeId());
+ TC_LOG_DEBUG("network", "WorldSession::HandlePetAction(petGuid: %s, tagGuid: %s, spellId: %u, flag: %u): object (GUID: %u Entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
+ guid1.ToString().c_str(), guid2.ToString().c_str(), spellid, flag, pet->GetGUIDLow(), pet->GetEntry(), pet->GetTypeId());
return;
}
@@ -287,7 +287,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid
{
case REACT_PASSIVE: //passive
pet->AttackStop();
-
+ // no break;
case REACT_DEFENSIVE: //recovery
case REACT_AGGRESSIVE: //activete
if (pet->GetTypeId() == TYPEID_UNIT)
@@ -418,7 +418,7 @@ void WorldSession::HandlePetNameQuery(WorldPacket& recvData)
TC_LOG_INFO("network", "HandlePetNameQuery. CMSG_PET_NAME_QUERY");
uint32 petnumber;
- uint64 petguid;
+ ObjectGuid petguid;
recvData >> petnumber;
recvData >> petguid;
@@ -426,7 +426,7 @@ void WorldSession::HandlePetNameQuery(WorldPacket& recvData)
SendPetNameQuery(petguid, petnumber);
}
-void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber)
+void WorldSession::SendPetNameQuery(ObjectGuid petguid, uint32 petnumber)
{
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
if (!pet)
@@ -457,14 +457,14 @@ void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber)
_player->GetSession()->SendPacket(&data);
}
-bool WorldSession::CheckStableMaster(uint64 guid)
+bool WorldSession::CheckStableMaster(ObjectGuid guid)
{
// spell case or GM
if (guid == GetPlayer()->GetGUID())
{
if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE))
{
- TC_LOG_DEBUG("network", "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "%s attempt open stable in cheating way.", guid.ToString().c_str());
return false;
}
}
@@ -473,7 +473,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
{
if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER))
{
- TC_LOG_DEBUG("network", "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "Stablemaster %s not found or you can't interact with him.", guid.ToString().c_str());
return false;
}
}
@@ -484,7 +484,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
{
TC_LOG_INFO("network", "HandlePetSetAction. CMSG_PET_SET_ACTION");
- uint64 petguid;
+ ObjectGuid petguid;
uint8 count;
recvData >> petguid;
@@ -493,7 +493,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
if (!pet || pet != _player->GetFirstControlled())
{
- TC_LOG_ERROR("network", "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow());
+ TC_LOG_ERROR("network", "HandlePetSetAction: Unknown %s or owner (%s)", petguid.ToString().c_str(), _player->GetGUID().ToString().c_str());
return;
}
@@ -601,7 +601,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
{
TC_LOG_INFO("network", "HandlePetRename. CMSG_PET_RENAME");
- uint64 petguid;
+ ObjectGuid petguid;
uint8 isdeclined;
std::string name;
@@ -667,7 +667,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
stmt->setUInt32(0, _player->GetGUIDLow());
for (uint8 i = 0; i < 5; i++)
- stmt->setString(i+1, declinedname.name[i]);
+ stmt->setString(i + 1, declinedname.name[i]);
trans->Append(stmt);
}
@@ -685,9 +685,9 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
void WorldSession::HandlePetAbandon(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid; //pet guid
- TC_LOG_INFO("network", "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid));
+ TC_LOG_INFO("network", "HandlePetAbandon. CMSG_PET_ABANDON %s", guid.ToString().c_str());
if (!_player->IsInWorld())
return;
@@ -706,7 +706,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData)
void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
{
TC_LOG_INFO("network", "CMSG_PET_SPELL_AUTOCAST");
- uint64 guid;
+ ObjectGuid guid;
uint32 spellid;
uint8 state; //1 for on, 0 for off
recvPacket >> guid >> spellid >> state;
@@ -721,7 +721,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm()))
{
- TC_LOG_ERROR("network", "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
+ TC_LOG_ERROR("network", "HandlePetSpellAutocastOpcode. %s isn't pet of player %s (%s).", guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
return;
}
@@ -755,14 +755,14 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL");
- uint64 guid;
+ ObjectGuid guid;
uint8 castCount;
uint32 spellId;
uint8 castFlags;
recvPacket >> guid >> castCount >> spellId >> castFlags;
- TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags);
+ TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, %s, castCount: %u, spellId %u, castFlags %u", guid.ToString().c_str(), castCount, spellId, castFlags);
// This opcode is also sent from charmed and possessed units (players and creatures)
if (!_player->GetGuardianPet() && !_player->GetCharm())
@@ -772,7 +772,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm()))
{
- TC_LOG_ERROR("network", "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
+ TC_LOG_ERROR("network", "HandlePetCastSpellOpcode: %s isn't pet of player %s (%s).", guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
return;
}
@@ -854,7 +854,7 @@ void WorldSession::HandlePetLearnTalent(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_PET_LEARN_TALENT");
- uint64 guid;
+ ObjectGuid guid;
uint32 talentId, requestedRank;
recvData >> guid >> talentId >> requestedRank;
@@ -866,7 +866,7 @@ void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_LEARN_PREVIEW_TALENTS_PET");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
uint32 talentsCount;
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index 8eb699a978f..d3d32745c5e 100644
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -54,7 +54,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_BUY");
- uint64 guidNPC;
+ ObjectGuid guidNPC;
uint32 clientIndex; // 1 for guild and arenaslot+1 for arenas in client
std::string name;
@@ -81,13 +81,13 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
recvData >> clientIndex; // index
recvData.read_skip<uint32>(); // 0
- TC_LOG_DEBUG("network", "Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str());
+ TC_LOG_DEBUG("network", "Petitioner %s tried sell petition: name %s", guidNPC.ToString().c_str(), name.c_str());
// prevent cheating
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC, UNIT_NPC_FLAG_PETITIONER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC));
+ TC_LOG_DEBUG("network", "WORLD: HandlePetitionBuyOpcode - %s not found or you can't interact with him.", guidNPC.ToString().c_str());
return;
}
@@ -250,11 +250,10 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_SHOW_SIGNATURES");
uint8 signs = 0;
- uint64 petitionguid;
+ ObjectGuid petitionguid;
recvData >> petitionguid; // petition guid
- // solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?)
- uint32 petitionGuidLow = GUID_LOPART(petitionguid);
+ uint32 petitionGuidLow = petitionguid.GetCounter();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE);
@@ -264,7 +263,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
if (!result)
{
- TC_LOG_DEBUG("entities.player.items", "Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str());
+ TC_LOG_DEBUG("entities.player.items", "Petition %u is not found for player %u %s", petitionguid.GetCounter(), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str());
return;
}
Field* fields = result->Fetch();
@@ -297,7 +296,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
Field* fields2 = result->Fetch();
uint32 lowGuid = fields2[0].GetUInt32();
- data << uint64(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER)); // Player GUID
+ data << ObjectGuid(HIGHGUID_PLAYER, 0, lowGuid); // Player GUID
data << uint32(0); // there 0 ...
result->NextRow();
@@ -310,41 +309,41 @@ void WorldSession::HandlePetitionQueryOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_QUERY"); // ok
uint32 guildguid;
- uint64 petitionguid;
+ ObjectGuid petitionguid;
recvData >> guildguid; // in Trinity always same as GUID_LOPART(petitionguid)
recvData >> petitionguid; // petition guid
- TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY Petition GUID %u Guild GUID %u", GUID_LOPART(petitionguid), guildguid);
+ TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY Petition %s Guild GUID %u", petitionguid.ToString().c_str(), guildguid);
SendPetitionQueryOpcode(petitionguid);
}
-void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
+void WorldSession::SendPetitionQueryOpcode(ObjectGuid petitionguid)
{
- uint64 ownerguid = 0;
+ ObjectGuid ownerguid;
uint32 type;
std::string name = "NO_NAME_FOR_GUID";
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION);
- stmt->setUInt32(0, GUID_LOPART(petitionguid));
+ stmt->setUInt32(0, petitionguid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
{
Field* fields = result->Fetch();
- ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
name = fields[1].GetString();
type = fields[2].GetUInt8();
}
else
{
- TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionguid));
+ TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (%s)", petitionguid.ToString().c_str());
return;
}
WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4+8+name.size()+1+1+4*12+2+10));
- data << uint32(GUID_LOPART(petitionguid)); // guild/team guid (in Trinity always same as GUID_LOPART(petition guid)
+ data << uint32(petitionguid.GetCounter()); // guild/team guid (in Trinity always same as GUID_LOPART(petition guid)
data << uint64(ownerguid); // charter owner guid
data << name; // name (guild/arena team)
data << uint8(0); // some string
@@ -384,7 +383,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "Received opcode MSG_PETITION_RENAME");
- uint64 petitionGuid;
+ ObjectGuid petitionGuid;
uint32 type;
std::string newName;
@@ -397,7 +396,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -408,7 +407,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
}
else
{
- TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionGuid));
+ TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition %s", petitionGuid.ToString().c_str());
return;
}
@@ -442,11 +441,11 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PETITION_NAME);
stmt->setString(0, newName);
- stmt->setUInt32(1, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(1, petitionGuid.GetCounter());
CharacterDatabase.Execute(stmt);
- TC_LOG_DEBUG("network", "Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionGuid), newName.c_str());
+ TC_LOG_DEBUG("network", "Petition %s renamed to '%s'", petitionGuid.ToString().c_str(), newName.c_str());
WorldPacket data(MSG_PETITION_RENAME, (8+newName.size()+1));
data << uint64(petitionGuid);
data << newName;
@@ -458,31 +457,31 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_SIGN"); // ok
Field* fields;
- uint64 petitionGuid;
+ ObjectGuid petitionGuid;
uint8 unk;
recvData >> petitionGuid; // petition guid
recvData >> unk;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURES);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
- stmt->setUInt32(1, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
+ stmt->setUInt32(1, petitionGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
- TC_LOG_ERROR("network", "Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str());
+ TC_LOG_ERROR("network", "Petition %s is not found for player %u %s", petitionGuid.ToString().c_str(), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str());
return;
}
fields = result->Fetch();
- uint64 ownerGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ ObjectGuid ownerGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
uint64 signs = fields[1].GetUInt64();
uint8 type = fields[2].GetUInt8();
uint32 playerGuid = _player->GetGUIDLow();
- if (GUID_LOPART(ownerGuid) == playerGuid)
+ if (ownerGuid == _player->GetGUID())
return;
// not let enemies sign guild charter
@@ -541,7 +540,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIG_BY_ACCOUNT);
stmt->setUInt32(0, GetAccountId());
- stmt->setUInt32(1, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(1, petitionGuid.GetCounter());
result = CharacterDatabase.Query(stmt);
@@ -559,14 +558,14 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION_SIGNATURE);
- stmt->setUInt32(0, GUID_LOPART(ownerGuid));
- stmt->setUInt32(1, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, ownerGuid.GetCounter());
+ stmt->setUInt32(1, petitionGuid.GetCounter());
stmt->setUInt32(2, playerGuid);
stmt->setUInt32(3, GetAccountId());
CharacterDatabase.Execute(stmt);
- TC_LOG_DEBUG("network", "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId());
+ TC_LOG_DEBUG("network", "PETITION SIGN: %s by player: %s (GUID: %u Account: %u)", petitionGuid.ToString().c_str(), _player->GetName().c_str(), playerGuid, GetAccountId());
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
data << uint64(petitionGuid);
@@ -590,14 +589,13 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "Received opcode MSG_PETITION_DECLINE"); // ok
- uint64 petitionguid;
- uint64 ownerguid;
+ ObjectGuid petitionguid;
recvData >> petitionguid; // petition guid
- TC_LOG_DEBUG("network", "Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow());
+ TC_LOG_DEBUG("network", "Petition %s declined by %u", petitionguid.ToString().c_str(), _player->GetGUIDLow());
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_OWNER_BY_GUID);
- stmt->setUInt32(0, GUID_LOPART(petitionguid));
+ stmt->setUInt32(0, petitionguid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -605,7 +603,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
return;
Field* fields = result->Fetch();
- ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ ObjectGuid ownerguid(HIGHGUID_PLAYER, 0, fields[0].GetUInt32());
Player* owner = ObjectAccessor::FindPlayer(ownerguid);
if (owner) // petition owner online
@@ -621,7 +619,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "Received opcode CMSG_OFFER_PETITION"); // ok
uint8 signs = 0;
- uint64 petitionguid, plguid;
+ ObjectGuid petitionguid, plguid;
uint32 type, junk;
Player* player;
recvData >> junk; // this is not petition type!
@@ -634,7 +632,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE);
- stmt->setUInt32(0, GUID_LOPART(petitionguid));
+ stmt->setUInt32(0, petitionguid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -644,7 +642,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
Field* fields = result->Fetch();
type = fields[0].GetUInt8();
- TC_LOG_DEBUG("network", "OFFER PETITION: type %u, GUID1 %u, to player id: %u", type, GUID_LOPART(petitionguid), GUID_LOPART(plguid));
+ TC_LOG_DEBUG("network", "OFFER PETITION: type %u, %s, to %s", type, petitionguid.ToString().c_str(), plguid.ToString().c_str());
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != player->GetTeam())
{
@@ -699,7 +697,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE);
- stmt->setUInt32(0, GUID_LOPART(petitionguid));
+ stmt->setUInt32(0, petitionguid.GetCounter());
result = CharacterDatabase.Query(stmt);
@@ -710,13 +708,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12));
data << uint64(petitionguid); // petition guid
data << uint64(_player->GetGUID()); // owner guid
- data << uint32(GUID_LOPART(petitionguid)); // guild guid
+ data << uint32(petitionguid.GetCounter()); // guild guid
data << uint8(signs); // sign's count
for (uint8 i = 1; i <= signs; ++i)
{
Field* fields2 = result->Fetch();
- data << uint64(MAKE_NEW_GUID(fields2[0].GetUInt32(), 0, HIGHGUID_PLAYER)); // Player GUID
+ data << uint64(ObjectGuid(HIGHGUID_PLAYER, fields2[0].GetUInt32())); // Player GUID
data << uint32(0); // there 0 ...
result->NextRow();
@@ -731,7 +729,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
// Get petition guid from packet
WorldPacket data;
- uint64 petitionGuid;
+ ObjectGuid petitionGuid;
recvData >> petitionGuid;
@@ -740,7 +738,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
if (!item)
return;
- TC_LOG_DEBUG("network", "Petition %u turned in by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow());
+ TC_LOG_DEBUG("network", "Petition %s turned in by %u", petitionGuid.ToString().c_str(), _player->GetGUIDLow());
// Get petition data from db
uint32 ownerguidlo;
@@ -748,7 +746,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
std::string name;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
@@ -760,7 +758,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
}
else
{
- TC_LOG_ERROR("network", "Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid));
+ TC_LOG_ERROR("network", "Player %s (guid: %u) tried to turn in petition (%s) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), petitionGuid.ToString().c_str());
return;
}
@@ -813,7 +811,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
uint8 signatures;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
result = CharacterDatabase.Query(stmt);
if (result)
@@ -861,7 +859,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
for (uint8 i = 0; i < signatures; ++i)
{
Field* fields = result->Fetch();
- guild->AddMember(MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
+ guild->AddMember(ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()));
result->NextRow();
}
}
@@ -888,9 +886,9 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
for (uint8 i = 0; i < signatures; ++i)
{
Field* fields = result->Fetch();
- uint32 memberGUID = fields[0].GetUInt32();
- TC_LOG_DEBUG("network", "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), memberGUID);
- arenaTeam->AddMember(MAKE_NEW_GUID(memberGUID, 0, HIGHGUID_PLAYER));
+ ObjectGuid memberGUID(HIGHGUID_PLAYER, fields[0].GetUInt32());
+ TC_LOG_DEBUG("network", "PetitionsHandler: Adding arena team (guid: %u) member %s", arenaTeam->GetId(), memberGUID.ToString().c_str());
+ arenaTeam->AddMember(memberGUID);
result->NextRow();
}
}
@@ -898,17 +896,17 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_GUID);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_GUID);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
// created
- TC_LOG_DEBUG("network", "TURN IN PETITION GUID %u", GUID_LOPART(petitionGuid));
+ TC_LOG_DEBUG("network", "Player %s (%s) turning in petition %s", _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), petitionGuid.ToString().c_str());
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
data << (uint32)PETITION_TURN_OK;
@@ -919,18 +917,18 @@ void WorldSession::HandlePetitionShowListOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "Received CMSG_PETITION_SHOWLIST");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
SendPetitionShowList(guid);
}
-void WorldSession::SendPetitionShowList(uint64 guid)
+void WorldSession::SendPetitionShowList(ObjectGuid guid)
{
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandlePetitionShowListOpcode - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index e6c94250262..1418cd8a2d8 100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -31,13 +31,13 @@
#include "Pet.h"
#include "MapManager.h"
-void WorldSession::SendNameQueryOpcode(uint64 guid)
+void WorldSession::SendNameQueryOpcode(ObjectGuid guid)
{
Player* player = ObjectAccessor::FindPlayer(guid);
- CharacterNameData const* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid));
+ CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid);
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10));
- data.appendPackGUID(guid);
+ data << guid.WriteAsPacked();
if (!nameData)
{
data << uint8(1); // name unknown
@@ -66,7 +66,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
void WorldSession::HandleNameQueryOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
// This is disable by default to prevent lots of console spam
@@ -93,7 +93,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
{
uint32 entry;
recvData >> entry;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(entry);
@@ -158,8 +158,8 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
}
else
{
- TC_LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)",
- GUID_LOPART(guid), entry);
+ TC_LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (%s, ENTRY: %u)",
+ guid.ToString().c_str(), entry);
WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 4);
data << uint32(entry | 0x80000000);
@@ -174,7 +174,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
{
uint32 entry;
recvData >> entry;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
const GameObjectTemplate* info = sObjectMgr->GetGameObjectTemplate(entry);
@@ -217,8 +217,8 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
}
else
{
- TC_LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)",
- GUID_LOPART(guid), entry);
+ TC_LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (%s, ENTRY: %u)",
+ guid.ToString().c_str(), entry);
WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 4);
data << uint32(entry | 0x80000000);
SendPacket(&data);
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index fe069ad5109..331256c7edd 100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -34,14 +34,14 @@
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
uint32 questStatus = DIALOG_STATUS_NONE;
Object* questGiver = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
if (!questGiver)
{
- TC_LOG_INFO("network", "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for non-existing questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid));
+ TC_LOG_INFO("network", "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for non-existing questgiver (%s)", guid.ToString().c_str());
return;
}
@@ -71,16 +71,16 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO %s", guid.ToString().c_str());
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.",
- GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - %s not found or you can't interact with him.",
+ guid.ToString().c_str());
return;
}
@@ -101,19 +101,19 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 questId;
uint32 unk1;
recvData >> guid >> questId >> unk1;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST %s, quest = %u, unk1 = %u", guid.ToString().c_str(), questId, unk1);
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER);
#define CLOSE_GOSSIP_CLEAR_DIVIDER() \
do { \
_player->PlayerTalkClass->SendCloseGossip(); \
- _player->SetDivider(0); \
+ _player->SetDivider(ObjectGuid::Empty); \
} while (0)
// no or incorrect quest giver
@@ -154,13 +154,13 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
return;
}
- if (_player->GetDivider() != 0)
+ if (!_player->GetDivider().IsEmpty())
{
Player* player = ObjectAccessor::FindPlayer(_player->GetDivider());
if (player)
{
player->SendPushToPartyResponse(_player, QUEST_PARTY_MSG_ACCEPT_QUEST);
- _player->SetDivider(0);
+ _player->SetDivider(ObjectGuid::Empty);
}
}
@@ -208,11 +208,11 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 questId;
uint8 unk1;
recvData >> guid >> questId >> unk1;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %s, quest = %u, unk1 = %u", guid.ToString().c_str(), questId, unk1);
// Verify that the guid is valid and is a questgiver or involved in the requested quest
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM);
@@ -253,7 +253,7 @@ void WorldSession::HandleQuestQueryOpcode(WorldPacket& recvData)
void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
{
uint32 questId, reward;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid >> questId >> reward;
if (reward >= QUEST_REWARD_CHOICES_COUNT)
@@ -262,7 +262,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
return;
}
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), questId, reward);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %s, quest = %u, reward = %u", guid.ToString().c_str(), questId, reward);
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
if (!quest)
@@ -353,10 +353,10 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData)
{
uint32 questId;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid >> questId;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %s, quest = %u", guid.ToString().c_str(), questId);
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
if (!object || !object->hasInvolvedQuest(questId))
@@ -457,18 +457,18 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData)
if (_player->CanAddQuest(quest, true))
_player->AddQuestAndCheckCompletion(quest, NULL); // NULL, this prevent DB script from duplicate running
- _player->SetDivider(0);
+ _player->SetDivider(ObjectGuid::Empty);
}
}
void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
{
uint32 questId;
- uint64 guid; // NPC / GameObject guid for normal quest completion. Player guid for self-completed quests
+ ObjectGuid guid; // NPC / GameObject guid for normal quest completion. Player guid for self-completed quests
bool autoCompleteMode; // 0 - standart complete quest mode with npc, 1 - auto-complete mode
recvData >> guid >> questId >> autoCompleteMode;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, questId = %u self-complete: %u", uint32(GUID_LOPART(guid)), questId, autoCompleteMode ? 1 : 0);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %s, questId = %u self-complete: %u", guid.ToString().c_str(), questId, autoCompleteMode ? 1 : 0);
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
if (!quest)
@@ -584,7 +584,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
continue;
}
- if (receiver->GetDivider() != 0)
+ if (receiver->GetDivider())
{
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_BUSY);
continue;
@@ -607,7 +607,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 questId;
uint8 msg;
recvPacket >> guid >> questId >> msg;
@@ -623,7 +623,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
data << uint64(_player->GetGUID());
data << uint8(msg); // valid values: 0-8
player->SendDirectMessage(&data);
- _player->SetDivider(0);
+ _player->SetDivider(ObjectGuid::Empty);
}
}
}
@@ -637,11 +637,11 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4 + 8 + 4);
data << uint32(count); // placeholder
- for (Player::ClientGUIDs::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
+ for (GuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
{
uint32 questStatus = DIALOG_STATUS_NONE;
- if (IS_CRE_OR_VEH_OR_PET_GUID(*itr))
+ if (itr->IsAnyTypeCreature())
{
// need also pet quests case support
Creature* questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*GetPlayer(), *itr);
@@ -656,7 +656,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
data << uint32(questStatus);
++count;
}
- else if (IS_GAMEOBJECT_GUID(*itr))
+ else if (itr->IsGameObject())
{
GameObject* questgiver = GetPlayer()->GetMap()->GetGameObject(*itr);
if (!questgiver || questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
diff --git a/src/server/game/Handlers/ReferAFriendHandler.cpp b/src/server/game/Handlers/ReferAFriendHandler.cpp
index 2efc9df5d94..3ffc8df465e 100644
--- a/src/server/game/Handlers/ReferAFriendHandler.cpp
+++ b/src/server/game/Handlers/ReferAFriendHandler.cpp
@@ -25,8 +25,8 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_GRANT_LEVEL");
- uint64 guid;
- recvData.readPackGUID(guid);
+ ObjectGuid guid;
+ recvData >> guid.ReadAsPacked();
Player* target = ObjectAccessor::GetObjectInWorld(guid, _player);
@@ -60,7 +60,7 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData)
}
WorldPacket data2(SMSG_PROPOSE_LEVEL_GRANT, 8);
- data2.append(_player->GetPackGUID());
+ data2 << _player->GetPackGUID();
target->GetSession()->SendPacket(&data2);
}
@@ -68,8 +68,8 @@ void WorldSession::HandleAcceptGrantLevel(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_ACCEPT_LEVEL_GRANT");
- uint64 guid;
- recvData.readPackGUID(guid);
+ ObjectGuid guid;
+ recvData >> guid.ReadAsPacked();
Player* other = ObjectAccessor::GetObjectInWorld(guid, _player);
if (!(other && other->GetSession()))
diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp
index 8e10fc94ea6..61868a8616a 100644
--- a/src/server/game/Handlers/SkillHandler.cpp
+++ b/src/server/game/Handlers/SkillHandler.cpp
@@ -83,13 +83,13 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket)
void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "MSG_TALENT_WIPE_CONFIRM");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleTalentWipeConfirmOpcode - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index ee428694beb..05d03a44012 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -88,7 +88,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
uint8 bagIndex, slot, castFlags;
uint8 castCount; // next cast if exists (single or not)
- uint64 itemGUID;
+ ObjectGuid itemGUID;
uint32 glyphIndex; // something to do with glyphs?
uint32 spellId; // cast spell id
@@ -261,7 +261,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
uint32 entry = fields[0].GetUInt32();
uint32 flags = fields[1].GetUInt32();
- item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, 0);
+ item->SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid::Empty);
item->SetEntry(entry);
item->SetUInt32Value(ITEM_FIELD_FLAGS, flags);
item->SetState(ITEM_CHANGED, pUser);
@@ -285,10 +285,10 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_USE Message [%s]", guid.ToString().c_str());
if (GameObject* obj = GetPlayer()->GetMap()->GetGameObject(guid))
{
@@ -306,10 +306,10 @@ void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData)
void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
recvPacket >> guid;
- TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [in game guid: %u]", GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [%s]", guid.ToString().c_str());
// ignore for remote control state
if (_player->m_mover != _player)
@@ -435,7 +435,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
spellInfo = actualSpellInfo;
}
- Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, 0, false);
+ Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, ObjectGuid::Empty, false);
spell->m_cast_count = castCount; // set count of casts
spell->m_glyphIndex = glyphIndex;
spell->prepare(&targets);
@@ -481,7 +481,7 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
return;
// maybe should only remove one buff when there are multiple?
- _player->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL);
+ _player->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
// If spell being removed is a resource tracker, see if player was tracking both (herbs / minerals) and remove the other
if (sWorld->getBoolConfig(CONFIG_ALLOW_TRACK_BOTH_RESOURCES) && spellInfo->HasAura(SPELL_AURA_TRACK_RESOURCES))
@@ -493,19 +493,19 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
// over AuraEffectList caused "incompatible iterator" errors on second pass
std::list<uint32> spellIDs;
- for (Unit::AuraEffectList::const_iterator auraEffect = auraEffects.begin(); auraEffect != auraEffects.end(); auraEffect++)
+ for (Unit::AuraEffectList::const_iterator auraEffect = auraEffects.begin(); auraEffect != auraEffects.end(); ++auraEffect)
spellIDs.push_back((*auraEffect)->GetId());
// Remove all auras related to resource tracking (only Herbs and Minerals in 3.3.5a)
- for (std::list<uint32>::iterator it = spellIDs.begin(); it != spellIDs.end(); it++)
- _player->RemoveOwnedAura(*it, 0, 0, AURA_REMOVE_BY_CANCEL);
+ for (std::list<uint32>::iterator it = spellIDs.begin(); it != spellIDs.end(); ++it)
+ _player->RemoveOwnedAura(*it, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
}
}
}
void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 spellId;
recvPacket >> guid;
@@ -522,13 +522,13 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
if (!pet)
{
- TC_LOG_ERROR("network", "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
+ TC_LOG_ERROR("network", "HandlePetCancelAura: Attempt to cancel an aura for non-existant %s by player '%s'", guid.ToString().c_str(), GetPlayer()->GetName().c_str());
return;
}
if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm())
{
- TC_LOG_ERROR("network", "HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
+ TC_LOG_ERROR("network", "HandlePetCancelAura: %s is not a pet of player '%s'", guid.ToString().c_str(), GetPlayer()->GetName().c_str());
return;
}
@@ -538,7 +538,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
return;
}
- pet->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL);
+ pet->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
pet->AddCreatureSpellCooldown(spellId);
}
@@ -606,7 +606,7 @@ void WorldSession::HandleSelfResOpcode(WorldPacket& /*recvData*/)
void WorldSession::HandleSpellClick(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
// this will get something not in world. crash
@@ -625,7 +625,7 @@ void WorldSession::HandleSpellClick(WorldPacket& recvData)
void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_GET_MIRRORIMAGE_DATA");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
recvData.read_skip<uint32>(); // DisplayId ?
@@ -719,7 +719,7 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_UPDATE_PROJECTILE_POSITION");
- uint64 casterGuid;
+ ObjectGuid casterGuid;
uint32 spellId;
uint8 castCount;
float x, y, z; // Position of missile hit
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp
index aaa9188b6f4..f281084f3ff 100644
--- a/src/server/game/Handlers/TaxiHandler.cpp
+++ b/src/server/game/Handlers/TaxiHandler.cpp
@@ -32,19 +32,19 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_TAXINODE_STATUS_QUERY");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
SendTaxiStatus(guid);
}
-void WorldSession::SendTaxiStatus(uint64 guid)
+void WorldSession::SendTaxiStatus(ObjectGuid guid)
{
// cheating checks
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
if (!unit)
{
- TC_LOG_DEBUG("network", "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WorldSession::SendTaxiStatus - %s not found.", guid.ToString().c_str());
return;
}
@@ -67,14 +67,14 @@ void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
// cheating checks
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleTaxiQueryAvailableNodes - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
@@ -167,7 +167,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXIEXPRESS");
- uint64 guid;
+ ObjectGuid guid;
uint32 node_count;
recvData >> guid >> node_count;
@@ -175,7 +175,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
if (!npc)
{
- TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - %s not found or you can't interact with it.", guid.ToString().c_str());
return;
}
std::vector<uint32> nodes;
@@ -282,7 +282,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXI");
- uint64 guid;
+ ObjectGuid guid;
std::vector<uint32> nodes;
nodes.resize(2);
@@ -291,7 +291,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
if (!npc)
{
- TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - %s not found or you can't interact with it.", guid.ToString().c_str());
return;
}
diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp
index 53cde5e8e5a..65377513002 100644
--- a/src/server/game/Handlers/TicketHandler.cpp
+++ b/src/server/game/Handlers/TicketHandler.cpp
@@ -218,7 +218,7 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData)
recvData >> comment;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_SURVEY);
- stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID()));
+ stmt->setUInt32(0, GetPlayer()->GetGUIDLow());
stmt->setUInt32(1, nextSurveyID);
stmt->setUInt32(2, mainSurvey);
stmt->setString(3, comment);
@@ -241,7 +241,7 @@ void WorldSession::HandleReportLag(WorldPacket& recvData)
recvData >> z;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_LAG_REPORT);
- stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID()));
+ stmt->setUInt32(0, GetPlayer()->GetGUIDLow());
stmt->setUInt8 (1, lagType);
stmt->setUInt16(2, mapId);
stmt->setFloat (3, x);
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index f4aca0528a0..e89cc788bf7 100644
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -122,8 +122,8 @@ void WorldSession::SendUpdateTrade(bool trader_data /*= true*/)
if (!item)
continue;
- ObjectGuid giftCreatorGuid = item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR);
- ObjectGuid creatorGuid = item->GetUInt64Value(ITEM_FIELD_CREATOR);
+ ObjectGuid giftCreatorGuid = item->GetGuidValue(ITEM_FIELD_GIFTCREATOR);
+ ObjectGuid creatorGuid = item->GetGuidValue(ITEM_FIELD_CREATOR);
data.WriteBit(giftCreatorGuid[7]);
data.WriteBit(giftCreatorGuid[1]);
@@ -557,12 +557,12 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
{
if (myItems[i])
{
- myItems[i]->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
+ myItems[i]->SetGuidValue(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
_player->MoveItemFromInventory(myItems[i]->GetBagSlot(), myItems[i]->GetSlot(), true);
}
if (hisItems[i])
{
- hisItems[i]->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, trader->GetGUID());
+ hisItems[i]->SetGuidValue(ITEM_FIELD_GIFTCREATOR, trader->GetGUID());
trader->MoveItemFromInventory(hisItems[i]->GetBagSlot(), hisItems[i]->GetSlot(), true);
}
}
@@ -849,7 +849,7 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket)
return;
}
- uint64 iGUID = item->GetGUID();
+ ObjectGuid iGUID = item->GetGUID();
// prevent place single item into many trade slots using cheating and client bugs
if (my_trade->HasItem(iGUID))
@@ -860,7 +860,7 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket)
return;
}
- if (slot != TRADE_SLOT_NONTRADED && item->IsBindedNotWith(my_trade->GetTrader()))
+ if (tradeSlot != TRADE_SLOT_NONTRADED && item->IsBindedNotWith(my_trade->GetTrader()))
{
info.Status = TRADE_STATUS_NOT_ON_TAPLIST;
info.Slot = tradeSlot;
diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp
index e17b33c345b..4181332fc02 100644
--- a/src/server/game/Handlers/VehicleHandler.cpp
+++ b/src/server/game/Handlers/VehicleHandler.cpp
@@ -28,7 +28,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
- uint64 vehicleGUID = _player->GetCharmGUID();
+ ObjectGuid vehicleGUID = _player->GetCharmGUID();
if (!vehicleGUID) // something wrong here...
{
@@ -100,7 +100,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
GetPlayer()->ReadMovementInfo(recvData, &movementInfo, &extra);
vehicle_base->m_movementInfo = movementInfo;
- uint64 accessory = extra.Data.guid;
+ ObjectGuid accessory = extra.Data.guid;
int8 seatId = extra.Data.byteData;
if (vehicle_base->GetGUID() != movementInfo.guid)
@@ -118,8 +118,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
}
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
{
- uint64 guid; // current vehicle guid
- recvData.readPackGUID(guid);
+ ObjectGuid guid; // current vehicle guid
+ recvData >> guid.ReadAsPacked();
int8 seatId;
recvData >> seatId;
@@ -140,7 +140,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
void WorldSession::HandleEnterPlayerVehicle(WorldPacket& data)
{
// Read guid
- uint64 guid;
+ ObjectGuid guid;
data >> guid;
if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -162,63 +162,37 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data)
if (!vehicle)
{
data.rfinish(); // prevent warnings spam
- TC_LOG_ERROR("network", "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow());
+ TC_LOG_ERROR("network", "HandleEjectPassenger: %s is not in a vehicle!", GetPlayer()->GetGUID().ToString().c_str());
return;
}
- uint64 guid;
+ ObjectGuid guid;
data >> guid;
- if (IS_PLAYER_GUID(guid))
- {
- Player* player = ObjectAccessor::FindPlayer(guid);
- if (!player)
- {
- TC_LOG_ERROR("network", "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
- return;
- }
-
- if (!player->IsOnVehicle(vehicle->GetBase()))
- {
- TC_LOG_ERROR("network", "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
- return;
- }
-
- VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(player);
- ASSERT(seat);
- if (seat->IsEjectable())
- player->ExitVehicle();
- else
- TC_LOG_ERROR("network", "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
- }
-
- else if (IS_CREATURE_GUID(guid))
+ if (guid.IsUnit())
{
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
if (!unit) // creatures can be ejected too from player mounts
{
- TC_LOG_ERROR("network", "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "%s tried to eject %s from vehicle, but the latter was not found in world!", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
return;
}
if (!unit->IsOnVehicle(vehicle->GetBase()))
{
- TC_LOG_ERROR("network", "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "%s tried to eject %s, but they are not in the same vehicle", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
return;
}
VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(unit);
ASSERT(seat);
if (seat->IsEjectable())
- {
- ASSERT(GetPlayer() == vehicle->GetBase());
unit->ExitVehicle();
- }
else
- TC_LOG_ERROR("network", "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "Player %u attempted to eject %s from non-ejectable seat.", GetPlayer()->GetGUIDLow(), guid.ToString().c_str());
}
else
- TC_LOG_ERROR("network", "HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
+ TC_LOG_ERROR("network", "HandleEjectPassenger: %s tried to eject invalid %s ", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
}
void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)
diff --git a/src/server/game/Handlers/VoidStorageHandler.cpp b/src/server/game/Handlers/VoidStorageHandler.cpp
index cf117762801..82e19ea8905 100644
--- a/src/server/game/Handlers/VoidStorageHandler.cpp
+++ b/src/server/game/Handlers/VoidStorageHandler.cpp
@@ -62,7 +62,7 @@ void WorldSession::HandleVoidStorageUnlock(WorldPacket& recvData)
Creature* unit = player->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_VAULTKEEPER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleVoidStorageUnlock - Unit (GUID: %u) not found or player can't interact with it.", GUID_LOPART(npcGuid));
+ TC_LOG_DEBUG("network", "WORLD: HandleVoidStorageUnlock - %s not found or player can't interact with it.", npcGuid.ToString().c_str());
return;
}
@@ -103,7 +103,7 @@ void WorldSession::HandleVoidStorageQuery(WorldPacket& recvData)
Creature* unit = player->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_VAULTKEEPER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleVoidStorageQuery - Unit (GUID: %u) not found or player can't interact with it.", GUID_LOPART(npcGuid));
+ TC_LOG_DEBUG("network", "WORLD: HandleVoidStorageQuery - %s not found or player can't interact with it.", npcGuid.ToString().c_str());
return;
}
@@ -130,7 +130,7 @@ void WorldSession::HandleVoidStorageQuery(WorldPacket& recvData)
if (!item)
continue;
- ObjectGuid itemId = item->ItemId;
+ ObjectGuid itemId(item->ItemId);
ObjectGuid creatorGuid = item->CreatorGuid;
data.WriteBit(creatorGuid[3]);
@@ -284,7 +284,7 @@ void WorldSession::HandleVoidStorageTransfer(WorldPacket& recvData)
Creature* unit = player->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_VAULTKEEPER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleVoidStorageTransfer - Unit (GUID: %u) not found or player can't interact with it.", GUID_LOPART(npcGuid));
+ TC_LOG_DEBUG("network", "WORLD: HandleVoidStorageTransfer - %s not found or player can't interact with it.", npcGuid.ToString().c_str());
return;
}
@@ -335,7 +335,7 @@ void WorldSession::HandleVoidStorageTransfer(WorldPacket& recvData)
continue;
}
- VoidStorageItem itemVS(sObjectMgr->GenerateVoidStorageItemId(), item->GetEntry(), item->GetUInt64Value(ITEM_FIELD_CREATOR), item->GetItemRandomPropertyId(), item->GetItemSuffixFactor());
+ VoidStorageItem itemVS(sObjectMgr->GenerateVoidStorageItemId(), item->GetEntry(), item->GetGuidValue(ITEM_FIELD_CREATOR), item->GetItemRandomPropertyId(), item->GetItemSuffixFactor());
uint8 slot = player->AddVoidStorageItem(itemVS);
@@ -370,7 +370,7 @@ void WorldSession::HandleVoidStorageTransfer(WorldPacket& recvData)
}
Item* item = player->StoreNewItem(dest, itemVS->ItemEntry, true, itemVS->ItemRandomPropertyId);
- item->SetUInt64Value(ITEM_FIELD_CREATOR, uint64(itemVS->CreatorGuid));
+ item->SetGuidValue(ITEM_FIELD_CREATOR, itemVS->CreatorGuid);
item->SetBinding(true);
player->SendNewItem(item, 1, false, false, false);
@@ -387,7 +387,7 @@ void WorldSession::HandleVoidStorageTransfer(WorldPacket& recvData)
for (uint8 i = 0; i < depositCount; ++i)
{
- ObjectGuid itemId = depositItems[i].first.ItemId;
+ ObjectGuid itemId(depositItems[i].first.ItemId);
ObjectGuid creatorGuid = depositItems[i].first.CreatorGuid;
data.WriteBit(creatorGuid[7]);
data.WriteBit(itemId[7]);
@@ -409,7 +409,7 @@ void WorldSession::HandleVoidStorageTransfer(WorldPacket& recvData)
for (uint8 i = 0; i < withdrawCount; ++i)
{
- ObjectGuid itemId = withdrawItems[i].ItemId;
+ ObjectGuid itemId(withdrawItems[i].ItemId);
data.WriteBit(itemId[1]);
data.WriteBit(itemId[7]);
data.WriteBit(itemId[3]);
@@ -424,7 +424,7 @@ void WorldSession::HandleVoidStorageTransfer(WorldPacket& recvData)
for (uint8 i = 0; i < withdrawCount; ++i)
{
- ObjectGuid itemId = withdrawItems[i].ItemId;
+ ObjectGuid itemId(withdrawItems[i].ItemId);
data.WriteByteSeq(itemId[3]);
data.WriteByteSeq(itemId[1]);
data.WriteByteSeq(itemId[0]);
@@ -437,7 +437,7 @@ void WorldSession::HandleVoidStorageTransfer(WorldPacket& recvData)
for (uint8 i = 0; i < depositCount; ++i)
{
- ObjectGuid itemId = depositItems[i].first.ItemId;
+ ObjectGuid itemId(depositItems[i].first.ItemId);
ObjectGuid creatorGuid = depositItems[i].first.CreatorGuid;
data << uint32(depositItems[i].first.ItemSuffixFactor);
@@ -521,7 +521,7 @@ void WorldSession::HandleVoidSwapItem(WorldPacket& recvData)
Creature* unit = player->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_VAULTKEEPER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleVoidSwapItem - Unit (GUID: %u) not found or player can't interact with it.", GUID_LOPART(npcGuid));
+ TC_LOG_DEBUG("network", "WORLD: HandleVoidSwapItem - %s not found or player can't interact with it.", npcGuid.ToString().c_str());
return;
}
@@ -542,7 +542,7 @@ void WorldSession::HandleVoidSwapItem(WorldPacket& recvData)
bool usedDestSlot = player->GetVoidStorageItem(newSlot) != NULL;
ObjectGuid itemIdDest;
if (usedDestSlot)
- itemIdDest = player->GetVoidStorageItem(newSlot)->ItemId;
+ itemIdDest.Set(player->GetVoidStorageItem(newSlot)->ItemId);
if (!player->SwapVoidStorageItem(oldSlot, newSlot))
{
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index ec149c34431..bb02b114e48 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -52,6 +52,43 @@ bool InstanceScript::IsEncounterInProgress() const
return false;
}
+void InstanceScript::OnCreatureCreate(Creature* creature)
+{
+ AddObject(creature, true);
+ AddMinion(creature, true);
+}
+
+void InstanceScript::OnCreatureRemove(Creature* creature)
+{
+ AddObject(creature, false);
+ AddMinion(creature, false);
+}
+
+void InstanceScript::OnGameObjectCreate(GameObject* go)
+{
+ AddObject(go, true);
+ AddDoor(go, true);
+}
+
+void InstanceScript::OnGameObjectRemove(GameObject* go)
+{
+ AddObject(go, false);
+ AddDoor(go, false);
+}
+
+ObjectGuid InstanceScript::GetObjectGuid(uint32 type) const
+{
+ ObjectGuidMap::const_iterator i = _objectGuids.find(type);
+ if (i != _objectGuids.end())
+ return i->second;
+ return ObjectGuid::Empty;
+}
+
+ObjectGuid InstanceScript::GetGuidData(uint32 type) const
+{
+ return GetObjectGuid(type);
+}
+
void InstanceScript::SetHeaders(std::string const& dataHeaders)
{
for (char header : dataHeaders)
@@ -83,6 +120,27 @@ void InstanceScript::LoadDoorData(const DoorData* data)
TC_LOG_DEBUG("scripts", "InstanceScript::LoadDoorData: " UI64FMTD " doors loaded.", uint64(doors.size()));
}
+void InstanceScript::LoadObjectData(ObjectData const* creatureData, ObjectData const* gameObjectData)
+{
+ if (creatureData)
+ LoadObjectData(creatureData, _creatureInfo);
+
+ if (gameObjectData)
+ LoadObjectData(gameObjectData, _gameObjectInfo);
+
+ TC_LOG_ERROR("scripts", "InstanceScript::LoadObjectData: " SZFMTD " objects loaded.", _creatureInfo.size() + _gameObjectInfo.size());
+}
+
+void InstanceScript::LoadObjectData(ObjectData const* data, ObjectInfoMap& objectInfo)
+{
+ while (data->entry)
+ {
+ ASSERT(objectInfo.find(data->entry) == objectInfo.end());
+ objectInfo[data->entry] = data->type;
+ ++data;
+ }
+}
+
void InstanceScript::UpdateMinionState(Creature* minion, EncounterState state)
{
switch (state)
@@ -133,6 +191,32 @@ void InstanceScript::UpdateDoorState(GameObject* door)
door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
}
+void InstanceScript::AddObject(Creature* obj, bool add)
+{
+ ObjectInfoMap::const_iterator j = _creatureInfo.find(obj->GetEntry());
+ if (j != _creatureInfo.end())
+ AddObject(obj, j->second, add);
+}
+
+void InstanceScript::AddObject(GameObject* obj, bool add)
+{
+ ObjectInfoMap::const_iterator j = _gameObjectInfo.find(obj->GetEntry());
+ if (j != _gameObjectInfo.end())
+ AddObject(obj, j->second, add);
+}
+
+void InstanceScript::AddObject(WorldObject* obj, uint32 type, bool add)
+{
+ if (add)
+ _objectGuids[type] = obj->GetGUID();
+ else
+ {
+ ObjectGuidMap::iterator i = _objectGuids.find(type);
+ if (i != _objectGuids.end() && i->second == obj->GetGUID())
+ _objectGuids.erase(i);
+ }
+}
+
void InstanceScript::AddDoor(GameObject* door, bool add)
{
DoorInfoMapBounds range = doors.equal_range(door->GetEntry());
@@ -206,7 +290,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state)
return false;
if (state == DONE)
- for (MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
+ for (GuidSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
if (Creature* minion = instance->GetCreature(*i))
if (minion->isWorldBoss() && minion->IsAlive())
return false;
@@ -216,11 +300,11 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state)
}
for (uint32 type = 0; type < MAX_DOOR_TYPES; ++type)
- for (DoorSet::iterator i = bossInfo->door[type].begin(); i != bossInfo->door[type].end(); ++i)
+ for (GuidSet::iterator i = bossInfo->door[type].begin(); i != bossInfo->door[type].end(); ++i)
if (GameObject* door = instance->GetGameObject(*i))
UpdateDoorState(door);
- for (MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
+ for (GuidSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
if (Creature* minion = instance->GetCreature(*i))
UpdateMinionState(minion, state);
@@ -308,7 +392,7 @@ void InstanceScript::WriteSaveDataBossStates(std::ostringstream& data)
data << uint32(bossInfo.state) << ' ';
}
-void InstanceScript::HandleGameObject(uint64 guid, bool open, GameObject* go /*= nullptr*/)
+void InstanceScript::HandleGameObject(ObjectGuid guid, bool open, GameObject* go /*= nullptr*/)
{
if (!go)
go = instance->GetGameObject(guid);
@@ -318,7 +402,7 @@ void InstanceScript::HandleGameObject(uint64 guid, bool open, GameObject* go /*=
TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed");
}
-void InstanceScript::DoUseDoorOrButton(uint64 guid, uint32 withRestoreTime /*= 0*/, bool useAlternativeState /*= false*/)
+void InstanceScript::DoUseDoorOrButton(ObjectGuid guid, uint32 withRestoreTime /*= 0*/, bool useAlternativeState /*= false*/)
{
if (!guid)
return;
@@ -339,7 +423,7 @@ void InstanceScript::DoUseDoorOrButton(uint64 guid, uint32 withRestoreTime /*= 0
TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed");
}
-void InstanceScript::DoRespawnGameObject(uint64 guid, uint32 timeToDespawn /*= MINUTE*/)
+void InstanceScript::DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn /*= MINUTE*/)
{
if (GameObject* go = instance->GetGameObject(guid))
{
@@ -480,7 +564,7 @@ void InstanceScript::SendEncounterUnit(uint32 type, Unit* unit /*= NULL*/, uint8
case ENCOUNTER_FRAME_UPDATE_PRIORITY:
if (!unit)
return;
- data.append(unit->GetPackGUID());
+ data << unit->GetPackGUID();
data << uint8(param1);
break;
case ENCOUNTER_FRAME_ADD_TIMER:
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index 5451849506e..1f190355b15 100644
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -35,9 +35,6 @@ class Player;
class GameObject;
class Creature;
-typedef std::set<uint64> DoorSet;
-typedef std::set<uint64> MinionSet;
-
enum EncounterFrameType
{
ENCOUNTER_FRAME_SET_COMBAT_RES_LIMIT = 0,
@@ -102,12 +99,18 @@ struct MinionData
uint32 entry, bossId;
};
+struct ObjectData
+{
+ uint32 entry;
+ uint32 type;
+};
+
struct BossInfo
{
BossInfo() : state(TO_BE_DECIDED) { }
EncounterState state;
- DoorSet door[MAX_DOOR_TYPES];
- MinionSet minion;
+ GuidSet door[MAX_DOOR_TYPES];
+ GuidSet minion;
BossBoundaryMap boundary;
};
@@ -130,6 +133,8 @@ typedef std::multimap<uint32 /*entry*/, DoorInfo> DoorInfoMap;
typedef std::pair<DoorInfoMap::const_iterator, DoorInfoMap::const_iterator> DoorInfoMapBounds;
typedef std::map<uint32 /*entry*/, MinionInfo> MinionInfoMap;
+typedef std::map<uint32 /*type*/, ObjectGuid /*guid*/> ObjectGuidMap;
+typedef std::map<uint32 /*entry*/, uint32 /*type*/> ObjectInfoMap;
class InstanceScript : public ZoneScript
{
@@ -157,19 +162,39 @@ class InstanceScript : public ZoneScript
// This is to prevent players from entering during boss encounters.
virtual bool IsEncounterInProgress() const;
+ // Called when a creature/gameobject is added to map or removed from map.
+ // Insert/Remove objectguid to dynamic guid store
+ virtual void OnCreatureCreate(Creature* creature) override;
+ virtual void OnCreatureRemove(Creature* creature) override;
+
+ virtual void OnGameObjectCreate(GameObject* go) override;
+ virtual void OnGameObjectRemove(GameObject* go) override;
+
+ ObjectGuid GetObjectGuid(uint32 type) const;
+ virtual ObjectGuid GetGuidData(uint32 type) const override;
+
+ inline Creature* GetCreature(uint32 type)
+ {
+ return ObjectAccessor::GetObjectInMap<Creature>(GetObjectGuid(type), instance, nullptr);
+ }
+ inline GameObject* GetGameObject(uint32 type)
+ {
+ return ObjectAccessor::GetObjectInMap<GameObject>(GetObjectGuid(type), instance, nullptr);
+ }
+
// Called when a player successfully enters the instance.
virtual void OnPlayerEnter(Player* /*player*/) { }
// Handle open / close objects
// * use HandleGameObject(0, boolen, GO); in OnObjectCreate in instance scripts
// * use HandleGameObject(GUID, boolen, NULL); in any other script
- void HandleGameObject(uint64 guid, bool open, GameObject* go = nullptr);
+ void HandleGameObject(ObjectGuid guid, bool open, GameObject* go = nullptr);
// Change active state of doors or buttons
- void DoUseDoorOrButton(uint64 guid, uint32 withRestoreTime = 0, bool useAlternativeState = false);
+ void DoUseDoorOrButton(ObjectGuid guid, uint32 withRestoreTime = 0, bool useAlternativeState = false);
// Respawns a GO having negative spawntimesecs in gameobject-table
- void DoRespawnGameObject(uint64 guid, uint32 timeToDespawn = MINUTE);
+ void DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn = MINUTE);
// Sends world state update to all players in instance
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue);
@@ -202,7 +227,7 @@ class InstanceScript : public ZoneScript
virtual bool CheckAchievementCriteriaMeet(uint32 /*criteria_id*/, Player const* /*source*/, Unit const* /*target*/ = NULL, uint32 /*miscvalue1*/ = 0);
// Checks boss requirements (one boss required to kill other)
- virtual bool CheckRequiredBosses(uint32 /*bossId*/, Player const* /*player*/ = NULL) const { return true; }
+ virtual bool CheckRequiredBosses(uint32 /*bossId*/, Player const* /*player*/ = nullptr) const { return true; }
// Checks encounter state at kill/spellcast
void UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit* source);
@@ -225,6 +250,11 @@ class InstanceScript : public ZoneScript
void SetBossNumber(uint32 number) { bosses.resize(number); }
void LoadDoorData(DoorData const* data);
void LoadMinionData(MinionData const* data);
+ void LoadObjectData(ObjectData const* creatureData, ObjectData const* gameObjectData);
+
+ void AddObject(Creature* obj, bool add);
+ void AddObject(GameObject* obj, bool add);
+ void AddObject(WorldObject* obj, uint32 type, bool add);
void AddDoor(GameObject* door, bool add);
void AddMinion(Creature* minion, bool add);
@@ -241,10 +271,15 @@ class InstanceScript : public ZoneScript
virtual void WriteSaveDataMore(std::ostringstream& /*data*/) { }
private:
+ static void LoadObjectData(ObjectData const* creatureData, ObjectInfoMap& objectInfo);
+
std::vector<char> headers;
std::vector<BossInfo> bosses;
DoorInfoMap doors;
MinionInfoMap minions;
+ ObjectInfoMap _creatureInfo;
+ ObjectInfoMap _gameObjectInfo;
+ ObjectGuidMap _objectGuids;
uint32 completedEncounters; // completed encounter mask, bit indexes are DungeonEncounter.dbc boss numbers, used for packets
};
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 26d348737ab..92694ebc834 100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -161,7 +161,7 @@ uint32 LootStore::LoadLootTable()
if (group >= 1 << 7) // it stored in 7 bit field
{
TC_LOG_ERROR("sql.sql", "Table '%s' entry %d item %d: group (%u) must be less %u - skipped", GetName(), entry, item, group, 1 << 7);
- return false;
+ return 0;
}
LootStoreItem* storeitem = new LootStoreItem(item, chanceOrQuestChance, lootmode, group, mincountOrRef, maxcount);
@@ -620,8 +620,8 @@ 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
- std::set<uint64>::iterator i_next;
- for (std::set<uint64>::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
+ GuidSet::iterator i_next;
+ for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
{
i_next = i;
++i_next;
@@ -635,8 +635,8 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
void Loot::NotifyMoneyRemoved()
{
// notify all players that are looting this that the money was removed
- std::set<uint64>::iterator i_next;
- for (std::set<uint64>::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
+ GuidSet::iterator i_next;
+ for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
{
i_next = i;
++i_next;
@@ -654,8 +654,8 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
// (other questitems can be looted by each group member)
// bit inefficient but isn't called often
- std::set<uint64>::iterator i_next;
- for (std::set<uint64>::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
+ GuidSet::iterator i_next;
+ for (GuidSet::iterator i = PlayersLooting.begin(); i != PlayersLooting.end(); i = i_next)
{
i_next = i;
++i_next;
@@ -916,7 +916,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
continue;
}
}
- else if (l.roundRobinPlayer == 0 || lv.viewer->GetGUID() == l.roundRobinPlayer || !l.items[i].is_underthreshold)
+ else if (l.roundRobinPlayer.IsEmpty() || lv.viewer->GetGUID() == l.roundRobinPlayer || !l.items[i].is_underthreshold)
{
// no round robin owner or he has released the loot
// or it IS the round robin group owner
@@ -940,7 +940,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
{
if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer))
{
- if (l.roundRobinPlayer != 0 && lv.viewer->GetGUID() != l.roundRobinPlayer)
+ if (!l.roundRobinPlayer.IsEmpty() && lv.viewer->GetGUID() != l.roundRobinPlayer)
// item shall not be displayed.
continue;
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index 09905572aae..673e5b6841e 100644
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -24,7 +24,7 @@
#include "RefManager.h"
#include "SharedDefines.h"
#include "ConditionMgr.h"
-
+#include "ObjectGuid.h"
#include <map>
#include <vector>
#include <list>
@@ -318,7 +318,7 @@ struct Loot
std::vector<LootItem> quest_items;
uint32 gold;
uint8 unlootedCount;
- uint64 roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
+ 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)
@@ -326,7 +326,7 @@ struct Loot
// Only set for inventory items that can be right-click looted
uint32 containerID;
- Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), roundRobinPlayer(0), loot_type(LOOT_CORPSE), maxDuplicates(1), containerID(0) { }
+ Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), roundRobinPlayer(), loot_type(LOOT_CORPSE), maxDuplicates(1), containerID(0) { }
~Loot() { clear(); }
// For deleting items at loot removal since there is no backward interface to the Item()
@@ -359,7 +359,7 @@ struct Loot
quest_items.clear();
gold = 0;
unlootedCount = 0;
- roundRobinPlayer = 0;
+ roundRobinPlayer.Clear();
loot_type = LOOT_NONE;
i_LootValidatorRefManager.clearReferences();
}
@@ -370,8 +370,8 @@ struct Loot
void NotifyItemRemoved(uint8 lootIndex);
void NotifyQuestItemRemoved(uint8 questIndex);
void NotifyMoneyRemoved();
- void AddLooter(uint64 GUID) { PlayersLooting.insert(GUID); }
- void RemoveLooter(uint64 GUID) { PlayersLooting.erase(GUID); }
+ 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);
@@ -390,7 +390,7 @@ struct Loot
QuestItemList* FillQuestLoot(Player* player);
QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player, bool presentAtLooting);
- std::set<uint64> PlayersLooting;
+ GuidSet PlayersLooting;
QuestItemMap PlayerQuestItems;
QuestItemMap PlayerFFAItems;
QuestItemMap PlayerNonQuestNonFFAConditionalItems;
diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp
index 2c65e363dd5..2459e468c25 100644
--- a/src/server/game/Mails/Mail.cpp
+++ b/src/server/game/Mails/Mail.cpp
@@ -130,11 +130,12 @@ void MailDraft::deleteIncludedItems(SQLTransaction& trans, bool inDB /*= false*/
void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, SQLTransaction& trans)
{
- Player* receiver = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(receiver_guid, 0, HIGHGUID_PLAYER));
+ ObjectGuid receiverGuid(HIGHGUID_PLAYER, receiver_guid);
+ Player* receiver = ObjectAccessor::FindPlayer(receiverGuid);
uint32 rc_account = 0;
if (!receiver)
- rc_account = sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(receiver_guid, 0, HIGHGUID_PLAYER));
+ rc_account = sObjectMgr->GetPlayerAccountIdByGUID(receiverGuid);
if (!receiver && !rc_account) // sender not exist
{
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 44e270d7625..ab50d16d8f5 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -159,7 +159,7 @@ void Map::LoadMap(int gx, int gy, bool reload)
// load grid map for base map
if (!m_parentMap->GridMaps[gx][gy])
- m_parentMap->EnsureGridCreated(GridCoord(63-gx, 63-gy));
+ m_parentMap->EnsureGridCreated(GridCoord((MAX_NUMBER_OF_GRIDS - 1) - gx, (MAX_NUMBER_OF_GRIDS - 1) - gy));
((MapInstanced*)(m_parentMap))->AddGridMapReference(GridCoord(gx, gy));
GridMaps[gx][gy] = m_parentMap->GridMaps[gx][gy];
@@ -305,7 +305,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on)
CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
if (!p.IsCoordValid())
{
- TC_LOG_ERROR("maps", "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
+ TC_LOG_ERROR("maps", "Map::SwitchGridContainers: Object %s has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID().ToString().c_str(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
return;
}
@@ -313,7 +313,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on)
if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y)))
return;
- TC_LOG_DEBUG("maps", "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
+ TC_LOG_DEBUG("maps", "Switch object %s from grid[%u, %u] %u", obj->GetGUID().ToString().c_str(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
ASSERT(ngrid != NULL);
@@ -342,7 +342,7 @@ void Map::SwitchGridContainers(GameObject* obj, bool on)
CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
if (!p.IsCoordValid())
{
- TC_LOG_ERROR("maps", "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
+ TC_LOG_ERROR("maps", "Map::SwitchGridContainers: Object %s has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID().ToString().c_str(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
return;
}
@@ -350,7 +350,7 @@ void Map::SwitchGridContainers(GameObject* obj, bool on)
if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y)))
return;
- TC_LOG_DEBUG("maps", "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
+ TC_LOG_DEBUG("maps", "Switch object %s from grid[%u, %u] %u", obj->GetGUID().ToString().c_str(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
ASSERT(ngrid != NULL);
@@ -426,7 +426,7 @@ void Map::EnsureGridLoadedForActiveObject(const Cell &cell, WorldObject* object)
// refresh grid state & timer
if (grid->GetGridState() != GRID_STATE_ACTIVE)
{
- TC_LOG_DEBUG("maps", "Active object " UI64FMTD " triggers loading of grid [%u, %u] on map %u", object->GetGUID(), cell.GridX(), cell.GridY(), GetId());
+ TC_LOG_DEBUG("maps", "Active object %s triggers loading of grid [%u, %u] on map %u", object->GetGUID().ToString().c_str(), cell.GridX(), cell.GridY(), GetId());
ResetGridExpiry(*grid, 0.1f);
grid->SetGridState(GRID_STATE_ACTIVE);
}
@@ -524,7 +524,7 @@ bool Map::AddToMap(T* obj)
ASSERT(cellCoord.IsCoordValid());
if (!cellCoord.IsCoordValid())
{
- TC_LOG_ERROR("maps", "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
+ TC_LOG_ERROR("maps", "Map::Add: Object %s has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID().ToString().c_str(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
return false; //Should delete object
}
@@ -534,7 +534,7 @@ bool Map::AddToMap(T* obj)
else
EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
AddToGrid(obj, cell);
- TC_LOG_DEBUG("maps", "Object %u enters grid[%u, %u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY());
+ TC_LOG_DEBUG("maps", "Object %s enters grid[%u, %u]", obj->GetGUID().ToString().c_str(), cell.GridX(), cell.GridY());
//Must already be set before AddToMap. Usually during obj->Create.
//obj->SetMap(this);
@@ -561,7 +561,7 @@ bool Map::AddToMap(Transport* obj)
CellCoord cellCoord = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
if (!cellCoord.IsCoordValid())
{
- TC_LOG_ERROR("maps", "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
+ TC_LOG_ERROR("maps", "Map::Add: Object %s has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID().ToString().c_str(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
return false; //Should delete object
}
@@ -1755,8 +1755,8 @@ uint16 GridMap::getArea(float x, float y) const
if (!_areaMap)
return _gridArea;
- x = 16 * (32 - x/SIZE_OF_GRIDS);
- y = 16 * (32 - y/SIZE_OF_GRIDS);
+ x = 16 * (CENTER_GRID_ID - x/SIZE_OF_GRIDS);
+ y = 16 * (CENTER_GRID_ID - y/SIZE_OF_GRIDS);
int lx = (int)x & 15;
int ly = (int)y & 15;
return _areaMap[lx*16 + ly];
@@ -1772,8 +1772,8 @@ float GridMap::getHeightFromFloat(float x, float y) const
if (!m_V8 || !m_V9)
return _gridHeight;
- x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
- y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
+ x = MAP_RESOLUTION * (CENTER_GRID_ID - x/SIZE_OF_GRIDS);
+ y = MAP_RESOLUTION * (CENTER_GRID_ID - y/SIZE_OF_GRIDS);
int x_int = (int)x;
int y_int = (int)y;
@@ -1854,8 +1854,8 @@ float GridMap::getHeightFromUint8(float x, float y) const
if (!m_uint8_V8 || !m_uint8_V9)
return _gridHeight;
- x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
- y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
+ x = MAP_RESOLUTION * (CENTER_GRID_ID - x/SIZE_OF_GRIDS);
+ y = MAP_RESOLUTION * (CENTER_GRID_ID - y/SIZE_OF_GRIDS);
int x_int = (int)x;
int y_int = (int)y;
@@ -1921,8 +1921,8 @@ float GridMap::getHeightFromUint16(float x, float y) const
if (!m_uint16_V8 || !m_uint16_V9)
return _gridHeight;
- x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
- y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
+ x = MAP_RESOLUTION * (CENTER_GRID_ID - x/SIZE_OF_GRIDS);
+ y = MAP_RESOLUTION * (CENTER_GRID_ID - y/SIZE_OF_GRIDS);
int x_int = (int)x;
int y_int = (int)y;
@@ -1988,8 +1988,8 @@ float GridMap::getLiquidLevel(float x, float y) const
if (!_liquidMap)
return _liquidLevel;
- x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
- y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
+ x = MAP_RESOLUTION * (CENTER_GRID_ID - x/SIZE_OF_GRIDS);
+ y = MAP_RESOLUTION * (CENTER_GRID_ID - y/SIZE_OF_GRIDS);
int cx_int = ((int)x & (MAP_RESOLUTION-1)) - _liquidOffY;
int cy_int = ((int)y & (MAP_RESOLUTION-1)) - _liquidOffX;
@@ -2008,8 +2008,8 @@ uint8 GridMap::getTerrainType(float x, float y) const
if (!_liquidFlags)
return 0;
- x = 16 * (32 - x/SIZE_OF_GRIDS);
- y = 16 * (32 - y/SIZE_OF_GRIDS);
+ x = 16 * (CENTER_GRID_ID - x/SIZE_OF_GRIDS);
+ y = 16 * (CENTER_GRID_ID - y/SIZE_OF_GRIDS);
int lx = (int)x & 15;
int ly = (int)y & 15;
return _liquidFlags[lx*16 + ly];
@@ -2023,8 +2023,8 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R
return LIQUID_MAP_NO_WATER;
// Get cell
- float cx = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
- float cy = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
+ float cx = MAP_RESOLUTION * (CENTER_GRID_ID - x/SIZE_OF_GRIDS);
+ float cy = MAP_RESOLUTION * (CENTER_GRID_ID - y/SIZE_OF_GRIDS);
int x_int = (int)cx & (MAP_RESOLUTION-1);
int y_int = (int)cy & (MAP_RESOLUTION-1);
@@ -2114,11 +2114,11 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R
inline GridMap* Map::GetGrid(float x, float y)
{
// half opt method
- int gx=(int)(32-x/SIZE_OF_GRIDS); //grid x
- int gy=(int)(32-y/SIZE_OF_GRIDS); //grid y
+ int gx=(int)(CENTER_GRID_ID - x/SIZE_OF_GRIDS); //grid x
+ int gy=(int)(CENTER_GRID_ID - y/SIZE_OF_GRIDS); //grid y
// ensure GridMap is loaded
- EnsureGridCreated(GridCoord(63-gx, 63-gy));
+ EnsureGridCreated(GridCoord((MAX_NUMBER_OF_GRIDS - 1) - gx, (MAX_NUMBER_OF_GRIDS - 1) - gy));
return GridMaps[gx][gy];
}
@@ -2967,7 +2967,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
InstanceGroupBind* groupBind = group->GetBoundInstance(this);
if (playerBind && playerBind->save != mapSave)
{
- TC_LOG_ERROR("maps", "InstanceMap::Add: player %s(%d) is being put into instance %s %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetMapName(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
+ TC_LOG_ERROR("maps", "InstanceMap::Add: player %s(%d) is being put into instance %s %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetMapName(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), group->GetLeaderGUID().GetCounter(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
if (groupBind)
TC_LOG_ERROR("maps", "InstanceMap::Add: the group is bound to the instance %s %d, %d, %d, %d, %d, %d", GetMapName(), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
//ASSERT(false);
@@ -2981,7 +2981,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
// cannot jump to a different instance without resetting it
if (groupBind->save != mapSave)
{
- TC_LOG_ERROR("maps", "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
+ TC_LOG_ERROR("maps", "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), group->GetLeaderGUID().GetCounter(), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
TC_LOG_ERROR("maps", "MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount());
if (groupBind->save)
TC_LOG_ERROR("maps", "GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount());
@@ -3085,7 +3085,7 @@ void InstanceMap::CreateInstanceData(bool load)
Field* fields = result->Fetch();
std::string data = fields[0].GetString();
i_data->SetCompletedEncountersMask(fields[1].GetUInt32());
- if (data != "")
+ if (!data.empty())
{
TC_LOG_DEBUG("maps", "Loading instance data for `%s` with id %u", sObjectMgr->GetScriptName(i_script_id), i_InstanceId);
i_data->Load(data.c_str());
@@ -3296,26 +3296,26 @@ void BattlegroundMap::RemoveAllPlayers()
player->TeleportTo(player->GetBattlegroundEntryPoint());
}
-Creature* Map::GetCreature(uint64 guid)
+Creature* Map::GetCreature(ObjectGuid guid)
{
return ObjectAccessor::GetObjectInMap(guid, this, (Creature*)NULL);
}
-GameObject* Map::GetGameObject(uint64 guid)
+GameObject* Map::GetGameObject(ObjectGuid guid)
{
return ObjectAccessor::GetObjectInMap(guid, this, (GameObject*)NULL);
}
-Transport* Map::GetTransport(uint64 guid)
+Transport* Map::GetTransport(ObjectGuid guid)
{
- if (GUID_HIPART(guid) != HIGHGUID_MO_TRANSPORT)
+ if (!guid.IsMOTransport())
return NULL;
GameObject* go = GetGameObject(guid);
return go ? go->ToTransport() : NULL;
}
-DynamicObject* Map::GetDynamicObject(uint64 guid)
+DynamicObject* Map::GetDynamicObject(ObjectGuid guid)
{
return ObjectAccessor::GetObjectInMap(guid, this, (DynamicObject*)NULL);
}
@@ -3440,15 +3440,15 @@ void Map::DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId)
CharacterDatabase.Execute(stmt);
}
-time_t Map::GetLinkedRespawnTime(uint64 guid) const
+time_t Map::GetLinkedRespawnTime(ObjectGuid guid) const
{
- uint64 linkedGuid = sObjectMgr->GetLinkedRespawnGuid(guid);
- switch (GUID_HIPART(linkedGuid))
+ ObjectGuid linkedGuid = sObjectMgr->GetLinkedRespawnGuid(guid);
+ switch (linkedGuid.GetHigh())
{
case HIGHGUID_UNIT:
- return GetCreatureRespawnTime(GUID_LOPART(linkedGuid));
+ return GetCreatureRespawnTime(linkedGuid.GetCounter());
case HIGHGUID_GAMEOBJECT:
- return GetGORespawnTime(GUID_LOPART(linkedGuid));
+ return GetGORespawnTime(linkedGuid.GetCounter());
default:
break;
}
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index a92c78ae951..c0b50b078d8 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -30,6 +30,7 @@
#include "MapRefManager.h"
#include "DynamicTree.h"
#include "GameObjectModel.h"
+#include "ObjectGuid.h"
#include <bitset>
#include <list>
@@ -56,9 +57,9 @@ namespace Trinity { struct ObjectUpdater; }
struct ScriptAction
{
- uint64 sourceGUID;
- uint64 targetGUID;
- uint64 ownerGUID; ///> owner of source if source is item
+ ObjectGuid sourceGUID;
+ ObjectGuid targetGUID;
+ ObjectGuid ownerGUID; ///> owner of source if source is item
ScriptInfo const* script; ///> pointer to static script data
};
@@ -451,10 +452,10 @@ class Map : public GridRefManager<NGridType>
TempSummon* SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties = NULL, uint32 duration = 0, Unit* summoner = NULL, uint32 spellId = 0, uint32 vehId = 0);
void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = NULL);
- Creature* GetCreature(uint64 guid);
- GameObject* GetGameObject(uint64 guid);
- Transport* GetTransport(uint64 guid);
- DynamicObject* GetDynamicObject(uint64 guid);
+ Creature* GetCreature(ObjectGuid guid);
+ GameObject* GetGameObject(ObjectGuid guid);
+ Transport* GetTransport(ObjectGuid guid);
+ DynamicObject* GetDynamicObject(ObjectGuid guid);
MapInstanced* ToMapInstanced() { if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); return NULL; }
MapInstanced const* ToMapInstanced() const { if (Instanceable()) return reinterpret_cast<MapInstanced const*>(this); return NULL; }
@@ -478,7 +479,7 @@ class Map : public GridRefManager<NGridType>
/*
RESPAWN TIMES
*/
- time_t GetLinkedRespawnTime(uint64 guid) const;
+ time_t GetLinkedRespawnTime(ObjectGuid guid) const;
time_t GetCreatureRespawnTime(uint32 dbGuid) const
{
std::unordered_map<uint32 /*dbGUID*/, time_t>::const_iterator itr = _creatureRespawnTimes.find(dbGuid);
diff --git a/src/server/game/Maps/MapInstanced.h b/src/server/game/Maps/MapInstanced.h
index 614764dbba3..ecf7c0a28fc 100644
--- a/src/server/game/Maps/MapInstanced.h
+++ b/src/server/game/Maps/MapInstanced.h
@@ -50,14 +50,14 @@ class MapInstanced : public Map
void AddGridMapReference(const GridCoord &p)
{
++GridMapReference[p.x_coord][p.y_coord];
- SetUnloadReferenceLock(GridCoord(63-p.x_coord, 63-p.y_coord), true);
+ SetUnloadReferenceLock(GridCoord((MAX_NUMBER_OF_GRIDS - 1) - p.x_coord, (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord), true);
}
void RemoveGridMapReference(GridCoord const& p)
{
--GridMapReference[p.x_coord][p.y_coord];
if (!GridMapReference[p.x_coord][p.y_coord])
- SetUnloadReferenceLock(GridCoord(63-p.x_coord, 63-p.y_coord), false);
+ SetUnloadReferenceLock(GridCoord((MAX_NUMBER_OF_GRIDS - 1) - p.x_coord, (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord), false);
}
InstancedMaps &GetInstancedMaps() { return m_InstancedMaps; }
diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp
index cc408988428..ac35b94575c 100644
--- a/src/server/game/Maps/MapManager.cpp
+++ b/src/server/game/Maps/MapManager.cpp
@@ -261,8 +261,8 @@ bool MapManager::ExistMapAndVMap(uint32 mapid, float x, float y)
{
GridCoord p = Trinity::ComputeGridCoord(x, y);
- int gx=63-p.x_coord;
- int gy=63-p.y_coord;
+ int gx = (MAX_NUMBER_OF_GRIDS - 1) - p.x_coord;
+ int gy = (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord;
return Map::ExistMap(mapid, gx, gy) && Map::ExistVMap(mapid, gx, gy);
}
diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h
index 5925806db75..9b1f7622b54 100644
--- a/src/server/game/Maps/ZoneScript.h
+++ b/src/server/game/Maps/ZoneScript.h
@@ -41,6 +41,9 @@ class ZoneScript
virtual void OnUnitDeath(Unit*) { }
//All-purpose data storage 64 bit
+ virtual ObjectGuid GetGuidData(uint32 /*DataId*/) const { return ObjectGuid::Empty; }
+ virtual void SetGuidData(uint32 /*DataId*/, ObjectGuid /*Value*/) { }
+
virtual uint64 GetData64(uint32 /*DataId*/) const { return 0; }
virtual void SetData64(uint32 /*DataId*/, uint64 /*Value*/) { }
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index dc5e28d3308..fe38c0dff62 100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -1202,8 +1202,5 @@ enum TrinityStrings
LANG_NPCINFO_INHABIT_TYPE = 11008,
LANG_NPCINFO_FLAGS_EXTRA = 11009
-
- // NOT RESERVED IDS 12000-1999999999
- // For other tables maybe 2000010000-2147483647 (max index)
};
#endif
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index c0d20c20639..aec90fa2770 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -412,7 +412,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/)
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
}
-void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id, bool generatePath)
+void MotionMaster::MoveCharge(float x, float y, float z, float speed /*= SPEED_CHARGE*/, uint32 id /*= EVENT_CHARGE*/, bool generatePath /*= false*/)
{
if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
return;
@@ -430,16 +430,16 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id,
}
}
-void MotionMaster::MoveCharge(PathGenerator const& path)
+void MotionMaster::MoveCharge(PathGenerator const& path, float speed /*= SPEED_CHARGE*/)
{
G3D::Vector3 dest = path.GetActualEndPosition();
- MoveCharge(dest.x, dest.y, dest.z, SPEED_CHARGE, EVENT_CHARGE_PREPATH);
+ MoveCharge(dest.x, dest.y, dest.z, speed, EVENT_CHARGE_PREPATH);
// Charge movement is not started when using EVENT_CHARGE_PREPATH
Movement::MoveSplineInit init(_owner);
init.MovebyPath(path.GetPath());
- init.SetVelocity(SPEED_CHARGE);
+ init.SetVelocity(speed);
init.Launch();
}
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h
index aabb117ef50..e162e45d962 100644
--- a/src/server/game/Movement/MotionMaster.h
+++ b/src/server/game/Movement/MotionMaster.h
@@ -178,7 +178,7 @@ class MotionMaster //: private std::stack<MovementGenerator *>
void MoveTakeoff(uint32 id, Position const& pos);
void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, bool generatePath = false);
- void MoveCharge(PathGenerator const& path);
+ void MoveCharge(PathGenerator const& path, float speed = SPEED_CHARGE);
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ);
void MoveJumpTo(float angle, float speedXY, float speedZ);
void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = EVENT_JUMP)
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
index c3bcfffb2a7..f2ff4c6839d 100755
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
@@ -25,7 +25,7 @@ template<class T>
class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovementGenerator<T> >
{
public:
- FleeingMovementGenerator(uint64 fright) : i_frightGUID(fright), i_nextCheckTime(0) { }
+ FleeingMovementGenerator(ObjectGuid fright) : i_frightGUID(fright), i_nextCheckTime(0) { }
void DoInitialize(T*);
void DoFinalize(T*);
@@ -38,14 +38,14 @@ class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovem
void _setTargetLocation(T*);
void _getPoint(T*, float &x, float &y, float &z);
- uint64 i_frightGUID;
+ ObjectGuid i_frightGUID;
TimeTracker i_nextCheckTime;
};
class TimedFleeingMovementGenerator : public FleeingMovementGenerator<Creature>
{
public:
- TimedFleeingMovementGenerator(uint64 fright, uint32 time) :
+ TimedFleeingMovementGenerator(ObjectGuid fright, uint32 time) :
FleeingMovementGenerator<Creature>(fright),
i_totalFleeTime(time) { }
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index 8cde9876ca1..b42bfe80a60 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -78,7 +78,7 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature)
if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance)
{
- TC_LOG_DEBUG("maps.script", "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID());
+ TC_LOG_DEBUG("maps.script", "Creature movement start script %u at point %u for %s.", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID().ToString().c_str());
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, NULL);
}
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index e1a15fa52b5..937ce90b23b 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -116,11 +116,11 @@ namespace Movement
move_spline.Initialize(args);
WorldPacket data(SMSG_MONSTER_MOVE, 64);
- data.append(unit->GetPackGUID());
+ data << unit->GetPackGUID();
if (unit->GetTransGUID())
{
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
- data.appendPackGUID(unit->GetTransGUID());
+ data << unit->GetTransGUID().WriteAsPacked();
data << int8(unit->GetTransSeat());
}
@@ -162,11 +162,11 @@ namespace Movement
move_spline.Initialize(args);
WorldPacket data(SMSG_MONSTER_MOVE, 64);
- data.append(unit->GetPackGUID());
+ data << unit->GetPackGUID();
if (transport)
{
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
- data.appendPackGUID(unit->GetTransGUID());
+ data << unit->GetTransGUID().WriteAsPacked();
data << int8(unit->GetTransSeat());
}
@@ -188,7 +188,7 @@ namespace Movement
void MoveSplineInit::SetFacing(const Unit* target)
{
args.flags.EnableFacingTarget();
- args.facing.target = target->GetGUID();
+ args.facing.target = target->GetGUID().GetRawValue();
}
void MoveSplineInit::SetFacing(float angle)
diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp
index 0793e51b164..fa44c19c354 100644
--- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp
+++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp
@@ -161,7 +161,7 @@ namespace Movement
{
case MoveSplineFlag::Final_Target:
{
- ObjectGuid targetGuid = moveSpline.facing.target;
+ ObjectGuid targetGuid(moveSpline.facing.target);
data.WriteBits(2, 2);
data.WriteBit(targetGuid[4]);
data.WriteBit(targetGuid[3]);
@@ -203,7 +203,7 @@ namespace Movement
data << moveSpline.facing.angle;
else if (splineFlags.final_target)
{
- ObjectGuid facingGuid = moveSpline.facing.target;
+ ObjectGuid facingGuid(moveSpline.facing.target);
data.WriteByteSeq(facingGuid[5]);
data.WriteByteSeq(facingGuid[3]);
data.WriteByteSeq(facingGuid[7]);
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index 92a83f9d6f0..c6235839476 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -49,7 +49,7 @@ class DefenseMessageBuilder
};
OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp):
- m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0),
+ m_capturePointGUID(), m_capturePoint(NULL), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0),
m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL),
m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp)
{ }
@@ -89,25 +89,27 @@ void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry)
{
if (!entry)
{
- const GameObjectData* data = sObjectMgr->GetGOData(guid);
+ GameObjectData const* data = sObjectMgr->GetGOData(guid);
if (!data)
return;
entry = data->id;
}
- m_Objects[type] = MAKE_NEW_GUID(guid, entry, HIGHGUID_GAMEOBJECT);
- m_ObjectTypes[m_Objects[type]]=type;
+
+ m_Objects[type] = ObjectGuid(HIGHGUID_GAMEOBJECT, entry, guid);
+ m_ObjectTypes[m_Objects[type]] = type;
}
void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry)
{
if (!entry)
{
- const CreatureData* data = sObjectMgr->GetCreatureData(guid);
+ CreatureData const* data = sObjectMgr->GetCreatureData(guid);
if (!data)
return;
entry = data->id;
}
- m_Creatures[type] = MAKE_NEW_GUID(guid, entry, HIGHGUID_UNIT);
+
+ m_Creatures[type] = ObjectGuid(HIGHGUID_UNIT, entry, guid);
m_CreatureTypes[m_Creatures[type]] = type;
}
@@ -145,7 +147,7 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
return false;
}
- m_capturePointGUID = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3);
+ m_capturePointGUID = ObjectGuid(HIGHGUID_GAMEOBJECT, entry, sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3));
if (!m_capturePointGUID)
return false;
@@ -170,7 +172,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
if (!cr)
{
// can happen when closing the core
- m_Creatures[type] = 0;
+ m_Creatures[type].Clear();
return false;
}
TC_LOG_DEBUG("outdoorpvp", "deleting opvp creature type %u", type);
@@ -193,7 +195,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
cr->AddObjectToRemoveList();
sObjectMgr->DeleteCreatureData(guid);
m_CreatureTypes[m_Creatures[type]] = 0;
- m_Creatures[type] = 0;
+ m_Creatures[type].Clear();
return true;
}
@@ -205,7 +207,7 @@ bool OPvPCapturePoint::DelObject(uint32 type)
GameObject* obj = HashMapHolder<GameObject>::Find(m_Objects[type]);
if (!obj)
{
- m_Objects[type] = 0;
+ m_Objects[type].Clear();
return false;
}
uint32 guid = obj->GetDBTableGUIDLow();
@@ -213,14 +215,14 @@ bool OPvPCapturePoint::DelObject(uint32 type)
obj->Delete();
sObjectMgr->DeleteGOData(guid);
m_ObjectTypes[m_Objects[type]] = 0;
- m_Objects[type] = 0;
+ m_Objects[type].Clear();
return true;
}
bool OPvPCapturePoint::DelCapturePoint()
{
- sObjectMgr->DeleteGOData(m_capturePointGUID);
- m_capturePointGUID = 0;
+ sObjectMgr->DeleteGOData(m_capturePointGUID.GetCounter());
+ m_capturePointGUID.Clear();
if (m_capturePoint)
{
@@ -233,9 +235,9 @@ bool OPvPCapturePoint::DelCapturePoint()
void OPvPCapturePoint::DeleteSpawns()
{
- for (std::map<uint32, uint64>::iterator i = m_Objects.begin(); i != m_Objects.end(); ++i)
+ for (std::map<uint32, ObjectGuid>::iterator i = m_Objects.begin(); i != m_Objects.end(); ++i)
DelObject(i->first);
- for (std::map<uint32, uint64>::iterator i = m_Creatures.begin(); i != m_Creatures.end(); ++i)
+ for (std::map<uint32, ObjectGuid>::iterator i = m_Creatures.begin(); i != m_Creatures.end(); ++i)
DelCreature(i->first);
DelCapturePoint();
}
@@ -296,9 +298,9 @@ bool OPvPCapturePoint::Update(uint32 diff)
for (uint32 team = 0; team < 2; ++team)
{
- for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
{
- uint64 playerGuid = *itr;
+ ObjectGuid playerGuid = *itr;
++itr;
if (Player* player = ObjectAccessor::FindPlayer(playerGuid))
@@ -413,7 +415,7 @@ void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value)
{
if (m_sendUpdate)
for (int i = 0; i < 2; ++i)
- for (PlayerSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
+ for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
player->SendUpdateWorldState(field, value);
}
@@ -423,13 +425,13 @@ void OPvPCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
for (uint32 team = 0; team < 2; ++team)
{
// send to all players present in the area
- for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
player->SendUpdateWorldState(field, value);
}
}
-void OPvPCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
+void OPvPCapturePoint::SendObjectiveComplete(uint32 id, ObjectGuid guid)
{
uint32 team;
switch (m_State)
@@ -445,7 +447,7 @@ void OPvPCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
}
// send to all players present in the area
- for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
player->KilledMonsterCredit(id, guid);
}
@@ -490,7 +492,7 @@ bool OutdoorPvP::IsInsideObjective(Player* player) const
bool OPvPCapturePoint::IsInsideObjective(Player* player) const
{
- PlayerSet const &plSet = m_activePlayers[player->GetTeamId()];
+ GuidSet const &plSet = m_activePlayers[player->GetTeamId()];
return plSet.find(player->GetGUID()) != plSet.end();
}
@@ -510,7 +512,7 @@ bool OPvPCapturePoint::HandleCustomSpell(Player* player, uint32 /*spellId*/, Gam
return false;
}
-bool OutdoorPvP::HandleOpenGo(Player* player, uint64 guid)
+bool OutdoorPvP::HandleOpenGo(Player* player, ObjectGuid guid)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if (itr->second->HandleOpenGo(player, guid) >= 0)
@@ -519,7 +521,7 @@ bool OutdoorPvP::HandleOpenGo(Player* player, uint64 guid)
return false;
}
-bool OutdoorPvP::HandleGossipOption(Player* player, uint64 guid, uint32 id)
+bool OutdoorPvP::HandleGossipOption(Player* player, ObjectGuid guid, uint32 id)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if (itr->second->HandleGossipOption(player, guid, id))
@@ -546,7 +548,7 @@ bool OutdoorPvP::HandleDropFlag(Player* player, uint32 id)
return false;
}
-bool OPvPCapturePoint::HandleGossipOption(Player* /*player*/, uint64 /*guid*/, uint32 /*id*/)
+bool OPvPCapturePoint::HandleGossipOption(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*id*/)
{
return false;
}
@@ -561,9 +563,9 @@ bool OPvPCapturePoint::HandleDropFlag(Player* /*player*/, uint32 /*id*/)
return false;
}
-int32 OPvPCapturePoint::HandleOpenGo(Player* /*player*/, uint64 guid)
+int32 OPvPCapturePoint::HandleOpenGo(Player* /*player*/, ObjectGuid guid)
{
- std::map<uint64, uint32>::iterator itr = m_ObjectTypes.find(guid);
+ std::map<ObjectGuid, uint32>::iterator itr = m_ObjectTypes.find(guid);
if (itr != m_ObjectTypes.end())
{
return itr->second;
@@ -580,7 +582,7 @@ void OutdoorPvP::BroadcastPacket(WorldPacket &data) const
{
// This is faster than sWorld->SendZoneMessage
for (uint32 team = 0; team < 2; ++team)
- for (PlayerSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
player->GetSession()->SendPacket(&data);
}
@@ -592,7 +594,7 @@ void OutdoorPvP::RegisterZone(uint32 zoneId)
bool OutdoorPvP::HasPlayer(Player const* player) const
{
- PlayerSet const &plSet = m_players[player->GetTeamId()];
+ GuidSet const &plSet = m_players[player->GetTeamId()];
return plSet.find(player->GetGUID()) != plSet.end();
}
@@ -600,13 +602,13 @@ void OutdoorPvP::TeamCastSpell(TeamId team, int32 spellId)
{
if (spellId > 0)
{
- for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
player->CastSpell(player, (uint32)spellId, true);
}
else
{
- for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
player->RemoveAura((uint32)-spellId); // by stack?
}
@@ -623,7 +625,7 @@ void OutdoorPvP::OnGameObjectCreate(GameObject* go)
if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT)
return;
- if (OPvPCapturePoint *cp = GetCapturePoint(go->GetDBTableGUIDLow()))
+ if (OPvPCapturePoint *cp = GetCapturePoint(go->GetGUID()))
cp->m_capturePoint = go;
}
@@ -632,7 +634,7 @@ void OutdoorPvP::OnGameObjectRemove(GameObject* go)
if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT)
return;
- if (OPvPCapturePoint *cp = GetCapturePoint(go->GetDBTableGUIDLow()))
+ if (OPvPCapturePoint *cp = GetCapturePoint(go->GetGUID()))
cp->m_capturePoint = NULL;
}
@@ -647,7 +649,7 @@ template<class Worker>
void OutdoorPvP::BroadcastWorker(Worker& _worker, uint32 zoneId)
{
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
- for (PlayerSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
+ for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
if (player->GetZoneId() == zoneId)
_worker(player);
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h
index b4e546164d0..c3161cc8cdd 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.h
@@ -83,8 +83,6 @@ class Unit;
struct GossipMenuItems;
class OutdoorPvP;
-typedef std::set<uint64> PlayerSet;
-
class OPvPCapturePoint
{
public:
@@ -99,7 +97,7 @@ class OPvPCapturePoint
void SendUpdateWorldState(uint32 field, uint32 value);
// send kill notify to players in the controlling faction
- void SendObjectiveComplete(uint32 id, uint64 guid);
+ void SendObjectiveComplete(uint32 id, ObjectGuid guid);
// used when player is activated/inactivated in the area
virtual bool HandlePlayerEnter(Player* player);
@@ -110,7 +108,7 @@ class OPvPCapturePoint
virtual bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
- virtual int32 HandleOpenGo(Player* player, uint64 guid);
+ virtual int32 HandleOpenGo(Player* player, ObjectGuid guid);
// returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
virtual bool Update(uint32 diff);
@@ -121,7 +119,7 @@ class OPvPCapturePoint
virtual void SendChangePhase();
- virtual bool HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
+ virtual bool HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid);
virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso);
@@ -129,7 +127,7 @@ class OPvPCapturePoint
virtual void DeleteSpawns();
- uint32 m_capturePointGUID;
+ ObjectGuid m_capturePointGUID;
GameObject* m_capturePoint;
@@ -153,7 +151,7 @@ class OPvPCapturePoint
protected:
// active players in the area of the objective, 0 - alliance, 1 - horde
- PlayerSet m_activePlayers[2];
+ GuidSet m_activePlayers[2];
// total shift needed to capture the objective
float m_maxValue;
@@ -179,10 +177,10 @@ class OPvPCapturePoint
// map to store the various gameobjects and creatures spawned by the objective
// type, guid
- std::map<uint32, uint64> m_Objects;
- std::map<uint32, uint64> m_Creatures;
- std::map<uint64, uint32> m_ObjectTypes;
- std::map<uint64, uint32> m_CreatureTypes;
+ std::map<uint32, ObjectGuid> m_Objects;
+ std::map<uint32, ObjectGuid> m_Creatures;
+ std::map<ObjectGuid, uint32> m_ObjectTypes;
+ std::map<ObjectGuid, uint32> m_CreatureTypes;
};
// base class for specific outdoor pvp handlers
@@ -201,7 +199,7 @@ class OutdoorPvP : public ZoneScript
// deletes all gos/creatures spawned by the pvp
void DeleteSpawns();
- typedef std::map<uint32/*lowguid*/, OPvPCapturePoint*> OPvPCapturePointMap;
+ typedef std::map<ObjectGuid/*guid*/, OPvPCapturePoint*> OPvPCapturePointMap;
virtual void FillInitialWorldStates(WorldPacket & /*data*/) { }
@@ -212,7 +210,7 @@ class OutdoorPvP : public ZoneScript
virtual bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
// called on go use
- virtual bool HandleOpenGo(Player* player, uint64 guid);
+ virtual bool HandleOpenGo(Player* player, ObjectGuid guid);
// setup stuff
virtual bool SetupOutdoorPvP() {return true;}
@@ -241,7 +239,7 @@ class OutdoorPvP : public ZoneScript
virtual bool HandleDropFlag(Player* player, uint32 spellId);
- virtual bool HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
+ virtual bool HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid);
virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso);
@@ -267,7 +265,7 @@ class OutdoorPvP : public ZoneScript
// the map of the objectives belonging to this outdoorpvp
OPvPCapturePointMap m_capturePoints;
- PlayerSet m_players[2];
+ GuidSet m_players[2];
uint32 m_TypeId;
@@ -288,9 +286,9 @@ class OutdoorPvP : public ZoneScript
m_capturePoints[cp->m_capturePointGUID] = cp;
}
- OPvPCapturePoint * GetCapturePoint(uint32 lowguid) const
+ OPvPCapturePoint * GetCapturePoint(ObjectGuid guid) const
{
- OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
+ OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.find(guid);
if (itr != m_capturePoints.end())
return itr->second;
return NULL;
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
index 5306a3ca3c1..4f423457b90 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
@@ -181,7 +181,7 @@ ZoneScript* OutdoorPvPMgr::GetZoneScript(uint32 zoneId)
return NULL;
}
-bool OutdoorPvPMgr::HandleOpenGo(Player* player, uint64 guid)
+bool OutdoorPvPMgr::HandleOpenGo(Player* player, ObjectGuid guid)
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
{
@@ -191,7 +191,7 @@ bool OutdoorPvPMgr::HandleOpenGo(Player* player, uint64 guid)
return false;
}
-void OutdoorPvPMgr::HandleGossipOption(Player* player, uint64 guid, uint32 gossipid)
+void OutdoorPvPMgr::HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid)
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
{
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
index bf2f14a291f..bbcad8074e1 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
@@ -70,7 +70,7 @@ class OutdoorPvPMgr
bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
// handle custom go if registered
- bool HandleOpenGo(Player* player, uint64 guid);
+ bool HandleOpenGo(Player* player, ObjectGuid guid);
ZoneScript* GetZoneScript(uint32 zoneId);
@@ -78,7 +78,7 @@ class OutdoorPvPMgr
void Update(uint32 diff);
- void HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
+ void HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid);
bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso);
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index b12b5f187ad..3ada9d9740b 100644
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -221,7 +221,7 @@ void PoolGroup<Creature>::Despawn1Object(uint32 guid)
{
sObjectMgr->RemoveCreatureFromGrid(guid, data);
- if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT), (Creature*)NULL))
+ if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, data->id, guid), (Creature*)NULL))
creature->AddObjectToRemoveList();
}
}
@@ -234,7 +234,7 @@ void PoolGroup<GameObject>::Despawn1Object(uint32 guid)
{
sObjectMgr->RemoveGameobjectFromGrid(guid, data);
- if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL))
+ if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, guid), (GameObject*)NULL))
pGameobject->AddObjectToRemoveList();
}
}
@@ -510,7 +510,7 @@ template <>
void PoolGroup<Creature>::ReSpawn1Object(PoolObject* obj)
{
if (CreatureData const* data = sObjectMgr->GetCreatureData(obj->guid))
- if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(obj->guid, data->id, HIGHGUID_UNIT), (Creature*)NULL))
+ if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, data->id, obj->guid), (Creature*)NULL))
creature->GetMap()->AddToMap(creature);
}
@@ -519,7 +519,7 @@ template <>
void PoolGroup<GameObject>::ReSpawn1Object(PoolObject* obj)
{
if (GameObjectData const* data = sObjectMgr->GetGOData(obj->guid))
- if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(obj->guid, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL))
+ if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, obj->guid), (GameObject*)NULL))
pGameobject->GetMap()->AddToMap(pGameobject);
}
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 888c1ec7e8d..8a49878aa50 100644
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -40,9 +40,9 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O
return;
// prepare static data
- uint64 sourceGUID = source ? source->GetGUID() : uint64(0); //some script commands doesn't have source
- uint64 targetGUID = target ? target->GetGUID() : uint64(0);
- uint64 ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : uint64(0);
+ ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty; //some script commands doesn't have source
+ ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty;
+ ObjectGuid ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty;
///- Schedule script execution for all scripts in the script map
ScriptMap const* s2 = &(s->second);
@@ -75,9 +75,9 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
// NOTE: script record _must_ exist until command executed
// prepare static data
- uint64 sourceGUID = source ? source->GetGUID() : uint64(0);
- uint64 targetGUID = target ? target->GetGUID() : uint64(0);
- uint64 ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : uint64(0);
+ ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty;
+ ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty;
+ ObjectGuid ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty;
ScriptAction sa;
sa.sourceGUID = sourceGUID;
@@ -299,7 +299,7 @@ void Map::ScriptsProcess()
Object* source = NULL;
if (step.sourceGUID)
{
- switch (GUID_HIPART(step.sourceGUID))
+ switch (step.sourceGUID.GetHigh())
{
case HIGHGUID_ITEM: // as well as HIGHGUID_CONTAINER
if (Player* player = HashMapHolder<Player>::Find(step.ownerGUID))
@@ -329,8 +329,8 @@ void Map::ScriptsProcess()
break;
}
default:
- TC_LOG_ERROR("scripts", "%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
- step.script->GetDebugInfo().c_str(), step.sourceGUID, GUID_HIPART(step.sourceGUID));
+ TC_LOG_ERROR("scripts", "%s source with unsupported high guid %s.",
+ step.script->GetDebugInfo().c_str(), step.sourceGUID.ToString().c_str());
break;
}
}
@@ -338,7 +338,7 @@ void Map::ScriptsProcess()
WorldObject* target = NULL;
if (step.targetGUID)
{
- switch (GUID_HIPART(step.targetGUID))
+ switch (step.targetGUID.GetHigh())
{
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE:
@@ -364,8 +364,8 @@ void Map::ScriptsProcess()
break;
}
default:
- TC_LOG_ERROR("scripts", "%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
- step.script->GetDebugInfo().c_str(), step.targetGUID, GUID_HIPART(step.targetGUID));
+ TC_LOG_ERROR("scripts", "%s target with unsupported high guid %s.",
+ step.script->GetDebugInfo().c_str(), step.targetGUID.ToString().c_str());
break;
}
}
@@ -374,12 +374,11 @@ void Map::ScriptsProcess()
{
case SCRIPT_COMMAND_TALK:
{
- if (step.script->Talk.ChatType > CHAT_TYPE_WHISPER && step.script->Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER)
+ if (step.script->Talk.ChatType > CHAT_TYPE_BOSS_WHISPER)
{
TC_LOG_ERROR("scripts", "%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType);
break;
}
- Unit* source = nullptr;
if (step.script->Talk.Flags & SF_TALK_USE_PLAYER)
source = _GetScriptPlayerSourceOrTarget(source, target, step.script);
@@ -388,26 +387,33 @@ void Map::ScriptsProcess()
if (source)
{
+ Unit* sourceUnit = source->ToUnit();
+ if (!sourceUnit)
+ {
+ TC_LOG_ERROR("scripts", "%s source object (%s) is not an unit, skipping.", step.script->GetDebugInfo().c_str(), source->GetGUID().ToString().c_str());
+ break;
+ }
+
switch (step.script->Talk.ChatType)
{
case CHAT_TYPE_SAY:
- source->Say(step.script->Talk.TextID, target);
+ sourceUnit->Say(step.script->Talk.TextID, target);
break;
case CHAT_TYPE_YELL:
- source->Yell(step.script->Talk.TextID, target);
+ sourceUnit->Yell(step.script->Talk.TextID, target);
break;
case CHAT_TYPE_TEXT_EMOTE:
case CHAT_TYPE_BOSS_EMOTE:
- source->TextEmote(step.script->Talk.TextID, target, step.script->Talk.ChatType == CHAT_TYPE_BOSS_EMOTE);
+ sourceUnit->TextEmote(step.script->Talk.TextID, target, step.script->Talk.ChatType == CHAT_TYPE_BOSS_EMOTE);
break;
case CHAT_TYPE_WHISPER:
- case CHAT_MSG_RAID_BOSS_WHISPER:
+ case CHAT_TYPE_BOSS_WHISPER:
{
Player* receiver = target ? target->ToPlayer() : nullptr;
if (!receiver)
TC_LOG_ERROR("scripts", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
else
- source->Whisper(step.script->Talk.TextID, receiver, step.script->Talk.ChatType == CHAT_MSG_RAID_BOSS_WHISPER);
+ sourceUnit->Whisper(step.script->Talk.TextID, receiver, step.script->Talk.ChatType == CHAT_TYPE_BOSS_WHISPER);
break;
}
default:
@@ -434,9 +440,9 @@ void Map::ScriptsProcess()
{
// Validate field number.
if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount())
- TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
+ TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, %s) specified, skipping.",
step.script->GetDebugInfo().c_str(), step.script->FieldSet.FieldID,
- cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow());
+ cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetGUID().ToString().c_str());
else
cSource->SetUInt32Value(step.script->FieldSet.FieldID, step.script->FieldSet.FieldValue);
}
@@ -565,7 +571,7 @@ void Map::ScriptsProcess()
if (step.script->KillCredit.Flags & SF_KILLCREDIT_REWARD_GROUP)
player->RewardPlayerAndGroupAtEvent(step.script->KillCredit.CreatureEntry, player);
else
- player->KilledMonsterCredit(step.script->KillCredit.CreatureEntry, 0);
+ player->KilledMonsterCredit(step.script->KillCredit.CreatureEntry);
}
break;
@@ -805,7 +811,7 @@ void Map::ScriptsProcess()
else //check hashmap holders
{
if (CreatureData const* data = sObjectMgr->GetCreatureData(step.script->CallScript.CreatureEntry))
- cTarget = ObjectAccessor::GetObjectInWorld<Creature>(data->mapid, data->posX, data->posY, MAKE_NEW_GUID(step.script->CallScript.CreatureEntry, data->id, HIGHGUID_UNIT), cTarget);
+ cTarget = ObjectAccessor::GetObjectInWorld<Creature>(data->mapid, data->posX, data->posY, ObjectGuid(HIGHGUID_UNIT, data->id, step.script->CallScript.CreatureEntry), cTarget);
}
if (!cTarget)
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index be75f42492a..448911aa82d 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -1240,7 +1240,7 @@ void ScriptMgr::OnPlayerEmote(Player* player, uint32 emote)
FOREACH_SCRIPT(PlayerScript)->OnEmote(player, emote);
}
-void ScriptMgr::OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, uint64 guid)
+void ScriptMgr::OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid)
{
FOREACH_SCRIPT(PlayerScript)->OnTextEmote(player, textEmote, emoteNum, guid);
}
@@ -1265,12 +1265,12 @@ void ScriptMgr::OnPlayerCreate(Player* player)
FOREACH_SCRIPT(PlayerScript)->OnCreate(player);
}
-void ScriptMgr::OnPlayerDelete(uint64 guid, uint32 accountId)
+void ScriptMgr::OnPlayerDelete(ObjectGuid guid, uint32 accountId)
{
FOREACH_SCRIPT(PlayerScript)->OnDelete(guid, accountId);
}
-void ScriptMgr::OnPlayerFailedDelete(uint64 guid, uint32 accountId)
+void ScriptMgr::OnPlayerFailedDelete(ObjectGuid guid, uint32 accountId)
{
FOREACH_SCRIPT(PlayerScript)->OnFailedDelete(guid, accountId);
}
@@ -1384,25 +1384,25 @@ void ScriptMgr::OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uin
}
// Group
-void ScriptMgr::OnGroupAddMember(Group* group, uint64 guid)
+void ScriptMgr::OnGroupAddMember(Group* group, ObjectGuid guid)
{
ASSERT(group);
FOREACH_SCRIPT(GroupScript)->OnAddMember(group, guid);
}
-void ScriptMgr::OnGroupInviteMember(Group* group, uint64 guid)
+void ScriptMgr::OnGroupInviteMember(Group* group, ObjectGuid guid)
{
ASSERT(group);
FOREACH_SCRIPT(GroupScript)->OnInviteMember(group, guid);
}
-void ScriptMgr::OnGroupRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason)
+void ScriptMgr::OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, const char* reason)
{
ASSERT(group);
FOREACH_SCRIPT(GroupScript)->OnRemoveMember(group, guid, method, kicker, reason);
}
-void ScriptMgr::OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
+void ScriptMgr::OnGroupChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid)
{
ASSERT(group);
FOREACH_SCRIPT(GroupScript)->OnChangeLeader(group, newLeaderGuid, oldLeaderGuid);
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 14155b536a3..5d63844d946 100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -737,7 +737,7 @@ class PlayerScript : public UnitScript
// Both of the below are called on emote opcodes.
virtual void OnEmote(Player* /*player*/, uint32 /*emote*/) { }
- virtual void OnTextEmote(Player* /*player*/, uint32 /*textEmote*/, uint32 /*emoteNum*/, uint64 /*guid*/) { }
+ virtual void OnTextEmote(Player* /*player*/, uint32 /*textEmote*/, uint32 /*emoteNum*/, ObjectGuid /*guid*/) { }
// Called in Spell::Cast.
virtual void OnSpellCast(Player* /*player*/, Spell* /*spell*/, bool /*skipCheck*/) { }
@@ -752,10 +752,10 @@ class PlayerScript : public UnitScript
virtual void OnCreate(Player* /*player*/) { }
// Called when a player is deleted.
- virtual void OnDelete(uint64 /*guid*/, uint32 /*accountId*/) { }
+ virtual void OnDelete(ObjectGuid /*guid*/, uint32 /*accountId*/) { }
// Called when a player delete failed
- virtual void OnFailedDelete(uint64 /*guid*/, uint32 /*accountId*/) { }
+ virtual void OnFailedDelete(ObjectGuid /*guid*/, uint32 /*accountId*/) { }
// Called when a player is about to be saved.
virtual void OnSave(Player* /*player*/) { }
@@ -854,16 +854,16 @@ class GroupScript : public ScriptObject
bool IsDatabaseBound() const final override { return false; }
// Called when a member is added to a group.
- virtual void OnAddMember(Group* /*group*/, uint64 /*guid*/) { }
+ virtual void OnAddMember(Group* /*group*/, ObjectGuid /*guid*/) { }
// Called when a member is invited to join a group.
- virtual void OnInviteMember(Group* /*group*/, uint64 /*guid*/) { }
+ virtual void OnInviteMember(Group* /*group*/, ObjectGuid /*guid*/) { }
// Called when a member is removed from a group.
- virtual void OnRemoveMember(Group* /*group*/, uint64 /*guid*/, RemoveMethod /*method*/, uint64 /*kicker*/, const char* /*reason*/) { }
+ virtual void OnRemoveMember(Group* /*group*/, ObjectGuid /*guid*/, RemoveMethod /*method*/, ObjectGuid /*kicker*/, const char* /*reason*/) { }
// Called when the leader of a group is changed.
- virtual void OnChangeLeader(Group* /*group*/, uint64 /*newLeaderGuid*/, uint64 /*oldLeaderGuid*/) { }
+ virtual void OnChangeLeader(Group* /*group*/, ObjectGuid /*newLeaderGuid*/, ObjectGuid /*oldLeaderGuid*/) { }
// Called when a group is disbanded.
virtual void OnDisband(Group* /*group*/) { }
@@ -1067,13 +1067,13 @@ class ScriptMgr
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild);
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Channel* channel);
void OnPlayerEmote(Player* player, uint32 emote);
- void OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, uint64 guid);
+ void OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid);
void OnPlayerSpellCast(Player* player, Spell* spell, bool skipCheck);
void OnPlayerLogin(Player* player, bool firstLogin);
void OnPlayerLogout(Player* player);
void OnPlayerCreate(Player* player);
- void OnPlayerDelete(uint64 guid, uint32 accountId);
- void OnPlayerFailedDelete(uint64 guid, uint32 accountId);
+ void OnPlayerDelete(ObjectGuid guid, uint32 accountId);
+ void OnPlayerFailedDelete(ObjectGuid guid, uint32 accountId);
void OnPlayerSave(Player* player);
void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent);
void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea);
@@ -1105,10 +1105,10 @@ class ScriptMgr
public: /* GroupScript */
- void OnGroupAddMember(Group* group, uint64 guid);
- void OnGroupInviteMember(Group* group, uint64 guid);
- void OnGroupRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason);
- void OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid);
+ void OnGroupAddMember(Group* group, ObjectGuid guid);
+ void OnGroupInviteMember(Group* group, ObjectGuid guid);
+ void OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, const char* reason);
+ void OnGroupChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid);
void OnGroupDisband(Group* group);
public: /* UnitScript */
diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp
index 8bd5bbf5a90..8ee3fade39f 100644
--- a/src/server/game/Server/Protocol/PacketLog.cpp
+++ b/src/server/game/Server/Protocol/PacketLog.cpp
@@ -98,7 +98,7 @@ void PacketLog::Initialize()
}
}
-void PacketLog::LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address addr, uint16 port)
+void PacketLog::LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address const& addr, uint16 port)
{
std::lock_guard<std::mutex> lock(_logPacketLock);
diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h
index 36e8c675f63..06674b88b9e 100644
--- a/src/server/game/Server/Protocol/PacketLog.h
+++ b/src/server/game/Server/Protocol/PacketLog.h
@@ -48,7 +48,7 @@ class PacketLog
void Initialize();
bool CanLogPacket() const { return (_file != NULL); }
- void LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address addr, uint16 port);
+ void LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address const& addr, uint16 port);
private:
FILE* _file;
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 6d0ea9ea7a4..428e0582867 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -128,7 +128,7 @@ WorldSession::WorldSession(uint32 id, uint32 battlenetAccountId, std::shared_ptr
_RBACData(NULL),
expireTime(60000), // 1 min after socket loss, session is deleted
forceExit(false),
- m_currentBankerGUID(0)
+ m_currentBankerGUID()
{
memset(m_Tutorials, 0, sizeof(m_Tutorials));
@@ -192,9 +192,11 @@ std::string WorldSession::GetPlayerInfo() const
{
std::ostringstream ss;
- ss << "[Player: " << GetPlayerName()
- << " (Guid: " << (_player != NULL ? _player->GetGUID() : 0)
- << ", Account: " << GetAccountId() << ")]";
+ ss << "[Player: " << GetPlayerName() << " (";
+ if (_player != NULL)
+ ss << _player->GetGUID().ToString() << ", ";
+
+ ss << "Account: " << GetAccountId() << ")]";
return ss.str();
}
@@ -476,7 +478,7 @@ void WorldSession::LogoutPlayer(bool save)
if (_player)
{
- if (uint64 lguid = _player->GetLootGUID())
+ if (ObjectGuid lguid = _player->GetLootGUID())
DoLootRelease(lguid);
///- If the player just died before logging out, make him appear as a ghost
@@ -543,7 +545,7 @@ void WorldSession::LogoutPlayer(bool save)
for (int j = BUYBACK_SLOT_START; j < BUYBACK_SLOT_END; ++j)
{
eslot = j - BUYBACK_SLOT_START;
- _player->SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), 0);
+ _player->SetGuidValue(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), ObjectGuid::Empty);
_player->SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0);
_player->SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, 0);
}
@@ -656,7 +658,7 @@ void WorldSession::SendNotification(uint32 string_id, ...)
}
}
-const char *WorldSession::GetTrinityString(int32 entry) const
+char const* WorldSession::GetTrinityString(uint32 entry) const
{
return sObjectMgr->GetTrinityString(entry, GetSessionDbLocaleIndex());
}
@@ -1089,7 +1091,7 @@ void WorldSession::ProcessQueryCallbacks()
//- SendStabledPet
if (_sendStabledPetCallback.IsReady())
{
- uint64 param = _sendStabledPetCallback.GetParam();
+ ObjectGuid param = _sendStabledPetCallback.GetParam();
_sendStabledPetCallback.GetResult(result);
SendStablePetCallback(result, param);
_sendStabledPetCallback.FreeResult();
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 7f4c487b607..4ec407f5254 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -287,38 +287,37 @@ class WorldSession
/// Handle the authentication waiting queue (to be completed)
void SendAuthWaitQue(uint32 position);
- //void SendTestCreatureQueryOpcode(uint32 entry, uint64 guid, uint32 testvalue);
- void SendNameQueryOpcode(uint64 guid);
-
- bool CanOpenMailBox(uint64 guid);
-
- void SendTrainerList(uint64 guid);
- void SendTrainerList(uint64 guid, std::string const& strTitle);
- void SendListInventory(uint64 guid);
- void SendShowBank(uint64 guid);
- void SendTabardVendorActivate(uint64 guid);
+ void SendNameQueryOpcode(ObjectGuid guid);
+
+ void SendTrainerList(ObjectGuid guid);
+ void SendTrainerList(ObjectGuid guid, std::string const& strTitle);
+ void SendListInventory(ObjectGuid guid);
+ void SendShowBank(ObjectGuid guid);
+ bool CanOpenMailBox(ObjectGuid guid);
+ void SendShowMailBox(ObjectGuid guid);
+ void SendTabardVendorActivate(ObjectGuid guid);
void SendSpiritResurrect();
void SendBindPoint(Creature* npc);
void SendAttackStop(Unit const* enemy);
- void SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId = BATTLEGROUND_RB);
+ void SendBattleGroundList(ObjectGuid guid, BattlegroundTypeId bgTypeId = BATTLEGROUND_RB);
void SendTradeStatus(TradeStatusInfo const& status);
void SendUpdateTrade(bool trader_data = true);
void SendCancelTrade();
- void SendPetitionQueryOpcode(uint64 petitionguid);
+ void SendPetitionQueryOpcode(ObjectGuid petitionguid);
// Spell
- void HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets & targets);
+ void HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets);
// Pet
- void SendPetNameQuery(uint64 guid, uint32 petnumber);
- void SendStablePet(uint64 guid);
- void SendStablePetCallback(PreparedQueryResult result, uint64 guid);
+ void SendPetNameQuery(ObjectGuid guid, uint32 petnumber);
+ void SendStablePet(ObjectGuid guid);
+ void SendStablePetCallback(PreparedQueryResult result, ObjectGuid guid);
void SendStableResult(uint8 guid);
- bool CheckStableMaster(uint64 guid);
+ bool CheckStableMaster(ObjectGuid guid);
// Account Data
AccountData* GetAccountData(AccountDataType type) { return &m_accountData[type]; }
@@ -342,18 +341,18 @@ class WorldSession
//used with item_page table
bool SendItemInfo(uint32 itemid, WorldPacket data);
//auction
- void SendAuctionHello(uint64 guid, Creature* unit);
+ void SendAuctionHello(ObjectGuid guid, Creature* unit);
void SendAuctionCommandResult(AuctionEntry* auction, uint32 Action, uint32 ErrorCode, uint32 bidError = 0);
- void SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template);
+ void SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 item_template);
void SendAuctionOwnerNotification(AuctionEntry* auction);
void SendAuctionRemovedNotification(uint32 auctionId, uint32 itemEntry, int32 randomPropertyId);
//Item Enchantment
- void SendEnchantmentLog(uint64 target, uint64 caster, uint32 itemId, uint32 enchantId);
- void SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid, uint32 slot, uint32 Duration);
+ void SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId);
+ void SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration);
//Taxi
- void SendTaxiStatus(uint64 guid);
+ void SendTaxiStatus(ObjectGuid guid);
void SendTaxiMenu(Creature* unit);
void SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathNode = 0);
bool SendLearnNewTaxiNode(Creature* unit);
@@ -362,11 +361,11 @@ class WorldSession
// Guild/Arena Team
void SendArenaTeamCommandResult(uint32 team_action, std::string const& team, std::string const& player, uint32 error_id = 0);
void SendNotInArenaTeamPacket(uint8 type);
- void SendPetitionShowList(uint64 guid);
+ void SendPetitionShowList(ObjectGuid guid);
void BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket* data);
- void DoLootRelease(uint64 lguid);
+ void DoLootRelease(ObjectGuid lguid);
// Account mute time
time_t m_muteTime;
@@ -374,7 +373,7 @@ class WorldSession
// Locales
LocaleConstant GetSessionDbcLocale() const { return m_sessionDbcLocale; }
LocaleConstant GetSessionDbLocaleIndex() const { return m_sessionDbLocaleIndex; }
- const char *GetTrinityString(int32 entry) const;
+ char const* GetTrinityString(uint32 entry) const;
uint32 GetLatency() const { return m_latency; }
void SetLatency(uint32 latency) { m_latency = latency; }
@@ -673,7 +672,6 @@ class WorldSession
void HandleMailCreateTextItem(WorldPacket& recvData);
void HandleQueryNextMailTime(WorldPacket& recvData);
void HandleCancelChanneling(WorldPacket& recvData);
- void SendShowMailBox(uint64 guid);
void SendItemPageInfo(ItemTemplate* itemProto);
void HandleSplitItemOpcode(WorldPacket& recvPacket);
@@ -778,7 +776,7 @@ class WorldSession
//Pet
void HandlePetAction(WorldPacket& recvData);
void HandlePetStopAttack(WorldPacket& recvData);
- void HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid, uint16 flag, uint64 guid2, float x, float y, float z);
+ void HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2, float x, float y, float z);
void HandlePetNameQuery(WorldPacket& recvData);
void HandlePetSetAction(WorldPacket& recvData);
void HandlePetAbandon(WorldPacket& recvData);
@@ -814,11 +812,11 @@ class WorldSession
void HandleRequestRatedBgStats(WorldPacket& recvData);
// Battlefield
- void SendBfInvitePlayerToWar(uint64 guid, uint32 zoneId, uint32 time);
- void SendBfInvitePlayerToQueue(uint64 guid);
- void SendBfQueueInviteResponse(uint64 guid, uint32 zoneId, bool canQueue = true, bool full = false);
- void SendBfEntered(uint64 guid);
- void SendBfLeaveMessage(uint64 guid, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
+ void SendBfInvitePlayerToWar(ObjectGuid guid, uint32 zoneId, uint32 time);
+ void SendBfInvitePlayerToQueue(ObjectGuid guid);
+ void SendBfQueueInviteResponse(ObjectGuid guid, uint32 zoneId, bool canQueue = true, bool full = false);
+ void SendBfEntered(ObjectGuid guid);
+ void SendBfLeaveMessage(ObjectGuid guid, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
void HandleBfQueueInviteResponse(WorldPacket& recvData);
void HandleBfEntryInviteResponse(WorldPacket& recvData);
void HandleBfExitRequest(WorldPacket& recvData);
@@ -855,7 +853,7 @@ class WorldSession
void HandleLfgGetStatus(WorldPacket& recvData);
void SendLfgUpdateStatus(lfg::LfgUpdateData const& updateData, bool party);
- void SendLfgRoleChosen(uint64 guid, uint8 roles);
+ void SendLfgRoleChosen(ObjectGuid guid, uint8 roles);
void SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& pRoleCheck);
void SendLfgLfrList(bool update);
void SendLfgJoinResult(lfg::LfgJoinResultData const& joinData);
@@ -997,7 +995,7 @@ class WorldSession
QueryCallback<PreparedQueryResult, std::string> _addFriendCallback;
QueryCallback<PreparedQueryResult, uint32> _unstablePetCallback;
QueryCallback<PreparedQueryResult, uint32> _stableSwapCallback;
- QueryCallback<PreparedQueryResult, uint64> _sendStabledPetCallback;
+ QueryCallback<PreparedQueryResult, ObjectGuid> _sendStabledPetCallback;
QueryCallback<PreparedQueryResult, CharacterCreateInfo*, true> _charCreateCallback;
QueryResultHolderFuture _charLoginCallback;
@@ -1035,21 +1033,21 @@ class WorldSession
// private trade methods
void moveItems(Item* myItems[], Item* hisItems[]);
- bool CanUseBank(uint64 bankerGUID = 0) const;
+ bool CanUseBank(ObjectGuid bankerGUID = ObjectGuid::Empty) const;
// logging helper
void LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason);
void LogUnprocessedTail(WorldPacket* packet);
// EnumData helpers
- bool IsLegitCharacterForAccount(uint32 lowGUID)
+ bool IsLegitCharacterForAccount(ObjectGuid lowGUID)
{
return _legitCharacters.find(lowGUID) != _legitCharacters.end();
}
// this stores the GUIDs of the characters who can login
// characters who failed on Player::BuildEnumData shouldn't login
- std::set<uint32> _legitCharacters;
+ GuidSet _legitCharacters;
uint32 m_GUIDLow; // set logined or recently logout player (while m_playerRecentlyLogout set)
Player* _player;
@@ -1090,7 +1088,7 @@ class WorldSession
rbac::RBACData* _RBACData;
uint32 expireTime;
bool forceExit;
- uint64 m_currentBankerGUID;
+ ObjectGuid m_currentBankerGUID;
WorldSession(WorldSession const& right) = delete;
WorldSession& operator=(WorldSession const& right) = delete;
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 83bf2c2fff8..f37354f7e65 100644
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -260,7 +260,7 @@ void WorldSocket::SendPacket(WorldPacket& packet)
_authCrypt.EncryptSend(header.header, header.getHeaderLength());
-#ifndef BOOST_ASIO_HAS_IOCP
+#ifndef TC_SOCKET_USE_IOCP
if (_writeQueue.empty() && _writeBuffer.GetRemainingSpace() >= header.getHeaderLength() + packet.size())
{
_writeBuffer.Write(header.header, header.getHeaderLength());
@@ -281,7 +281,7 @@ void WorldSocket::SendPacket(WorldPacket& packet)
void WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
{
- uint8 digest[20];
+ uint8 digest[SHA_DIGEST_LENGTH];
uint32 clientSeed;
uint8 security;
uint16 clientBuild;
@@ -421,7 +421,7 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
sha.UpdateBigNumbers(&k, NULL);
sha.Finalize();
- if (memcmp(sha.GetDigest(), digest, 20))
+ if (memcmp(sha.GetDigest(), digest, SHA_DIGEST_LENGTH) != 0)
{
SendAuthResponseError(AUTH_FAILED);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
@@ -432,7 +432,7 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
///- Re-check ip locking (same check as in auth).
if (fields[3].GetUInt8() == 1) // if ip is locked
{
- if (strcmp(fields[2].GetCString(), address.c_str()))
+ if (strcmp(fields[2].GetCString(), address.c_str()) != 0)
{
SendAuthResponseError(AUTH_FAILED);
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", fields[2].GetCString(), address.c_str());
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index e43363e9cf6..83441b73c8e 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -483,7 +483,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
// check item enchant aura cast
if (!amount && caster)
- if (uint64 itemGUID = GetBase()->GetCastItemGUID())
+ if (ObjectGuid itemGUID = GetBase()->GetCastItemGUID())
if (Player* playerCaster = caster->ToPlayer())
if (Item* castItem = playerCaster->GetItemByGuid(itemGUID))
if (castItem->GetItemSuffixFactor())
@@ -799,7 +799,7 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply)
case SPELLMOD_EFFECT2:
case SPELLMOD_EFFECT3:
{
- uint64 guid = target->GetGUID();
+ ObjectGuid guid = target->GetGUID();
Unit::AuraApplicationMap & auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter)
{
@@ -1752,7 +1752,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
}
// remove other shapeshift before applying a new one
- target->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT, 0, GetBase());
+ target->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT, ObjectGuid::Empty, GetBase());
// stop handling the effect if it was removed by linked event
if (aurApp->GetRemoveMode())
@@ -2090,7 +2090,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
{
// for players, start regeneration after 1s (in polymorph fast regeneration case)
// only if caster is Player (after patch 2.4.2)
- if (IS_PLAYER_GUID(GetCasterGUID()))
+ if (GetCasterGUID().IsPlayer())
target->ToPlayer()->setRegenTimerCount(1*IN_MILLISECONDS);
//dismount polymorphed target (after patch 2.4.2)
@@ -3406,7 +3406,7 @@ void AuraEffect::HandleAuraModStateImmunity(AuraApplication const* aurApp, uint8
target->ApplySpellImmune(GetId(), IMMUNITY_STATE, GetMiscValue(), apply);
if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
- target->RemoveAurasByType(AuraType(GetMiscValue()), 0, GetBase());
+ target->RemoveAurasByType(AuraType(GetMiscValue()), ObjectGuid::Empty, GetBase());
}
void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -5193,13 +5193,13 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo
}
else
{
- uint64 casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
+ ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode());
}
}
else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
{
- uint64 casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
+ ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
// change the stack amount to be equal to stack amount of our aura
if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
@@ -5317,7 +5317,7 @@ void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode,
return;
WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, target->GetPackGUID().size()+4);
- data.appendPackGUID(target->GetGUID());
+ data << target->GetPackGUID();
data << uint32(apply ? vehicleId : 0);
target->SendMessageToSet(&data, true);
@@ -5637,7 +5637,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
case 28820:
{
// Need remove self if Lightning Shield not active
- if (!target->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400))
+ if (!target->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400, 0, 0))
target->RemoveAurasDueToSpell(28820);
return;
}
@@ -5911,8 +5911,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo());
- TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
- GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb);
+ TC_LOG_INFO("spells", "PeriodicTick: %s attacked %s for %u dmg inflicted by %u absorb is %u",
+ GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId(), absorb);
caster->DealDamageMods(target, damage, &absorb);
@@ -6001,8 +6001,8 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
if (target->GetHealth() < damage)
damage = uint32(target->GetHealth());
- TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
- GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb);
+ TC_LOG_INFO("spells", "PeriodicTick: %s health leech of %s for %u dmg inflicted by %u abs is %u",
+ GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId(), absorb);
caster->SendSpellNonMeleeDamageLog(target, GetId(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit);
@@ -6129,8 +6129,8 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
if (crit)
damage = caster->SpellCriticalHealingBonus(m_spellInfo, damage, target);
- TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
- GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId());
+ TC_LOG_INFO("spells", "PeriodicTick: %s heal of %s for %u health inflicted by %u",
+ GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId());
uint32 absorb = 0;
uint32 heal = uint32(damage);
@@ -6142,7 +6142,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
- bool haveCastItem = GetBase()->GetCastItemGUID() != 0;
+ bool haveCastItem = !GetBase()->GetCastItemGUID().IsEmpty();
// Health Funnel
// damage caster for heal amount
@@ -6200,8 +6200,8 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
drainAmount = maxmana;
}
- TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
- GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), drainAmount, GetId());
+ TC_LOG_INFO("spells", "PeriodicTick: %s power leech of %s for %u dmg inflicted by %u",
+ GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), drainAmount, GetId());
int32 drainedAmount = -target->ModifyPower(powerType, -drainAmount);
@@ -6257,8 +6257,8 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const
// ignore negative values (can be result apply spellmods to aura damage
uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(powerType) /100;
- TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
- GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId());
+ TC_LOG_INFO("spells", "PeriodicTick: %s energize %s for %u dmg inflicted by %u",
+ GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), amount, GetId());
SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
target->SendPeriodicAuraLog(&pInfo);
@@ -6295,8 +6295,8 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons
SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
target->SendPeriodicAuraLog(&pInfo);
- TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
- GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId());
+ TC_LOG_INFO("spells", "PeriodicTick: %s energize %s for %u dmg inflicted by %u",
+ GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), amount, GetId());
int32 gain = target->ModifyPower(powerType, amount);
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h
index 700bbb10417..d07885aaa83 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.h
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.h
@@ -30,14 +30,14 @@ typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const* aurApp, uin
class AuraEffect
{
friend void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount);
- friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
+ friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID);
friend Aura::~Aura();
private:
~AuraEffect();
explicit AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* caster);
public:
Unit* GetCaster() const { return GetBase()->GetCaster(); }
- uint64 GetCasterGUID() const { return GetBase()->GetCasterGUID(); }
+ ObjectGuid GetCasterGUID() const { return GetBase()->GetCasterGUID(); }
Aura* GetBase() const { return m_base; }
void GetTargetList(std::list<Unit*> & targetList) const;
void GetApplicationList(std::list<AuraApplication*> & applicationList) const;
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index dadca633401..afe0e477b20 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -203,7 +203,7 @@ void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const
data << uint8(aura->GetSpellInfo()->StackAmount ? aura->GetStackAmount() : aura->GetCharges());
if (!(flags & AFLAG_CASTER))
- data.appendPackGUID(aura->GetCasterGUID());
+ data << aura->GetCasterGUID().WriteAsPacked();
if (flags & AFLAG_DURATION)
{
@@ -223,7 +223,7 @@ void AuraApplication::ClientUpdate(bool remove)
_needClientUpdate = false;
WorldPacket data(SMSG_AURA_UPDATE);
- data.append(GetTarget()->GetPackGUID());
+ data << GetTarget()->GetPackGUID();
BuildUpdatePacket(data, remove);
_target->SendMessageToSet(&data, true);
@@ -257,7 +257,7 @@ uint8 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleE
return effMask & avalibleEffectMask;
}
-Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/, bool* refresh /*= NULL*/)
+Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, ObjectGuid casterGUID /*= ObjectGuid::Empty*/, bool* refresh /*= NULL*/)
{
ASSERT(spellproto);
ASSERT(owner);
@@ -283,7 +283,7 @@ Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMas
return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
}
-Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
+Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, ObjectGuid casterGUID /*= ObjectGuid::Empty*/)
{
ASSERT(spellproto);
ASSERT(owner);
@@ -295,7 +295,7 @@ Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject
return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
}
-Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID)
+Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID)
{
ASSERT(effMask);
ASSERT(spellproto);
@@ -340,9 +340,9 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
return aura;
}
-Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID) :
+Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, ObjectGuid casterGUID) :
m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
-m_castItemGuid(castItem ? castItem->GetGUID() : 0), m_applyTime(time(NULL)),
+m_castItemGuid(castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_applyTime(time(NULL)),
m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0),
m_casterLevel(caster ? caster->getLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false), m_dropEvent(nullptr)
@@ -2246,7 +2246,7 @@ void Aura::CallScriptAfterEffectProcHandlers(AuraEffect const* aurEff, AuraAppli
}
}
-UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID)
+UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID)
: Aura(spellproto, owner, caster, castItem, casterGUID)
{
m_AuraDRGroup = DIMINISHING_NONE;
@@ -2349,7 +2349,7 @@ void UnitAura::FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster)
}
}
-DynObjAura::DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID)
+DynObjAura::DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID)
: Aura(spellproto, owner, caster, castItem, casterGUID)
{
LoadScripts();
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h
index 1266bf5c6ec..f69d9baafe0 100644
--- a/src/server/game/Spells/Auras/SpellAuras.h
+++ b/src/server/game/Spells/Auras/SpellAuras.h
@@ -84,23 +84,23 @@ class AuraApplication
class Aura
{
- friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
+ friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID);
public:
- typedef std::map<uint64, AuraApplication *> ApplicationMap;
+ typedef std::map<ObjectGuid, AuraApplication*> ApplicationMap;
static uint8 BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner);
- static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0, bool* refresh = NULL);
- static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0);
- static Aura* Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
- explicit Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID);
+ static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, ObjectGuid casterGUID = ObjectGuid::Empty, bool* refresh = NULL);
+ static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount = NULL, Item* castItem = NULL, ObjectGuid casterGUID = ObjectGuid::Empty);
+ static Aura* Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID);
+ explicit Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, ObjectGuid casterGUID);
void _InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount);
virtual ~Aura();
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
uint32 GetId() const{ return GetSpellInfo()->Id; }
- uint64 GetCastItemGUID() const { return m_castItemGuid; }
- uint64 GetCasterGUID() const { return m_casterGuid; }
+ ObjectGuid GetCastItemGUID() const { return m_castItemGuid; }
+ ObjectGuid GetCasterGUID() const { return m_casterGuid; }
Unit* GetCaster() const;
WorldObject* GetOwner() const { return m_owner; }
Unit* GetUnitOwner() const { ASSERT(GetType() == UNIT_AURA_TYPE); return (Unit*)m_owner; }
@@ -186,11 +186,11 @@ class Aura
void HandleAllEffects(AuraApplication * aurApp, uint8 mode, bool apply);
// Helpers for targets
- ApplicationMap const & GetApplicationMap() {return m_applications;}
+ ApplicationMap const& GetApplicationMap() { return m_applications; }
void GetApplicationList(Unit::AuraApplicationList& applicationList) const;
- const AuraApplication * GetApplicationOfTarget (uint64 guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
- AuraApplication * GetApplicationOfTarget (uint64 guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
- bool IsAppliedOnTarget(uint64 guid) const { return m_applications.find(guid) != m_applications.end(); }
+ const AuraApplication* GetApplicationOfTarget(ObjectGuid guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
+ AuraApplication* GetApplicationOfTarget(ObjectGuid guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
+ bool IsAppliedOnTarget(ObjectGuid guid) const { return m_applications.find(guid) != m_applications.end(); }
void SetNeedClientUpdateForTargets() const;
void HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, bool apply, bool onReapply);
@@ -246,10 +246,10 @@ class Aura
void _DeleteRemovedApplications();
protected:
SpellInfo const* const m_spellInfo;
- uint64 const m_casterGuid;
- uint64 const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
+ ObjectGuid const m_casterGuid;
+ ObjectGuid const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
time_t const m_applyTime;
- WorldObject* const m_owner; //
+ WorldObject* const m_owner;
int32 m_maxDuration; // Max aura duration
int32 m_duration; // Current time
@@ -275,9 +275,9 @@ class Aura
class UnitAura : public Aura
{
- friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
+ friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID);
protected:
- explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
+ explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID);
public:
void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp) override;
void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp) override;
@@ -296,9 +296,9 @@ class UnitAura : public Aura
class DynObjAura : public Aura
{
- friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
+ friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID);
protected:
- explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
+ explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID);
public:
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) override;
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 9ff644a7616..05cf35465ef 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -63,14 +63,14 @@ extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];
SpellDestination::SpellDestination()
{
_position.Relocate(0, 0, 0, 0);
- _transportGUID = 0;
+ _transportGUID.Clear();
_transportOffset.Relocate(0, 0, 0, 0);
}
SpellDestination::SpellDestination(float x, float y, float z, float orientation, uint32 mapId)
{
_position.Relocate(x, y, z, orientation);
- _transportGUID = 0;
+ _transportGUID.Clear();
_position.m_mapId = mapId;
_transportOffset.Relocate(0, 0, 0, 0);
}
@@ -78,7 +78,7 @@ SpellDestination::SpellDestination(float x, float y, float z, float orientation,
SpellDestination::SpellDestination(Position const& pos)
{
_position.Relocate(pos);
- _transportGUID = 0;
+ _transportGUID.Clear();
_transportOffset.Relocate(0, 0, 0, 0);
}
@@ -113,8 +113,8 @@ SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0), m_strTarget()
m_objectTarget = NULL;
m_itemTarget = NULL;
- m_objectTargetGUID = 0;
- m_itemTargetGUID = 0;
+ m_objectTargetGUID.Clear();
+ m_itemTargetGUID.Clear();
m_itemTargetEntry = 0;
m_targetMask = 0;
@@ -130,14 +130,14 @@ void SpellCastTargets::Read(ByteBuffer& data, Unit* caster)
return;
if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_CORPSE_ALLY))
- data.readPackGUID(m_objectTargetGUID);
+ data >> m_objectTargetGUID.ReadAsPacked();
if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM))
- data.readPackGUID(m_itemTargetGUID);
+ data >> m_itemTargetGUID.ReadAsPacked();
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
{
- data.readPackGUID(m_src._transportGUID);
+ data >> m_src._transportGUID.ReadAsPacked();
if (m_src._transportGUID)
data >> m_src._transportOffset.PositionXYZStream();
else
@@ -154,7 +154,7 @@ void SpellCastTargets::Read(ByteBuffer& data, Unit* caster)
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
- data.readPackGUID(m_dst._transportGUID);
+ data >> m_dst._transportGUID.ReadAsPacked();
if (m_dst._transportGUID)
data >> m_dst._transportOffset.PositionXYZStream();
else
@@ -180,19 +180,19 @@ void SpellCastTargets::Write(ByteBuffer& data)
data << uint32(m_targetMask);
if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_UNIT_MINIPET))
- data.appendPackGUID(m_objectTargetGUID);
+ data << m_objectTargetGUID.WriteAsPacked();
if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM))
{
if (m_itemTarget)
- data.append(m_itemTarget->GetPackGUID());
+ data << m_itemTarget->GetPackGUID();
else
data << uint8(0);
}
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
{
- data.appendPackGUID(m_src._transportGUID); // relative position guid here - transport for example
+ data << m_src._transportGUID.WriteAsPacked(); // relative position guid here - transport for example
if (m_src._transportGUID)
data << m_src._transportOffset.PositionXYZStream();
else
@@ -201,7 +201,7 @@ void SpellCastTargets::Write(ByteBuffer& data)
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
- data.appendPackGUID(m_dst._transportGUID); // relative position guid here - transport for example
+ data << m_dst._transportGUID.WriteAsPacked(); // relative position guid here - transport for example
if (m_dst._transportGUID)
data << m_dst._transportOffset.PositionXYZStream();
else
@@ -212,24 +212,19 @@ void SpellCastTargets::Write(ByteBuffer& data)
data << m_strTarget;
}
-uint64 SpellCastTargets::GetUnitTargetGUID() const
+ObjectGuid SpellCastTargets::GetUnitTargetGUID() const
{
- switch (GUID_HIPART(m_objectTargetGUID))
- {
- case HIGHGUID_PLAYER:
- case HIGHGUID_VEHICLE:
- case HIGHGUID_UNIT:
- case HIGHGUID_PET:
- return m_objectTargetGUID;
- default:
- return 0LL;
- }
+ if (m_objectTargetGUID.IsUnit())
+ return m_objectTargetGUID;
+
+ return ObjectGuid::Empty;
}
Unit* SpellCastTargets::GetUnitTarget() const
{
if (m_objectTarget)
return m_objectTarget->ToUnit();
+
return NULL;
}
@@ -243,27 +238,22 @@ void SpellCastTargets::SetUnitTarget(Unit* target)
m_targetMask |= TARGET_FLAG_UNIT;
}
-uint64 SpellCastTargets::GetGOTargetGUID() const
+ObjectGuid SpellCastTargets::GetGOTargetGUID() const
{
- switch (GUID_HIPART(m_objectTargetGUID))
- {
- case HIGHGUID_TRANSPORT:
- case HIGHGUID_MO_TRANSPORT:
- case HIGHGUID_GAMEOBJECT:
- return m_objectTargetGUID;
- default:
- return 0LL;
- }
+ if (m_objectTargetGUID.IsAnyTypeGameObject())
+ return m_objectTargetGUID;
+
+ return ObjectGuid::Empty;
}
GameObject* SpellCastTargets::GetGOTarget() const
{
if (m_objectTarget)
return m_objectTarget->ToGameObject();
+
return NULL;
}
-
void SpellCastTargets::SetGOTarget(GameObject* target)
{
if (!target)
@@ -274,21 +264,19 @@ void SpellCastTargets::SetGOTarget(GameObject* target)
m_targetMask |= TARGET_FLAG_GAMEOBJECT;
}
-uint64 SpellCastTargets::GetCorpseTargetGUID() const
+ObjectGuid SpellCastTargets::GetCorpseTargetGUID() const
{
- switch (GUID_HIPART(m_objectTargetGUID))
- {
- case HIGHGUID_CORPSE:
- return m_objectTargetGUID;
- default:
- return 0LL;
- }
+ if (m_objectTargetGUID.IsCorpse())
+ return m_objectTargetGUID;
+
+ return ObjectGuid::Empty;
}
Corpse* SpellCastTargets::GetCorpseTarget() const
{
if (m_objectTarget)
return m_objectTarget->ToCorpse();
+
return NULL;
}
@@ -297,7 +285,7 @@ WorldObject* SpellCastTargets::GetObjectTarget() const
return m_objectTarget;
}
-uint64 SpellCastTargets::GetObjectTargetGUID() const
+ObjectGuid SpellCastTargets::GetObjectTargetGUID() const
{
return m_objectTargetGUID;
}
@@ -305,7 +293,7 @@ uint64 SpellCastTargets::GetObjectTargetGUID() const
void SpellCastTargets::RemoveObjectTarget()
{
m_objectTarget = NULL;
- m_objectTargetGUID = 0LL;
+ m_objectTargetGUID.Clear();
m_targetMask &= ~(TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK);
}
@@ -322,7 +310,7 @@ void SpellCastTargets::SetItemTarget(Item* item)
void SpellCastTargets::SetTradeItemTarget(Player* caster)
{
- m_itemTargetGUID = uint64(TRADE_SLOT_NONTRADED);
+ m_itemTargetGUID.Set(uint64(TRADE_SLOT_NONTRADED));
m_itemTargetEntry = 0;
m_targetMask |= TARGET_FLAG_TRADE_ITEM;
@@ -445,7 +433,7 @@ void SpellCastTargets::Update(Unit* caster)
if (m_targetMask & TARGET_FLAG_ITEM)
m_itemTarget = player->GetItemByGuid(m_itemTargetGUID);
else if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
- if (m_itemTargetGUID == TRADE_SLOT_NONTRADED) // here it is not guid but slot. Also prevents hacking slots
+ if (m_itemTargetGUID.GetRawValue() == TRADE_SLOT_NONTRADED) // here it is not guid but slot. Also prevents hacking slots
if (TradeData* pTrade = player->GetTradeData())
m_itemTarget = pTrade->GetTraderData()->GetItem(TRADE_SLOT_NONTRADED);
@@ -480,15 +468,15 @@ void SpellCastTargets::OutDebug() const
TC_LOG_INFO("spells", "target mask: %u", m_targetMask);
if (m_targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK))
- TC_LOG_INFO("spells", "Object target: " UI64FMTD, m_objectTargetGUID);
+ TC_LOG_INFO("spells", "Object target: %s", m_objectTargetGUID.ToString().c_str());
if (m_targetMask & TARGET_FLAG_ITEM)
- TC_LOG_INFO("spells", "Item target: " UI64FMTD, m_itemTargetGUID);
+ TC_LOG_INFO("spells", "Item target: %s", m_itemTargetGUID.ToString().c_str());
if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
- TC_LOG_INFO("spells", "Trade item target: " UI64FMTD, m_itemTargetGUID);
+ TC_LOG_INFO("spells", "Trade item target: %s", m_itemTargetGUID.ToString().c_str());
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
- TC_LOG_INFO("spells", "Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str());
+ TC_LOG_INFO("spells", "Source location: transport guid:%s trans offset: %s position: %s", m_src._transportGUID.ToString().c_str(), m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str());
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
- TC_LOG_INFO("spells", "Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str());
+ TC_LOG_INFO("spells", "Destination location: transport guid:%s trans offset: %s position: %s", m_dst._transportGUID.ToString().c_str(), m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str());
if (m_targetMask & TARGET_FLAG_STRING)
TC_LOG_INFO("spells", "String: %s", m_strTarget.c_str());
TC_LOG_INFO("spells", "speed: %f", m_speed);
@@ -504,7 +492,7 @@ SpellValue::SpellValue(SpellInfo const* proto)
AuraStackAmount = 1;
}
-Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID, bool skipCheck) :
+Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID, bool skipCheck) :
m_spellInfo(sSpellMgr->GetSpellForDifficultyFromSpell(info, caster)),
m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharmerOrOwner()) ? caster->GetCharmerOrOwner() : caster)
, m_spellValue(new SpellValue(m_spellInfo)), m_preGeneratedPath(PathGenerator(m_caster))
@@ -572,7 +560,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme
_triggeredCastFlags = TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT);
m_CastItem = NULL;
- m_castItemGUID = 0;
+ m_castItemGUID.Clear();
m_castItemEntry = 0;
unitTarget = NULL;
@@ -958,7 +946,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa
{
case TARGET_UNIT_CHANNEL_TARGET:
{
- WorldObject* target = ObjectAccessor::GetUnit(*m_caster, m_originalCaster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT));
+ WorldObject* target = ObjectAccessor::GetUnit(*m_caster, m_originalCaster->GetChannelObjectGuid());
CallScriptObjectTargetSelectHandlers(target, effIndex, targetType);
// unit target may be no longer avalible - teleported out of map for example
if (target && target->ToUnit())
@@ -970,7 +958,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa
case TARGET_DEST_CHANNEL_TARGET:
if (channeledSpell->m_targets.HasDst())
m_targets.SetDst(channeledSpell->m_targets);
- else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, m_originalCaster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)))
+ else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, m_originalCaster->GetChannelObjectGuid()))
{
CallScriptObjectTargetSelectHandlers(target, effIndex, targetType);
if (target)
@@ -1068,7 +1056,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
AddUnitTarget(unitTarget, effMask, true, false);
else
{
- TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected unit, got %s, effect %u", m_spellInfo->Id, GetLogNameForGuid(target->GetGUID()), effMask);
+ TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected unit, got %s, effect %u", m_spellInfo->Id, target->GetGUID().GetTypeName(), effMask);
return;
}
break;
@@ -1078,7 +1066,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
AddGOTarget(gobjTarget, effMask);
else
{
- TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected gameobject, got %s, effect %u", m_spellInfo->Id, GetLogNameForGuid(target->GetGUID()), effMask);
+ TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected gameobject, got %s, effect %u", m_spellInfo->Id, target->GetGUID().GetTypeName(), effMask);
return;
}
break;
@@ -2016,7 +2004,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
if (target->IsImmunedToSpellEffect(m_spellInfo, effIndex))
effectMask &= ~(1 << effIndex);
- uint64 targetGUID = target->GetGUID();
+ ObjectGuid targetGUID = target->GetGUID();
// Lookup target in already in list
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
@@ -2130,7 +2118,7 @@ void Spell::AddGOTarget(GameObject* go, uint32 effectMask)
if (!effectMask)
return;
- uint64 targetGUID = go->GetGUID();
+ ObjectGuid targetGUID = go->GetGUID();
// Lookup target in already in list
for (std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
@@ -2564,7 +2552,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
{
bool refresh = false;
m_spellAura = Aura::TryRefreshStackOrCreate(aurSpellInfo, effectMask, unit,
- m_originalCaster, (aurSpellInfo == m_spellInfo)? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, 0, &refresh);
+ m_originalCaster, (aurSpellInfo == m_spellInfo) ? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, ObjectGuid::Empty, &refresh);
if (m_spellAura)
{
// Set aura stack amount to desired value
@@ -2821,7 +2809,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
}
else
{
- m_castItemGUID = 0;
+ m_castItemGUID.Clear();
m_castItemEntry = 0;
}
@@ -3787,11 +3775,11 @@ void Spell::SendSpellStart()
WorldPacket data(SMSG_SPELL_START, (8+8+4+4+2));
if (m_CastItem)
- data.append(m_CastItem->GetPackGUID());
+ data << m_CastItem->GetPackGUID();
else
- data.append(m_caster->GetPackGUID());
+ data << m_caster->GetPackGUID();
- data.append(m_caster->GetPackGUID());
+ data << m_caster->GetPackGUID();
data << uint8(m_cast_count); // pending spell cast?
data << uint32(m_spellInfo->Id); // spellId
data << uint32(castFlags); // cast flags
@@ -3891,11 +3879,11 @@ void Spell::SendSpellGo()
WorldPacket data(SMSG_SPELL_GO, 50); // guess size
if (m_CastItem)
- data.append(m_CastItem->GetPackGUID());
+ data << m_CastItem->GetPackGUID();
else
- data.append(m_caster->GetPackGUID());
+ data << m_caster->GetPackGUID();
- data.append(m_caster->GetPackGUID());
+ data << m_caster->GetPackGUID();
data << uint8(m_cast_count); // pending spell cast?
data << uint32(m_spellInfo->Id); // spellId
data << uint32(castFlags); // cast flags
@@ -4029,7 +4017,7 @@ void Spell::SendLogExecute()
{
WorldPacket data(SMSG_SPELLLOGEXECUTE, (8+4+4+4+4+8));
- data.append(m_caster->GetPackGUID());
+ data << m_caster->GetPackGUID();
data << uint32(m_spellInfo->Id);
@@ -4062,7 +4050,7 @@ void Spell::SendLogExecute()
void Spell::ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32 powerType, uint32 powerTaken, float gainMultiplier)
{
InitEffectExecuteData(effIndex);
- m_effectExecuteData[effIndex]->append(target->GetPackGUID());
+ *m_effectExecuteData[effIndex] << target->GetPackGUID();
*m_effectExecuteData[effIndex] << uint32(powerTaken);
*m_effectExecuteData[effIndex] << uint32(powerType);
*m_effectExecuteData[effIndex] << float(gainMultiplier);
@@ -4071,7 +4059,7 @@ void Spell::ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32
void Spell::ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit* victim, uint32 attCount)
{
InitEffectExecuteData(effIndex);
- m_effectExecuteData[effIndex]->append(victim->GetPackGUID());
+ *m_effectExecuteData[effIndex] << victim->GetPackGUID();
*m_effectExecuteData[effIndex] << uint32(attCount);
}
@@ -4123,7 +4111,7 @@ void Spell::ExecuteLogEffectInterruptCast(uint8 /*effIndex*/, Unit* victim, uint
void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 slot)
{
InitEffectExecuteData(effIndex);
- m_effectExecuteData[effIndex]->append(victim->GetPackGUID());
+ *m_effectExecuteData[effIndex] << victim->GetPackGUID();
*m_effectExecuteData[effIndex] << int32(itemId);
*m_effectExecuteData[effIndex] << int32(slot);
}
@@ -4131,7 +4119,7 @@ void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32
void Spell::ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj)
{
InitEffectExecuteData(effIndex);
- m_effectExecuteData[effIndex]->append(obj->GetPackGUID());
+ *m_effectExecuteData[effIndex] << obj->GetPackGUID();
}
void Spell::ExecuteLogEffectCreateItem(uint8 effIndex, uint32 entry)
@@ -4149,32 +4137,32 @@ void Spell::ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry)
void Spell::ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject* obj)
{
InitEffectExecuteData(effIndex);
- m_effectExecuteData[effIndex]->append(obj->GetPackGUID());
+ *m_effectExecuteData[effIndex] << obj->GetPackGUID();
}
void Spell::ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject* obj)
{
InitEffectExecuteData(effIndex);
- m_effectExecuteData[effIndex]->append(obj->GetPackGUID());
+ *m_effectExecuteData[effIndex] << obj->GetPackGUID();
}
void Spell::ExecuteLogEffectResurrect(uint8 effIndex, Unit* target)
{
InitEffectExecuteData(effIndex);
- m_effectExecuteData[effIndex]->append(target->GetPackGUID());
+ *m_effectExecuteData[effIndex] << target->GetPackGUID();
}
void Spell::SendInterrupted(uint8 result)
{
WorldPacket data(SMSG_SPELL_FAILURE, (8+4+1));
- data.append(m_caster->GetPackGUID());
+ data << m_caster->GetPackGUID();
data << uint8(m_cast_count);
data << uint32(m_spellInfo->Id);
data << uint8(result);
m_caster->SendMessageToSet(&data, true);
data.Initialize(SMSG_SPELL_FAILED_OTHER, (8+4));
- data.append(m_caster->GetPackGUID());
+ data << m_caster->GetPackGUID();
data << uint8(m_cast_count);
data << uint32(m_spellInfo->Id);
data << uint8(result);
@@ -4185,12 +4173,12 @@ void Spell::SendChannelUpdate(uint32 time)
{
if (time == 0)
{
- m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0);
+ m_caster->SetChannelObjectGuid(ObjectGuid::Empty);
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
}
WorldPacket data(MSG_CHANNEL_UPDATE, 8+4);
- data.append(m_caster->GetPackGUID());
+ data << m_caster->GetPackGUID();
data << uint32(time);
m_caster->SendMessageToSet(&data, true);
@@ -4198,13 +4186,13 @@ void Spell::SendChannelUpdate(uint32 time)
void Spell::SendChannelStart(uint32 duration)
{
- uint64 channelTarget = m_targets.GetObjectTargetGUID();
+ ObjectGuid channelTarget = m_targets.GetObjectTargetGUID();
if (!channelTarget && !m_spellInfo->NeedsExplicitUnitTarget())
if (m_UniqueTargetInfo.size() + m_UniqueGOTargetInfo.size() == 1) // this is for TARGET_SELECT_CATEGORY_NEARBY
channelTarget = !m_UniqueTargetInfo.empty() ? m_UniqueTargetInfo.front().targetGUID : m_UniqueGOTargetInfo.front().targetGUID;
WorldPacket data(MSG_CHANNEL_START, (8+4+4));
- data.append(m_caster->GetPackGUID());
+ data << m_caster->GetPackGUID();
data << uint32(m_spellInfo->Id);
data << uint32(duration);
data << uint8(0); // immunity (castflag & 0x04000000)
@@ -4230,7 +4218,7 @@ void Spell::SendChannelStart(uint32 duration)
m_timer = duration;
if (channelTarget)
- m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, channelTarget);
+ m_caster->SetChannelObjectGuid(channelTarget);
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id);
}
@@ -4320,7 +4308,7 @@ void Spell::TakeCastItem()
m_targets.SetItemTarget(NULL);
m_CastItem = NULL;
- m_castItemGUID = 0;
+ m_castItemGUID.Clear();
m_castItemEntry = 0;
}
}
@@ -4342,7 +4330,7 @@ void Spell::TakePower()
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (powerType == POWER_RAGE || powerType == POWER_ENERGY || powerType == POWER_RUNES)
- if (uint64 targetGUID = m_targets.GetUnitTargetGUID())
+ if (ObjectGuid targetGUID = m_targets.GetUnitTargetGUID())
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if (ihit->targetGUID == targetGUID)
{
@@ -4560,7 +4548,7 @@ void Spell::TakeReagents()
}
m_CastItem = NULL;
- m_castItemGUID = 0;
+ m_castItemGUID.Clear();
m_castItemEntry = 0;
}
@@ -5186,7 +5174,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_targets.GetTargetMask() & TARGET_FLAG_TRADE_ITEM)
{
if (TradeData* pTrade = m_caster->ToPlayer()->GetTradeData())
- pTempItem = pTrade->GetTraderData()->GetItem(TradeSlots(m_targets.GetItemTargetGUID()));
+ pTempItem = pTrade->GetTraderData()->GetItem(TradeSlots(m_targets.GetItemTargetGUID().GetRawValue())); // at this point item target guid contains the trade slot
}
else if (m_targets.GetTargetMask() & TARGET_FLAG_ITEM)
pTempItem = m_caster->ToPlayer()->GetItemByGuid(m_targets.GetItemTargetGUID());
@@ -5514,7 +5502,8 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!my_trade)
return SPELL_FAILED_NOT_TRADING;
- TradeSlots slot = TradeSlots(m_targets.GetItemTargetGUID());
+ // Item target guid contains trade slot until m_targets.UpdateTradeSlotItem() is called
+ TradeSlots slot = TradeSlots(m_targets.GetItemTargetGUID().GetRawValue());
if (slot != TRADE_SLOT_NONTRADED)
return SPELL_FAILED_BAD_TARGETS;
@@ -5728,7 +5717,7 @@ SpellCastResult Spell::CheckArenaAndRatedBattlegroundCastRules()
bool Spell::CanAutoCast(Unit* target)
{
- uint64 targetguid = target->GetGUID();
+ ObjectGuid targetguid = target->GetGUID();
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
@@ -6347,7 +6336,7 @@ void Spell::Delayed() // only called in DealDamage()
TC_LOG_INFO("spells", "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime);
WorldPacket data(SMSG_SPELL_DELAYED, 8+4);
- data.append(m_caster->GetPackGUID());
+ data << m_caster->GetPackGUID();
data << uint32(delaytime);
m_caster->SendMessageToSet(&data, true);
@@ -6522,7 +6511,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff, Position const* lo
{
// Get GO cast coordinates if original caster -> GO
WorldObject* caster = NULL;
- if (IS_GAMEOBJECT_GUID(m_originalCasterGUID))
+ if (m_originalCasterGUID.IsGameObject())
caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID);
if (!caster)
caster = m_caster;
@@ -7308,8 +7297,7 @@ WorldObjectSpellTargetCheck::WorldObjectSpellTargetCheck(Unit* caster, Unit* ref
WorldObjectSpellTargetCheck::~WorldObjectSpellTargetCheck()
{
- if (_condSrcInfo)
- delete _condSrcInfo;
+ delete _condSrcInfo;
}
bool WorldObjectSpellTargetCheck::operator()(WorldObject* target)
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 5d854659f4e..9fc3deaef99 100644
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -91,7 +91,7 @@ struct SpellDestination
void RelocateOffset(Position const& offset);
WorldLocation _position;
- uint64 _transportGUID;
+ ObjectGuid _transportGUID;
Position _transportOffset;
};
@@ -109,22 +109,22 @@ class SpellCastTargets
void SetTargetFlag(SpellCastTargetFlags flag) { m_targetMask |= flag; }
- uint64 GetUnitTargetGUID() const;
+ ObjectGuid GetUnitTargetGUID() const;
Unit* GetUnitTarget() const;
void SetUnitTarget(Unit* target);
- uint64 GetGOTargetGUID() const;
+ ObjectGuid GetGOTargetGUID() const;
GameObject* GetGOTarget() const;
void SetGOTarget(GameObject* target);
- uint64 GetCorpseTargetGUID() const;
+ ObjectGuid GetCorpseTargetGUID() const;
Corpse* GetCorpseTarget() const;
WorldObject* GetObjectTarget() const;
- uint64 GetObjectTargetGUID() const;
+ ObjectGuid GetObjectTargetGUID() const;
void RemoveObjectTarget();
- uint64 GetItemTargetGUID() const { return m_itemTargetGUID; }
+ ObjectGuid GetItemTargetGUID() const { return m_itemTargetGUID; }
Item* GetItemTarget() const { return m_itemTarget; }
uint32 GetItemTargetEntry() const { return m_itemTargetEntry; }
void SetItemTarget(Item* item);
@@ -174,8 +174,8 @@ class SpellCastTargets
Item* m_itemTarget;
// object GUID/etc, can be used always
- uint64 m_objectTargetGUID;
- uint64 m_itemTargetGUID;
+ ObjectGuid m_objectTargetGUID;
+ ObjectGuid m_itemTargetGUID;
uint32 m_itemTargetEntry;
SpellDestination m_src;
@@ -212,6 +212,8 @@ enum SpellEffectHandleMode
SPELL_EFFECT_HANDLE_HIT_TARGET
};
+typedef std::list<std::pair<uint32, ObjectGuid>> DispelList;
+
class Spell
{
friend void Unit::SetCurrentCastSpell(Spell* pSpell);
@@ -351,7 +353,7 @@ class Spell
typedef std::set<Aura*> UsedSpellMods;
- Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID = 0, bool skipCheck = false);
+ Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID = ObjectGuid::Empty, bool skipCheck = false);
~Spell();
void InitExplicitTargets(SpellCastTargets const& targets);
@@ -455,7 +457,7 @@ class Spell
SpellInfo const* const m_spellInfo;
Item* m_CastItem;
- uint64 m_castItemGUID;
+ ObjectGuid m_castItemGUID;
uint32 m_castItemEntry;
uint8 m_cast_count;
uint32 m_glyphIndex;
@@ -502,13 +504,13 @@ class Spell
void TriggerGlobalCooldown();
void CancelGlobalCooldown();
- void SendLoot(uint64 guid, LootType loottype);
+ void SendLoot(ObjectGuid guid, LootType loottype);
Unit* const m_caster;
SpellValue* const m_spellValue;
- uint64 m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection
+ ObjectGuid m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection
// e.g. damage around area spell trigered by victim aura and damage enemies of aura caster
Unit* m_originalCaster; // cached pointer for m_originalCaster, updated at Spell::UpdatePointers()
@@ -581,7 +583,7 @@ class Spell
// Targets store structures and data
struct TargetInfo
{
- uint64 targetGUID;
+ ObjectGuid targetGUID;
uint64 timeDelay;
SpellMissInfo missCondition:8;
SpellMissInfo reflectResult:8;
@@ -597,7 +599,7 @@ class Spell
struct GOTargetInfo
{
- uint64 targetGUID;
+ ObjectGuid targetGUID;
uint64 timeDelay;
uint8 effectMask:8;
bool processed:1;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index a5e2971c8df..b68b6dfbc04 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1265,7 +1265,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
if (!targetAura)
{
- TC_LOG_ERROR("spells", "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID());
+ TC_LOG_ERROR("spells", "Target (%s) has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID().ToString().c_str());
return;
}
@@ -1461,7 +1461,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
// set the "Crafted by ..." property of the item
if (pItem->GetTemplate()->Class != ITEM_CLASS_CONSUMABLE && pItem->GetTemplate()->Class != ITEM_CLASS_QUEST && newitemid != 6265 && newitemid != 6948)
- pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow());
+ pItem->SetGuidValue(ITEM_FIELD_CREATOR, player->GetGUID());
// send info to the client
player->SendNewItem(pItem, num_to_add, true, bgType == 0);
@@ -1713,7 +1713,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, gain, power);
}
-void Spell::SendLoot(uint64 guid, LootType loottype)
+void Spell::SendLoot(ObjectGuid guid, LootType loottype)
{
Player* player = m_caster->ToPlayer();
if (!player)
@@ -1795,7 +1795,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
Player* player = m_caster->ToPlayer();
uint32 lockId = 0;
- uint64 guid = 0;
+ ObjectGuid guid;
// Get lockId
if (gameObjTarget)
@@ -1938,7 +1938,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
m_targets.SetItemTarget(NULL);
m_CastItem = NULL;
- m_castItemGUID = 0;
+ m_castItemGUID.Clear();
m_castItemEntry = 0;
player->StoreItem(dest, pNewItem, true);
@@ -1958,7 +1958,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
m_targets.SetItemTarget(NULL);
m_CastItem = NULL;
- m_castItemGUID = 0;
+ m_castItemGUID.Clear();
m_castItemEntry = 0;
player->BankItem(dest, pNewItem, true);
@@ -1982,7 +1982,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
m_targets.SetItemTarget(NULL);
m_CastItem = NULL;
- m_castItemGUID = 0;
+ m_castItemGUID.Clear();
m_castItemEntry = 0;
player->EquipItem(dest, pNewItem, true);
@@ -2220,7 +2220,6 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex)
TC_LOG_DEBUG("spells", "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow());
}
-typedef std::list< std::pair<uint32, uint64> > DispelList;
void Spell::EffectDispel(SpellEffIndex effIndex)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
@@ -2299,8 +2298,8 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
WorldPacket dataSuccess(SMSG_SPELLDISPELLOG, 8+8+4+1+4+success_list.size()*5);
// Send packet header
- dataSuccess.append(unitTarget->GetPackGUID()); // Victim GUID
- dataSuccess.append(m_caster->GetPackGUID()); // Caster GUID
+ dataSuccess << unitTarget->GetPackGUID(); // Victim GUID
+ dataSuccess << m_caster->GetPackGUID(); // Caster GUID
dataSuccess << uint32(m_spellInfo->Id); // dispel spell id
dataSuccess << uint8(0); // not used
dataSuccess << uint32(success_list.size()); // count
@@ -2410,7 +2409,7 @@ void Spell::EffectUntrainTalents(SpellEffIndex /*effIndex*/)
if (!unitTarget || m_caster->GetTypeId() == TYPEID_PLAYER)
return;
- if (uint64 guid = m_caster->GetGUID()) // the trainer is the caster
+ if (ObjectGuid guid = m_caster->GetGUID()) // the trainer is the caster
unitTarget->ToPlayer()->SendTalentWipeConfirm(guid);
}
@@ -3911,8 +3910,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
duel2->isMounted = (GetSpellInfo()->Id == 62875); // Mounted Duel
target->duel = duel2;
- caster->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
- target->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
+ caster->SetGuidValue(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
+ target->SetGuidValue(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
sScriptMgr->OnPlayerDuelRequest(target, caster);
}
@@ -4201,7 +4200,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
uint32 go_id = m_spellInfo->Effects[effIndex].MiscValue;
uint8 slot = m_spellInfo->Effects[effIndex].Effect - SPELL_EFFECT_SUMMON_OBJECT_SLOT1;
- if (uint64 guid = m_caster->m_ObjectSlot[slot])
+ if (ObjectGuid guid = m_caster->m_ObjectSlot[slot])
{
if (GameObject* obj = m_caster->GetMap()->GetGameObject(guid))
{
@@ -4210,7 +4209,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
obj->SetSpellId(0);
m_caster->RemoveGameObject(obj, true);
}
- m_caster->m_ObjectSlot[slot] = 0;
+ m_caster->m_ObjectSlot[slot].Clear();
}
GameObject* go = new GameObject();
@@ -4454,15 +4453,16 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
{
+ float speed = G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) ? m_spellInfo->Speed : SPEED_CHARGE;
// Spell is not using explicit target - no generated path
if (m_preGeneratedPath.GetPathType() == PATHFIND_BLANK)
{
//unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetObjectSize(), unitTarget->GetRelativeAngle(m_caster));
- m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ);
+ m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed);
}
else
- m_caster->GetMotionMaster()->MoveCharge(m_preGeneratedPath);
+ m_caster->GetMotionMaster()->MoveCharge(m_preGeneratedPath, speed);
}
if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET)
@@ -4635,9 +4635,7 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex)
return;
uint32 mechanic = m_spellInfo->Effects[effIndex].MiscValue;
-
- std::queue < std::pair < uint32, uint64 > > dispel_list;
-
+ DispelList dispel_list;
Unit::AuraMap const& auras = unitTarget->GetOwnedAuras();
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
@@ -4646,12 +4644,13 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex)
continue;
if (roll_chance_i(aura->CalcDispelChance(unitTarget, !unitTarget->IsFriendlyTo(m_caster))))
if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & (1 << mechanic)))
- dispel_list.push(std::make_pair(aura->GetId(), aura->GetCasterGUID()));
+ dispel_list.push_back(std::make_pair(aura->GetId(), aura->GetCasterGUID()));
}
- for (; dispel_list.size(); dispel_list.pop())
+ while (!dispel_list.empty())
{
unitTarget->RemoveAura(dispel_list.front().first, dispel_list.front().second, 0, AURA_REMOVE_BY_ENEMY_SPELL);
+ dispel_list.pop_front();
}
}
@@ -4873,7 +4872,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
{
case GAMEOBJECT_TYPE_FISHINGNODE:
{
- m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pGameObj->GetGUID());
+ m_caster->SetChannelObjectGuid(pGameObj->GetGUID());
m_caster->AddGameObject(pGameObj); // will removed at spell cancel
// end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo))
@@ -5137,8 +5136,8 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex)
return;
WorldPacket dataSuccess(SMSG_SPELLSTEALLOG, 8+8+4+1+4+damage*5);
- dataSuccess.append(unitTarget->GetPackGUID()); // Victim GUID
- dataSuccess.append(m_caster->GetPackGUID()); // Caster GUID
+ dataSuccess << unitTarget->GetPackGUID(); // Victim GUID
+ dataSuccess << m_caster->GetPackGUID(); // Caster GUID
dataSuccess << uint32(m_spellInfo->Id); // dispel spell id
dataSuccess << uint8(0); // not used
dataSuccess << uint32(success_list.size()); // count
@@ -5159,7 +5158,7 @@ void Spell::EffectKillCreditPersonal(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue, 0);
+ unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue);
}
void Spell::EffectKillCredit(SpellEffIndex effIndex)
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index a23fa54f255..c7944173817 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -976,10 +976,10 @@ bool SpellMgr::CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcE
// check spell family name/flags (if set) for spells
if (eventInfo.GetTypeMask() & (PERIODIC_PROC_FLAG_MASK | SPELL_PROC_FLAG_MASK | PROC_FLAG_DONE_TRAP_ACTIVATION))
{
- if (procEntry.spellFamilyName && (procEntry.spellFamilyName != eventInfo.GetSpellInfo()->SpellFamilyName))
+ if (procEntry.spellFamilyName && eventInfo.GetSpellInfo() && (procEntry.spellFamilyName != eventInfo.GetSpellInfo()->SpellFamilyName))
return false;
- if (procEntry.spellFamilyMask && !(procEntry.spellFamilyMask & eventInfo.GetSpellInfo()->SpellFamilyFlags))
+ if (procEntry.spellFamilyMask && eventInfo.GetSpellInfo() && !(procEntry.spellFamilyMask & eventInfo.GetSpellInfo()->SpellFamilyFlags))
return false;
}
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index 7132e0583e8..8ab3a72b47e 100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -972,7 +972,7 @@ uint32 AuraScript::GetId() const
return m_aura->GetId();
}
-uint64 AuraScript::GetCasterGUID() const
+ObjectGuid AuraScript::GetCasterGUID() const
{
return m_aura->GetCasterGUID();
}
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index 756644dbd1b..653ae9ab5e9 100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -797,7 +797,7 @@ class AuraScript : public _SpellScript
uint32 GetId() const;
// returns guid of object which cast the aura (m_originalCaster of the Spell class)
- uint64 GetCasterGUID() const;
+ ObjectGuid GetCasterGUID() const;
// returns unit which cast the aura or NULL if not avalible (caster logged out for example)
Unit* GetCaster() const;
// returns object on which aura was cast, target for non-area auras, area aura source for area auras
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index 6da4f6fdade..1cff81c171d 100644
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -24,7 +24,6 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CreatureTextMgr.h"
-#include "Group.h"
class CreatureTextBuilder
{
@@ -91,7 +90,6 @@ void CreatureTextMgr::LoadCreatureTexts()
}
uint32 textCount = 0;
- uint32 creatureCount = 0;
do
{
@@ -109,25 +107,26 @@ void CreatureTextMgr::LoadCreatureTexts()
temp.duration = fields[8].GetUInt32();
temp.sound = fields[9].GetUInt32();
temp.BroadcastTextId = fields[10].GetUInt32();
+ temp.TextRange = CreatureTextRange(fields[11].GetUInt8());
if (temp.sound)
{
if (!sSoundEntriesStore.LookupEntry(temp.sound))
{
- TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
+ TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
temp.sound = 0;
}
}
if (!GetLanguageDescByID(temp.lang))
{
- TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
+ TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
temp.lang = LANG_UNIVERSAL;
}
if (temp.type >= MAX_CHAT_MSG_TYPE)
{
- TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
+ TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
temp.type = CHAT_MSG_SAY;
}
@@ -135,7 +134,7 @@ void CreatureTextMgr::LoadCreatureTexts()
{
if (!sEmotesStore.LookupEntry(temp.emote))
{
- TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));
+ TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));
temp.emote = EMOTE_ONESHOT_NONE;
}
}
@@ -149,9 +148,11 @@ void CreatureTextMgr::LoadCreatureTexts()
}
}
- // entry not yet added, add empty TextHolder (list of groups)
- if (mTextMap.find(temp.entry) == mTextMap.end())
- ++creatureCount;
+ if (temp.TextRange > TEXT_RANGE_WORLD)
+ {
+ TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has incorrect TextRange %u.", temp.entry, temp.group, temp.id, temp.TextRange);
+ temp.TextRange = TEXT_RANGE_NORMAL;
+ }
// add the text into our entry's group
mTextMap[temp.entry][temp.group].push_back(temp);
@@ -160,7 +161,7 @@ void CreatureTextMgr::LoadCreatureTexts()
}
while (result->NextRow());
- TC_LOG_INFO("server.loading", ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
+ TC_LOG_INFO("server.loading", ">> Loaded %u creature texts for " SZFMTD " creatures in %u ms", textCount, mTextMap.size(), GetMSTimeDiffToNow(oldMSTime));
}
void CreatureTextMgr::LoadCreatureTextLocales()
@@ -193,7 +194,7 @@ void CreatureTextMgr::LoadCreatureTextLocales()
}
-uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget /*= NULL*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= NULL*/)
+uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget /*= nullptr*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= nullptr*/)
{
if (!source)
return 0;
@@ -274,6 +275,9 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject
Language finalLang = (language == LANG_ADDON) ? iter->lang : language;
uint32 finalSound = sound ? sound : iter->sound;
+ if (range == TEXT_RANGE_NORMAL)
+ range = iter->TextRange;
+
if (finalSound)
SendSound(source, finalSound, finalType, whisperTarget, range, team, gmOnly);
@@ -335,6 +339,18 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data,
{
switch (msgType)
{
+ case CHAT_MSG_MONSTER_PARTY:
+ {
+ if (!whisperTarget)
+ return;
+
+ if (Player const* whisperPlayer = whisperTarget->ToPlayer())
+ {
+ if (Group const* group = whisperPlayer->GetGroup())
+ group->BroadcastWorker([data](Player* player) { player->SendDirectMessage(data); });
+ }
+ return;
+ }
case CHAT_MSG_MONSTER_WHISPER:
case CHAT_MSG_RAID_BOSS_WHISPER:
{
@@ -348,18 +364,6 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data,
}
break;
}
- case CHAT_MSG_MONSTER_PARTY:
- if (!whisperTarget)
- return;
-
- if (Player const* player = whisperTarget->ToPlayer())
- {
- if (Group* group = const_cast<Group*>(player->GetGroup()))
- for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
- if (Player* member = itr->GetSource())
- member->GetSession()->SendPacket(data);
- }
- return;
default:
break;
}
diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h
index aef38a1923e..147228b51db 100644
--- a/src/server/game/Texts/CreatureTextMgr.h
+++ b/src/server/game/Texts/CreatureTextMgr.h
@@ -23,6 +23,16 @@
#include "ObjectAccessor.h"
#include "SharedDefines.h"
#include "Opcodes.h"
+#include "Group.h"
+
+enum CreatureTextRange
+{
+ TEXT_RANGE_NORMAL = 0,
+ TEXT_RANGE_AREA = 1,
+ TEXT_RANGE_ZONE = 2,
+ TEXT_RANGE_MAP = 3,
+ TEXT_RANGE_WORLD = 4
+};
struct CreatureTextEntry
{
@@ -37,15 +47,7 @@ struct CreatureTextEntry
uint32 duration;
uint32 sound;
uint32 BroadcastTextId;
-};
-
-enum CreatureTextRange
-{
- TEXT_RANGE_NORMAL = 0,
- TEXT_RANGE_AREA = 1,
- TEXT_RANGE_ZONE = 2,
- TEXT_RANGE_MAP = 3,
- TEXT_RANGE_WORLD = 4
+ CreatureTextRange TextRange;
};
struct CreatureTextLocale
@@ -55,9 +57,7 @@ struct CreatureTextLocale
struct CreatureTextId
{
- CreatureTextId(uint32 e, uint32 g, uint32 i) : entry(e), textGroup(g), textId(i)
- {
- }
+ CreatureTextId(uint32 e, uint32 g, uint32 i) : entry(e), textGroup(g), textId(i) { }
bool operator<(CreatureTextId const& right) const
{
@@ -69,22 +69,22 @@ struct CreatureTextId
uint32 textId;
};
-typedef std::vector<CreatureTextEntry> CreatureTextGroup; //texts in a group
-typedef std::unordered_map<uint8, CreatureTextGroup> CreatureTextHolder; //groups for a creature by groupid
-typedef std::unordered_map<uint32, CreatureTextHolder> CreatureTextMap; //all creatures by entry
+typedef std::vector<CreatureTextEntry> CreatureTextGroup; // texts in a group
+typedef std::unordered_map<uint8, CreatureTextGroup> CreatureTextHolder; // groups for a creature by groupid
+typedef std::unordered_map<uint32, CreatureTextHolder> CreatureTextMap; // all creatures by entry
typedef std::map<CreatureTextId, CreatureTextLocale> LocaleCreatureTextMap;
//used for handling non-repeatable random texts
typedef std::vector<uint8> CreatureTextRepeatIds;
typedef std::unordered_map<uint8, CreatureTextRepeatIds> CreatureTextRepeatGroup;
-typedef std::unordered_map<uint64, CreatureTextRepeatGroup> CreatureTextRepeatMap;//guid based
+typedef std::unordered_map<ObjectGuid, CreatureTextRepeatGroup> CreatureTextRepeatMap;//guid based
class CreatureTextMgr
{
private:
- CreatureTextMgr() { };
- ~CreatureTextMgr() { };
+ CreatureTextMgr() { }
+ ~CreatureTextMgr() { }
public:
static CreatureTextMgr* instance()
@@ -101,11 +101,11 @@ class CreatureTextMgr
void SendEmote(Unit* source, uint32 emote);
//if sent, returns the 'duration' of the text else 0 if error
- uint32 SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget = NULL, ChatMsg msgType = CHAT_MSG_ADDON, Language language = LANG_ADDON, CreatureTextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, Team team = TEAM_OTHER, bool gmOnly = false, Player* srcPlr = NULL);
+ uint32 SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget = nullptr, ChatMsg msgType = CHAT_MSG_ADDON, Language language = LANG_ADDON, CreatureTextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, Team team = TEAM_OTHER, bool gmOnly = false, Player* srcPlr = nullptr);
bool TextExist(uint32 sourceEntry, uint8 textGroup);
std::string GetLocalizedChatString(uint32 entry, uint8 gender, uint8 textGroup, uint32 id, LocaleConstant locale) const;
- template<class Builder> void SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget = NULL, CreatureTextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false) const;
+ template<class Builder> void SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget = nullptr, CreatureTextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false) const;
private:
CreatureTextRepeatIds GetRepeatGroup(Creature* source, uint8 textGroup);
@@ -165,7 +165,7 @@ class CreatureTextLocalizer
{
case CHAT_MSG_MONSTER_WHISPER:
case CHAT_MSG_RAID_BOSS_WHISPER:
- data.put<uint64>(whisperGUIDpos, player->GetGUID());
+ data.put<uint64>(whisperGUIDpos, player->GetGUID().GetRawValue());
break;
default:
break;
@@ -181,7 +181,7 @@ class CreatureTextLocalizer
};
template<class Builder>
-void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget /*= NULL*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/) const
+void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget /*= nullptr*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/) const
{
if (!source)
return;
@@ -190,6 +190,18 @@ void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder
switch (msgType)
{
+ case CHAT_MSG_MONSTER_PARTY:
+ {
+ if (!whisperTarget)
+ return;
+
+ if (Player* whisperPlayer = const_cast<Player*>(whisperTarget->ToPlayer()))
+ {
+ if (Group* group = whisperPlayer->GetGroup())
+ group->BroadcastWorker(localizer);
+ }
+ return;
+ }
case CHAT_MSG_MONSTER_WHISPER:
case CHAT_MSG_RAID_BOSS_WHISPER:
{
@@ -240,7 +252,7 @@ void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder
SessionMap const& smap = sWorld->GetAllSessions();
for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
if (Player* player = iter->second->GetPlayer())
- if (player->GetSession() && (!team || Team(player->GetTeam()) == team) && (!gmOnly || player->IsGameMaster()))
+ if ((!team || Team(player->GetTeam()) == team) && (!gmOnly || player->IsGameMaster()))
localizer(player);
return;
}
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index 566033fb700..0c5f3e608d9 100644
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
@@ -32,12 +32,12 @@ inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; }
///////////////////////////////////////////////////////////////////////////////////////////////////
// GM ticket
-GmTicket::GmTicket() : _id(0), _playerGuid(0), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0),
- _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false),
+GmTicket::GmTicket() : _id(0), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0),
+ _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false),
_needResponse(false), _needMoreHelp(false) { }
GmTicket::GmTicket(Player* player) : _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(time(NULL)), _lastModifiedTime(time(NULL)),
- _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false),
+ _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false),
_needResponse(false), _needMoreHelp(false)
{
_id = sTicketMgr->GenerateTicketId();
@@ -53,7 +53,7 @@ bool GmTicket::LoadFromDB(Field* fields)
// ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, haveTicket
uint8 index = 0;
_id = fields[ index].GetUInt32();
- _playerGuid = MAKE_NEW_GUID(fields[++index].GetUInt32(), 0, HIGHGUID_PLAYER);
+ _playerGuid = ObjectGuid(HIGHGUID_PLAYER, fields[++index].GetUInt32());
_playerName = fields[++index].GetString();
_message = fields[++index].GetString();
_createTime = fields[++index].GetUInt32();
@@ -62,8 +62,8 @@ bool GmTicket::LoadFromDB(Field* fields)
_posY = fields[++index].GetFloat();
_posZ = fields[++index].GetFloat();
_lastModifiedTime = fields[++index].GetUInt32();
- _closedBy = fields[++index].GetInt32();
- _assignedTo = MAKE_NEW_GUID(fields[++index].GetUInt32(), 0, HIGHGUID_PLAYER);
+ _closedBy = ObjectGuid(uint64(fields[++index].GetInt32()));
+ _assignedTo = ObjectGuid(HIGHGUID_PLAYER, fields[++index].GetUInt32());
_comment = fields[++index].GetString();
_response = fields[++index].GetString();
_completed = fields[++index].GetBool();
@@ -80,7 +80,7 @@ void GmTicket::SaveToDB(SQLTransaction& trans) const
uint8 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GM_TICKET);
stmt->setUInt32( index, _id);
- stmt->setUInt32(++index, GUID_LOPART(_playerGuid));
+ stmt->setUInt32(++index, _playerGuid.GetCounter());
stmt->setString(++index, _playerName);
stmt->setString(++index, _message);
stmt->setUInt32(++index, uint32(_createTime));
@@ -89,8 +89,8 @@ void GmTicket::SaveToDB(SQLTransaction& trans) const
stmt->setFloat (++index, _posY);
stmt->setFloat (++index, _posZ);
stmt->setUInt32(++index, uint32(_lastModifiedTime));
- stmt->setInt32 (++index, GUID_LOPART(_closedBy));
- stmt->setUInt32(++index, GUID_LOPART(_assignedTo));
+ stmt->setInt32 (++index, int32(_closedBy.GetCounter()));
+ stmt->setUInt32(++index, _assignedTo.GetCounter());
stmt->setString(++index, _comment);
stmt->setString(++index, _response);
stmt->setBool (++index, _completed);
@@ -204,7 +204,7 @@ std::string GmTicket::FormatMessageString(ChatHandler& handler, const char* szCl
void GmTicket::SetUnassigned()
{
- _assignedTo = 0;
+ _assignedTo.Clear();
switch (_escalatedStatus)
{
case TICKET_ASSIGNED: _escalatedStatus = TICKET_UNASSIGNED; break;
@@ -354,7 +354,7 @@ void TicketMgr::AddTicket(GmTicket* ticket)
ticket->SaveToDB(trans);
}
-void TicketMgr::CloseTicket(uint32 ticketId, int64 source)
+void TicketMgr::CloseTicket(uint32 ticketId, ObjectGuid source)
{
if (GmTicket* ticket = GetTicket(ticketId))
{
diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h
index 8b1c8fbc0f9..d9b9b68d133 100644
--- a/src/server/game/Tickets/TicketMgr.h
+++ b/src/server/game/Tickets/TicketMgr.h
@@ -84,19 +84,19 @@ public:
GmTicket(Player* player);
~GmTicket();
- bool IsClosed() const { return _closedBy != 0; }
+ bool IsClosed() const { return !_closedBy.IsEmpty(); }
bool IsCompleted() const { return _completed; }
- bool IsFromPlayer(uint64 guid) const { return guid == _playerGuid; }
- bool IsAssigned() const { return _assignedTo != 0; }
- bool IsAssignedTo(uint64 guid) const { return guid == _assignedTo; }
- bool IsAssignedNotTo(uint64 guid) const { return IsAssigned() && !IsAssignedTo(guid); }
+ bool IsFromPlayer(ObjectGuid guid) const { return guid == _playerGuid; }
+ bool IsAssigned() const { return !_assignedTo.IsEmpty(); }
+ bool IsAssignedTo(ObjectGuid guid) const { return guid == _assignedTo; }
+ bool IsAssignedNotTo(ObjectGuid guid) const { return IsAssigned() && !IsAssignedTo(guid); }
uint32 GetId() const { return _id; }
Player* GetPlayer() const { return ObjectAccessor::FindPlayer(_playerGuid); }
std::string const& GetPlayerName() const { return _playerName; }
std::string const& GetMessage() const { return _message; }
Player* GetAssignedPlayer() const { return ObjectAccessor::FindPlayer(_assignedTo); }
- uint64 GetAssignedToGUID() const { return _assignedTo; }
+ ObjectGuid GetAssignedToGUID() const { return _assignedTo; }
std::string GetAssignedToName() const
{
std::string name;
@@ -110,7 +110,7 @@ public:
GMTicketEscalationStatus GetEscalatedStatus() const { return _escalatedStatus; }
void SetEscalatedStatus(GMTicketEscalationStatus escalatedStatus) { _escalatedStatus = escalatedStatus; }
- void SetAssignedTo(uint64 guid, bool isAdmin)
+ void SetAssignedTo(ObjectGuid guid, bool isAdmin)
{
_assignedTo = guid;
if (isAdmin && _escalatedStatus == TICKET_IN_ESCALATION_QUEUE)
@@ -118,7 +118,7 @@ public:
else if (_escalatedStatus == TICKET_UNASSIGNED)
_escalatedStatus = TICKET_ASSIGNED;
}
- void SetClosedBy(int64 value) { _closedBy = value; }
+ void SetClosedBy(ObjectGuid value) { _closedBy = value; }
void SetCompleted() { _completed = true; }
void SetMessage(std::string const& message)
{
@@ -149,7 +149,7 @@ public:
private:
uint32 _id;
- uint64 _playerGuid;
+ ObjectGuid _playerGuid;
std::string _playerName;
float _posX;
float _posY;
@@ -158,8 +158,8 @@ private:
std::string _message;
uint64 _createTime;
uint64 _lastModifiedTime;
- int64 _closedBy; // 0 = Open, -1 = Console, playerGuid = player abandoned ticket, other = GM who closed it.
- uint64 _assignedTo;
+ ObjectGuid _closedBy; // 0 = Open, -1 = Console, playerGuid = player abandoned ticket, other = GM who closed it.
+ ObjectGuid _assignedTo;
std::string _comment;
bool _completed;
GMTicketEscalationStatus _escalatedStatus;
@@ -196,7 +196,7 @@ public:
return NULL;
}
- GmTicket* GetTicketByPlayer(uint64 playerGuid)
+ GmTicket* GetTicketByPlayer(ObjectGuid playerGuid)
{
for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr)
if (itr->second && itr->second->IsFromPlayer(playerGuid) && !itr->second->IsClosed())
@@ -215,7 +215,7 @@ public:
}
void AddTicket(GmTicket* ticket);
- void CloseTicket(uint32 ticketId, int64 source = -1);
+ void CloseTicket(uint32 ticketId, ObjectGuid source);
void RemoveTicket(uint32 ticketId);
bool GetStatus() const { return _status; }
diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp
index 3cde5a6d70f..e64bd4868bb 100644
--- a/src/server/game/Tools/PlayerDump.cpp
+++ b/src/server/game/Tools/PlayerDump.cpp
@@ -347,9 +347,7 @@ bool PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl
bool PlayerDumpWriter::GetDump(uint32 guid, std::string &dump)
{
- dump = "";
-
- dump += "IMPORTANT NOTE: THIS DUMPFILE IS MADE FOR USE WITH THE 'PDUMP' COMMAND ONLY - EITHER THROUGH INGAME CHAT OR ON CONSOLE!\n";
+ dump = "IMPORTANT NOTE: THIS DUMPFILE IS MADE FOR USE WITH THE 'PDUMP' COMMAND ONLY - EITHER THROUGH INGAME CHAT OR ON CONSOLE!\n";
dump += "IMPORTANT NOTE: DO NOT apply it directly - it will irreversibly DAMAGE and CORRUPT your database! You have been warned!\n\n";
for (int i = 0; i < DUMP_TABLE_COUNT; ++i)
@@ -430,7 +428,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
// normalize the name if specified and check if it exists
if (!normalizePlayerName(name))
- name = "";
+ name.clear();
if (ObjectMgr::CheckPlayerName(name, true) == CHAR_NAME_SUCCESS)
{
@@ -439,10 +437,10 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
- name = ""; // use the one from the dump
+ name.clear(); // use the one from the dump
}
else
- name = "";
+ name.clear();
// name encoded or empty
@@ -538,7 +536,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
playerClass = uint8(atol(getnth(line, 5).c_str()));
gender = uint8(atol(getnth(line, 6).c_str()));
level = uint8(atol(getnth(line, 7).c_str()));
- if (name == "")
+ if (name.empty())
{
// check if the original name already exists
name = getnth(line, 3);
@@ -634,7 +632,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
snprintf(lastpetid, 20, "%s", currpetid);
if (strcmp(lastpetid, currpetid) != 0)
{
- snprintf(newpetid, 20, "%d", sObjectMgr->GeneratePetNumber());
+ snprintf(newpetid, 20, "%u", sObjectMgr->GeneratePetNumber());
snprintf(lastpetid, 20, "%s", currpetid);
}
@@ -681,7 +679,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
CharacterDatabase.CommitTransaction(trans);
// in case of name conflict player has to rename at login anyway
- sWorld->AddCharacterNameData(guid, name, gender, race, playerClass, level);
+ sWorld->AddCharacterNameData(ObjectGuid(HIGHGUID_PLAYER, guid), name, gender, race, playerClass, level);
sObjectMgr->_hiItemGuid += items.size();
sObjectMgr->_mailId += mails.size();
diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp
index 092bb19de07..f903e5324ac 100644
--- a/src/server/game/Warden/WardenMac.cpp
+++ b/src/server/game/Warden/WardenMac.cpp
@@ -244,7 +244,7 @@ void WardenMac::HandleData(ByteBuffer &buff)
uint8 sha1Hash[20];
buff.read(sha1Hash, 20);
- if (memcmp(sha1Hash, sha1.GetDigest(), 20))
+ if (memcmp(sha1Hash, sha1.GetDigest(), 20) != 0)
{
TC_LOG_DEBUG("warden", "Handle data failed: SHA1 hash is wrong!");
//found = true;
@@ -259,7 +259,7 @@ void WardenMac::HandleData(ByteBuffer &buff)
uint8 theirsMD5Hash[16];
buff.read(theirsMD5Hash, 16);
- if (memcmp(ourMD5Hash, theirsMD5Hash, 16))
+ if (memcmp(ourMD5Hash, theirsMD5Hash, 16) != 0)
{
TC_LOG_DEBUG("warden", "Handle data failed: MD5 hash is wrong!");
//found = true;
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 7369e9285a2..163d76a18bd 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -2226,7 +2226,7 @@ namespace Trinity
{
public:
typedef std::vector<WorldPacket*> WorldPacketList;
- explicit WorldWorldTextBuilder(int32 textId, va_list* args = NULL) : i_textId(textId), i_args(args) { }
+ explicit WorldWorldTextBuilder(uint32 textId, va_list* args = NULL) : i_textId(textId), i_args(args) { }
void operator()(WorldPacketList& data_list, LocaleConstant loc_idx)
{
char const* text = sObjectMgr->GetTrinityString(i_textId, loc_idx);
@@ -2259,13 +2259,13 @@ namespace Trinity
}
}
- int32 i_textId;
+ uint32 i_textId;
va_list* i_args;
};
} // namespace Trinity
/// Send a System Message to all players (except self if mentioned)
-void World::SendWorldText(int32 string_id, ...)
+void World::SendWorldText(uint32 string_id, ...)
{
va_list ap;
va_start(ap, string_id);
@@ -2284,7 +2284,7 @@ void World::SendWorldText(int32 string_id, ...)
}
/// Send a System Message to all GMs (except self if mentioned)
-void World::SendGMText(int32 string_id, ...)
+void World::SendGMText(uint32 string_id, ...)
{
va_list ap;
va_start(ap, string_id);
@@ -3206,15 +3206,15 @@ void World::ProcessQueryCallbacks()
}
/**
-* @brief Loads several pieces of information on server startup with the low GUID
+* @brief Loads several pieces of information on server startup with the GUID
* There is no further database query necessary.
* These are a number of methods that work into the calling function.
*
-* @param guid Requires a lowGUID to call
+* @param guid Requires a guid to call
* @return Name, Gender, Race, Class and Level of player character
* Example Usage:
* @code
-* CharacterNameData const* nameData = sWorld->GetCharacterNameData(lowGUID);
+* CharacterNameData const* nameData = sWorld->GetCharacterNameData(GUID);
* if (!nameData)
* return;
*
@@ -3242,7 +3242,7 @@ void World::LoadCharacterNameData()
do
{
Field* fields = result->Fetch();
- AddCharacterNameData(fields[0].GetUInt32(), fields[1].GetString(),
+ AddCharacterNameData(ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()), fields[1].GetString(),
fields[3].GetUInt8() /*gender*/, fields[2].GetUInt8() /*race*/, fields[4].GetUInt8() /*class*/, fields[5].GetUInt8() /*level*/);
++count;
} while (result->NextRow());
@@ -3250,7 +3250,7 @@ void World::LoadCharacterNameData()
TC_LOG_INFO("server.loading", "Loaded name data for %u characters", count);
}
-void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level)
+void World::AddCharacterNameData(ObjectGuid guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level)
{
CharacterNameData& data = _characterNameDataMap[guid];
data.m_name = name;
@@ -3260,9 +3260,9 @@ void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gen
data.m_level = level;
}
-void World::UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender /*= GENDER_NONE*/, uint8 race /*= RACE_NONE*/)
+void World::UpdateCharacterNameData(ObjectGuid guid, std::string const& name, uint8 gender /*= GENDER_NONE*/, uint8 race /*= RACE_NONE*/)
{
- std::map<uint32, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid);
+ std::map<ObjectGuid, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid);
if (itr == _characterNameDataMap.end())
return;
@@ -3275,22 +3275,22 @@ void World::UpdateCharacterNameData(uint32 guid, std::string const& name, uint8
itr->second.m_race = race;
WorldPacket data(SMSG_INVALIDATE_PLAYER, 8);
- data << MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER);
+ data << guid;
SendGlobalMessage(&data);
}
-void World::UpdateCharacterNameDataLevel(uint32 guid, uint8 level)
+void World::UpdateCharacterNameDataLevel(ObjectGuid guid, uint8 level)
{
- std::map<uint32, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid);
+ std::map<ObjectGuid, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid);
if (itr == _characterNameDataMap.end())
return;
itr->second.m_level = level;
}
-CharacterNameData const* World::GetCharacterNameData(uint32 guid) const
+CharacterNameData const* World::GetCharacterNameData(ObjectGuid guid) const
{
- std::map<uint32, CharacterNameData>::const_iterator itr = _characterNameDataMap.find(guid);
+ std::map<ObjectGuid, CharacterNameData>::const_iterator itr = _characterNameDataMap.find(guid);
if (itr != _characterNameDataMap.end())
return &itr->second;
else
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index b70ea28eb15..3bbc4e48eea 100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -24,6 +24,7 @@
#define __WORLD_H
#include "Common.h"
+#include "ObjectGuid.h"
#include "Timer.h"
#include "SharedDefines.h"
#include "QueryResult.h"
@@ -646,9 +647,9 @@ class World
void SetInitialWorldSettings();
void LoadConfigSettings(bool reload = false);
- void SendWorldText(int32 string_id, ...);
+ void SendWorldText(uint32 string_id, ...);
void SendGlobalText(const char* text, WorldSession* self);
- void SendGMText(int32 string_id, ...);
+ void SendGMText(uint32 string_id, ...);
void SendServerMessage(ServerMessageType type, const char *text = "", Player* player = NULL);
void SendGlobalMessage(WorldPacket* packet, WorldSession* self = nullptr, uint32 team = 0);
void SendGlobalGMMessage(WorldPacket* packet, WorldSession* self = nullptr, uint32 team = 0);
@@ -756,12 +757,12 @@ class World
void UpdateAreaDependentAuras();
- CharacterNameData const* GetCharacterNameData(uint32 guid) const;
- void AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level);
- void UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender = GENDER_NONE, uint8 race = RACE_NONE);
- void UpdateCharacterNameDataLevel(uint32 guid, uint8 level);
- void DeleteCharacterNameData(uint32 guid) { _characterNameDataMap.erase(guid); }
- bool HasCharacterNameData(uint32 guid) { return _characterNameDataMap.find(guid) != _characterNameDataMap.end(); }
+ CharacterNameData const* GetCharacterNameData(ObjectGuid guid) const;
+ void AddCharacterNameData(ObjectGuid guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level);
+ void UpdateCharacterNameData(ObjectGuid guid, std::string const& name, uint8 gender = GENDER_NONE, uint8 race = RACE_NONE);
+ void UpdateCharacterNameDataLevel(ObjectGuid guid, uint8 level);
+ void DeleteCharacterNameData(ObjectGuid guid) { _characterNameDataMap.erase(guid); }
+ bool HasCharacterNameData(ObjectGuid guid) { return _characterNameDataMap.find(guid) != _characterNameDataMap.end(); }
uint32 GetCleaningFlags() const { return m_CleaningFlags; }
void SetCleaningFlags(uint32 flags) { m_CleaningFlags = flags; }
@@ -869,7 +870,7 @@ class World
typedef std::map<uint8, uint8> AutobroadcastsWeightMap;
AutobroadcastsWeightMap m_AutobroadcastsWeights;
- std::map<uint32, CharacterNameData> _characterNameDataMap;
+ std::map<ObjectGuid, CharacterNameData> _characterNameDataMap;
void LoadCharacterNameData();
void ProcessQueryCallbacks();
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index bef9ae9532e..e398e54ad19 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -774,7 +774,7 @@ public:
if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true))
return false;
- if (strcmp(password, passwordConfirmation))
+ if (strcmp(password, passwordConfirmation) != 0)
{
handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
handler->SetSentErrorMessage(true);
diff --git a/src/server/scripts/Commands/cs_arena.cpp b/src/server/scripts/Commands/cs_arena.cpp
index 5658701bd54..4db7c088d35 100644
--- a/src/server/scripts/Commands/cs_arena.cpp
+++ b/src/server/scripts/Commands/cs_arena.cpp
@@ -103,7 +103,7 @@ public:
}
sArenaTeamMgr->AddArenaTeam(arena);
- handler->PSendSysMessage(LANG_ARENA_CREATE, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetCaptain());
+ handler->PSendSysMessage(LANG_ARENA_CREATE, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetCaptain().GetCounter());
}
else
{
@@ -232,7 +232,7 @@ public:
return false;
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid))
return false;
@@ -275,7 +275,7 @@ public:
arena->SetCaptain(targetGuid);
- CharacterNameData const* oldCaptainNameData = sWorld->GetCharacterNameData(GUID_LOPART(arena->GetCaptain()));
+ CharacterNameData const* oldCaptainNameData = sWorld->GetCharacterNameData(arena->GetCaptain());
if (!oldCaptainNameData)
{
handler->SetSentErrorMessage(true);
@@ -313,7 +313,7 @@ public:
handler->PSendSysMessage(LANG_ARENA_INFO_HEADER, arena->GetName().c_str(), arena->GetId(), arena->GetRating(), arena->GetType(), arena->GetType());
for (ArenaTeam::MemberList::iterator itr = arena->m_membersBegin(); itr != arena->m_membersEnd(); ++itr)
- handler->PSendSysMessage(LANG_ARENA_INFO_MEMBERS, itr->Name.c_str(), GUID_LOPART(itr->Guid), itr->PersonalRating, (arena->GetCaptain() == itr->Guid ? "- Captain" : ""));
+ handler->PSendSysMessage(LANG_ARENA_INFO_MEMBERS, itr->Name.c_str(), itr->Guid.GetCounter(), itr->PersonalRating, (arena->GetCaptain() == itr->Guid ? "- Captain" : ""));
return true;
}
diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
index 880cf1eac1f..e11ee0008d2 100644
--- a/src/server/scripts/Commands/cs_ban.cpp
+++ b/src/server/scripts/Commands/cs_ban.cpp
@@ -340,7 +340,7 @@ public:
bool permanent = (fields[1].GetUInt32() == uint32(0));
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true);
handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
- fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO), fields[4].GetCString(), fields[5].GetCString());
+ TimeToTimestampStr(fields[0].GetUInt32()).c_str(), banTime.c_str(), active ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO), fields[4].GetCString(), fields[5].GetCString());
}
while (result->NextRow());
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index 0c6d495a360..8254d08558a 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -79,7 +79,7 @@ public:
// Stores informations about a deleted character
struct DeletedInfo
{
- uint32 lowGuid; ///< the low GUID from the character
+ ObjectGuid guid; ///< the GUID from the character
std::string name; ///< the character name
uint32 accountId; ///< the account id
std::string accountName; ///< the account name
@@ -133,7 +133,7 @@ public:
DeletedInfo info;
- info.lowGuid = fields[0].GetUInt32();
+ info.guid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
info.name = fields[1].GetString();
info.accountId = fields[2].GetUInt32();
@@ -173,11 +173,11 @@ public:
if (!handler->GetSession())
handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE,
- itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
+ itr->guid.GetCounter(), itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
itr->accountId, dateStr.c_str());
else
handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT,
- itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
+ itr->guid.GetCounter(), itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
itr->accountId, dateStr.c_str());
}
@@ -199,7 +199,7 @@ public:
{
if (delInfo.accountName.empty()) // account not exist
{
- handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.guid.GetCounter(), delInfo.accountId);
return;
}
@@ -207,29 +207,29 @@ public:
uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId);
if (charcount >= 10)
{
- handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.guid.GetCounter(), delInfo.accountId);
return;
}
if (sObjectMgr->GetPlayerGUIDByName(delInfo.name))
{
- handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.guid.GetCounter(), delInfo.accountId);
return;
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_RESTORE_DELETE_INFO);
stmt->setString(0, delInfo.name);
stmt->setUInt32(1, delInfo.accountId);
- stmt->setUInt32(2, delInfo.lowGuid);
+ stmt->setUInt32(2, delInfo.guid.GetCounter());
CharacterDatabase.Execute(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA);
- stmt->setUInt32(0, delInfo.lowGuid);
+ stmt->setUInt32(0, delInfo.guid.GetCounter());
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
- sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8());
+ sWorld->AddCharacterNameData(delInfo.guid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8());
}
- static void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler)
+ static void HandleCharacterLevel(Player* player, ObjectGuid playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler)
{
if (player)
{
@@ -252,7 +252,7 @@ public:
// Update level and reset XP, everything else will be updated at login
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
stmt->setUInt8(0, uint8(newLevel));
- stmt->setUInt32(1, GUID_LOPART(playerGuid));
+ stmt->setUInt32(1, playerGuid.GetCounter());
CharacterDatabase.Execute(stmt);
}
}
@@ -303,7 +303,7 @@ public:
static bool HandleCharacterRenameCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -318,7 +318,7 @@ public:
if (target)
{
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
playerOldName = target->GetName();
@@ -368,7 +368,7 @@ public:
// Remove declined name from db
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME);
- stmt->setUInt32(0, targetGuid);
+ stmt->setUInt32(0, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
if (target)
@@ -382,7 +382,7 @@ public:
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME_BY_GUID);
stmt->setString(0, newName);
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -396,14 +396,14 @@ public:
sLog->outCommand(session->GetAccountId(), "GM %s (Account: %u) forced rename %s to player %s (Account: %u)", player->GetName().c_str(), session->GetAccountId(), newName.c_str(), playerOldName.c_str(), sObjectMgr->GetPlayerAccountIdByGUID(targetGuid));
}
else
- sLog->outCommand(0, "CONSOLE forced rename '%s' to '%s' (GUID: %u)", playerOldName.c_str(), newName.c_str(), GUID_LOPART(targetGuid));
+ sLog->outCommand(0, "CONSOLE forced rename '%s' to '%s' (%s)", playerOldName.c_str(), newName.c_str(), targetGuid.ToString().c_str());
}
else
{
if (target)
{
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target).c_str());
@@ -416,11 +416,11 @@ public:
return false;
std::string oldNameLink = handler->playerLink(targetName);
- handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
+ handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
}
}
@@ -444,7 +444,7 @@ public:
}
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
return false;
@@ -472,7 +472,7 @@ public:
static bool HandleCharacterCustomizeCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -488,8 +488,8 @@ public:
else
{
std::string oldNameLink = handler->playerLink(targetName);
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
- handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, targetGuid.GetCounter());
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
}
CharacterDatabase.Execute(stmt);
@@ -499,7 +499,7 @@ public:
static bool HandleCharacterChangeFactionCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
@@ -516,8 +516,8 @@ public:
else
{
std::string oldNameLink = handler->playerLink(targetName);
- handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
+ stmt->setUInt32(1, targetGuid.GetCounter());
}
CharacterDatabase.Execute(stmt);
@@ -527,7 +527,7 @@ public:
static bool HandleCharacterChangeRaceCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -545,8 +545,8 @@ public:
{
std::string oldNameLink = handler->playerLink(targetName);
/// @todo add text into database
- handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
+ stmt->setUInt32(1, targetGuid.GetCounter());
}
CharacterDatabase.Execute(stmt);
@@ -721,7 +721,7 @@ public:
// Call the appropriate function to delete them (current account for deleted characters is 0)
for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
- Player::DeleteFromDB(itr->lowGuid, 0, false, true);
+ Player::DeleteFromDB(itr->guid, 0, false, true);
return true;
}
@@ -773,7 +773,7 @@ public:
if (!normalizePlayerName(characterName))
return false;
- uint64 characterGuid;
+ ObjectGuid characterGuid;
uint32 accountId;
Player* player = sObjectAccessor->FindPlayerByName(characterName);
@@ -799,7 +799,7 @@ public:
AccountMgr::GetName(accountId, accountName);
Player::DeleteFromDB(characterGuid, accountId, true, true);
- handler->PSendSysMessage(LANG_CHARACTER_DELETED, characterName.c_str(), GUID_LOPART(characterGuid), accountName.c_str(), accountId);
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED, characterName.c_str(), characterGuid.GetCounter(), accountName.c_str(), accountId);
return true;
}
@@ -818,7 +818,7 @@ public:
}
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
return false;
@@ -921,7 +921,7 @@ public:
return false;
}
- if (sObjectMgr->GetPlayerAccountIdByGUID(guid))
+ if (sObjectMgr->GetPlayerAccountIdByGUID(ObjectGuid(HIGHGUID_PLAYER, guid)))
{
handler->PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid);
handler->SetSentErrorMessage(true);
@@ -966,10 +966,10 @@ public:
if (!fileStr || !playerStr)
return false;
- uint64 guid;
+ ObjectGuid guid;
// character name can't start from number
if (isNumeric(playerStr))
- guid = MAKE_NEW_GUID(atoi(playerStr), 0, HIGHGUID_PLAYER);
+ guid = ObjectGuid(HIGHGUID_PLAYER, uint32(atoi(playerStr)));
else
{
std::string name = handler->extractPlayerNameFromLink(playerStr);
diff --git a/src/server/scripts/Commands/cs_cheat.cpp b/src/server/scripts/Commands/cs_cheat.cpp
index 1fe7c6adf5b..54db5c2af51 100644
--- a/src/server/scripts/Commands/cs_cheat.cpp
+++ b/src/server/scripts/Commands/cs_cheat.cpp
@@ -228,7 +228,7 @@ public:
if (!chr)
chr = handler->GetSession()->GetPlayer();
- else if (handler->HasLowerSecurity(chr, 0)) // check online security
+ else if (handler->HasLowerSecurity(chr, ObjectGuid::Empty)) // check online security
return false;
if (argstr == "on")
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 4ff7efd2f0a..4b555fcf625 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -240,7 +240,7 @@ public:
return false;
SellResult msg = SellResult(atoi(args));
- handler->GetSession()->GetPlayer()->SendSellError(msg, 0, 0);
+ handler->GetSession()->GetPlayer()->SendSellError(msg, nullptr, ObjectGuid::Empty);
return true;
}
@@ -250,7 +250,7 @@ public:
return false;
BuyResult msg = BuyResult(atoi(args));
- handler->GetSession()->GetPlayer()->SendBuyError(msg, 0, 0, 0);
+ handler->GetSession()->GetPlayer()->SendBuyError(msg, nullptr, 0, 0);
return true;
}
@@ -321,7 +321,7 @@ public:
std::string type;
parsedStream >> type;
- if (type == "")
+ if (type.empty())
break;
if (type == "uint8")
@@ -362,11 +362,11 @@ public:
}
else if (type == "appitsguid")
{
- data.append(unit->GetPackGUID());
+ data << unit->GetPackGUID();
}
else if (type == "appmyguid")
{
- data.append(player->GetPackGUID());
+ data << player->GetPackGUID();
}
else if (type == "appgoguid")
{
@@ -378,7 +378,7 @@ public:
ifs.close();
return false;
}
- data.append(obj->GetPackGUID());
+ data << obj->GetPackGUID();
}
else if (type == "goguid")
{
@@ -559,10 +559,10 @@ public:
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
if (Item* item2 = bag->GetItemByPos(j))
if (item2->GetState() == state)
- handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()));
+ handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), item2->GetOwnerGUID().GetCounter());
}
else if (item->GetState() == state)
- handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()));
+ handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), item->GetOwnerGUID().GetCounter());
}
}
}
@@ -624,7 +624,7 @@ public:
if (item->GetOwnerGUID() != player->GetGUID())
{
- handler->PSendSysMessage("The item with slot %d and itemguid %d does have non-matching owner guid (%d) and player guid (%d) !", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow());
+ handler->PSendSysMessage("The item with slot %d and itemguid %d does have non-matching owner guid (%d) and player guid (%d) !", item->GetSlot(), item->GetGUIDLow(), item->GetOwnerGUID().GetCounter(), player->GetGUIDLow());
error = true;
continue;
}
@@ -684,7 +684,7 @@ public:
if (item2->GetOwnerGUID() != player->GetGUID())
{
- handler->PSendSysMessage("The item in bag %d at slot %d and with itemguid %d, the owner's guid (%d) and the player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()), player->GetGUIDLow());
+ handler->PSendSysMessage("The item in bag %d at slot %d and with itemguid %d, the owner's guid (%d) and the player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), item2->GetOwnerGUID().GetCounter(), player->GetGUIDLow());
error = true;
continue;
}
@@ -746,7 +746,7 @@ public:
if (item->GetOwnerGUID() != player->GetGUID())
{
- handler->PSendSysMessage("queue(%zu): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow());
+ handler->PSendSysMessage("queue(%zu): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), item->GetOwnerGUID().GetCounter(), player->GetGUIDLow());
error = true;
continue;
}
@@ -990,7 +990,7 @@ public:
uint32 guid = (uint32)atoi(e);
uint32 index = (uint32)atoi(f);
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
+ Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid));
if (!i)
return false;
@@ -1021,7 +1021,7 @@ public:
uint32 index = (uint32)atoi(f);
uint32 value = (uint32)atoi(g);
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
+ Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid));
if (!i)
return false;
@@ -1045,7 +1045,7 @@ public:
uint32 guid = (uint32)atoi(e);
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
+ Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
if (!i)
return false;
@@ -1124,12 +1124,12 @@ public:
return false;
}
- uint64 guid = target->GetGUID();
+ ObjectGuid guid = target->GetGUID();
uint32 field = (uint32)atoi(x);
if (field >= target->GetValuesCount())
{
- handler->PSendSysMessage(LANG_TOO_BIG_INDEX, field, GUID_LOPART(guid), target->GetValuesCount());
+ handler->PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.GetCounter(), target->GetValuesCount());
return false;
}
@@ -1141,13 +1141,13 @@ public:
{
uint32 value = (uint32)atoi(y);
target->SetUInt32Value(field, value);
- handler->PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), field, value);
+ handler->PSendSysMessage(LANG_SET_UINT_FIELD, guid.GetCounter(), field, value);
}
else
{
float value = (float)atof(y);
target->SetFloatValue(field, value);
- handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), field, value);
+ handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, guid.GetCounter(), field, value);
}
return true;
@@ -1172,12 +1172,12 @@ public:
return false;
}
- uint64 guid = target->GetGUID();
+ ObjectGuid guid = target->GetGUID();
uint32 opcode = (uint32)atoi(x);
if (opcode >= target->GetValuesCount())
{
- handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, GUID_LOPART(guid), target->GetValuesCount());
+ handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, guid.GetCounter(), target->GetValuesCount());
return false;
}
@@ -1188,12 +1188,12 @@ public:
if (isInt32)
{
uint32 value = target->GetUInt32Value(opcode);
- handler->PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), opcode, value);
+ handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.GetCounter(), opcode, value);
}
else
{
float value = target->GetFloatValue(opcode);
- handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), opcode, value);
+ handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.GetCounter(), opcode, value);
}
return true;
diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp
index d12ba9ad9b4..27ec4835ce6 100644
--- a/src/server/scripts/Commands/cs_gm.cpp
+++ b/src/server/scripts/Commands/cs_gm.cpp
@@ -208,7 +208,7 @@ public:
if (param == "on")
{
- if (_player->HasAura(VISUAL_AURA, 0))
+ if (_player->HasAura(VISUAL_AURA))
_player->RemoveAurasDueToSpell(VISUAL_AURA);
_player->SetGMVisible(true);
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index 6c321a66c48..a7fa77fbe97 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -140,7 +140,7 @@ public:
Transport* transport = NULL;
- if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, id, HIGHGUID_UNIT), (Creature*)NULL))
+ if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, id, guid), (Creature*)NULL))
{
x = creature->GetPositionX();
y = creature->GetPositionY();
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index d7b7adc05ba..c8168a1391a 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -327,7 +327,7 @@ public:
return false;
}
- GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(guidLow, id, HIGHGUID_GAMEOBJECT));
+ GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, id, guidLow));
handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->name.c_str(), guidLow, id, x, y, z, mapId, o, phase);
@@ -370,13 +370,13 @@ public:
return false;
}
- uint64 ownerGuid = object->GetOwnerGUID();
+ ObjectGuid ownerGuid = object->GetOwnerGUID();
if (ownerGuid)
{
Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid);
- if (!owner || !IS_PLAYER_GUID(ownerGuid))
+ if (!owner || !ownerGuid.IsPlayer())
{
- handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(ownerGuid), object->GetGUIDLow());
+ handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), object->GetGUIDLow());
handler->SetSentErrorMessage(true);
return false;
}
diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp
index 470eb27bad2..e39aca6f6a7 100644
--- a/src/server/scripts/Commands/cs_group.cpp
+++ b/src/server/scripts/Commands/cs_group.cpp
@@ -57,7 +57,7 @@ public:
return false;
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
Group* group = target->GetGroup();
@@ -95,7 +95,7 @@ public:
continue;
// check online security
- if (handler->HasLowerSecurity(player, 0))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
return false;
std::string plNameLink = handler->GetNameLink(player);
@@ -147,7 +147,7 @@ public:
{
Player* player = NULL;
Group* group = NULL;
- uint64 guid = 0;
+ ObjectGuid guid;
char* nameStr = strtok((char*)args, " ");
if (!handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
@@ -173,7 +173,7 @@ public:
{
Player* player = NULL;
Group* group = NULL;
- uint64 guid = 0;
+ ObjectGuid guid;
char* nameStr = strtok((char*)args, " ");
if (!handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
@@ -194,7 +194,7 @@ public:
{
Player* player = NULL;
Group* group = NULL;
- uint64 guid = 0;
+ ObjectGuid guid;
char* nameStr = strtok((char*)args, " ");
if (!handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
@@ -220,8 +220,8 @@ public:
Player* playerTarget = NULL;
Group* groupSource = NULL;
Group* groupTarget = NULL;
- uint64 guidSource = 0;
- uint64 guidTarget = 0;
+ ObjectGuid guidSource;
+ ObjectGuid guidTarget;
char* nameplgrStr = strtok((char*)args, " ");
char* nameplStr = strtok(NULL, " ");
@@ -263,18 +263,18 @@ public:
// Get ALL the variables!
Player* playerTarget;
uint32 phase = 0;
- uint64 guidTarget;
+ ObjectGuid guidTarget;
std::string nameTarget;
std::string zoneName;
const char* onlineState = "";
// Parse the guid to uint32...
- uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
+ ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args)));
// ... and try to extract a player out of it.
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget))
{
- playerTarget = sObjectMgr->GetPlayerByLowGUID(parseGUID);
+ playerTarget = ObjectAccessor::FindPlayer(parseGUID);
guidTarget = parseGUID;
}
// If not, we return false and end right away.
@@ -292,7 +292,7 @@ public:
if (!groupTarget)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER);
- stmt->setUInt32(0, guidTarget);
+ stmt->setUInt32(0, guidTarget.GetCounter());
PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt);
if (resultGroup)
groupTarget = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32());
@@ -368,7 +368,7 @@ public:
// Now we can print those informations for every single member of each group!
handler->PSendSysMessage(LANG_GROUP_PLAYER_NAME_GUID, slot.name.c_str(), onlineState,
- zoneName.c_str(), phase, GUID_LOPART(slot.guid), flags.c_str(),
+ zoneName.c_str(), phase, slot.guid.GetCounter(), flags.c_str(),
lfg::GetRolesString(slot.roles).c_str());
}
diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp
index 362f16d29a3..e06fbde868c 100644
--- a/src/server/scripts/Commands/cs_guild.cpp
+++ b/src/server/scripts/Commands/cs_guild.cpp
@@ -132,7 +132,7 @@ public:
return false;
// if not guild name only (in "") then player name
- uint64 targetGuid;
+ ObjectGuid targetGuid;
if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &targetGuid))
return false;
@@ -156,7 +156,7 @@ public:
static bool HandleGuildUninviteCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
return false;
@@ -181,7 +181,7 @@ public:
return false;
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string target_name;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &target_name))
return false;
@@ -251,7 +251,7 @@ public:
{
Guild* guild = nullptr;
- if (args && strlen(args) > 0)
+ if (args && args[0] != '\0')
{
if (isNumeric(args))
{
@@ -275,7 +275,7 @@ public:
std::string guildMasterName;
if (sObjectMgr->GetPlayerNameByGUID(guild->GetLeaderGUID(), guildMasterName))
- handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID()); // Guild Master
+ handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID().GetCounter()); // Guild Master
// Format creation date
char createdDateStr[20];
diff --git a/src/server/scripts/Commands/cs_honor.cpp b/src/server/scripts/Commands/cs_honor.cpp
index 6b76f753403..eeaee40fea9 100644
--- a/src/server/scripts/Commands/cs_honor.cpp
+++ b/src/server/scripts/Commands/cs_honor.cpp
@@ -71,7 +71,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
uint32 amount = (uint32)atoi(args);
@@ -91,7 +91,7 @@ public:
// check online security
if (Player* player = target->ToPlayer())
- if (handler->HasLowerSecurity(player, 0))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
return false;
handler->GetSession()->GetPlayer()->RewardHonor(target, 1);
@@ -109,7 +109,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
target->UpdateHonorFields();
diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp
index 464d58ad908..a426c49a5f7 100644
--- a/src/server/scripts/Commands/cs_instance.cpp
+++ b/src/server/scripts/Commands/cs_instance.cpp
@@ -125,7 +125,7 @@ public:
uint16 counter = 0;
uint16 MapId = 0;
- if (strcmp(map, "all"))
+ if (strcmp(map, "all") != 0)
{
MapId = uint16(atoi(map));
if (!MapId)
diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp
index 2f6afd29e9f..1a4cce16d68 100644
--- a/src/server/scripts/Commands/cs_lfg.cpp
+++ b/src/server/scripts/Commands/cs_lfg.cpp
@@ -27,7 +27,7 @@ void GetPlayerInfo(ChatHandler* handler, Player* player)
if (!player)
return;
- uint64 guid = player->GetGUID();
+ ObjectGuid guid = player->GetGUID();
lfg::LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(guid);
std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid));
@@ -86,7 +86,7 @@ public:
return true;
}
- uint64 guid = grp->GetGUID();
+ ObjectGuid guid = grp->GetGUID();
std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid));
handler->PSendSysMessage(LANG_LFG_GROUP_INFO, grp->isLFGGroup(),
state.c_str(), sLFGMgr->GetDungeon(guid));
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index ff0a5519495..f12fbee44b5 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -447,8 +447,8 @@ public:
handler->PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (handler->GetSession() ? ss_name.str().c_str() : name),
aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""),
- (talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",
- GUID_LOPART(aura->GetCasterGUID()));
+ (talent ? talentStr : ""), aura->GetCasterGUID().IsPlayer() ? "player" : "creature",
+ aura->GetCasterGUID().GetCounter());
}
for (uint16 i = 0; i < TOTAL_AURAS; ++i)
@@ -469,25 +469,25 @@ public:
static bool HandleListMailCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
PreparedStatement* stmt = NULL;
if (!*args)
return false;
- uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
+ ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args)));
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
{
- target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
+ target = ObjectAccessor::FindPlayer(parseGUID);
targetGuid = parseGUID;
}
else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_COUNT);
- stmt->setUInt32(0, targetGuid);
+ stmt->setUInt32(0, targetGuid.GetCounter());
PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
if (queryResult)
{
@@ -495,11 +495,11 @@ public:
uint32 countMail = fields[0].GetUInt64();
std::string nameLink = handler->playerLink(targetName);
- handler->PSendSysMessage(LANG_LIST_MAIL_HEADER, countMail, nameLink.c_str(), targetGuid);
+ handler->PSendSysMessage(LANG_LIST_MAIL_HEADER, countMail, nameLink.c_str(), targetGuid.GetCounter());
handler->PSendSysMessage(LANG_ACCOUNT_LIST_BAR);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_INFO);
- stmt->setUInt32(0, targetGuid);
+ stmt->setUInt32(0, targetGuid.GetCounter());
PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
if (queryResult)
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 319151141b7..9277956262f 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -135,7 +135,7 @@ public:
WorldObject* object = NULL;
if (*args)
{
- uint64 guid = handler->extractGuidFromLink((char*)args);
+ ObjectGuid guid = handler->extractGuidFromLink((char*)args);
if (guid)
object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
@@ -180,9 +180,8 @@ public:
GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
- // 63? WHY?
- int gridX = 63 - gridCoord.x_coord;
- int gridY = 63 - gridCoord.y_coord;
+ int gridX = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.x_coord;
+ int gridY = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.y_coord;
uint32 haveMap = Map::ExistMap(mapId, gridX, gridY) ? 1 : 0;
uint32 haveVMap = Map::ExistVMap(mapId, gridX, gridY) ? 1 : 0;
@@ -198,10 +197,12 @@ public:
else
handler->PSendSysMessage(LANG_GPS_NO_VMAP);
+ char const* unknown = handler->GetTrinityString(LANG_UNKNOWN);
+
handler->PSendSysMessage(LANG_MAP_POSITION,
- mapId, (mapEntry ? mapEntry->name : handler->GetTrinityString(LANG_UNKNOWN)),
- zoneId, (zoneEntry ? zoneEntry->area_name : handler->GetTrinityString(LANG_UNKNOWN)),
- areaId, (areaEntry ? areaEntry->area_name : handler->GetTrinityString(LANG_UNKNOWN)),
+ mapId, (mapEntry ? mapEntry->name : unknown),
+ zoneId, (zoneEntry ? zoneEntry->area_name : unknown),
+ areaId, (areaEntry ? areaEntry->area_name : unknown),
object->GetPhaseMask(),
object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
@@ -265,7 +266,7 @@ public:
static bool HandleAppearCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -281,7 +282,7 @@ public:
if (target)
{
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string chrNameLink = handler->playerLink(targetName);
@@ -408,7 +409,7 @@ public:
static bool HandleSummonCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -425,7 +426,7 @@ public:
{
std::string nameLink = handler->playerLink(targetName);
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
if (target->IsBeingTeleported())
@@ -538,7 +539,7 @@ public:
}
if (Player* player = target->ToPlayer())
- if (handler->HasLowerSecurity(player, 0, false))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false))
return false;
if (target->IsAlive())
@@ -555,7 +556,7 @@ public:
static bool HandleReviveCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
return false;
@@ -598,16 +599,16 @@ public:
static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/)
{
- uint64 guid = handler->GetSession()->GetPlayer()->GetTarget();
+ ObjectGuid guid = handler->GetSession()->GetPlayer()->GetTarget();
- if (guid == 0)
+ if (guid.IsEmpty())
{
handler->SendSysMessage(LANG_NO_SELECTION);
handler->SetSentErrorMessage(true);
return false;
}
- handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid));
+ handler->PSendSysMessage(LANG_OBJECT_GUID, guid.GetCounter(), guid.GetHigh());
return true;
}
@@ -704,7 +705,7 @@ public:
if (*args)
{
- uint64 guid = handler->extractGuidFromLink((char*)args);
+ ObjectGuid guid = handler->extractGuidFromLink((char*)args);
if (guid)
obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
@@ -738,7 +739,7 @@ public:
return false;
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
if (target->IsBeingTeleported())
@@ -806,7 +807,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string kickReasonStr = handler->GetTrinityString(LANG_NO_REASON);
@@ -1381,17 +1382,17 @@ public:
{
// Define ALL the player variables!
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
PreparedStatement* stmt = NULL;
// To make sure we get a target, we convert our guid to an omniversal...
- uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
+ ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args)));
// ... and make sure we get a target, somehow.
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
{
- target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
+ target = ObjectAccessor::FindPlayer(parseGUID);
targetGuid = parseGUID;
}
// if not, then return false. Which shouldn't happen, now should it ?
@@ -1433,7 +1434,7 @@ public:
// Account data print variables
std::string userName = handler->GetTrinityString(LANG_ERROR);
uint32 accId = 0;
- uint32 lowguid = GUID_LOPART(targetGuid);
+ uint32 lowguid = targetGuid.GetCounter();
std::string eMail = handler->GetTrinityString(LANG_ERROR);
std::string regMail = handler->GetTrinityString(LANG_ERROR);
uint32 security = 0;
@@ -1487,7 +1488,7 @@ public:
if (target)
{
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
accId = target->GetSession()->GetAccountId();
@@ -1712,7 +1713,9 @@ public:
}
if (target)
- handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name, (!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)), (!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)));
+ handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name,
+ (!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)),
+ (!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)));
// Output XVII. - XVIX. if they are not empty
if (!guildName.empty())
@@ -1797,7 +1800,7 @@ public:
muteReasonStr = muteReason;
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
return false;
@@ -1860,7 +1863,7 @@ public:
static bool HandleUnmuteCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -2116,7 +2119,7 @@ public:
}
if (Player* player = target->ToPlayer())
- if (handler->HasLowerSecurity(player, 0, false))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false))
return false;
if (!target->IsAlive())
@@ -2188,7 +2191,7 @@ public:
{
Player* target = NULL;
- if (args && strlen(args) > 0)
+ if (args && args[0] != '\0')
{
target = sObjectAccessor->FindPlayerByName(args);
if (!target)
@@ -2206,7 +2209,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
target->CombatStop();
@@ -2221,7 +2224,7 @@ public:
return false;
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
// Repair items
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 36182a535a7..d88e1670a09 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -107,7 +107,7 @@ public:
return false;
}
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_HP, handler->GetNameLink(target).c_str(), hp, hpm);
@@ -145,7 +145,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_MANA, handler->GetNameLink(target).c_str(), mana, manam);
@@ -194,7 +194,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_ENERGY, handler->GetNameLink(target).c_str(), energy/10, energym/10);
@@ -245,7 +245,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_RAGE, handler->GetNameLink(target).c_str(), rage/10, ragem/10);
@@ -399,7 +399,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_SPELLFLATID, spellflatid, val, mark, handler->GetNameLink(target).c_str());
@@ -437,7 +437,7 @@ public:
if (target->GetTypeId() == TYPEID_PLAYER)
{
// check online security
- if (handler->HasLowerSecurity(target->ToPlayer(), 0))
+ if (handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
return false;
target->ToPlayer()->SetFreeTalentPoints(tp);
target->ToPlayer()->SendTalentsInfoData(false);
@@ -449,7 +449,7 @@ public:
if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer()))
{
// check online security
- if (handler->HasLowerSecurity(owner->ToPlayer(), 0))
+ if (handler->HasLowerSecurity(owner->ToPlayer(), ObjectGuid::Empty))
return false;
((Pet*)target)->SetFreeTalentPoints(tp);
owner->ToPlayer()->SendTalentsInfoData(true);
@@ -486,7 +486,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string targetNameLink = handler->GetNameLink(target);
@@ -534,7 +534,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string targetNameLink = handler->GetNameLink(target);
@@ -579,7 +579,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string targetNameLink = handler->GetNameLink(target);
@@ -624,7 +624,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string targetNameLink = handler->GetNameLink(target);
@@ -669,7 +669,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, FSpeed, handler->GetNameLink(target).c_str());
@@ -706,7 +706,7 @@ public:
if (Player* player = target->ToPlayer())
{
// check online security
- if (handler->HasLowerSecurity(player, 0))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, handler->GetNameLink(player).c_str());
@@ -954,7 +954,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
handler->PSendSysMessage(LANG_YOU_GIVE_MOUNT, handler->GetNameLink(target).c_str());
@@ -965,14 +965,14 @@ public:
target->Mount(mId);
WorldPacket data(SMSG_MOVE_SET_RUN_SPEED, (8+4+1+4));
- data.append(target->GetPackGUID());
+ data << target->GetPackGUID();
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.append(target->GetPackGUID());
+ data << target->GetPackGUID();
data << (uint32)0;
data << float(speed);
target->SendMessageToSet(&data, true);
@@ -995,7 +995,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
int64 moneyToAdd = 0;
@@ -1066,7 +1066,7 @@ public:
}
// check online security
- if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
+ if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
return false;
char* pField = strtok((char*)args, " ");
@@ -1120,7 +1120,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
int32 amount = (uint32)atoi(args);
@@ -1161,7 +1161,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
char* factionTxt = handler->extractKeyFromLink((char*)args, "Hfaction");
@@ -1260,7 +1260,7 @@ public:
target = handler->GetSession()->GetPlayer();
// check online security
- else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
+ else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
return false;
target->SetDisplayId(display_id);
@@ -1365,7 +1365,7 @@ public:
target = handler->GetSession()->GetPlayer();
// check online security
- else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
+ else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), ObjectGuid::Empty))
return false;
target->DeMorph();
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index df80429f6de..85bc6db46f5 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -527,7 +527,7 @@ public:
return false;
if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid))
- unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT));
+ unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, cr_data->id, lowguid));
}
else
unit = handler->getSelectedCreature();
@@ -689,8 +689,8 @@ public:
}
creature->AI()->SetData(data_1, data_2);
- std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
- handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
+ std::string AIorScript = !creature->GetAIName().empty() ? "AI type: " + creature->GetAIName() : (!creature->GetScriptName().empty() ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
+ handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID().GetCounter(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
return true;
}
@@ -1323,11 +1323,11 @@ public:
return false;
}
- uint64 receiver_guid = atol(receiver_str);
+ ObjectGuid receiver_guid(HIGHGUID_PLAYER, uint32(atol(receiver_str)));
// check online security
Player* receiver = ObjectAccessor::FindPlayer(receiver_guid);
- if (handler->HasLowerSecurity(receiver, 0))
+ if (handler->HasLowerSecurity(receiver, ObjectGuid::Empty))
return false;
creature->Whisper(text, LANG_UNIVERSAL, receiver);
diff --git a/src/server/scripts/Commands/cs_pet.cpp b/src/server/scripts/Commands/cs_pet.cpp
index 82f99501a58..bb5e0764f2f 100644
--- a/src/server/scripts/Commands/cs_pet.cpp
+++ b/src/server/scripts/Commands/cs_pet.cpp
@@ -85,7 +85,7 @@ public:
creatureTarget->RemoveCorpse();
creatureTarget->SetHealth(0); // just for nice GM-mode view
- pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
+ pet->SetGuidValue(UNIT_FIELD_CREATEDBY, player->GetGUID());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 08603279824..dc75e0aedab 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -206,11 +206,11 @@ public:
{
if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creature))
for (uint16 z = 0; z < creatureCount; ++z)
- player->KilledMonster(creatureInfo, 0);
+ player->KilledMonster(creatureInfo, ObjectGuid::Empty);
}
else if (creature < 0)
for (uint16 z = 0; z < creatureCount; ++z)
- player->KillCreditGO(creature, 0);
+ player->KillCreditGO(creature);
}
// If the quest requires reputation to complete
diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp
index 495dc522414..faf87adc7b6 100644
--- a/src/server/scripts/Commands/cs_reset.cpp
+++ b/src/server/scripts/Commands/cs_reset.cpp
@@ -59,14 +59,14 @@ public:
static bool HandleResetAchievementsCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
return false;
if (target)
target->ResetAchievements();
else
- AchievementMgr<Player>::DeleteFromDB(GUID_LOPART(targetGuid));
+ AchievementMgr<Player>::DeleteFromDB(targetGuid);
return true;
}
@@ -155,7 +155,7 @@ public:
static bool HandleResetSpellsCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -172,7 +172,7 @@ public:
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
handler->PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, targetName.c_str());
@@ -202,7 +202,7 @@ public:
static bool HandleResetTalentsCommand(ChatHandler* handler, char const* args)
{
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
{
@@ -246,7 +246,7 @@ public:
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
std::string nameLink = handler->playerLink(targetName);
diff --git a/src/server/scripts/Commands/cs_send.cpp b/src/server/scripts/Commands/cs_send.cpp
index 486645df290..e27f09278fd 100644
--- a/src/server/scripts/Commands/cs_send.cpp
+++ b/src/server/scripts/Commands/cs_send.cpp
@@ -51,7 +51,7 @@ public:
{
// format: name "subject text" "mail text"
Player* target;
- uint64 targetGuid;
+ ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -82,7 +82,7 @@ public:
/// @todo Fix poor design
SQLTransaction trans = CharacterDatabase.BeginTransaction();
MailDraft(subject, text)
- .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender);
+ .SendMailTo(trans, MailReceiver(target, targetGuid.GetCounter()), sender);
CharacterDatabase.CommitTransaction(trans);
@@ -96,7 +96,7 @@ public:
{
// format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
Player* receiver;
- uint64 receiverGuid;
+ ObjectGuid receiverGuid;
std::string receiverName;
if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
return false;
@@ -192,7 +192,7 @@ public:
}
}
- draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+ draft.SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), sender);
CharacterDatabase.CommitTransaction(trans);
std::string nameLink = handler->playerLink(receiverName);
@@ -205,7 +205,7 @@ public:
/// format: name "subject text" "mail text" money
Player* receiver;
- uint64 receiverGuid;
+ ObjectGuid receiverGuid;
std::string receiverName;
if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
return false;
@@ -242,7 +242,7 @@ public:
MailDraft(subject, text)
.AddMoney(money)
- .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+ .SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), sender);
CharacterDatabase.CommitTransaction(trans);
diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp
index ad77464b6e1..6b4fb7d104d 100644
--- a/src/server/scripts/Commands/cs_tele.cpp
+++ b/src/server/scripts/Commands/cs_tele.cpp
@@ -123,7 +123,7 @@ public:
return false;
Player* target;
- uint64 target_guid;
+ ObjectGuid target_guid;
std::string target_name;
if (!handler->extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
return false;
@@ -135,7 +135,7 @@ public:
else
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);
- stmt->setUInt32(0, target_guid);
+ stmt->setUInt32(0, target_guid.GetCounter());
PreparedQueryResult resultDB = CharacterDatabase.Query(stmt);
if (resultDB)
@@ -166,7 +166,7 @@ public:
if (target)
{
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
std::string chrNameLink = handler->playerLink(target_name);
@@ -225,7 +225,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
@@ -263,7 +263,7 @@ public:
continue;
// check online security
- if (handler->HasLowerSecurity(player, 0))
+ if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
return false;
std::string plNameLink = handler->GetNameLink(player);
diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp
index cbf0ae51a82..674658f41ff 100644
--- a/src/server/scripts/Commands/cs_ticket.cpp
+++ b/src/server/scripts/Commands/cs_ticket.cpp
@@ -95,7 +95,7 @@ public:
return true;
}
- uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target);
+ ObjectGuid targetGuid = sObjectMgr->GetPlayerGUIDByName(target);
uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
// Target must exist and have administrative rights
if (!AccountMgr::HasPermission(accountId, rbac::RBAC_PERM_COMMANDS_BE_ASSIGNED_TICKET, realmID))
@@ -153,7 +153,7 @@ public:
return true;
}
- sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1);
+ sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : ObjectGuid(uint64(-1)));
sTicketMgr->UpdateLastChange();
std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL, NULL);
@@ -376,7 +376,7 @@ public:
security = assignedPlayer->GetSession()->GetSecurity();
else
{
- uint64 guid = ticket->GetAssignedToGUID();
+ ObjectGuid guid = ticket->GetAssignedToGUID();
uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid);
security = AccountMgr::GetSecurity(accountId, realmID);
}
@@ -434,7 +434,7 @@ public:
return false;
// Detect target's GUID
- uint64 guid = 0;
+ ObjectGuid guid;
if (Player* player = sObjectAccessor->FindPlayerByName(name))
guid = player->GetGUID();
else
diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp
index b1e5bd0ca98..0826e0ca476 100644
--- a/src/server/scripts/Commands/cs_titles.cpp
+++ b/src/server/scripts/Commands/cs_titles.cpp
@@ -80,7 +80,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
@@ -124,7 +124,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
@@ -170,7 +170,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
@@ -218,7 +218,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(target, 0))
+ if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
return false;
uint64 titles2 = titles;
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 5698366acc9..f158b9aa59e 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -631,7 +631,7 @@ public:
handler->PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid);
if (wpGuid != 0)
- if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
+ if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
@@ -664,7 +664,7 @@ public:
// Respawn the owner of the waypoints
if (wpGuid != 0)
{
- if (Creature* wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
+ if (Creature* wpCreature = map->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
@@ -848,7 +848,7 @@ public:
{
Field* fields = result2->Fetch();
uint32 wpguid = fields[0].GetUInt32();
- Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpguid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
+ Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpguid));
if (!creature)
{
@@ -1053,7 +1053,7 @@ public:
{
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
- Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(guid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
+ Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, guid));
if (!creature)
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid);
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
index 651e487522d..c8717a73f16 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
@@ -65,7 +65,7 @@ public:
void Initialize()
{
- WaterElementalGUID = 0;
+ WaterElementalGUID.Clear();
HasCastIceblock = false;
}
@@ -177,7 +177,7 @@ public:
private:
EventMap events;
SummonList summons;
- uint64 WaterElementalGUID;
+ ObjectGuid WaterElementalGUID;
bool HasCastIceblock;
};
diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp
index 52eac77cd46..62d12a94c54 100644
--- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp
+++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp
@@ -68,7 +68,7 @@ class at_alizabal_intro : public AreaTriggerScript
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
{
if (InstanceScript* instance = player->GetInstanceScript())
- if (Creature* alizabal = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_ALIZABAL)))
+ if (Creature* alizabal = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_ALIZABAL)))
alizabal->AI()->DoAction(ACTION_INTRO);
return true;
}
diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
index ca2679b042a..9c203ac2395 100644
--- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
+++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
@@ -166,7 +166,7 @@ class npc_eyestalk : public CreatureScript
void IsSummonedBy(Unit* /*summoner*/) override
{
// player is the spellcaster so register summon manually
- if (Creature* occuthar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_OCCUTHAR)))
+ if (Creature* occuthar = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_OCCUTHAR)))
occuthar->AI()->JustSummoned(me);
}
@@ -324,7 +324,7 @@ class spell_occuthar_eyes_of_occuthar_vehicle : public SpellScriptLoader
{
Position pos = GetHitUnit()->GetPosition();
- if (Creature* occuthar = ObjectAccessor::GetCreature(*GetCaster(), GetCaster()->GetInstanceScript()->GetData64(DATA_OCCUTHAR)))
+ if (Creature* occuthar = ObjectAccessor::GetCreature(*GetCaster(), GetCaster()->GetInstanceScript()->GetGuidData(DATA_OCCUTHAR)))
{
if (Creature* creature = occuthar->SummonCreature(NPC_EYE_OF_OCCUTHAR, pos))
creature->CastSpell(GetHitUnit(), SPELL_GAZE_OF_OCCUTHAR, false);
diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp
index 0f9102a2485..8f523b7bfac 100644
--- a/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp
+++ b/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp
@@ -39,10 +39,6 @@ class instance_baradin_hold: public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
-
- ArgalothGUID = 0;
- OccutharGUID = 0;
- AlizabalGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -73,7 +69,7 @@ class instance_baradin_hold: public InstanceMapScript
}
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -87,7 +83,7 @@ class instance_baradin_hold: public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
void OnGameObjectRemove(GameObject* go) override
@@ -103,9 +99,9 @@ class instance_baradin_hold: public InstanceMapScript
}
protected:
- uint64 ArgalothGUID;
- uint64 OccutharGUID;
- uint64 AlizabalGUID;
+ ObjectGuid ArgalothGUID;
+ ObjectGuid OccutharGUID;
+ ObjectGuid AlizabalGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
index 51ca327738b..08b773bc61a 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
@@ -38,10 +38,10 @@ public:
else
instance->SetData(TYPE_LYCEUM, IN_PROGRESS);
// If used brazier open linked doors (North or South)
- if (go->GetGUID() == instance->GetData64(DATA_SF_BRAZIER_N))
- instance->HandleGameObject(instance->GetData64(DATA_GOLEM_DOOR_N), true);
- else if (go->GetGUID() == instance->GetData64(DATA_SF_BRAZIER_S))
- instance->HandleGameObject(instance->GetData64(DATA_GOLEM_DOOR_S), true);
+ if (go->GetGUID() == instance->GetGuidData(DATA_SF_BRAZIER_N))
+ instance->HandleGameObject(instance->GetGuidData(DATA_GOLEM_DOOR_N), true);
+ else if (go->GetGUID() == instance->GetGuidData(DATA_SF_BRAZIER_S))
+ instance->HandleGameObject(instance->GetGuidData(DATA_GOLEM_DOOR_S), true);
}
return false;
}
@@ -138,9 +138,9 @@ public:
MobDeath_Timer = 0;
for (uint8 i = 0; i < MAX_NPC_AMOUNT; ++i)
- RingMobGUID[i] = 0;
+ RingMobGUID[i].Clear();
- RingBossGUID = 0;
+ RingBossGUID.Clear();
CanWalk = false;
}
@@ -154,8 +154,8 @@ public:
uint8 MobCount;
uint32 MobDeath_Timer;
- uint64 RingMobGUID[4];
- uint64 RingBossGUID;
+ ObjectGuid RingMobGUID[4];
+ ObjectGuid RingBossGUID;
bool CanWalk;
@@ -222,7 +222,7 @@ public:
void HandleGameObject(uint32 id, bool open)
{
- instance->HandleGameObject(instance->GetData64(id), open);
+ instance->HandleGameObject(instance->GetGuidData(id), open);
}
void UpdateAI(uint32 diff) override
@@ -238,7 +238,7 @@ public:
Creature* boss = ObjectAccessor::GetCreature(*me, RingBossGUID);
if (boss && !boss->IsAlive() && boss->isDead())
{
- RingBossGUID = 0;
+ RingBossGUID.Clear();
Event_Timer = 5000;
MobDeath_Timer = 0;
return;
@@ -251,7 +251,7 @@ public:
Creature* mob = ObjectAccessor::GetCreature(*me, RingMobGUID[i]);
if (mob && !mob->IsAlive() && mob->isDead())
{
- RingMobGUID[i] = 0;
+ RingMobGUID[i].Clear();
--MobCount;
//seems all are gone, so set timer to continue and discontinue this
@@ -1277,7 +1277,7 @@ public:
void DoGo(uint32 id, uint32 state)
{
- if (GameObject* go = instance->instance->GetGameObject(instance->GetData64(id)))
+ if (GameObject* go = instance->instance->GetGameObject(instance->GetGuidData(id)))
go->SetGoState((GOState)state);
}
@@ -1324,7 +1324,7 @@ public:
DoGo(DATA_GO_BAR_KEG_TRAP, 0); //doesn't work very well, leaving code here for future
//spell by trap has effect61, this indicate the bar go hostile
- if (Unit* tmp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PHALANX)))
+ if (Unit* tmp = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PHALANX)))
tmp->setFaction(14);
//for later, this event(s) has alot more to it.
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
index cec29bcd4d1..4b2434c73c9 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
@@ -70,7 +70,7 @@ class boss_emperor_dagran_thaurissan : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* moira = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MOIRA)))
+ if (Creature* moira = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MOIRA)))
{
moira->AI()->EnterEvadeMode();
moira->setFaction(35);
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp
index e6bbbaa73a9..3230a700810 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp
@@ -96,7 +96,7 @@ class boss_magmus : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
if (InstanceScript* instance = me->GetInstanceScript())
- instance->HandleGameObject(instance->GetData64(DATA_THRONE_DOOR), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_THRONE_DOOR), true);
}
private:
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
index 77a8c68d28e..6706713698d 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
@@ -76,7 +76,7 @@ public:
if (InstanceScript* instance = creature->GetInstanceScript())
{
//are 5 minutes expected? go template may have data to despawn when used at quest
- instance->DoRespawnGameObject(instance->GetData64(DATA_GO_CHALICE), MINUTE*5);
+ instance->DoRespawnGameObject(instance->GetGuidData(DATA_GO_CHALICE), MINUTE*5);
}
break;
}
@@ -139,7 +139,7 @@ class boss_doomrel : public CreatureScript
creature->AI()->AttackStart(player);
InstanceScript* instance = creature->GetInstanceScript();
if (instance)
- instance->SetData64(DATA_EVENSTARTER, player->GetGUID());
+ instance->SetGuidData(DATA_EVENSTARTER, player->GetGUID());
break;
}
return true;
@@ -202,7 +202,7 @@ class boss_doomrel : public CreatureScript
{
ScriptedAI::EnterEvadeMode();
- _instance->SetData64(DATA_EVENSTARTER, 0);
+ _instance->SetGuidData(DATA_EVENSTARTER, ObjectGuid::Empty);
}
void JustDied(Unit* /*killer*/) override
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 67219a2990a..22999c221dd 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
@@ -81,37 +81,37 @@ public:
uint32 encounter[MAX_ENCOUNTER];
std::string str_data;
- uint64 EmperorGUID;
- uint64 PhalanxGUID;
- uint64 MagmusGUID;
- uint64 MoiraGUID;
-
- uint64 GoArena1GUID;
- uint64 GoArena2GUID;
- uint64 GoArena3GUID;
- uint64 GoArena4GUID;
- uint64 GoShadowLockGUID;
- uint64 GoShadowMechGUID;
- uint64 GoShadowGiantGUID;
- uint64 GoShadowDummyGUID;
- uint64 GoBarKegGUID;
- uint64 GoBarKegTrapGUID;
- uint64 GoBarDoorGUID;
- uint64 GoTombEnterGUID;
- uint64 GoTombExitGUID;
- uint64 GoLyceumGUID;
- uint64 GoSFSGUID;
- uint64 GoSFNGUID;
- uint64 GoGolemNGUID;
- uint64 GoGolemSGUID;
- uint64 GoThroneGUID;
- uint64 GoChestGUID;
- uint64 GoSpectralChaliceGUID;
+ ObjectGuid EmperorGUID;
+ ObjectGuid PhalanxGUID;
+ ObjectGuid MagmusGUID;
+ ObjectGuid MoiraGUID;
+
+ ObjectGuid GoArena1GUID;
+ ObjectGuid GoArena2GUID;
+ ObjectGuid GoArena3GUID;
+ ObjectGuid GoArena4GUID;
+ ObjectGuid GoShadowLockGUID;
+ ObjectGuid GoShadowMechGUID;
+ ObjectGuid GoShadowGiantGUID;
+ ObjectGuid GoShadowDummyGUID;
+ ObjectGuid GoBarKegGUID;
+ ObjectGuid GoBarKegTrapGUID;
+ ObjectGuid GoBarDoorGUID;
+ ObjectGuid GoTombEnterGUID;
+ ObjectGuid GoTombExitGUID;
+ ObjectGuid GoLyceumGUID;
+ ObjectGuid GoSFSGUID;
+ ObjectGuid GoSFNGUID;
+ ObjectGuid GoGolemNGUID;
+ ObjectGuid GoGolemSGUID;
+ ObjectGuid GoThroneGUID;
+ ObjectGuid GoChestGUID;
+ ObjectGuid GoSpectralChaliceGUID;
uint32 BarAleCount;
uint32 GhostKillCount;
- uint64 TombBossGUIDs[7];
- uint64 TombEventStarterGUID;
+ ObjectGuid TombBossGUIDs[7];
+ ObjectGuid TombEventStarterGUID;
uint32 TombTimer;
uint32 TombEventCounter;
@@ -120,41 +120,10 @@ public:
SetHeaders(DataHeader);
memset(&encounter, 0, sizeof(encounter));
- EmperorGUID = 0;
- PhalanxGUID = 0;
- MagmusGUID = 0;
- MoiraGUID = 0;
-
- GoArena1GUID = 0;
- GoArena2GUID = 0;
- GoArena3GUID = 0;
- GoArena4GUID = 0;
- GoShadowLockGUID = 0;
- GoShadowMechGUID = 0;
- GoShadowGiantGUID = 0;
- GoShadowDummyGUID = 0;
- GoBarKegGUID = 0;
- GoBarKegTrapGUID = 0;
- GoBarDoorGUID = 0;
- GoTombEnterGUID = 0;
- GoTombExitGUID = 0;
- GoLyceumGUID = 0;
- GoSFSGUID = 0;
- GoSFNGUID = 0;
- GoGolemNGUID = 0;
- GoGolemSGUID = 0;
- GoThroneGUID = 0;
- GoChestGUID = 0;
- GoSpectralChaliceGUID = 0;
-
BarAleCount = 0;
GhostKillCount = 0;
- TombEventStarterGUID = 0;
TombTimer = TIMER_TOMBOFTHESEVEN;
TombEventCounter = 0;
-
- for (uint8 i = 0; i < 7; ++i)
- TombBossGUIDs[i] = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -174,7 +143,7 @@ public:
case NPC_MAGMUS:
MagmusGUID = creature->GetGUID();
if (!creature->IsAlive())
- HandleGameObject(GetData64(DATA_THRONE_DOOR), true); // if Magmus is dead open door to last boss
+ HandleGameObject(GetGuidData(DATA_THRONE_DOOR), true); // if Magmus is dead open door to last boss
break;
}
}
@@ -198,9 +167,9 @@ public:
case GO_TOMB_EXIT:
GoTombExitGUID = go->GetGUID();
if (GhostKillCount >= 7)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
else
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_LYCEUM: GoLyceumGUID = go->GetGUID(); break;
case GO_SF_S: GoSFSGUID = go->GetGUID(); break;
@@ -213,9 +182,9 @@ public:
}
}
- void SetData64(uint32 type, uint64 data) override
+ void SetGuidData(uint32 type, ObjectGuid data) override
{
- TC_LOG_DEBUG("scripts", "Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data);
+ TC_LOG_DEBUG("scripts", "Instance Blackrock Depths: SetGuidData update (Type: %u Data %s)", type, data.ToString().c_str());
switch (type)
{
@@ -301,7 +270,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -340,7 +309,7 @@ public:
case DATA_GO_CHALICE:
return GoSpectralChaliceGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
std::string GetSaveData() override
@@ -409,7 +378,7 @@ public:
}
}
GhostKillCount = 0;
- TombEventStarterGUID = 0;
+ TombEventStarterGUID.Clear();
TombEventCounter = 0;
TombTimer = TIMER_TOMBOFTHESEVEN;
SetData(TYPE_TOMB_OF_SEVEN, NOT_STARTED);
@@ -427,7 +396,7 @@ public:
DoRespawnGameObject(GoChestGUID, DAY);
HandleGameObject(GoTombExitGUID, true);//event done, open exit door
HandleGameObject(GoTombEnterGUID, true);//event done, open entrance door
- TombEventStarterGUID = 0;
+ TombEventStarterGUID.Clear();
SetData(TYPE_TOMB_OF_SEVEN, DONE);
}
void Update(uint32 diff) override
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp
index 2bd43e7283c..92906009b9a 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp
@@ -104,10 +104,10 @@ public:
break;
case 2:
// Close these two doors on Blackhand Incarcerators aggro
- if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_IN)))
+ if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_IN)))
if (door1->GetGoState() == GO_STATE_ACTIVE)
door1->SetGoState(GO_STATE_READY);
- if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_DOORS)))
+ if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_DOORS)))
if (door2->GetGoState() == GO_STATE_ACTIVE)
door2->SetGoState(GO_STATE_READY);
break;
@@ -166,33 +166,33 @@ public:
void OpenDoors(bool Boss_Killed)
{
// These two doors reopen on reset or boss kill
- if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_IN)))
+ if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_IN)))
door1->SetGoState(GO_STATE_ACTIVE);
- if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_DOORS)))
+ if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_DOORS)))
door2->SetGoState(GO_STATE_ACTIVE);
// This door opens on boss kill
if (Boss_Killed)
- if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_OUT)))
+ if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_OUT)))
door3->SetGoState(GO_STATE_ACTIVE);
}
void UpdateRunes(GOState state)
{
// update all runes
- if (GameObject* rune1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_1)))
+ if (GameObject* rune1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_1)))
rune1->SetGoState(state);
- if (GameObject* rune2 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_2)))
+ if (GameObject* rune2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_2)))
rune2->SetGoState(state);
- if (GameObject* rune3 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_3)))
+ if (GameObject* rune3 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_3)))
rune3->SetGoState(state);
- if (GameObject* rune4 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_4)))
+ if (GameObject* rune4 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_4)))
rune4->SetGoState(state);
- if (GameObject* rune5 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_5)))
+ if (GameObject* rune5 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_5)))
rune5->SetGoState(state);
- if (GameObject* rune6 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_6)))
+ if (GameObject* rune6 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_6)))
rune6->SetGoState(state);
- if (GameObject* rune7 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_RUNE_7)))
+ if (GameObject* rune7 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_7)))
rune7->SetGoState(state);
}
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp
index 94bf3e991f4..2018f12b613 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp
@@ -167,16 +167,16 @@ public:
boss_rend_blackhandAI(Creature* creature) : BossAI(creature, DATA_WARCHIEF_REND_BLACKHAND)
{
gythEvent = false;
- victorGUID = 0;
- portcullisGUID = 0;
+ victorGUID.Clear();
+ portcullisGUID.Clear();
}
void Reset() override
{
_Reset();
gythEvent = false;
- victorGUID = 0;
- portcullisGUID = 0;
+ victorGUID.Clear();
+ portcullisGUID.Clear();
}
void EnterCombat(Unit* /*who*/) override
@@ -437,8 +437,8 @@ public:
private:
bool gythEvent;
- uint64 victorGUID;
- uint64 portcullisGUID;
+ ObjectGuid victorGUID;
+ ObjectGuid portcullisGUID;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp
index e95fb8da42e..34d524a5470 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp
@@ -52,29 +52,6 @@ public:
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
- HighlordOmokk = 0;
- ShadowHunterVoshgajin = 0;
- WarMasterVoone = 0;
- MotherSmolderweb = 0;
- UrokDoomhowl = 0;
- QuartermasterZigris = 0;
- GizrultheSlavener = 0;
- Halycon = 0;
- OverlordWyrmthalak = 0;
- PyroguardEmberseer = 0;
- WarchiefRendBlackhand = 0;
- Gyth = 0;
- LordVictorNefarius = 0;
- TheBeast = 0;
- GeneralDrakkisath = 0;
- go_emberseerin = 0;
- go_doors = 0;
- go_emberseerout = 0;
- go_blackrockaltar = 0;
- go_portcullis_active = 0;
- go_portcullis_tobossrooms = 0;
- memset(go_roomrunes, 0, sizeof(go_roomrunes));
- memset(go_emberseerrunes, 0, sizeof(go_emberseerrunes));
}
void OnCreatureCreate(Creature* creature) override
@@ -145,97 +122,97 @@ public:
case GO_EMBERSEER_IN:
go_emberseerin = go->GetGUID();
if (GetBossState(DATA_DRAGONSPIRE_ROOM) == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_DOORS:
go_doors = go->GetGUID();
if (GetBossState(DATA_DRAGONSPIRE_ROOM) == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_EMBERSEER_OUT:
go_emberseerout = go->GetGUID();
if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_HALL_RUNE_1:
go_roomrunes[0] = go->GetGUID();
if (GetBossState(DATA_HALL_RUNE_1) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_HALL_RUNE_2:
go_roomrunes[1] = go->GetGUID();
if (GetBossState(DATA_HALL_RUNE_2) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_HALL_RUNE_3:
go_roomrunes[2] = go->GetGUID();
if (GetBossState(DATA_HALL_RUNE_3) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_HALL_RUNE_4:
go_roomrunes[3] = go->GetGUID();
if (GetBossState(DATA_HALL_RUNE_4) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_HALL_RUNE_5:
go_roomrunes[4] = go->GetGUID();
if (GetBossState(DATA_HALL_RUNE_5) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_HALL_RUNE_6:
go_roomrunes[5] = go->GetGUID();
if (GetBossState(DATA_HALL_RUNE_6) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_HALL_RUNE_7:
go_roomrunes[6] = go->GetGUID();
if (GetBossState(DATA_HALL_RUNE_7) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_EMBERSEER_RUNE_1:
go_emberseerrunes[0] = go->GetGUID();
if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_EMBERSEER_RUNE_2:
go_emberseerrunes[1] = go->GetGUID();
if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_EMBERSEER_RUNE_3:
go_emberseerrunes[2] = go->GetGUID();
if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_EMBERSEER_RUNE_4:
go_emberseerrunes[3] = go->GetGUID();
if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_EMBERSEER_RUNE_5:
go_emberseerrunes[4] = go->GetGUID();
if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_EMBERSEER_RUNE_6:
go_emberseerrunes[5] = go->GetGUID();
if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_EMBERSEER_RUNE_7:
go_emberseerrunes[6] = go->GetGUID();
if (GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_PORTCULLIS_ACTIVE:
go_portcullis_active = go->GetGUID();
if (GetBossState(DATA_GYTH) == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_PORTCULLIS_TOBOSSROOMS:
go_portcullis_tobossrooms = go->GetGUID();
if (GetBossState(DATA_GYTH) == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
default:
break;
@@ -309,7 +286,7 @@ public:
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -382,7 +359,7 @@ public:
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
void Update(uint32 diff) override
@@ -459,7 +436,7 @@ public:
if (!_mobAlive && rune->GetGoState() == GO_STATE_ACTIVE)
{
- HandleGameObject(0, false, rune);
+ HandleGameObject(ObjectGuid::Empty, false, rune);
switch (rune->GetEntry())
{
@@ -496,38 +473,38 @@ public:
{
SetBossState(DATA_DRAGONSPIRE_ROOM, DONE);
if (GameObject* door1 = instance->GetGameObject(go_emberseerin))
- HandleGameObject(0, true, door1);
+ HandleGameObject(ObjectGuid::Empty, true, door1);
if (GameObject* door2 = instance->GetGameObject(go_doors))
- HandleGameObject(0, true, door2);
+ HandleGameObject(ObjectGuid::Empty, true, door2);
}
}
protected:
EventMap Events;
- uint64 HighlordOmokk;
- uint64 ShadowHunterVoshgajin;
- uint64 WarMasterVoone;
- uint64 MotherSmolderweb;
- uint64 UrokDoomhowl;
- uint64 QuartermasterZigris;
- uint64 GizrultheSlavener;
- uint64 Halycon;
- uint64 OverlordWyrmthalak;
- uint64 PyroguardEmberseer;
- uint64 WarchiefRendBlackhand;
- uint64 Gyth;
- uint64 LordVictorNefarius;
- uint64 TheBeast;
- uint64 GeneralDrakkisath;
- uint64 go_emberseerin;
- uint64 go_doors;
- uint64 go_emberseerout;
- uint64 go_blackrockaltar;
- uint64 go_roomrunes[7];
- uint64 go_emberseerrunes[7];
- uint64 runecreaturelist[7][5];
- uint64 go_portcullis_active;
- uint64 go_portcullis_tobossrooms;
+ ObjectGuid HighlordOmokk;
+ ObjectGuid ShadowHunterVoshgajin;
+ ObjectGuid WarMasterVoone;
+ ObjectGuid MotherSmolderweb;
+ ObjectGuid UrokDoomhowl;
+ ObjectGuid QuartermasterZigris;
+ ObjectGuid GizrultheSlavener;
+ ObjectGuid Halycon;
+ ObjectGuid OverlordWyrmthalak;
+ ObjectGuid PyroguardEmberseer;
+ ObjectGuid WarchiefRendBlackhand;
+ ObjectGuid Gyth;
+ ObjectGuid LordVictorNefarius;
+ ObjectGuid TheBeast;
+ ObjectGuid GeneralDrakkisath;
+ ObjectGuid go_emberseerin;
+ ObjectGuid go_doors;
+ ObjectGuid go_emberseerout;
+ ObjectGuid go_blackrockaltar;
+ ObjectGuid go_roomrunes[7];
+ ObjectGuid go_emberseerrunes[7];
+ ObjectGuid runecreaturelist[7][5];
+ ObjectGuid go_portcullis_active;
+ ObjectGuid go_portcullis_tobossrooms;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
index b83cc4694ab..2efea4ae30c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
@@ -175,7 +175,7 @@ public:
{
if (InstanceScript* instance = go->GetInstanceScript())
if (instance->GetData(DATA_EGG_EVENT) != DONE)
- if (Creature* razor = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_RAZORGORE_THE_UNTAMED)))
+ if (Creature* razor = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_RAZORGORE_THE_UNTAMED)))
{
razor->Attack(player, true);
player->CastSpell(razor, SPELL_MINDCONTROL);
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
index 49e6faa340b..22a33ba4b6c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
@@ -78,7 +78,7 @@ public:
void Initialize()
{
- PlayerGUID = 0;
+ PlayerGUID.Clear();
HasYelled = false;
}
@@ -231,7 +231,7 @@ public:
}
private:
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
bool HasYelled;
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp
index 8cb3c37a7a2..ad395ebe497 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp
@@ -60,25 +60,6 @@ public:
// Razorgore
EggCount = 0;
EggEvent = 0;
- RazorgoreTheUntamedGUID = 0;
- RazorgoreDoorGUID = 0;
- // Vaelastrasz the Corrupt
- VaelastraszTheCorruptGUID = 0;
- VaelastraszDoorGUID = 0;
- // Broodlord Lashlayer
- BroodlordLashlayerGUID = 0;
- BroodlordDoorGUID = 0;
- // 3 Dragons
- FiremawGUID = 0;
- EbonrocGUID = 0;
- FlamegorGUID = 0;
- ChrommagusDoorGUID = 0;
- // Chormaggus
- ChromaggusGUID = 0;
- NefarianDoorGUID = 0;
- // Nefarian
- LordVictorNefariusGUID = 0;
- NefarianGUID = 0;
SetBossNumber(EncounterCount);
}
@@ -87,26 +68,6 @@ public:
// Razorgore
EggCount = 0;
EggEvent = 0;
- RazorgoreTheUntamedGUID = 0;
- RazorgoreDoorGUID = 0;
- EggList.clear();
- // Vaelastrasz the Corrupt
- VaelastraszTheCorruptGUID = 0;
- VaelastraszDoorGUID = 0;
- // Broodlord Lashlayer
- BroodlordLashlayerGUID = 0;
- BroodlordDoorGUID = 0;
- // 3 Dragons
- FiremawGUID = 0;
- EbonrocGUID = 0;
- FlamegorGUID = 0;
- ChrommagusDoorGUID = 0;
- // Chormaggus
- ChromaggusGUID = 0;
- NefarianDoorGUID = 0;
- // Nefarian
- LordVictorNefariusGUID = 0;
- NefarianGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -162,23 +123,23 @@ public:
break;
case 175946: // Door
RazorgoreDoorGUID = go->GetGUID();
- HandleGameObject(0, GetBossState(BOSS_RAZORGORE) == DONE, go);
+ HandleGameObject(ObjectGuid::Empty, GetBossState(BOSS_RAZORGORE) == DONE, go);
break;
case 175185: // Door
VaelastraszDoorGUID = go->GetGUID();
- HandleGameObject(0, GetBossState(BOSS_VAELASTRAZ) == DONE, go);
+ HandleGameObject(ObjectGuid::Empty, GetBossState(BOSS_VAELASTRAZ) == DONE, go);
break;
case 180424: // Door
BroodlordDoorGUID = go->GetGUID();
- HandleGameObject(0, GetBossState(BOSS_BROODLORD) == DONE, go);
+ HandleGameObject(ObjectGuid::Empty, GetBossState(BOSS_BROODLORD) == DONE, go);
break;
case 185483: // Door
ChrommagusDoorGUID = go->GetGUID();
- HandleGameObject(0, GetBossState(BOSS_FIREMAW) == DONE && GetBossState(BOSS_EBONROC) == DONE && GetBossState(BOSS_FLAMEGOR) == DONE, go);
+ HandleGameObject(ObjectGuid::Empty, GetBossState(BOSS_FIREMAW) == DONE && GetBossState(BOSS_EBONROC) == DONE && GetBossState(BOSS_FLAMEGOR) == DONE, go);
break;
case 181125: // Door
NefarianDoorGUID = go->GetGUID();
- HandleGameObject(0, GetBossState(BOSS_CHROMAGGUS) == DONE, go);
+ HandleGameObject(ObjectGuid::Empty, GetBossState(BOSS_CHROMAGGUS) == DONE, go);
break;
}
}
@@ -200,7 +161,7 @@ public:
HandleGameObject(RazorgoreDoorGUID, state == DONE);
if (state == DONE)
{
- for (std::list<uint64>::const_iterator itr = EggList.begin(); itr != EggList.end(); ++itr)
+ for (GuidList::const_iterator itr = EggList.begin(); itr != EggList.end(); ++itr)
if (GameObject* egg = instance->GetGameObject((*itr)))
egg->SetLootState(GO_JUST_DEACTIVATED);
}
@@ -239,7 +200,7 @@ public:
return true;
}
- uint64 GetData64(uint32 id) const override
+ ObjectGuid GetGuidData(uint32 id) const override
{
switch (id)
{
@@ -254,7 +215,7 @@ public:
case DATA_NEFARIAN: return NefarianGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
void SetData(uint32 type, uint32 data) override
@@ -340,31 +301,31 @@ public:
// Razorgore
uint8 EggCount;
uint32 EggEvent;
- uint64 RazorgoreTheUntamedGUID;
- uint64 RazorgoreDoorGUID;
- std::list<uint64> EggList;
+ ObjectGuid RazorgoreTheUntamedGUID;
+ ObjectGuid RazorgoreDoorGUID;
+ GuidList EggList;
// Vaelastrasz the Corrupt
- uint64 VaelastraszTheCorruptGUID;
- uint64 VaelastraszDoorGUID;
+ ObjectGuid VaelastraszTheCorruptGUID;
+ ObjectGuid VaelastraszDoorGUID;
// Broodlord Lashlayer
- uint64 BroodlordLashlayerGUID;
- uint64 BroodlordDoorGUID;
+ ObjectGuid BroodlordLashlayerGUID;
+ ObjectGuid BroodlordDoorGUID;
// 3 Dragons
- uint64 FiremawGUID;
- uint64 EbonrocGUID;
- uint64 FlamegorGUID;
- uint64 ChrommagusDoorGUID;
+ ObjectGuid FiremawGUID;
+ ObjectGuid EbonrocGUID;
+ ObjectGuid FlamegorGUID;
+ ObjectGuid ChrommagusDoorGUID;
// Chormaggus
- uint64 ChromaggusGUID;
- uint64 NefarianDoorGUID;
+ ObjectGuid ChromaggusGUID;
+ ObjectGuid NefarianDoorGUID;
// Nefarian
- uint64 LordVictorNefariusGUID;
- uint64 NefarianGUID;
+ ObjectGuid LordVictorNefariusGUID;
+ ObjectGuid NefarianGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp
index c8b33e48852..cdfe00c767f 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp
@@ -150,7 +150,7 @@ class npc_core_rager : public CreatureScript
if (HealthAbovePct(50) || !instance)
return;
- if (Creature* pGolemagg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_GOLEMAGG_THE_INCINERATOR)))
+ if (Creature* pGolemagg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_GOLEMAGG_THE_INCINERATOR)))
{
if (pGolemagg->IsAlive())
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
index 4a0e22b1ba8..58f38ec4267 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
@@ -153,7 +153,7 @@ class boss_ragnaros : public CreatureScript
break;
case EVENT_INTRO_4:
Talk(SAY_ARRIVAL5_RAG);
- if (Creature* executus = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MAJORDOMO_EXECUTUS)))
+ if (Creature* executus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MAJORDOMO_EXECUTUS)))
me->Kill(executus);
break;
case EVENT_INTRO_5:
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp
index 800b6bb0edc..7de89b41b7f 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp
@@ -45,9 +45,6 @@ class instance_molten_core : public InstanceMapScript
{
SetHeaders(DataHeader);
SetBossNumber(MAX_ENCOUNTER);
- _golemaggTheIncineratorGUID = 0;
- _majordomoExecutusGUID = 0;
- _cacheOfTheFirelordGUID = 0;
_executusSchedule = false;
_ragnarosAddDeaths = 0;
}
@@ -107,7 +104,7 @@ class instance_molten_core : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -117,7 +114,7 @@ class instance_molten_core : public InstanceMapScript
return _majordomoExecutusGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
bool SetBossState(uint32 bossId, EncounterState state) override
@@ -176,9 +173,9 @@ class instance_molten_core : public InstanceMapScript
}
private:
- uint64 _golemaggTheIncineratorGUID;
- uint64 _majordomoExecutusGUID;
- uint64 _cacheOfTheFirelordGUID;
+ ObjectGuid _golemaggTheIncineratorGUID;
+ ObjectGuid _majordomoExecutusGUID;
+ ObjectGuid _cacheOfTheFirelordGUID;
bool _executusSchedule;
uint8 _ragnarosAddDeaths;
};
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
index 7338620a8b2..029c3f08a8d 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
@@ -133,7 +133,7 @@ public:
++uiHealth;
DoCastAOE(SPELL_SMITE_STOMP, false);
SetCombatMovement(false);
- if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_SMITE_CHEST)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_SMITE_CHEST)))
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(1, go->GetPositionX() - 3.0f, go->GetPositionY(), go->GetPositionZ());
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
index 4869ffc4756..d7667b37e87 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
@@ -58,32 +58,24 @@ class instance_deadmines : public InstanceMapScript
{
instance_deadmines_InstanceMapScript(Map* map) : InstanceScript(map) { }
- uint64 FactoryDoorGUID;
- uint64 IronCladDoorGUID;
- uint64 DefiasCannonGUID;
- uint64 DoorLeverGUID;
- uint64 DefiasPirate1GUID;
- uint64 DefiasPirate2GUID;
- uint64 DefiasCompanionGUID;
+ ObjectGuid FactoryDoorGUID;
+ ObjectGuid IronCladDoorGUID;
+ ObjectGuid DefiasCannonGUID;
+ ObjectGuid DoorLeverGUID;
+ ObjectGuid DefiasPirate1GUID;
+ ObjectGuid DefiasPirate2GUID;
+ ObjectGuid DefiasCompanionGUID;
uint32 State;
uint32 CannonBlast_Timer;
uint32 PiratesDelay_Timer;
- uint64 uiSmiteChestGUID;
+ ObjectGuid uiSmiteChestGUID;
void Initialize() override
{
SetHeaders(DataHeader);
- FactoryDoorGUID = 0;
- IronCladDoorGUID = 0;
- DefiasCannonGUID = 0;
- DoorLeverGUID = 0;
- DefiasPirate1GUID = 0;
- DefiasPirate2GUID = 0;
- DefiasCompanionGUID = 0;
State = CANNON_NOT_USED;
- uiSmiteChestGUID = 0;
}
virtual void Update(uint32 diff) override
@@ -227,7 +219,7 @@ class instance_deadmines : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -235,7 +227,7 @@ class instance_deadmines : public InstanceMapScript
return uiSmiteChestGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
};
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
index d009986651a..6d9d07fdd81 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
@@ -103,8 +103,8 @@ public:
uint8 uiPhase;
uint32 uiTimer;
- std::list<uint64> SummonList;
- std::list<uint64> GoSummonList;
+ GuidList SummonList;
+ GuidList GoSummonList;
void Reset() override
{
@@ -147,7 +147,7 @@ public:
if (GoSummonList.empty())
return;
- for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
+ for (GuidList::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
{
if (GameObject* go = ObjectAccessor::GetGameObject(*me, *itr))
{
@@ -162,33 +162,33 @@ public:
}
}
- if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT)))
- instance->HandleGameObject(0, false, go);
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT)))
+ instance->HandleGameObject(ObjectGuid::Empty, false, go);
}
void SetInFace(bool isRight)
{
- if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT)))
me->SetFacingToObject(go);
}
void RestoreAll()
{
- if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
- instance->HandleGameObject(0, false, go);
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_CAVE_IN_RIGHT)))
+ instance->HandleGameObject(ObjectGuid::Empty, false, go);
- if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT)))
- instance->HandleGameObject(0, false, go);
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_CAVE_IN_LEFT)))
+ instance->HandleGameObject(ObjectGuid::Empty, false, go);
if (!GoSummonList.empty())
- for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
+ for (GuidList::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
{
if (GameObject* go = ObjectAccessor::GetGameObject(*me, *itr))
go->RemoveFromWorld();
}
if (!SummonList.empty())
- for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
+ for (GuidList::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
{
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
{
@@ -398,8 +398,8 @@ public:
SetInFace(true);
Talk(SAY_BLASTMASTER_5);
Summon(1);
- if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
- instance->HandleGameObject(0, true, go);
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_CAVE_IN_RIGHT)))
+ instance->HandleGameObject(ObjectGuid::Empty, true, go);
NextStep(3000, true);
break;
case 7:
@@ -444,8 +444,8 @@ public:
case 16:
Talk(SAY_BLASTMASTER_14);
SetInFace(false);
- if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT)))
- instance->HandleGameObject(0, true, go);
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_CAVE_IN_LEFT)))
+ instance->HandleGameObject(ObjectGuid::Empty, true, go);
NextStep(2000, true);
break;
case 17:
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
index f8e00fab682..9cd6afaca78 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
@@ -41,19 +41,14 @@ public:
uint32 m_auiEncounter[MAX_ENCOUNTER];
- uint64 uiCaveInLeftGUID;
- uint64 uiCaveInRightGUID;
+ ObjectGuid uiCaveInLeftGUID;
+ ObjectGuid uiCaveInRightGUID;
- uint64 uiBastmasterEmiShortfuseGUID;
+ ObjectGuid uiBastmasterEmiShortfuseGUID;
void Initialize() override
{
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
-
- uiCaveInLeftGUID = 0;
- uiCaveInRightGUID = 0;
-
- uiBastmasterEmiShortfuseGUID = 0;
}
void Load(const char* in) override
@@ -93,12 +88,12 @@ public:
case GO_CAVE_IN_LEFT:
uiCaveInLeftGUID = go->GetGUID();
if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_CAVE_IN_RIGHT:
uiCaveInRightGUID = go->GetGUID();
if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED)
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
}
}
@@ -124,7 +119,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 uiType) const override
+ ObjectGuid GetGuidData(uint32 uiType) const override
{
switch (uiType)
{
@@ -133,7 +128,7 @@ public:
case DATA_NPC_BASTMASTER_EMI_SHORTFUSE: return uiBastmasterEmiShortfuseGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
};
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index bbddf0aa5f5..87f7ab5f07e 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -75,10 +75,10 @@ public:
void Initialize()
{
ResetTimer = 0;
- Midnight = 0;
+ Midnight.Clear();
}
- uint64 Midnight;
+ ObjectGuid Midnight;
uint8 Phase;
uint32 CleaveTimer;
uint32 CurseTimer;
@@ -141,11 +141,11 @@ public:
void Initialize()
{
Phase = 1;
- Attumen = 0;
+ Attumen.Clear();
Mount_Timer = 0;
}
- uint64 Attumen;
+ ObjectGuid Attumen;
uint8 Phase;
uint32 Mount_Timer;
@@ -242,7 +242,7 @@ public:
Mount_Timer = 1000;
}
- void SetMidnight(Creature* pAttumen, uint64 value)
+ void SetMidnight(Creature* pAttumen, ObjectGuid value)
{
ENSURE_AI(boss_attumen::boss_attumenAI, pAttumen->AI())->Midnight = value;
}
@@ -262,7 +262,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(uint32 diff)
pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pMidnight->SetVisible(true);
}
- Midnight = 0;
+ Midnight.Clear();
me->SetVisible(false);
me->Kill(me);
} else ResetTimer -= diff;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
index 5b4f25aea44..0d9827d390c 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
@@ -107,7 +107,6 @@ public:
{
Initialize();
memset(AddId, 0, sizeof(AddId));
- memset(AddGUID, 0, sizeof(AddGUID));
instance = creature->GetInstanceScript();
}
@@ -126,7 +125,7 @@ public:
InstanceScript* instance;
- uint64 AddGUID[4];
+ ObjectGuid AddGUID[4];
uint32 Vanish_Timer;
uint32 Blind_Timer;
@@ -339,13 +338,10 @@ struct boss_moroes_guestAI : public ScriptedAI
{
InstanceScript* instance;
- uint64 GuestGUID[4];
+ ObjectGuid GuestGUID[4];
boss_moroes_guestAI(Creature* creature) : ScriptedAI(creature)
{
- for (uint8 i = 0; i < 4; ++i)
- GuestGUID[i] = 0;
-
instance = creature->GetInstanceScript();
}
@@ -356,15 +352,15 @@ struct boss_moroes_guestAI : public ScriptedAI
void AcquireGUID()
{
- if (Creature* Moroes = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOROES)))
+ if (Creature* Moroes = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MOROES)))
for (uint8 i = 0; i < 4; ++i)
- if (uint64 GUID = ENSURE_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i])
+ if (ObjectGuid GUID = ENSURE_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i])
GuestGUID[i] = GUID;
}
Unit* SelectGuestTarget()
{
- uint64 TempGUID = GuestGUID[rand32() % 4];
+ ObjectGuid TempGUID = GuestGUID[rand32() % 4];
if (TempGUID)
{
Unit* unit = ObjectAccessor::GetUnit(*me, TempGUID);
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
index a928413fea0..77e9e3fe86d 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
@@ -81,13 +81,6 @@ public:
Initialize();
instance = creature->GetInstanceScript();
- for (int i=0; i<3; ++i)
- {
- PortalGUID[i] = 0;
- BeamTarget[i] = 0;
- BeamerGUID[i] = 0;
- }
-
PortalPhase = false;
PhaseTimer = 0;
EmpowermentTimer = 0;
@@ -112,9 +105,9 @@ public:
uint32 NetherbreathTimer;
uint32 EmpowermentTimer;
uint32 PortalTimer; // timer for beam checking
- uint64 PortalGUID[3]; // guid's of portals
- uint64 BeamerGUID[3]; // guid's of auxiliary beaming portals
- uint64 BeamTarget[3]; // guid's of portals' current targets
+ ObjectGuid PortalGUID[3]; // guid's of portals
+ ObjectGuid BeamerGUID[3]; // guid's of auxiliary beaming portals
+ ObjectGuid BeamTarget[3]; // guid's of portals' current targets
bool IsBetween(WorldObject* u1, WorldObject* target, WorldObject* u2) // the in-line checker
{
@@ -157,7 +150,7 @@ public:
pos[GREEN_PORTAL] = ((r % 2) ? 0 : (r > 1 ? 2 : 1));
pos[BLUE_PORTAL] = (r > 1 ? 1 : 2); // Blue Portal not on the left side (0)
- for (int i=0; i<3; ++i)
+ for (int i = 0; i < 3; ++i)
if (Creature* portal = me->SummonCreature(PortalID[i], PortalCoord[pos[i]][0], PortalCoord[pos[i]][1], PortalCoord[pos[i]][2], 0, TEMPSUMMON_TIMED_DESPAWN, 60000))
{
PortalGUID[i] = portal->GetGUID();
@@ -173,14 +166,14 @@ public:
portal->DisappearAndDie();
if (Creature* portal = ObjectAccessor::GetCreature(*me, BeamerGUID[i]))
portal->DisappearAndDie();
- PortalGUID[i] = 0;
- BeamTarget[i] = 0;
+ PortalGUID[i].Clear();
+ BeamTarget[i].Clear();
}
}
void UpdatePortals() // Here we handle the beams' behavior
{
- for (int j=0; j<3; ++j) // j = color
+ for (int j = 0; j < 3; ++j) // j = color
if (Creature* portal = ObjectAccessor::GetCreature(*me, PortalGUID[j]))
{
// the one who's been cast upon before
@@ -198,9 +191,9 @@ public:
Player* p = i->GetSource();
if (p && p->IsAlive() // alive
&& (!target || target->GetDistance2d(portal)>p->GetDistance2d(portal)) // closer than current best
- && !p->HasAura(PlayerDebuff[j], 0) // not exhausted
- && !p->HasAura(PlayerBuff[(j+1)%3], 0) // not on another beam
- && !p->HasAura(PlayerBuff[(j+2)%3], 0)
+ && !p->HasAura(PlayerDebuff[j]) // not exhausted
+ && !p->HasAura(PlayerBuff[(j + 1) % 3]) // not on another beam
+ && !p->HasAura(PlayerBuff[(j + 2) % 3])
&& IsBetween(me, p, portal)) // on the beam
target = p;
}
@@ -220,7 +213,7 @@ public:
{
beamer->CastSpell(target, PortalBeam[j], false);
beamer->DisappearAndDie();
- BeamerGUID[j] = 0;
+ BeamerGUID[j].Clear();
}
// create new one and start beaming on the target
if (Creature* beamer = portal->SummonCreature(PortalID[j], portal->GetPositionX(), portal->GetPositionY(), portal->GetPositionZ(), portal->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 60000))
@@ -264,7 +257,7 @@ public:
void HandleDoors(bool open) // Massive Door switcher
{
- if (GameObject* Door = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_MASSIVE_DOOR) ))
+ if (GameObject* Door = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_MASSIVE_DOOR) ))
Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
index 7ce11653567..619e3c9cd15 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
@@ -159,8 +159,8 @@ public:
void HandleTerraceDoors(bool open)
{
- instance->HandleGameObject(instance->GetData64(DATA_MASTERS_TERRACE_DOOR_1), open);
- instance->HandleGameObject(instance->GetData64(DATA_MASTERS_TERRACE_DOOR_2), open);
+ instance->HandleGameObject(instance->GetGuidData(DATA_MASTERS_TERRACE_DOOR_1), open);
+ instance->HandleGameObject(instance->GetGuidData(DATA_MASTERS_TERRACE_DOOR_2), open);
}
void EnterCombat(Unit* /*who*/) override
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index c09b349f143..06e4859a931 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
@@ -110,11 +110,11 @@ public:
struct netherspite_infernalAI : public ScriptedAI
{
netherspite_infernalAI(Creature* creature) : ScriptedAI(creature),
- HellfireTimer(0), CleanupTimer(0), malchezaar(0), point(NULL) { }
+ HellfireTimer(0), CleanupTimer(0), point(NULL) { }
uint32 HellfireTimer;
uint32 CleanupTimer;
- uint64 malchezaar;
+ ObjectGuid malchezaar;
InfernalPoint *point;
void Reset() override { }
@@ -189,7 +189,6 @@ public:
Initialize();
instance = creature->GetInstanceScript();
- memset(axes, 0, sizeof(axes));
}
void Initialize()
@@ -208,7 +207,7 @@ public:
for (uint8 i = 0; i < 5; ++i)
{
- enfeeble_targets[i] = 0;
+ enfeeble_targets[i].Clear();
enfeeble_health[i] = 0;
}
}
@@ -225,12 +224,12 @@ public:
uint32 AxesTargetSwitchTimer;
uint32 InfernalCleanupTimer;
- std::vector<uint64> infernals;
+ GuidVector infernals;
std::vector<InfernalPoint*> positions;
- uint64 axes[2];
- uint64 enfeeble_targets[5];
- uint32 enfeeble_health[5];
+ ObjectGuid axes[2];
+ ObjectGuid enfeeble_targets[5];
+ uint64 enfeeble_health[5];
uint32 phase;
@@ -246,7 +245,7 @@ public:
for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i)
positions.push_back(&InfernalPoints[i]);
- instance->HandleGameObject(instance->GetData64(DATA_GO_NETHER_DOOR), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), true);
}
void KilledUnit(Unit* /*victim*/) override
@@ -266,20 +265,20 @@ public:
for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i)
positions.push_back(&InfernalPoints[i]);
- instance->HandleGameObject(instance->GetData64(DATA_GO_NETHER_DOOR), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), true);
}
void EnterCombat(Unit* /*who*/) override
{
Talk(SAY_AGGRO);
- instance->HandleGameObject(instance->GetData64(DATA_GO_NETHER_DOOR), false); // Open the door leading further in
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), false); // Open the door leading further in
}
void InfernalCleanup()
{
//Infernal Cleanup
- for (std::vector<uint64>::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr)
+ for (GuidVector::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr)
if (Unit* pInfernal = ObjectAccessor::GetUnit(*me, *itr))
if (pInfernal->IsAlive())
{
@@ -297,7 +296,7 @@ public:
Unit* axe = ObjectAccessor::GetUnit(*me, axes[i]);
if (axe && axe->IsAlive())
axe->Kill(axe);
- axes[i] = 0;
+ axes[i].Clear();
}
}
@@ -350,7 +349,7 @@ public:
Unit* target = ObjectAccessor::GetUnit(*me, enfeeble_targets[i]);
if (target && target->IsAlive())
target->SetHealth(enfeeble_health[i]);
- enfeeble_targets[i] = 0;
+ enfeeble_targets[i].Clear();
enfeeble_health[i] = 0;
}
}
@@ -398,7 +397,7 @@ public:
if (me->HasUnitState(UNIT_STATE_STUNNED)) // While shifting to phase 2 malchezaar stuns himself
return;
- if (me->GetVictim() && me->GetUInt64Value(UNIT_FIELD_TARGET) != me->EnsureVictim()->GetGUID())
+ if (me->GetVictim() && me->GetTarget() != me->EnsureVictim()->GetGUID())
me->SetTarget(me->EnsureVictim()->GetGUID());
if (phase == 1)
@@ -576,11 +575,13 @@ public:
void Cleanup(Creature* infernal, InfernalPoint *point)
{
- for (std::vector<uint64>::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr)
- if (*itr == infernal->GetGUID())
+ for (GuidVector::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr)
{
- infernals.erase(itr);
- break;
+ if (*itr == infernal->GetGUID())
+ {
+ infernals.erase(itr);
+ break;
+ }
}
positions.push_back(point);
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
index c66f2b335c4..4cb0b61365d 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
@@ -134,7 +134,7 @@ public:
uint32 FlameWreathTimer;
uint32 FlameWreathCheckTime;
- uint64 FlameWreathTarget[3];
+ ObjectGuid FlameWreathTarget[3];
float FWTargPosX[3];
float FWTargPosY[3];
@@ -155,7 +155,7 @@ public:
// Not in progress
instance->SetData(TYPE_ARAN, NOT_STARTED);
- instance->HandleGameObject(instance->GetData64(DATA_GO_LIBRARY_DOOR), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_LIBRARY_DOOR), true);
}
void KilledUnit(Unit* /*victim*/) override
@@ -168,7 +168,7 @@ public:
Talk(SAY_DEATH);
instance->SetData(TYPE_ARAN, DONE);
- instance->HandleGameObject(instance->GetData64(DATA_GO_LIBRARY_DOOR), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_LIBRARY_DOOR), true);
}
void EnterCombat(Unit* /*who*/) override
@@ -176,7 +176,7 @@ public:
Talk(SAY_AGGRO);
instance->SetData(TYPE_ARAN, IN_PROGRESS);
- instance->HandleGameObject(instance->GetData64(DATA_GO_LIBRARY_DOOR), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_LIBRARY_DOOR), false);
}
void FlameWreathEffect()
@@ -223,7 +223,7 @@ public:
{
if (CloseDoorTimer <= diff)
{
- instance->HandleGameObject(instance->GetData64(DATA_GO_LIBRARY_DOOR), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_LIBRARY_DOOR), false);
CloseDoorTimer = 0;
} else CloseDoorTimer -= diff;
}
@@ -393,9 +393,9 @@ public:
FlameWreathTimer = 20000;
FlameWreathCheckTime = 500;
- FlameWreathTarget[0] = 0;
- FlameWreathTarget[1] = 0;
- FlameWreathTarget[2] = 0;
+ FlameWreathTarget[0].Clear();
+ FlameWreathTarget[1].Clear();
+ FlameWreathTarget[2].Clear();
FlameWreathEffect();
break;
@@ -465,7 +465,7 @@ public:
{
unit->CastSpell(unit, 20476, true, 0, 0, me->GetGUID());
unit->CastSpell(unit, 11027, true);
- FlameWreathTarget[i] = 0;
+ FlameWreathTarget[i].Clear();
}
}
FlameWreathCheckTime = 500;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
index d27caea573e..be6d07571cf 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
@@ -100,7 +100,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- Creature* Terestian = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TERESTIAN));
+ Creature* Terestian = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TERESTIAN));
if (Terestian && Terestian->IsAlive())
DoCast(Terestian, SPELL_BROKEN_PACT, true);
}
@@ -143,10 +143,10 @@ public:
void Initialize()
{
- SacrificeGUID = 0;
+ SacrificeGUID.Clear();
}
- uint64 SacrificeGUID;
+ ObjectGuid SacrificeGUID;
void Reset() override
{
@@ -268,10 +268,8 @@ public:
{
boss_terestianAI(Creature* creature) : ScriptedAI(creature)
{
- Initialize();
- for (uint8 i = 0; i < 2; ++i)
- PortalGUID[i] = 0;
instance = creature->GetInstanceScript();
+ Initialize();
}
void Initialize()
@@ -288,7 +286,7 @@ public:
InstanceScript* instance;
- uint64 PortalGUID[2];
+ ObjectGuid PortalGUID[2];
uint8 PortalsCount;
uint32 SacrificeTimer;
@@ -311,7 +309,7 @@ public:
pPortal->DespawnOrUnsummon();
}
- PortalGUID[i] = 0;
+ PortalGUID[i].Clear();
}
}
@@ -366,7 +364,7 @@ public:
if (Creature* pPortal = ObjectAccessor::GetCreature((*me), PortalGUID[i]))
pPortal->DespawnOrUnsummon();
- PortalGUID[i] = 0;
+ PortalGUID[i].Clear();
}
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index 7b51b61ba0a..63d543568fb 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -250,11 +250,11 @@ public:
void Initialize()
{
- DorotheeGUID = 0;
+ DorotheeGUID.Clear();
YipTimer = 10000;
}
- uint64 DorotheeGUID;
+ ObjectGuid DorotheeGUID;
uint32 YipTimer;
void Reset() override
@@ -710,10 +710,10 @@ public:
Talk(SAY_CRONE_DEATH);
instance->SetData(TYPE_OPERA, DONE);
- instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORLEFT), true);
- instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORRIGHT), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORLEFT), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORRIGHT), true);
- if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
+ if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetGuidData(DATA_GO_SIDE_ENTRANCE_DOOR)))
pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
}
@@ -868,7 +868,7 @@ public:
FearTimer = urand(25000, 35000);
SwipeTimer = 5000;
- HoodGUID = 0;
+ HoodGUID.Clear();
TempThreat = 0;
IsChasing = false;
@@ -880,7 +880,7 @@ public:
uint32 FearTimer;
uint32 SwipeTimer;
- uint64 HoodGUID;
+ ObjectGuid HoodGUID;
float TempThreat;
bool IsChasing;
@@ -910,10 +910,10 @@ public:
DoPlaySoundToSet(me, SOUND_WOLF_DEATH);
instance->SetData(TYPE_OPERA, DONE);
- instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORLEFT), true);
- instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORRIGHT), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORLEFT), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORRIGHT), true);
- if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
+ if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetGuidData(DATA_GO_SIDE_ENTRANCE_DOOR)))
pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
}
@@ -947,7 +947,7 @@ public:
if (Unit* target = ObjectAccessor::GetUnit(*me, HoodGUID))
{
- HoodGUID = 0;
+ HoodGUID.Clear();
if (DoGetThreat(target))
DoModifyThreatPercent(target, -100);
me->AddThreat(target, TempThreat);
@@ -1073,7 +1073,7 @@ public:
void Initialize()
{
- RomuloGUID = 0;
+ RomuloGUID.Clear();
Phase = PHASE_JULIANNE;
BlindingPassionTimer = 30000;
@@ -1093,7 +1093,7 @@ public:
uint32 EntryYellTimer;
uint32 AggroYellTimer;
- uint64 RomuloGUID;
+ ObjectGuid RomuloGUID;
uint32 Phase;
@@ -1160,9 +1160,9 @@ public:
Talk(SAY_JULIANNE_DEATH02);
instance->SetData(TYPE_OPERA, DONE);
- instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORLEFT), true);
- instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORRIGHT), true);
- if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORLEFT), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORRIGHT), true);
+ if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetGuidData(DATA_GO_SIDE_ENTRANCE_DOOR)))
pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
}
@@ -1197,7 +1197,7 @@ public:
void Initialize()
{
- JulianneGUID = 0;
+ JulianneGUID.Clear();
Phase = PHASE_ROMULO;
BackwardLungeTimer = 15000;
@@ -1212,7 +1212,7 @@ public:
InstanceScript* instance;
- uint64 JulianneGUID;
+ ObjectGuid JulianneGUID;
uint32 Phase;
uint32 EntryYellTimer;
@@ -1318,10 +1318,10 @@ public:
Talk(SAY_ROMULO_DEATH);
instance->SetData(TYPE_OPERA, DONE);
- instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORLEFT), true);
- instance->HandleGameObject(instance->GetData64(DATA_GO_STAGEDOORRIGHT), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORLEFT), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_STAGEDOORRIGHT), true);
- if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
+ if (GameObject* pSideEntrance = instance->instance->GetGameObject(instance->GetGuidData(DATA_GO_SIDE_ENTRANCE_DOOR)))
pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
index 8f6d142e22b..0d639df731a 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
@@ -64,21 +64,21 @@ public:
uint32 m_uiOperaEvent;
uint32 m_uiOzDeathCount;
- uint64 m_uiCurtainGUID;
- uint64 m_uiStageDoorLeftGUID;
- uint64 m_uiStageDoorRightGUID;
- uint64 m_uiKilrekGUID;
- uint64 m_uiTerestianGUID;
- uint64 m_uiMoroesGUID;
- uint64 m_uiLibraryDoor; // Door at Shade of Aran
- uint64 m_uiMassiveDoor; // Door at Netherspite
- uint64 m_uiSideEntranceDoor; // Side Entrance
- uint64 m_uiGamesmansDoor; // Door before Chess
- uint64 m_uiGamesmansExitDoor; // Door after Chess
- uint64 m_uiNetherspaceDoor; // Door at Malchezaar
- uint64 MastersTerraceDoor[2];
- uint64 ImageGUID;
- uint64 DustCoveredChest;
+ ObjectGuid m_uiCurtainGUID;
+ ObjectGuid m_uiStageDoorLeftGUID;
+ ObjectGuid m_uiStageDoorRightGUID;
+ ObjectGuid m_uiKilrekGUID;
+ ObjectGuid m_uiTerestianGUID;
+ ObjectGuid m_uiMoroesGUID;
+ ObjectGuid m_uiLibraryDoor; // Door at Shade of Aran
+ ObjectGuid m_uiMassiveDoor; // Door at Netherspite
+ ObjectGuid m_uiSideEntranceDoor; // Side Entrance
+ ObjectGuid m_uiGamesmansDoor; // Door before Chess
+ ObjectGuid m_uiGamesmansExitDoor; // Door after Chess
+ ObjectGuid m_uiNetherspaceDoor; // Door at Malchezaar
+ ObjectGuid MastersTerraceDoor[2];
+ ObjectGuid ImageGUID;
+ ObjectGuid DustCoveredChest;
void Initialize() override
{
@@ -88,25 +88,6 @@ public:
// 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered.
m_uiOperaEvent = urand(1, 3);
m_uiOzDeathCount = 0;
-
- m_uiCurtainGUID = 0;
- m_uiStageDoorLeftGUID = 0;
- m_uiStageDoorRightGUID = 0;
-
- m_uiKilrekGUID = 0;
- m_uiTerestianGUID = 0;
- m_uiMoroesGUID = 0;
-
- m_uiLibraryDoor = 0;
- m_uiMassiveDoor = 0;
- m_uiSideEntranceDoor = 0;
- m_uiGamesmansDoor = 0;
- m_uiGamesmansExitDoor = 0;
- m_uiNetherspaceDoor = 0;
- MastersTerraceDoor[0]= 0;
- MastersTerraceDoor[1]= 0;
- ImageGUID = 0;
- DustCoveredChest = 0;
}
bool IsEncounterInProgress() const override
@@ -183,7 +164,7 @@ public:
}
}
- void SetData64(uint32 identifier, uint64 data) override
+ void SetGuidData(uint32 identifier, ObjectGuid data) override
{
switch (identifier)
{
@@ -265,7 +246,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 uiData) const override
+ ObjectGuid GetGuidData(uint32 uiData) const override
{
switch (uiData)
{
@@ -286,7 +267,7 @@ public:
case DATA_IMAGE_OF_MEDIVH: return ImageGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
void Load(char const* chrIn)
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
index 716b32601be..159035c6eb3 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
@@ -139,7 +139,7 @@ public:
void Initialize()
{
- m_uiSpotlightGUID = 0;
+ m_uiSpotlightGUID.Clear();
TalkCount = 0;
TalkTimer = 2000;
@@ -150,7 +150,7 @@ public:
InstanceScript* instance;
- uint64 m_uiSpotlightGUID;
+ ObjectGuid m_uiSpotlightGUID;
uint32 TalkCount;
uint32 TalkTimer;
@@ -186,7 +186,7 @@ public:
{
case 0:
DoCast(me, SPELL_TUXEDO, false);
- instance->DoUseDoorOrButton(instance->GetData64(DATA_GO_STAGEDOORLEFT));
+ instance->DoUseDoorOrButton(instance->GetGuidData(DATA_GO_STAGEDOORLEFT));
break;
case 4:
TalkCount = 0;
@@ -202,12 +202,12 @@ public:
}
break;
case 8:
- instance->DoUseDoorOrButton(instance->GetData64(DATA_GO_STAGEDOORLEFT));
+ instance->DoUseDoorOrButton(instance->GetGuidData(DATA_GO_STAGEDOORLEFT));
PerformanceReady = true;
break;
case 9:
PrepareEncounter();
- instance->DoUseDoorOrButton(instance->GetData64(DATA_GO_CURTAINS));
+ instance->DoUseDoorOrButton(instance->GetGuidData(DATA_GO_CURTAINS));
break;
}
}
@@ -360,17 +360,17 @@ public:
case GOSSIP_ACTION_INFO_DEF+3:
player->CLOSE_GOSSIP_MENU();
pBarnesAI->m_uiEventId = EVENT_OZ;
- TC_LOG_INFO("scripts", "player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID());
+ TC_LOG_INFO("scripts", "player (%s) manually set Opera event to EVENT_OZ", player->GetGUID().ToString().c_str());
break;
case GOSSIP_ACTION_INFO_DEF+4:
player->CLOSE_GOSSIP_MENU();
pBarnesAI->m_uiEventId = EVENT_HOOD;
- TC_LOG_INFO("scripts", "player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID());
+ TC_LOG_INFO("scripts", "player (%s) manually set Opera event to EVENT_HOOD", player->GetGUID().ToString().c_str());
break;
case GOSSIP_ACTION_INFO_DEF+5:
player->CLOSE_GOSSIP_MENU();
pBarnesAI->m_uiEventId = EVENT_RAJ;
- TC_LOG_INFO("scripts", "player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID());
+ TC_LOG_INFO("scripts", "player (%s) manually set Opera event to EVENT_RAJ", player->GetGUID().ToString().c_str());
break;
}
@@ -491,14 +491,14 @@ public:
void Initialize()
{
- ArcanagosGUID = 0;
+ ArcanagosGUID.Clear();
EventStarted = false;
YellTimer = 0;
}
InstanceScript* instance;
- uint64 ArcanagosGUID;
+ ObjectGuid ArcanagosGUID;
uint32 YellTimer;
uint32 Step;
@@ -511,9 +511,9 @@ public:
{
Initialize();
- if (instance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0)
+ if (instance->GetGuidData(DATA_IMAGE_OF_MEDIVH).IsEmpty())
{
- instance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID());
+ instance->SetGuidData(DATA_IMAGE_OF_MEDIVH, me->GetGUID());
(*me).GetMotionMaster()->MovePoint(1, MedivPos[0], MedivPos[1], MedivPos[2]);
Step = 0;
}
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index 1aafb32cef9..bae61f9b452 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -166,7 +166,7 @@ public:
instance->SetBossState(DATA_KAELTHAS, DONE);
// Enable the Translocation Orb Exit
- if (GameObject* escapeOrb = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ESCAPE_ORB)))
+ if (GameObject* escapeOrb = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ESCAPE_ORB)))
escapeOrb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
@@ -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.append(unit->GetPackGUID());
+ data << unit->GetPackGUID();
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.append(unit->GetPackGUID());
+ data << unit->GetPackGUID();
data << uint32(0);
unit->SendMessageToSet(&data, true);
}
@@ -548,7 +548,7 @@ public:
me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->ClearAllReactives();
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
me->SetStandState(UNIT_STAND_STATE_DEAD);
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
index cc2af3dcea5..9acf82c312e 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
@@ -119,7 +119,6 @@ public:
{
Initialize();
instance = creature->GetInstanceScript();
- memset(&m_auiLackeyGUID, 0, sizeof(m_auiLackeyGUID));
LackeyEntryList.clear();
}
@@ -138,7 +137,7 @@ public:
InstanceScript* instance;
std::vector<uint32> LackeyEntryList;
- uint64 m_auiLackeyGUID[MAX_ACTIVE_LACKEY];
+ ObjectGuid m_auiLackeyGUID[MAX_ACTIVE_LACKEY];
uint8 PlayersKilled;
@@ -361,7 +360,6 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
{
Initialize();
instance = creature->GetInstanceScript();
- memset(&m_auiLackeyGUIDs, 0, sizeof(m_auiLackeyGUIDs));
AcquireGUIDs();
}
@@ -378,7 +376,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
InstanceScript* instance;
- uint64 m_auiLackeyGUIDs[MAX_ACTIVE_LACKEY];
+ ObjectGuid m_auiLackeyGUIDs[MAX_ACTIVE_LACKEY];
uint32 ResetThreatTimer;
bool UsedPotion;
@@ -388,7 +386,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
Initialize();
// in case she is not alive and Reset was for some reason called, respawn her (most likely party wipe after killing her)
- if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA)))
+ if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA)))
{
if (!pDelrissa->IsAlive())
pDelrissa->Respawn();
@@ -412,7 +410,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
}
}
- if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA)))
+ if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA)))
{
if (pDelrissa->IsAlive() && !pDelrissa->GetVictim())
{
@@ -424,7 +422,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
void JustDied(Unit* /*killer*/) override
{
- Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA));
+ Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA));
uint32 uiLackeyDeathCount = instance->GetData(DATA_DELRISSA_DEATH_COUNT);
if (!pDelrissa)
@@ -453,13 +451,13 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
void KilledUnit(Unit* victim) override
{
- if (Creature* Delrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA)))
+ if (Creature* Delrissa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA)))
Delrissa->AI()->KilledUnit(victim);
}
void AcquireGUIDs()
{
- if (Creature* Delrissa = (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA))))
+ if (Creature* Delrissa = (ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA))))
{
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
m_auiLackeyGUIDs[i] = ENSURE_AI(boss_priestess_delrissa::boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i];
@@ -1054,7 +1052,6 @@ public:
boss_garaxxasAI(Creature* creature) : boss_priestess_lackey_commonAI(creature)
{
Initialize();
- m_uiPetGUID = 0;
}
void Initialize()
@@ -1067,7 +1064,7 @@ public:
Freezing_Trap_Timer = 15000;
}
- uint64 m_uiPetGUID;
+ ObjectGuid m_uiPetGUID;
uint32 Aimed_Shot_Timer;
uint32 Shoot_Timer;
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
index d34123c58b2..c186470f2d5 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
@@ -71,7 +71,6 @@ class boss_selin_fireheart : public CreatureScript
{
boss_selin_fireheartAI(Creature* creature) : BossAI(creature, DATA_SELIN)
{
- CrystalGUID = 0;
_scheduledEvents = false;
}
@@ -89,7 +88,7 @@ class boss_selin_fireheart : public CreatureScript
}
_Reset();
- CrystalGUID = 0;
+ CrystalGUID.Clear();
_scheduledEvents = false;
}
@@ -221,7 +220,7 @@ class boss_selin_fireheart : public CreatureScript
if (CrystalChosen && CrystalChosen->IsAlive())
CrystalChosen->Kill(CrystalChosen);
- CrystalGUID = 0;
+ CrystalGUID.Clear();
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveChase(me->GetVictim());
@@ -255,7 +254,7 @@ class boss_selin_fireheart : public CreatureScript
private:
std::list<Creature*> Crystals;
- uint64 CrystalGUID;
+ ObjectGuid CrystalGUID;
bool _scheduledEvents;
};
@@ -278,7 +277,7 @@ class npc_fel_crystal : public CreatureScript
{
if (InstanceScript* instance = me->GetInstanceScript())
{
- Creature* Selin = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SELIN));
+ Creature* Selin = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SELIN));
if (Selin && Selin->IsAlive())
Selin->AI()->DoAction(ACTION_SWITCH_PHASE);
}
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
index 01491c53f72..65fed52d998 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
@@ -50,12 +50,6 @@ class instance_magisters_terrace : public InstanceMapScript
LoadDoorData(doorData);
DelrissaDeathCount = 0;
-
- SelinGUID = 0;
- DelrissaGUID = 0;
- EscapeOrbGUID = 0;
-
- memset(KaelStatue, 0, 2 * sizeof(uint64));
}
uint32 GetData(uint32 type) const override
@@ -162,7 +156,7 @@ class instance_magisters_terrace : public InstanceMapScript
return true;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -179,14 +173,14 @@ class instance_magisters_terrace : public InstanceMapScript
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
protected:
- uint64 SelinGUID;
- uint64 DelrissaGUID;
- uint64 KaelStatue[2];
- uint64 EscapeOrbGUID;
+ ObjectGuid SelinGUID;
+ ObjectGuid DelrissaGUID;
+ ObjectGuid KaelStatue[2];
+ ObjectGuid EscapeOrbGUID;
uint32 DelrissaDeathCount;
};
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
index a20f595183f..6cd14598a58 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
@@ -165,7 +165,7 @@ public:
if (Player* player = i->GetSource())
{
if (spell && spell->Effects[0].MiscValue)
- player->KilledMonsterCredit(spell->Effects[0].MiscValue, 0);
+ player->KilledMonsterCredit(spell->Effects[0].MiscValue);
}
}
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index 6c48ee7f348..c01affd3012 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -107,7 +107,6 @@ public:
if (!me->GetCurrentEquipmentId())
me->SetCurrentEquipmentId(me->GetOriginalEquipmentId());
- playerGUID = 0;
wait_timer = 0;
anchorX = 0.f;
anchorY = 0.f;
@@ -115,15 +114,15 @@ public:
void Initialize()
{
- anchorGUID = 0;
+ anchorGUID.Clear();
phase = PHASE_CHAINED;
}
- uint64 playerGUID;
+ ObjectGuid playerGUID;
UnworthyInitiatePhase phase;
uint32 wait_timer;
float anchorX, anchorY;
- uint64 anchorGUID;
+ ObjectGuid anchorGUID;
EventMap events;
@@ -300,17 +299,17 @@ public:
struct npc_unworthy_initiate_anchorAI : public PassiveAI
{
- npc_unworthy_initiate_anchorAI(Creature* creature) : PassiveAI(creature), prisonerGUID(0) { }
+ npc_unworthy_initiate_anchorAI(Creature* creature) : PassiveAI(creature) { }
- uint64 prisonerGUID;
+ ObjectGuid prisonerGUID;
- void SetGUID(uint64 guid, int32 /*id*/) override
+ void SetGUID(ObjectGuid guid, int32 /*id*/) override
{
if (!prisonerGUID)
prisonerGUID = guid;
}
- uint64 GetGUID(int32 /*id*/) const override
+ ObjectGuid GetGUID(int32 /*id*/) const override
{
return prisonerGUID;
}
@@ -325,7 +324,7 @@ public:
bool OnGossipHello(Player* player, GameObject* go) override
{
if (Creature* anchor = go->FindNearestCreature(29521, 15))
- if (uint64 prisonerGUID = anchor->AI()->GetGUID())
+ if (ObjectGuid prisonerGUID = anchor->AI()->GetGUID())
if (Creature* prisoner = ObjectAccessor::GetCreature(*player, prisonerGUID))
ENSURE_AI(npc_unworthy_initiate::npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, player);
@@ -421,7 +420,7 @@ class npc_eye_of_acherus : public CreatureScript
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
me->SetSpeed(UnitMoveType(i), owner->GetSpeedRate(UnitMoveType(i)), true);
- TalkToMap(TALK_CONTROL, owner);
+ Talk(TALK_CONTROL, owner);
}
me->SetDisableGravity(false);
DoCast(me, SPELL_EYE_FLIGHT);
@@ -532,14 +531,14 @@ public:
void Initialize()
{
- m_uiDuelerGUID = 0;
+ m_uiDuelerGUID.Clear();
m_uiDuelTimer = 5000;
m_bIsDuelInProgress = false;
lose = false;
}
bool lose;
- uint64 m_uiDuelerGUID;
+ ObjectGuid m_uiDuelerGUID;
uint32 m_uiDuelTimer;
bool m_bIsDuelInProgress;
@@ -655,7 +654,7 @@ class npc_dark_rider_of_acherus : public CreatureScript
PhaseTimer = 4000;
Phase = 0;
Intro = false;
- TargetGUID = 0;
+ TargetGUID.Clear();
}
void Reset() override
@@ -716,7 +715,7 @@ class npc_dark_rider_of_acherus : public CreatureScript
uint32 PhaseTimer;
uint32 Phase;
bool Intro;
- uint64 TargetGUID;
+ ObjectGuid TargetGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -1010,7 +1009,7 @@ class npc_scarlet_miner_cart : public CreatureScript
struct npc_scarlet_miner_cartAI : public PassiveAI
{
- npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature), _minerGUID(0), _playerGUID(0)
+ npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature)
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse.
@@ -1028,7 +1027,7 @@ class npc_scarlet_miner_cart : public CreatureScript
void SummonedCreatureDespawn(Creature* summon) override
{
if (summon->GetEntry() == NPC_MINER)
- _minerGUID = 0;
+ _minerGUID.Clear();
}
void DoAction(int32 /*param*/) override
@@ -1054,15 +1053,15 @@ class npc_scarlet_miner_cart : public CreatureScript
}
else
{
- _playerGUID = 0;
+ _playerGUID.Clear();
if (Creature* miner = ObjectAccessor::GetCreature(*me, _minerGUID))
miner->DespawnOrUnsummon();
}
}
private:
- uint64 _minerGUID;
- uint64 _playerGUID;
+ ObjectGuid _minerGUID;
+ ObjectGuid _playerGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -1096,14 +1095,14 @@ class npc_scarlet_miner : public CreatureScript
void Initialize()
{
- carGUID = 0;
+ carGUID.Clear();
IntroTimer = 0;
IntroPhase = 0;
}
uint32 IntroTimer;
uint32 IntroPhase;
- uint64 carGUID;
+ ObjectGuid carGUID;
void Reset() override
{
@@ -1148,7 +1147,7 @@ class npc_scarlet_miner : public CreatureScript
}
}
- void SetGUID(uint64 guid, int32 /*id = 0*/) override
+ void SetGUID(ObjectGuid guid, int32 /*id = 0*/) override
{
InitWaypoint();
Start(false, false, guid);
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
index ee624c4f6a5..fe433a6692d 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
@@ -60,12 +60,12 @@ public:
{
speechTimer = 0;
speechCounter = 0;
- playerGUID = 0;
+ playerGUID.Clear();
}
uint32 speechTimer;
uint32 speechCounter;
- uint64 playerGUID;
+ ObjectGuid playerGUID;
void Reset() override
{
@@ -223,7 +223,7 @@ public:
{
wave = 0;
waveTimer = 3000;
- valrothGUID = 0;
+ valrothGUID.Clear();
}
void Reset() override
@@ -357,7 +357,7 @@ public:
private:
uint8 wave;
uint32 waveTimer;
- uint64 valrothGUID;
+ ObjectGuid valrothGUID;
};
@@ -642,12 +642,12 @@ public:
{
ExecuteSpeech_Timer = 0;
ExecuteSpeech_Counter = 0;
- PlayerGUID = 0;
+ PlayerGUID.Clear();
}
uint32 ExecuteSpeech_Timer;
uint32 ExecuteSpeech_Counter;
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
void Reset() override
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index f6757afd5bc..d67c28a3552 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -311,25 +311,6 @@ public:
{
npc_highlord_darion_mograineAI(Creature* creature) : npc_escortAI(creature)
{
- uiTirionGUID = 0;
- uiAlexandrosGUID = 0;
- uiDarionGUID = 0;
- uiKorfaxGUID = 0;
- uiMaxwellGUID = 0;
- uiEligorGUID = 0;
- uiRayneGUID = 0;
- uiKoltiraGUID = 0;
- uiOrbazGUID = 0;
- uiThassarianGUID = 0;
- uiLichKingGUID = 0;
-
- memset(uiDefenderGUID, 0, sizeof(uiDefenderGUID));
- memset(uiEarthshatterGUID, 0, sizeof(uiEarthshatterGUID));
- memset(uiAbominationGUID, 0, sizeof(uiAbominationGUID));
- memset(uiBehemothGUID, 0, sizeof(uiBehemothGUID));
- memset(uiGhoulGUID, 0, sizeof(uiGhoulGUID));
- memset(uiWarriorGUID, 0, sizeof(uiWarriorGUID));
-
Reset();
}
@@ -352,25 +333,25 @@ public:
uint32 uiTargetcheck;
// Dawn
- uint64 uiTirionGUID;
- uint64 uiAlexandrosGUID;
- uint64 uiDarionGUID;
- uint64 uiKorfaxGUID;
- uint64 uiMaxwellGUID;
- uint64 uiEligorGUID;
- uint64 uiRayneGUID;
- uint64 uiDefenderGUID[ENCOUNTER_DEFENDER_NUMBER];
- uint64 uiEarthshatterGUID[ENCOUNTER_EARTHSHATTER_NUMBER];
+ ObjectGuid uiTirionGUID;
+ ObjectGuid uiAlexandrosGUID;
+ ObjectGuid uiDarionGUID;
+ ObjectGuid uiKorfaxGUID;
+ ObjectGuid uiMaxwellGUID;
+ ObjectGuid uiEligorGUID;
+ ObjectGuid uiRayneGUID;
+ ObjectGuid uiDefenderGUID[ENCOUNTER_DEFENDER_NUMBER];
+ ObjectGuid uiEarthshatterGUID[ENCOUNTER_EARTHSHATTER_NUMBER];
// Death
- uint64 uiKoltiraGUID;
- uint64 uiOrbazGUID;
- uint64 uiThassarianGUID;
- uint64 uiLichKingGUID;
- uint64 uiAbominationGUID[ENCOUNTER_ABOMINATION_NUMBER];
- uint64 uiBehemothGUID[ENCOUNTER_BEHEMOTH_NUMBER];
- uint64 uiGhoulGUID[ENCOUNTER_GHOUL_NUMBER];
- uint64 uiWarriorGUID[ENCOUNTER_WARRIOR_NUMBER];
+ ObjectGuid uiKoltiraGUID;
+ ObjectGuid uiOrbazGUID;
+ ObjectGuid uiThassarianGUID;
+ ObjectGuid uiLichKingGUID;
+ ObjectGuid uiAbominationGUID[ENCOUNTER_ABOMINATION_NUMBER];
+ ObjectGuid uiBehemothGUID[ENCOUNTER_BEHEMOTH_NUMBER];
+ ObjectGuid uiGhoulGUID[ENCOUNTER_GHOUL_NUMBER];
+ ObjectGuid uiWarriorGUID[ENCOUNTER_WARRIOR_NUMBER];
void Reset() override
{
@@ -413,23 +394,23 @@ public:
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiRayneGUID))
temp->setDeathState(JUST_DIED);
- uiTirionGUID = 0;
- uiKorfaxGUID = 0;
- uiMaxwellGUID = 0;
- uiEligorGUID = 0;
- uiRayneGUID = 0;
+ uiTirionGUID.Clear();
+ uiKorfaxGUID.Clear();
+ uiMaxwellGUID.Clear();
+ uiEligorGUID.Clear();
+ uiRayneGUID.Clear();
for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i)
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDefenderGUID[i]))
temp->setDeathState(JUST_DIED);
- uiDefenderGUID[i] = 0;
+ uiDefenderGUID[i].Clear();
}
for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i)
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[i]))
temp->setDeathState(JUST_DIED);
- uiEarthshatterGUID[i] = 0;
+ uiEarthshatterGUID[i].Clear();
}
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID))
@@ -441,33 +422,33 @@ public:
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID))
temp->Respawn();
- uiKoltiraGUID = 0;
- uiOrbazGUID = 0;
- uiThassarianGUID = 0;
- uiLichKingGUID = 0;
+ uiKoltiraGUID.Clear();
+ uiOrbazGUID.Clear();
+ uiThassarianGUID.Clear();
+ uiLichKingGUID.Clear();
for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i)
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i]))
temp->setDeathState(JUST_DIED);
- uiAbominationGUID[i] = 0;
+ uiAbominationGUID[i].Clear();
}
for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i)
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i]))
temp->setDeathState(JUST_DIED);
- uiBehemothGUID[i] = 0;
+ uiBehemothGUID[i].Clear();
}
for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i)
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i]))
temp->setDeathState(JUST_DIED);
- uiGhoulGUID[i] = 0;
+ uiGhoulGUID[i].Clear();
}
for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i)
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i]))
temp->setDeathState(JUST_DIED);
- uiWarriorGUID[i] = 0;
+ uiWarriorGUID[i].Clear();
}
}
}
@@ -552,18 +533,18 @@ public:
//Unit* pTirion = ObjectAccessor::GetCreature(*me, uiTirionGUID);
Talk(EMOTE_LIGHT_OF_DAWN05);
- if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0))
+ if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN))
me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN);
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID))
{
- if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0))
+ if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN))
temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN);
temp->SetWalk(true);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[19].x, LightofDawnLoc[19].y, LightofDawnLoc[19].z);
}
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID))
{
- if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0))
+ if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN))
temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN);
temp->SetWalk(true);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[21].x, LightofDawnLoc[21].y, LightofDawnLoc[21].z);
@@ -1143,7 +1124,7 @@ public:
me->SummonGameObject(GO_LIGHT_OF_DAWN, 2283.896f, -5287.914f, 83.066f, 0, 0, 0, 0, 0, 30);
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
{
- if (temp->HasAura(SPELL_REBIRTH_OF_THE_ASHBRINGER, 0))
+ if (temp->HasAura(SPELL_REBIRTH_OF_THE_ASHBRINGER))
temp->RemoveAurasDueToSpell(SPELL_REBIRTH_OF_THE_ASHBRINGER);
temp->CastSpell(temp, 41542, false); // workarounds, light expoded, makes it cool
temp->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
@@ -1433,7 +1414,7 @@ public:
bIsBattle = false;
uiFight_duration = 300000;
- if (me->HasAura(SPELL_THE_MIGHT_OF_MOGRAINE, 0))
+ if (me->HasAura(SPELL_THE_MIGHT_OF_MOGRAINE))
me->RemoveAurasDueToSpell(SPELL_THE_MIGHT_OF_MOGRAINE);
me->RemoveAllAuras();
me->DeleteThreatList();
@@ -1532,7 +1513,7 @@ public:
++uiStep;
}
- void NPCChangeTarget(uint64 ui_GUID)
+ void NPCChangeTarget(ObjectGuid ui_GUID)
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, ui_GUID))
if (temp->IsAlive())
@@ -1651,7 +1632,7 @@ public:
}
}
- void DespawnNPC(uint64 pGUID)
+ void DespawnNPC(ObjectGuid pGUID)
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, pGUID))
if (temp->IsAlive())
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index b9429954dea..58165df48ef 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -240,14 +240,14 @@ public:
void Initialize()
{
Phase = 0;
- bodyGUID = 0;
+ bodyGUID.Clear();
die = false;
withbody = true;
wait = 1000;
laugh = urand(15000, 30000);
}
- uint64 bodyGUID;
+ ObjectGuid bodyGUID;
uint32 Phase;
uint32 laugh;
@@ -390,8 +390,6 @@ public:
{
Initialize();
instance = creature->GetInstanceScript();
- headGUID = 0;
- PlayerGUID = 0;
id = 0;
whirlwind = 0;
wp_reached = false;
@@ -417,8 +415,8 @@ public:
InstanceScript* instance;
- uint64 headGUID;
- uint64 PlayerGUID;
+ ObjectGuid headGUID;
+ ObjectGuid PlayerGUID;
uint32 Phase;
uint32 id;
@@ -446,9 +444,9 @@ public:
if (headGUID)
{
if (Creature* Head = ObjectAccessor::GetCreature((*me), headGUID))
- Head->DisappearAndDie();
+ Head->DespawnOrUnsummon();
- headGUID = 0;
+ headGUID.Clear();
}
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
@@ -806,18 +804,17 @@ public:
npc_pulsing_pumpkinAI(Creature* creature) : ScriptedAI(creature)
{
sprouted = false;
- debuffGUID = 0;
}
bool sprouted;
- uint64 debuffGUID;
+ ObjectGuid debuffGUID;
void Reset() override
{
float x, y, z;
me->GetPosition(x, y, z); //this visual aura some under ground
me->SetPosition(x, y, z + 0.35f, 0.0f);
- debuffGUID = 0;
+ debuffGUID.Clear();
Despawn();
Creature* debuff = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 14500);
if (debuff)
@@ -857,7 +854,7 @@ public:
if (debuff)
{
debuff->SetVisible(false);
- debuffGUID = 0;
+ debuffGUID.Clear();
}
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
index 3e752858e63..4f0cdc2ec16 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
@@ -77,7 +77,7 @@ class boss_interrogator_vishas : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
_JustDied();
- if (Creature* vorrel = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VORREL)))
+ if (Creature* vorrel = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VORREL)))
vorrel->AI()->Talk(SAY_TRIGGER_VORREL);
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
index 02f7c815414..da32e535ab2 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
@@ -132,7 +132,7 @@ public:
return;
//On first death, fake death and open door, as well as initiate whitemane if exist
- if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_WHITEMANE)))
+ if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_WHITEMANE)))
{
instance->SetBossState(DATA_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS);
@@ -180,7 +180,7 @@ public:
if (_bHasDied && !_bHeal && instance->GetBossState(DATA_MOGRAINE_AND_WHITE_EVENT) == SPECIAL)
{
//On resurrection, stop fake death and heal whitemane and resume fight
- if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_WHITEMANE)))
+ if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_WHITEMANE)))
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_STAND);
@@ -302,7 +302,7 @@ public:
//When casting resuruction make sure to delay so on rez when reinstate battle deepsleep runs out
if (Wait_Timer <= diff)
{
- if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOGRAINE)))
+ if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MOGRAINE)))
{
DoCast(mograine, SPELL_SCARLETRESURRECTION);
Talk(SAY_WH_RESURRECT);
@@ -336,7 +336,7 @@ public:
if (!HealthAbovePct(75))
target = me;
- if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOGRAINE)))
+ if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MOGRAINE)))
{
// checking _bCanResurrectCheck prevents her healing Mograine while he is "faking death"
if (_bCanResurrectCheck && mograine->IsAlive() && !mograine->HealthAbovePct(75))
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
index 3a79dac3a90..ab0a44b013d 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
@@ -38,13 +38,6 @@ class instance_scarlet_monastery : public InstanceMapScript
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- PumpkinShrineGUID = 0;
- HorsemanGUID = 0;
- HeadGUID = 0;
- MograineGUID = 0;
- WhitemaneGUID = 0;
- VorrelGUID = 0;
-
HorsemanAdds.clear();
}
@@ -124,7 +117,7 @@ class instance_scarlet_monastery : public InstanceMapScript
case DATA_HORSEMAN_EVENT:
if (state == DONE)
{
- for (uint64 guid : HorsemanAdds)
+ for (ObjectGuid guid : HorsemanAdds)
{
Creature* add = instance->GetCreature(guid);
if (add && add->IsAlive())
@@ -140,7 +133,7 @@ class instance_scarlet_monastery : public InstanceMapScript
return true;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -153,18 +146,18 @@ class instance_scarlet_monastery : public InstanceMapScript
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
protected:
- uint64 PumpkinShrineGUID;
- uint64 HorsemanGUID;
- uint64 HeadGUID;
- uint64 MograineGUID;
- uint64 WhitemaneGUID;
- uint64 VorrelGUID;
-
- std::set<uint64> HorsemanAdds;
+ ObjectGuid PumpkinShrineGUID;
+ ObjectGuid HorsemanGUID;
+ ObjectGuid HeadGUID;
+ ObjectGuid MograineGUID;
+ ObjectGuid WhitemaneGUID;
+ ObjectGuid VorrelGUID;
+
+ GuidSet HorsemanAdds;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
index 0386341ed0c..24f7d90817d 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
@@ -59,14 +59,14 @@ class boss_darkmaster_gandling : public CreatureScript
void Reset() override
{
_Reset();
- if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_GANDLING)))
+ if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_GANDLING)))
gate->SetGoState(GO_STATE_ACTIVE);
}
void JustDied(Unit* /*killer*/) override
{
_JustDied();
- if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_GANDLING)))
+ if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_GANDLING)))
gate->SetGoState(GO_STATE_ACTIVE);
}
@@ -78,7 +78,7 @@ class boss_darkmaster_gandling : public CreatureScript
events.ScheduleEvent(EVENT_CURSE, 2000);
events.ScheduleEvent(EVENT_SHADOW_PORTAL, 16000);
- if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_GANDLING)))
+ if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_GANDLING)))
gate->SetGoState(GO_STATE_READY);
}
@@ -181,32 +181,32 @@ class spell_shadow_portal : public SpellScriptLoader
switch (urand(0, 5))
{
case ROOM_HALL_OF_SECRETS:
- if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_RAVENIAN)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_RAVENIAN)))
if (go->GetGoState() == GO_STATE_ACTIVE)
spellId = SPELL_SHADOW_PORTAL_HALLOFSECRETS;
break;
case ROOM_HALL_OF_THE_DAMNED:
- if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_THEOLEN)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_THEOLEN)))
if (go->GetGoState() == GO_STATE_ACTIVE)
spellId = SPELL_SHADOW_PORTAL_HALLOFTHEDAMNED;
break;
case ROOM_THE_COVEN:
- if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_MALICIA)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_MALICIA)))
if (go->GetGoState() == GO_STATE_ACTIVE)
spellId = SPELL_SHADOW_PORTAL_THECOVEN;
break;
case ROOM_THE_SHADOW_VAULT:
- if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_ILLUCIA)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_ILLUCIA)))
if (go->GetGoState() == GO_STATE_ACTIVE)
spellId = SPELL_SHADOW_PORTAL_THESHADOWVAULT;
break;
case ROOM_BAROV_FAMILY_VAULT:
- if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_BAROV)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_BAROV)))
if (go->GetGoState() == GO_STATE_ACTIVE)
spellId = SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT;
break;
case ROOM_VAULT_OF_THE_RAVENIAN:
- if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_POLKELT)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(GO_GATE_POLKELT)))
if (go->GetGoState() == GO_STATE_ACTIVE)
spellId = SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN;
break;
@@ -348,7 +348,7 @@ class spell_shadow_portal_rooms : public SpellScriptLoader
}
}
- if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(gate_to_close)))
+ if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(gate_to_close)))
gate->SetGoState(GO_STATE_READY);
}
}
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp
index 3b423134f2a..05f5dcd9952 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp
@@ -98,9 +98,9 @@ class boss_kirtonos_the_herald : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS)))
+ if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_KIRTONOS)))
gate->SetGoState(GO_STATE_ACTIVE);
- if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD)))
+ if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD)))
{
brazier->ResetDoorOrButton();
brazier->SetGoState(GO_STATE_READY);
@@ -110,9 +110,9 @@ class boss_kirtonos_the_herald : public CreatureScript
void EnterEvadeMode() override
{
- if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS)))
+ if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_KIRTONOS)))
gate->SetGoState(GO_STATE_ACTIVE);
- if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD)))
+ if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD)))
{
brazier->ResetDoorOrButton();
brazier->SetGoState(GO_STATE_READY);
@@ -160,13 +160,13 @@ class boss_kirtonos_the_herald : public CreatureScript
events.ScheduleEvent(INTRO_3, 1000);
break;
case INTRO_3:
- if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS)))
+ if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_KIRTONOS)))
gate->SetGoState(GO_STATE_READY);
me->SetFacingTo(0.01745329f);
events.ScheduleEvent(INTRO_4, 3000);
break;
case INTRO_4:
- if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD)))
+ if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD)))
brazier->SetGoState(GO_STATE_READY);
me->SetWalk(true);
me->SetDisableGravity(false);
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
index f1959b6cf56..9565666cee8 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
@@ -38,15 +38,6 @@ class instance_scholomance : public InstanceMapScript
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
- GateKirtonosGUID = 0;
- GateGandlingGUID = 0;
- GateMiliciaGUID = 0;
- GateTheolenGUID = 0;
- GatePolkeltGUID = 0;
- GateRavenianGUID = 0;
- GateBarovGUID = 0;
- GateIlluciaGUID = 0;
- BrazierOfTheHeraldGUID = 0;
}
void OnGameObjectCreate(GameObject* go) override
@@ -107,7 +98,7 @@ class instance_scholomance : public InstanceMapScript
return true;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -133,7 +124,7 @@ class instance_scholomance : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
bool CheckPreBosses(uint32 bossId) const
@@ -175,15 +166,15 @@ class instance_scholomance : public InstanceMapScript
}
protected:
- uint64 GateKirtonosGUID;
- uint64 GateGandlingGUID;
- uint64 GateMiliciaGUID;
- uint64 GateTheolenGUID;
- uint64 GatePolkeltGUID;
- uint64 GateRavenianGUID;
- uint64 GateBarovGUID;
- uint64 GateIlluciaGUID;
- uint64 BrazierOfTheHeraldGUID;
+ ObjectGuid GateKirtonosGUID;
+ ObjectGuid GateGandlingGUID;
+ ObjectGuid GateMiliciaGUID;
+ ObjectGuid GateTheolenGUID;
+ ObjectGuid GatePolkeltGUID;
+ ObjectGuid GateRavenianGUID;
+ ObjectGuid GateBarovGUID;
+ ObjectGuid GateIlluciaGUID;
+ ObjectGuid BrazierOfTheHeraldGUID;
};
};
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
index 10c4aedf103..ae8cb74ea49 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
@@ -83,13 +83,13 @@ public:
uint32 m_auiEncounter[MAX_ENCOUNTER];
std::string str_data;
- uint64 uiAshGUID;
- uint64 uiAdaGUID;
- uint64 uiArchmageArugalGUID;
+ ObjectGuid uiAshGUID;
+ ObjectGuid uiAdaGUID;
+ ObjectGuid uiArchmageArugalGUID;
- uint64 DoorCourtyardGUID;
- uint64 DoorSorcererGUID;
- uint64 DoorArugalGUID;
+ ObjectGuid DoorCourtyardGUID;
+ ObjectGuid DoorSorcererGUID;
+ ObjectGuid DoorArugalGUID;
uint8 uiPhase;
uint16 uiTimer;
@@ -99,14 +99,6 @@ public:
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
- uiAshGUID = 0;
- uiAdaGUID = 0;
- uiArchmageArugalGUID = 0;
-
- DoorCourtyardGUID = 0;
- DoorSorcererGUID = 0;
- DoorArugalGUID = 0;
-
uiPhase = 0;
uiTimer = 0;
}
@@ -128,17 +120,17 @@ public:
case GO_COURTYARD_DOOR:
DoorCourtyardGUID = go->GetGUID();
if (m_auiEncounter[0] == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_SORCERER_DOOR:
DoorSorcererGUID = go->GetGUID();
if (m_auiEncounter[2] == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_ARUGAL_DOOR:
DoorArugalGUID = go->GetGUID();
if (m_auiEncounter[3] == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
}
}
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
index 0a09bc85ea3..e855b7e676f 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
@@ -132,7 +132,7 @@ public:
if (instance->GetData(TYPE_SH_QUEST))
{
if (Player* player = killer->ToPlayer())
- player->KilledMonsterCredit(SH_QUEST_CREDIT, 0);
+ player->KilledMonsterCredit(SH_QUEST_CREDIT);
}
}
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
index 43ce4d05297..927ca0b19ac 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
@@ -56,21 +56,21 @@ class instance_stratholme : public InstanceMapScript
bool IsSilverHandDead[5];
- uint64 serviceEntranceGUID;
- uint64 gauntletGate1GUID;
- uint64 ziggurat1GUID;
- uint64 ziggurat2GUID;
- uint64 ziggurat3GUID;
- uint64 ziggurat4GUID;
- uint64 ziggurat5GUID;
- uint64 portGauntletGUID;
- uint64 portSlaugtherGUID;
- uint64 portElderGUID;
-
- uint64 baronGUID;
- uint64 ysidaTriggerGUID;
- std::set<uint64> crystalsGUID;
- std::set<uint64> abomnationGUID;
+ ObjectGuid serviceEntranceGUID;
+ ObjectGuid gauntletGate1GUID;
+ ObjectGuid ziggurat1GUID;
+ ObjectGuid ziggurat2GUID;
+ ObjectGuid ziggurat3GUID;
+ ObjectGuid ziggurat4GUID;
+ ObjectGuid ziggurat5GUID;
+ ObjectGuid portGauntletGUID;
+ ObjectGuid portSlaugtherGUID;
+ ObjectGuid portElderGUID;
+
+ ObjectGuid baronGUID;
+ ObjectGuid ysidaTriggerGUID;
+ GuidSet crystalsGUID;
+ GuidSet abomnationGUID;
EventMap events;
void Initialize() override
@@ -81,19 +81,6 @@ class instance_stratholme : public InstanceMapScript
for (uint8 i = 0; i < 5; ++i)
IsSilverHandDead[i] = false;
- serviceEntranceGUID = 0;
- gauntletGate1GUID = 0;
- ziggurat1GUID = 0;
- ziggurat2GUID = 0;
- ziggurat3GUID = 0;
- ziggurat4GUID = 0;
- ziggurat5GUID = 0;
- portGauntletGUID = 0;
- portSlaugtherGUID = 0;
- portElderGUID = 0;
-
- baronGUID = 0;
- ysidaTriggerGUID = 0;
crystalsGUID.clear();
abomnationGUID.clear();
}
@@ -113,7 +100,7 @@ class instance_stratholme : public InstanceMapScript
}
//if withRestoreTime true, then newState will be ignored and GO should be restored to original state after 10 seconds
- void UpdateGoState(uint64 goGuid, uint32 newState, bool withRestoreTime)
+ void UpdateGoState(ObjectGuid goGuid, uint32 newState, bool withRestoreTime)
{
if (!goGuid)
return;
@@ -176,37 +163,37 @@ class instance_stratholme : public InstanceMapScript
case GO_ZIGGURAT1:
ziggurat1GUID = go->GetGUID();
if (GetData(TYPE_BARONESS) == IN_PROGRESS)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_ZIGGURAT2:
ziggurat2GUID = go->GetGUID();
if (GetData(TYPE_NERUB) == IN_PROGRESS)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_ZIGGURAT3:
ziggurat3GUID = go->GetGUID();
if (GetData(TYPE_PALLID) == IN_PROGRESS)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_ZIGGURAT4:
ziggurat4GUID = go->GetGUID();
if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_ZIGGURAT5:
ziggurat5GUID = go->GetGUID();
if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_PORT_GAUNTLET:
portGauntletGUID = go->GetGUID();
if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_PORT_SLAUGTHER:
portSlaugtherGUID = go->GetGUID();
if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_PORT_ELDERS:
portElderGUID = go->GetGUID();
@@ -276,7 +263,7 @@ class instance_stratholme : public InstanceMapScript
HandleGameObject(portGauntletGUID, false);
uint32 count = abomnationGUID.size();
- for (std::set<uint64>::const_iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i)
+ for (GuidSet::const_iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i)
{
if (Creature* pAbom = instance->GetCreature(*i))
if (!pAbom->IsAlive())
@@ -418,7 +405,7 @@ class instance_stratholme : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -427,7 +414,7 @@ class instance_stratholme : public InstanceMapScript
case DATA_YSIDA_TRIGGER:
return ysidaTriggerGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
void Update(uint32 diff) override
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
index 9c733677b42..384be9c90a8 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
@@ -117,12 +117,12 @@ public:
void Initialize()
{
- Tagger = 0;
+ Tagger.Clear();
Die_Timer = 5000;
Tagged = false;
}
- uint64 Tagger;
+ ObjectGuid Tagger;
uint32 Die_Timer;
bool Tagged;
diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
index ee16a662711..194f5790f44 100644
--- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
+++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
@@ -63,13 +63,13 @@ public:
SetHeaders(DataHeader);
}
- uint64 GOAtalaiStatue1;
- uint64 GOAtalaiStatue2;
- uint64 GOAtalaiStatue3;
- uint64 GOAtalaiStatue4;
- uint64 GOAtalaiStatue5;
- uint64 GOAtalaiStatue6;
- uint64 GOAtalaiIdol;
+ ObjectGuid GOAtalaiStatue1;
+ ObjectGuid GOAtalaiStatue2;
+ ObjectGuid GOAtalaiStatue3;
+ ObjectGuid GOAtalaiStatue4;
+ ObjectGuid GOAtalaiStatue5;
+ ObjectGuid GOAtalaiStatue6;
+ ObjectGuid GOAtalaiIdol;
uint32 State;
@@ -82,13 +82,6 @@ public:
void Initialize() override
{
- GOAtalaiStatue1 = 0;
- GOAtalaiStatue2 = 0;
- GOAtalaiStatue3 = 0;
- GOAtalaiStatue4 = 0;
- GOAtalaiStatue5 = 0;
- GOAtalaiStatue6 = 0;
- GOAtalaiIdol = 0;
State = 0;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
index 4e401be7df3..1ad113456ac 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
@@ -147,7 +147,7 @@ public:
if (!Intro || IsIntro)
return;
- if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MADRIGOSA)))
+ if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MADRIGOSA)))
{
Madrigosa->Respawn();
Madrigosa->setActive(true);
@@ -182,7 +182,7 @@ public:
void DoIntro()
{
- Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MADRIGOSA));
+ Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MADRIGOSA));
if (!Madrigosa)
return;
@@ -285,7 +285,7 @@ public:
{
if (IntroFrostBoltTimer <= diff)
{
- if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MADRIGOSA)))
+ if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MADRIGOSA)))
{
Madrigosa->CastSpell(me, SPELL_INTRO_FROSTBOLT, true);
IntroFrostBoltTimer = 2000;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
index d2382cda37d..7613811e021 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
@@ -114,7 +114,7 @@ public:
{
Enraged = false;
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALYTHESS)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALYTHESS)))
{
if (temp->isDead())
temp->Respawn();
@@ -134,7 +134,7 @@ public:
{
DoZoneInCombat();
- Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALYTHESS));
+ Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALYTHESS));
if (temp && temp->IsAlive() && !temp->GetVictim())
temp->AI()->AttackStart(who);
@@ -207,7 +207,7 @@ public:
{
if (!SisterDeath)
{
- Unit* Temp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ALYTHESS));
+ Unit* Temp = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ALYTHESS));
if (Temp && Temp->isDead())
{
Talk(YELL_SISTER_ALYTHESS_DEAD);
@@ -366,7 +366,7 @@ public:
{
Enraged = false;
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SACROLASH)))
{
if (temp->isDead())
temp->Respawn();
@@ -386,7 +386,7 @@ public:
{
DoZoneInCombat();
- Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH));
+ Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SACROLASH));
if (temp && temp->IsAlive() && !temp->GetVictim())
temp->AI()->AttackStart(who);
@@ -486,7 +486,7 @@ public:
uint32 IntroStep(uint32 step)
{
- Creature* Sacrolash = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH));
+ Creature* Sacrolash = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SACROLASH));
switch (step)
{
case 0:
@@ -535,7 +535,7 @@ public:
if (!SisterDeath)
{
- Unit* Temp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SACROLASH));
+ Unit* Temp = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_SACROLASH));
if (Temp && Temp->isDead())
{
Talk(YELL_SISTER_SACROLASH_DEAD);
@@ -546,7 +546,7 @@ public:
}
if (!me->GetVictim())
{
- Creature* sisiter = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH));
+ Creature* sisiter = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SACROLASH));
if (sisiter && !sisiter->isDead() && sisiter->GetVictim())
{
me->AddThreat(sisiter->GetVictim(), 0.0f);
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
index 4b17f698553..859a09aff78 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
@@ -288,7 +288,7 @@ public:
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
if (!target)
- target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
+ target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PLAYER_GUID));
if (!target)
{
@@ -314,7 +314,7 @@ public:
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
if (!target)
- target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
+ target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PLAYER_GUID));
if (!target)
{
@@ -343,7 +343,7 @@ public:
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
if (!target)
- target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
+ target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PLAYER_GUID));
if (!target)
{
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index 60bfae36f47..f88c9c6159e 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -115,7 +115,7 @@ public:
void Initialize()
{
- SathGUID = 0;
+ SathGUID.Clear();
ArcaneBuffetTimer = 8000;
FrostBreathTimer = 15000;
WildMagicTimer = 10000;
@@ -148,11 +148,11 @@ public:
bool isBanished;
bool bJustReset;
- uint64 SathGUID;
+ ObjectGuid SathGUID;
void Reset() override
{
- SathGUID = instance->GetData64(DATA_SATHROVARR);
+ SathGUID = instance->GetGuidData(DATA_SATHROVARR);
instance->SetBossState(DATA_KALECGOS, NOT_STARTED);
if (Creature* Sath = ObjectAccessor::GetCreature(*me, SathGUID))
@@ -456,7 +456,7 @@ public:
uint32 YellTimer;
uint32 YellSequence;
- uint64 SathGUID;
+ ObjectGuid SathGUID;
bool isEnraged; // if demon is enraged
@@ -464,7 +464,6 @@ public:
{
Initialize();
instance = creature->GetInstanceScript();
- SathGUID = 0;
}
void Initialize()
@@ -479,7 +478,7 @@ public:
void Reset() override
{
- SathGUID = instance->GetData64(DATA_SATHROVARR);
+ SathGUID = instance->GetGuidData(DATA_SATHROVARR);
Initialize();
}
@@ -593,8 +592,6 @@ public:
{
Initialize();
instance = creature->GetInstanceScript();
- KalecGUID = 0;
- KalecgosGUID = 0;
}
void Initialize()
@@ -616,8 +613,8 @@ public:
uint32 CheckTimer;
uint32 ResetThreat;
- uint64 KalecGUID;
- uint64 KalecgosGUID;
+ ObjectGuid KalecGUID;
+ ObjectGuid KalecgosGUID;
bool isEnraged;
bool isBanished;
@@ -626,13 +623,13 @@ public:
{
me->SetFullHealth();//dunno why it does not resets health at evade..
me->setActive(true);
- KalecgosGUID = instance->GetData64(DATA_KALECGOS_DRAGON);
+ KalecgosGUID = instance->GetGuidData(DATA_KALECGOS_DRAGON);
instance->SetBossState(DATA_KALECGOS, NOT_STARTED);
if (KalecGUID)
{
if (Creature* Kalec = ObjectAccessor::GetCreature(*me, KalecGUID))
Kalec->setDeathState(JUST_DIED);
- KalecGUID = 0;
+ KalecGUID.Clear();
}
Initialize();
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index 79ebfa7b62b..9bddbcccf49 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -274,13 +274,13 @@ public:
switch (index)
{
case 0:
- return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1));
+ return ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1));
case 1:
- return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2));
+ return ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2));
case 2:
- return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3));
+ return ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3));
case 3:
- return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4));
+ return ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4));
}
return NULL;
@@ -375,7 +375,7 @@ public:
player->CastSpell(player, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, false);
go->SetUInt32Value(GAMEOBJECT_FACTION, 0);
- if (Creature* pKalec = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_KALECGOS_KJ)))
+ if (Creature* pKalec = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_KALECGOS_KJ)))
ENSURE_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->SetRingOfBlueFlames();
go->Refresh();
@@ -437,7 +437,7 @@ public:
{
Initialize();
- if (Creature* pKalecKJ = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_KALECGOS_KJ)))
+ if (Creature* pKalecKJ = ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_KALECGOS_KJ)))
ENSURE_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs();
summons.DespawnAll();
}
@@ -571,7 +571,7 @@ public:
{
Initialize();
- if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ)))
+ if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KALECGOS_KJ)))
pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES);
me->SetFloatValue(UNIT_FIELD_COMBATREACH, 12);
@@ -631,7 +631,7 @@ public:
summons.DespawnAll();
// Reset the controller
- if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER)))
+ if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KILJAEDEN_CONTROLLER)))
ENSURE_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->Reset();
}
@@ -713,10 +713,10 @@ public:
if (Speeches[speechCount].timer < SpeechTimer)
{
SpeechTimer = 0;
- if (Creature* speechCreature = ObjectAccessor::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature)))
+ if (Creature* speechCreature = ObjectAccessor::GetCreature(*me, instance->GetGuidData(Speeches[speechCount].creature)))
speechCreature->AI()->Talk(Speeches[speechCount].textid);
if (speechCount == 12)
- if (Creature* pAnveena = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANVEENA)))
+ if (Creature* pAnveena = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ANVEENA)))
pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false);
// ChangeTimers(true, 10000); // Kil should do an emote while screaming without attacking for 10 seconds
if (speechCount == speechPhaseEnd)
@@ -742,7 +742,7 @@ public:
for (uint8 z = 0; z < 6; ++z)
{
pRandomPlayer = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
- if (!pRandomPlayer || !pRandomPlayer->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0))
+ if (!pRandomPlayer || !pRandomPlayer->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT))
break;
}
@@ -815,7 +815,7 @@ public:
}
break;
case TIMER_ORBS_EMPOWER: //Phase 3
- if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ)))
+ if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KALECGOS_KJ)))
{
switch (Phase)
{
@@ -835,7 +835,7 @@ public:
for (uint8 z = 0; z < 6; ++z)
{
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
- if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0)) break;
+ if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT)) break;
}
if (target)
{
@@ -941,7 +941,7 @@ public:
void EnterCombat(Unit* who) override
{
instance->SetBossState(DATA_KILJAEDEN, IN_PROGRESS);
- if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER)))
+ if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KILJAEDEN_CONTROLLER)))
pControl->AddThreat(who, 1.0f);
me->InterruptNonMeleeSpells(true);
@@ -949,7 +949,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER)))
+ if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KILJAEDEN_CONTROLLER)))
++(ENSURE_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->deceiverDeathCount);
}
@@ -962,7 +962,7 @@ public:
return;
// Gain Shadow Infusion at 20% health
- if (HealthBelowPct(20) && !me->HasAura(SPELL_SHADOW_INFUSION, 0))
+ if (HealthBelowPct(20) && !me->HasAura(SPELL_SHADOW_INFUSION))
DoCast(me, SPELL_SHADOW_INFUSION, true);
// Shadow Bolt Volley - Shoots Shadow Bolts at all enemies within 30 yards, for ~2k Shadow damage.
@@ -1260,7 +1260,7 @@ public:
if (uiTimer <= diff)
{
- if (Unit* random = ObjectAccessor::GetPlayer(*me, instance->GetData64(DATA_PLAYER_GUID)))
+ if (Unit* random = ObjectAccessor::GetPlayer(*me, instance->GetGuidData(DATA_PLAYER_GUID)))
DoCast(random, SPELL_SHADOW_BOLT, false);
uiTimer = urand(500, 1000);
} else uiTimer -= diff;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
index 823423fc3a8..99b710afb1e 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
@@ -153,7 +153,7 @@ public:
void EnterEvadeMode() override
{
- if (Creature* muru = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MURU)))
+ if (Creature* muru = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MURU)))
muru->AI()->Reset(); // Reset encounter.
me->DisappearAndDie();
summons.DespawnAll();
@@ -183,7 +183,7 @@ public:
{
DarkFiend = false;
HasEnraged = false;
- EntropiusGUID = 0;
+ EntropiusGUID.Clear();
}
void Reset() override
@@ -278,7 +278,7 @@ public:
private:
bool DarkFiend;
bool HasEnraged;
- uint64 EntropiusGUID;
+ ObjectGuid EntropiusGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -334,7 +334,7 @@ public:
void JustSummoned(Creature* summoned) override
{
- if (Player* target = ObjectAccessor::GetPlayer(*me, instance->GetData64(DATA_PLAYER_GUID)))
+ if (Player* target = ObjectAccessor::GetPlayer(*me, instance->GetGuidData(DATA_PLAYER_GUID)))
summoned->AI()->AttackStart(target);
Summons.Summon(summoned);
@@ -555,7 +555,7 @@ public:
{
if (SpellTimer <= diff)
{
- Unit* Victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID));
+ Unit* Victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PLAYER_GUID));
switch (NeedForAHack)
{
case 0:
@@ -574,7 +574,7 @@ public:
case 2:
SpellTimer = 400;
NeedForAHack = 3;
- me->RemoveAura(SPELL_BLACKHOLE_GROW, 1);
+ me->RemoveAura(SPELL_BLACKHOLE_GROW);
break;
case 3:
SpellTimer = urand(400, 900);
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
index 2066c4309b2..f0e785bad16 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
@@ -53,21 +53,7 @@ class instance_sunwell_plateau : public InstanceMapScript
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- KalecgosDragonGUID = 0;
- KalecgosHumanGUID = 0;
- SathrovarrGUID = 0;
- BrutallusGUID = 0;
- MadrigosaGUID = 0;
- FelmystGUID = 0;
- AlythessGUID = 0;
- SacrolashGUID = 0;
- MuruGUID = 0;
- KilJaedenGUID = 0;
- KilJaedenControllerGUID = 0;
- AnveenaGUID = 0;
- KalecgosKjGUID = 0;
SpectralPlayers = 0;
-
SpectralRealmTimer = 5000;
}
@@ -80,7 +66,7 @@ class instance_sunwell_plateau : public InstanceMapScript
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
Player* player = itr->GetSource();
- if (player && !player->HasAura(45839, 0))
+ if (player && !player->HasAura(45839))
return player;
}
}
@@ -172,7 +158,7 @@ class instance_sunwell_plateau : public InstanceMapScript
}
}
- uint64 GetData64(uint32 id) const override
+ ObjectGuid GetGuidData(uint32 id) const override
{
switch (id)
{
@@ -205,32 +191,32 @@ class instance_sunwell_plateau : public InstanceMapScript
case DATA_PLAYER_GUID:
{
Player const* target = GetPlayerInMap();
- return target ? target->GetGUID() : 0;
+ return target ? target->GetGUID() : ObjectGuid::Empty;
}
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
protected:
- uint64 KalecgosDragonGUID;
- uint64 KalecgosHumanGUID;
- uint64 SathrovarrGUID;
- uint64 BrutallusGUID;
- uint64 MadrigosaGUID;
- uint64 FelmystGUID;
- uint64 AlythessGUID;
- uint64 SacrolashGUID;
- uint64 MuruGUID;
- uint64 KilJaedenGUID;
- uint64 KilJaedenControllerGUID;
- uint64 AnveenaGUID;
- uint64 KalecgosKjGUID;
+ ObjectGuid KalecgosDragonGUID;
+ ObjectGuid KalecgosHumanGUID;
+ ObjectGuid SathrovarrGUID;
+ ObjectGuid BrutallusGUID;
+ ObjectGuid MadrigosaGUID;
+ ObjectGuid FelmystGUID;
+ ObjectGuid AlythessGUID;
+ ObjectGuid SacrolashGUID;
+ ObjectGuid MuruGUID;
+ ObjectGuid KilJaedenGUID;
+ ObjectGuid KilJaedenControllerGUID;
+ ObjectGuid AnveenaGUID;
+ ObjectGuid KalecgosKjGUID;
uint32 SpectralPlayers;
uint32 SpectralRealmTimer;
- std::vector<uint64> SpectralRealmList;
+ GuidVector SpectralRealmList;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
index f82d71901ac..6986cb8d6e9 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
@@ -98,7 +98,7 @@ class boss_archaedas : public CreatureScript
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
}
- void ActivateMinion(uint64 uiGuid, bool flag)
+ void ActivateMinion(ObjectGuid uiGuid, bool flag)
{
Unit* minion = ObjectAccessor::GetUnit(*me, uiGuid);
@@ -145,7 +145,7 @@ class boss_archaedas : public CreatureScript
} else if (bWakingUp && iAwakenTimer <= 0)
{
bWakingUp = false;
- AttackStart(ObjectAccessor::GetUnit(*me, instance->GetData64(0)));
+ AttackStart(ObjectAccessor::GetUnit(*me, instance->GetGuidData(0)));
return; // dont want to continue until we finish the AttackStart method
}
@@ -164,12 +164,12 @@ class boss_archaedas : public CreatureScript
//If we are <66 summon the guardians
if (!bGuardiansAwake && !HealthAbovePct(66))
{
- ActivateMinion(instance->GetData64(5), true); // EarthenGuardian1
- ActivateMinion(instance->GetData64(6), true); // EarthenGuardian2
- ActivateMinion(instance->GetData64(7), true); // EarthenGuardian3
- ActivateMinion(instance->GetData64(8), true); // EarthenGuardian4
- ActivateMinion(instance->GetData64(9), true); // EarthenGuardian5
- ActivateMinion(instance->GetData64(10), false); // EarthenGuardian6
+ ActivateMinion(instance->GetGuidData(5), true); // EarthenGuardian1
+ ActivateMinion(instance->GetGuidData(6), true); // EarthenGuardian2
+ ActivateMinion(instance->GetGuidData(7), true); // EarthenGuardian3
+ ActivateMinion(instance->GetGuidData(8), true); // EarthenGuardian4
+ ActivateMinion(instance->GetGuidData(9), true); // EarthenGuardian5
+ ActivateMinion(instance->GetGuidData(10), false); // EarthenGuardian6
Talk(SAY_SUMMON_GUARDIANS);
bGuardiansAwake = true;
}
@@ -177,10 +177,10 @@ class boss_archaedas : public CreatureScript
//If we are <33 summon the vault walkers
if (!bVaultWalkersAwake && !HealthAbovePct(33))
{
- ActivateMinion(instance->GetData64(1), true); // VaultWalker1
- ActivateMinion(instance->GetData64(2), true); // VaultWalker2
- ActivateMinion(instance->GetData64(3), true); // VaultWalker3
- ActivateMinion(instance->GetData64(4), false); // VaultWalker4
+ ActivateMinion(instance->GetGuidData(1), true); // VaultWalker1
+ ActivateMinion(instance->GetGuidData(2), true); // VaultWalker2
+ ActivateMinion(instance->GetGuidData(3), true); // VaultWalker3
+ ActivateMinion(instance->GetGuidData(4), false); // VaultWalker4
Talk(SAY_SUMMON_VAULT_WALKERS);
bVaultWalkersAwake = true;
}
@@ -297,7 +297,7 @@ class npc_archaedas_minions : public CreatureScript
{
bWakingUp = false;
bAmIAwake = true;
- // AttackStart(ObjectAccessor::GetUnit(*me, instance->GetData64(0))); // whoWokeArchaedasGUID
+ // AttackStart(ObjectAccessor::GetUnit(*me, instance->GetGuidData(0))); // whoWokeArchaedasGUID
return; // dont want to continue until we finish the AttackStart method
}
@@ -401,7 +401,7 @@ class go_altar_of_archaedas : public GameObjectScript
player->CastSpell (player, SPELL_BOSS_OBJECT_VISUAL, false);
- instance->SetData64(0, player->GetGUID()); // activate archaedas
+ instance->SetGuidData(0, player->GetGUID()); // activate archaedas
return false;
}
};
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
index 17a6440702e..956f7099596 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
@@ -52,18 +52,6 @@ class instance_uldaman : public InstanceMapScript
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
- archaedasGUID = 0;
- ironayaGUID = 0;
- whoWokeuiArchaedasGUID = 0;
-
- altarOfTheKeeperTempleDoor = 0;
- archaedasTempleDoor = 0;
- ancientVaultDoor = 0;
-
- ironayaSealDoor = 0;
-
- keystoneGUID = 0;
-
ironayaSealDoorTimer = 27000; //animation time
keystoneCheck = false;
}
@@ -77,25 +65,25 @@ class instance_uldaman : public InstanceMapScript
return false;
}
- uint64 archaedasGUID;
- uint64 ironayaGUID;
- uint64 whoWokeuiArchaedasGUID;
+ ObjectGuid archaedasGUID;
+ ObjectGuid ironayaGUID;
+ ObjectGuid whoWokeuiArchaedasGUID;
- uint64 altarOfTheKeeperTempleDoor;
- uint64 archaedasTempleDoor;
- uint64 ancientVaultDoor;
- uint64 ironayaSealDoor;
+ ObjectGuid altarOfTheKeeperTempleDoor;
+ ObjectGuid archaedasTempleDoor;
+ ObjectGuid ancientVaultDoor;
+ ObjectGuid ironayaSealDoor;
- uint64 keystoneGUID;
+ ObjectGuid keystoneGUID;
uint32 ironayaSealDoorTimer;
bool keystoneCheck;
- std::vector<uint64> stoneKeepers;
- std::vector<uint64> altarOfTheKeeperCounts;
- std::vector<uint64> vaultWalkers;
- std::vector<uint64> earthenGuardians;
- std::vector<uint64> archaedasWallMinions; // minions lined up around the wall
+ GuidVector stoneKeepers;
+ GuidVector altarOfTheKeeperCounts;
+ GuidVector vaultWalkers;
+ GuidVector earthenGuardians;
+ GuidVector archaedasWallMinions; // minions lined up around the wall
uint32 m_auiEncounter[MAX_ENCOUNTER];
std::string str_data;
@@ -108,14 +96,14 @@ class instance_uldaman : public InstanceMapScript
altarOfTheKeeperTempleDoor = go->GetGUID();
if (m_auiEncounter[0] == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_ARCHAEDAS_TEMPLE_DOOR:
archaedasTempleDoor = go->GetGUID();
if (m_auiEncounter[0] == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_ANCIENT_VAULT_DOOR:
@@ -124,14 +112,14 @@ class instance_uldaman : public InstanceMapScript
ancientVaultDoor = go->GetGUID();
if (m_auiEncounter[1] == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_IRONAYA_SEAL_DOOR:
ironayaSealDoor = go->GetGUID();
if (m_auiEncounter[2] == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_KEYSTONE:
@@ -139,7 +127,7 @@ class instance_uldaman : public InstanceMapScript
if (m_auiEncounter[2] == DONE)
{
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
go->SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
}
break;
@@ -155,7 +143,7 @@ class instance_uldaman : public InstanceMapScript
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
}
- void SetDoor(uint64 guid, bool open)
+ void SetDoor(ObjectGuid guid, bool open)
{
GameObject* go = instance->GetGameObject(guid);
if (!go)
@@ -164,7 +152,7 @@ class instance_uldaman : public InstanceMapScript
HandleGameObject(guid, open);
}
- void BlockGO(uint64 guid)
+ void BlockGO(ObjectGuid guid)
{
GameObject* go = instance->GetGameObject(guid);
if (!go)
@@ -177,7 +165,7 @@ class instance_uldaman : public InstanceMapScript
{
if (GetData(DATA_ALTAR_DOORS) != DONE)
{
- for (std::vector<uint64>::const_iterator i = stoneKeepers.begin(); i != stoneKeepers.end(); ++i)
+ for (GuidVector::const_iterator i = stoneKeepers.begin(); i != stoneKeepers.end(); ++i)
{
Creature* target = instance->GetCreature(*i);
if (!target || !target->IsAlive())
@@ -199,7 +187,7 @@ class instance_uldaman : public InstanceMapScript
if (!archaedas)
return;
- for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
+ for (GuidVector::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
{
Creature* target = instance->GetCreature(*i);
if (!target || !target->IsAlive() || target->getFaction() == 14)
@@ -217,7 +205,7 @@ class instance_uldaman : public InstanceMapScript
void DeActivateMinions()
{
// first despawn any aggroed wall minions
- for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
+ for (GuidVector::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
{
Creature* target = instance->GetCreature(*i);
if (!target || target->isDead() || target->getFaction() != 14)
@@ -227,7 +215,7 @@ class instance_uldaman : public InstanceMapScript
}
// Vault Walkers
- for (std::vector<uint64>::const_iterator i = vaultWalkers.begin(); i != vaultWalkers.end(); ++i)
+ for (GuidVector::const_iterator i = vaultWalkers.begin(); i != vaultWalkers.end(); ++i)
{
Creature* target = instance->GetCreature(*i);
if (!target || target->isDead() || target->getFaction() != 14)
@@ -237,7 +225,7 @@ class instance_uldaman : public InstanceMapScript
}
// Earthen Guardians
- for (std::vector<uint64>::const_iterator i = earthenGuardians.begin(); i != earthenGuardians.end(); ++i)
+ for (GuidVector::const_iterator i = earthenGuardians.begin(); i != earthenGuardians.end(); ++i)
{
Creature* target = instance->GetCreature(*i);
if (!target || target->isDead() || target->getFaction() != 14)
@@ -247,7 +235,7 @@ class instance_uldaman : public InstanceMapScript
}
}
- void ActivateArchaedas(uint64 target)
+ void ActivateArchaedas(ObjectGuid target)
{
Creature* archaedas = instance->GetCreature(archaedasGUID);
if (!archaedas)
@@ -274,7 +262,7 @@ class instance_uldaman : public InstanceMapScript
void RespawnMinions()
{
// first respawn any aggroed wall minions
- for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
+ for (GuidVector::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
{
Creature* target = instance->GetCreature(*i);
if (target && target->isDead())
@@ -286,7 +274,7 @@ class instance_uldaman : public InstanceMapScript
}
// Vault Walkers
- for (std::vector<uint64>::const_iterator i = vaultWalkers.begin(); i != vaultWalkers.end(); ++i)
+ for (GuidVector::const_iterator i = vaultWalkers.begin(); i != vaultWalkers.end(); ++i)
{
Creature* target = instance->GetCreature(*i);
if (target && target->isDead())
@@ -298,7 +286,7 @@ class instance_uldaman : public InstanceMapScript
}
// Earthen Guardians
- for (std::vector<uint64>::const_iterator i = earthenGuardians.begin(); i != earthenGuardians.end(); ++i)
+ for (GuidVector::const_iterator i = earthenGuardians.begin(); i != earthenGuardians.end(); ++i)
{
Creature* target = instance->GetCreature(*i);
if (target && target->isDead())
@@ -394,7 +382,7 @@ class instance_uldaman : public InstanceMapScript
}
}
- void SetData64(uint32 type, uint64 data) override
+ void SetGuidData(uint32 type, ObjectGuid data) override
{
// Archaedas
if (type == 0)
@@ -470,7 +458,7 @@ class instance_uldaman : public InstanceMapScript
}
}
- uint64 GetData64(uint32 identifier) const override
+ ObjectGuid GetGuidData(uint32 identifier) const override
{
switch (identifier)
{
@@ -492,8 +480,8 @@ class instance_uldaman : public InstanceMapScript
break;
}
- return 0;
- } // end GetData64
+ return ObjectGuid::Empty;
+ } // end GetGuidData
void ProcessEvent(WorldObject* /*gameObject*/, uint32 eventId) override
{
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
index 11bf47c4cd1..7d5ff280533 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
@@ -32,14 +32,6 @@ class instance_zulaman : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
- AkilzonGUID = 0;
- NalorakkGUID = 0;
- JanalaiGUID = 0;
- HalazziGUID = 0;
- HexLordMalacrassGUID = 0;
- DaakaraGUID = 0;
- VoljinGUID = 0;
- HexLordTriggerGUID = 0;
SpeedRunTimer = 16;
ZulAmanState = NOT_STARTED;
ZulAmanBossCount = 0;
@@ -114,7 +106,7 @@ class instance_zulaman : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -140,7 +132,7 @@ class instance_zulaman : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
void SetData(uint32 type, uint32 data) override
@@ -290,16 +282,16 @@ class instance_zulaman : public InstanceMapScript
protected:
EventMap events;
- uint64 AkilzonGUID;
- uint64 NalorakkGUID;
- uint64 JanalaiGUID;
- uint64 HalazziGUID;
- uint64 HexLordMalacrassGUID;
- uint64 DaakaraGUID;
- uint64 VoljinGUID;
- uint64 HexLordTriggerGUID;
- uint64 StrangeGongGUID;
- uint64 MasiveGateGUID;
+ ObjectGuid AkilzonGUID;
+ ObjectGuid NalorakkGUID;
+ ObjectGuid JanalaiGUID;
+ ObjectGuid HalazziGUID;
+ ObjectGuid HexLordMalacrassGUID;
+ ObjectGuid DaakaraGUID;
+ ObjectGuid VoljinGUID;
+ ObjectGuid HexLordTriggerGUID;
+ ObjectGuid StrangeGongGUID;
+ ObjectGuid MasiveGateGUID;
uint32 SpeedRunTimer;
uint32 ZulAmanState;
uint32 ZulAmanBossCount;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
index d4b4cb3ea6b..900b7b52bd7 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
@@ -143,7 +143,7 @@ class npc_voljin_zulaman : public CreatureScript
_events.ScheduleEvent(EVENT_BANGING_THE_GONG, 3000);
case EVENT_BANGING_THE_GONG:
DoCast(me, SPELL_BANGING_THE_GONG);
- if (GameObject* strangeGong = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_STRANGE_GONG)))
+ if (GameObject* strangeGong = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_STRANGE_GONG)))
strangeGong->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, uint32(ITEM_VIRTUAL_ITEM));
break;
@@ -153,7 +153,7 @@ class npc_voljin_zulaman : public CreatureScript
break;
case EVENT_START_DOOR_OPENING_2:
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, uint32(0));
- if (GameObject* strangeGong = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_STRANGE_GONG)))
+ if (GameObject* strangeGong = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_STRANGE_GONG)))
strangeGong->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
_events.ScheduleEvent(EVENT_START_DOOR_OPENING_3, 500);
break;
@@ -162,7 +162,7 @@ class npc_voljin_zulaman : public CreatureScript
break;
case EVENT_START_DOOR_OPENING_4:
_instance->SetData(DATA_ZULAMAN_STATE, IN_PROGRESS);
- if (GameObject* masiveGate = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_MASSIVE_GATE)))
+ if (GameObject* masiveGate = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_MASSIVE_GATE)))
masiveGate->SetGoState(GO_STATE_ACTIVE);
_events.ScheduleEvent(EVENT_START_DOOR_OPENING_5, 3000);
break;
@@ -174,7 +174,7 @@ class npc_voljin_zulaman : public CreatureScript
_events.ScheduleEvent(EVENT_START_DOOR_OPENING_7, 6000);
break;
case EVENT_START_DOOR_OPENING_7:
- if (Creature* hexLordTrigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HEXLORD_TRIGGER)))
+ if (Creature* hexLordTrigger = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HEXLORD_TRIGGER)))
sCreatureTextMgr->SendChat(hexLordTrigger, SAY_HEXLOR_INTRO, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
break;
default:
@@ -191,7 +191,7 @@ class npc_voljin_zulaman : public CreatureScript
switch (pointId)
{
case POINT_STRANGE_GONG:
- if (GameObject* strangeGong = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_STRANGE_GONG)))
+ if (GameObject* strangeGong = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_STRANGE_GONG)))
me->SetFacingToObject(strangeGong); // setInFront
break;
case POINT_START_DOOR_OPENING_1:
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
index bb355be52a9..b278916c8a3 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
@@ -118,7 +118,7 @@ class boss_mandokir : public CreatureScript
me->SummonCreatureGroup(SUMMON_GROUP_CHAINED_SPIRIT);
_ohganotSoFast = true;
_reanimateOhganCooldown = false;
- _reviveGUID = 0;
+ _reviveGUID.Clear();
}
void EnterCombat(Unit* /*who*/) override
@@ -130,7 +130,7 @@ class boss_mandokir : public CreatureScript
if (!summons.empty())
{
- for (std::list<uint64>::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
+ for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
{
if (Creature* chainedSpirit = ObjectAccessor::GetCreature(*me, *itr))
if (chainedSpirit->GetEntry() == NPC_CHAINED_SPIRIT && chainedSpirit->AI())
@@ -196,7 +196,7 @@ class boss_mandokir : public CreatureScript
{
chainedSpirit->AI()->SetGUID(_reviveGUID);
chainedSpirit->AI()->DoAction(ACTION_REVIVE);
- _reviveGUID = 0;
+ _reviveGUID.Clear();
}
}
break;
@@ -215,7 +215,7 @@ class boss_mandokir : public CreatureScript
return 0;
}
- void SetGUID(uint64 guid, int32 /*type = 0 */) override
+ void SetGUID(ObjectGuid guid, int32 /*type = 0 */) override
{
_reviveGUID = guid;
}
@@ -280,7 +280,7 @@ class boss_mandokir : public CreatureScript
private:
bool _ohganotSoFast;
bool _reanimateOhganCooldown;
- uint64 _reviveGUID;
+ ObjectGuid _reviveGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -309,15 +309,15 @@ class npc_ohgan : public CreatureScript
void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
if (damage >= me->GetHealth())
- {
+ {
damage = 0;
me->AttackStop();
me->SetHealth(0);
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
DoCast(me, SPELL_CLEAR_ALL, true);
DoCast(me, SPELL_PERMANENT_FEIGN_DEATH);
- if (Creature* mandokir = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MANDOKIR)))
+ if (Creature* mandokir = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MANDOKIR)))
mandokir->AI()->DoAction(ACTION_OHGAN_IS_DEATH);
}
}
@@ -365,10 +365,10 @@ class npc_chained_spirit : public CreatureScript
void Reset() override
{
- _revivePlayerGUID = 0;
+ _revivePlayerGUID.Clear();
}
- void SetGUID(uint64 guid, int32 /*type = 0 */) override
+ void SetGUID(ObjectGuid guid, int32 /*type = 0 */) override
{
_revivePlayerGUID = guid;
}
@@ -406,7 +406,7 @@ class npc_chained_spirit : public CreatureScript
if (!target || target->IsAlive())
return;
- if (Creature* mandokir = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MANDOKIR)))
+ if (Creature* mandokir = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MANDOKIR)))
{
mandokir->GetAI()->SetGUID(target->GetGUID());
mandokir->GetAI()->DoAction(ACTION_START_REVIVE);
@@ -419,7 +419,7 @@ class npc_chained_spirit : public CreatureScript
private:
InstanceScript* _instance;
- uint64 _revivePlayerGUID;
+ ObjectGuid _revivePlayerGUID;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
index 581839315da..914f06ee033 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
@@ -42,16 +42,6 @@ class instance_zulgurub : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- venoxisGUID = 0;
- mandokirGUID = 0;
- kilnaraGUID = 0;
- zanzilGUID = 0;
- jindoGUID = 0;
- hazzarahGUID = 0;
- renatakiGUID = 0;
- wushoolayGUID = 0;
- grilekGUID = 0;
- jindoTiggerGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -167,7 +157,7 @@ class instance_zulgurub : public InstanceMapScript
}
*/
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -195,20 +185,20 @@ class instance_zulgurub : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
protected:
- uint64 venoxisGUID;
- uint64 mandokirGUID;
- uint64 kilnaraGUID;
- uint64 zanzilGUID;
- uint64 jindoGUID;
- uint64 hazzarahGUID;
- uint64 renatakiGUID;
- uint64 wushoolayGUID;
- uint64 grilekGUID;
- uint64 jindoTiggerGUID;
+ ObjectGuid venoxisGUID;
+ ObjectGuid mandokirGUID;
+ ObjectGuid kilnaraGUID;
+ ObjectGuid zanzilGUID;
+ ObjectGuid jindoGUID;
+ ObjectGuid hazzarahGUID;
+ ObjectGuid renatakiGUID;
+ ObjectGuid wushoolayGUID;
+ ObjectGuid grilekGUID;
+ ObjectGuid jindoTiggerGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
index ea997c5563f..48f614a73c0 100644
--- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
@@ -108,7 +108,7 @@ public:
{
LamentEventTimer = 5000;
LamentEvent = false;
- targetGUID = 0;
+ targetGUID.Clear();
FadeTimer = 30000;
SummonSkeletonTimer = 20000;
@@ -119,7 +119,7 @@ public:
uint32 LamentEventTimer;
bool LamentEvent;
- uint64 targetGUID;
+ ObjectGuid targetGUID;
uint32 FadeTimer;
uint32 SummonSkeletonTimer;
diff --git a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
index d242d17806c..952d191bd1a 100644
--- a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
@@ -322,7 +322,6 @@ public:
npc_anchorite_truuenAI(Creature* creature) : npc_escortAI(creature)
{
Initialize();
- UghostGUID = 0;
}
void Initialize()
@@ -332,7 +331,7 @@ public:
uint32 m_uiChatTimer;
- uint64 UghostGUID;
+ ObjectGuid UghostGUID;
void Reset() override
{
diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp
index 4bc0642e348..6e95b9351fd 100644
--- a/src/server/scripts/Events/childrens_week.cpp
+++ b/src/server/scripts/Events/childrens_week.cpp
@@ -131,13 +131,13 @@ enum Misc
DISPLAY_INVISIBLE = 11686
};
-uint64 getOrphanGUID(Player* player, uint32 orphan)
+ObjectGuid getOrphanGUID(Player* player, uint32 orphan)
{
if (Aura* orphanOut = player->GetAura(SPELL_ORPHAN_OUT))
if (orphanOut->GetCaster() && orphanOut->GetCaster()->GetEntry() == orphan)
return orphanOut->GetCaster()->GetGUID();
- return 0;
+ return ObjectGuid::Empty;
}
/*######
@@ -159,8 +159,8 @@ class npc_winterfin_playmate : public CreatureScript
{
timer = 0;
phase = 0;
- playerGUID = 0;
- orphanGUID = 0;
+ playerGUID.Clear();
+ orphanGUID.Clear();
}
void Reset() override
@@ -235,8 +235,8 @@ class npc_winterfin_playmate : public CreatureScript
private:
uint32 timer;
int8 phase;
- uint64 playerGUID;
- uint64 orphanGUID;
+ ObjectGuid playerGUID;
+ ObjectGuid orphanGUID;
};
@@ -265,8 +265,8 @@ class npc_snowfall_glade_playmate : public CreatureScript
{
timer = 0;
phase = 0;
- playerGUID = 0;
- orphanGUID = 0;
+ playerGUID.Clear();
+ orphanGUID.Clear();
}
void Reset() override
@@ -342,8 +342,8 @@ class npc_snowfall_glade_playmate : public CreatureScript
private:
uint32 timer;
int8 phase;
- uint64 playerGUID;
- uint64 orphanGUID;
+ ObjectGuid playerGUID;
+ ObjectGuid orphanGUID;
};
CreatureAI* GetAI(Creature* pCreature) const override
@@ -372,8 +372,8 @@ class npc_the_biggest_tree : public CreatureScript
{
timer = 1000;
phase = 0;
- playerGUID = 0;
- orphanGUID = 0;
+ playerGUID.Clear();
+ orphanGUID.Clear();
}
void Reset() override
@@ -436,8 +436,8 @@ class npc_the_biggest_tree : public CreatureScript
private:
uint32 timer;
uint8 phase;
- uint64 playerGUID;
- uint64 orphanGUID;
+ ObjectGuid playerGUID;
+ ObjectGuid orphanGUID;
};
@@ -466,8 +466,8 @@ class npc_high_oracle_soo_roo : public CreatureScript
{
timer = 0;
phase = 0;
- playerGUID = 0;
- orphanGUID = 0;
+ playerGUID.Clear();
+ orphanGUID.Clear();
}
void Reset() override
@@ -533,8 +533,8 @@ class npc_high_oracle_soo_roo : public CreatureScript
private:
uint32 timer;
int8 phase;
- uint64 playerGUID;
- uint64 orphanGUID;
+ ObjectGuid playerGUID;
+ ObjectGuid orphanGUID;
};
@@ -563,8 +563,8 @@ class npc_elder_kekek : public CreatureScript
{
timer = 0;
phase = 0;
- playerGUID = 0;
- orphanGUID = 0;
+ playerGUID.Clear();
+ orphanGUID.Clear();
}
void Reset() override
@@ -628,8 +628,8 @@ class npc_elder_kekek : public CreatureScript
private:
uint32 timer;
int8 phase;
- uint64 playerGUID;
- uint64 orphanGUID;
+ ObjectGuid playerGUID;
+ ObjectGuid orphanGUID;
};
@@ -659,8 +659,8 @@ class npc_the_etymidian : public CreatureScript
{
timer = 0;
phase = 0;
- playerGUID = 0;
- orphanGUID = 0;
+ playerGUID.Clear();
+ orphanGUID.Clear();
}
void Reset() override
@@ -732,8 +732,8 @@ class npc_the_etymidian : public CreatureScript
private:
uint32 timer;
int8 phase;
- uint64 playerGUID;
- uint64 orphanGUID;
+ ObjectGuid playerGUID;
+ ObjectGuid orphanGUID;
};
@@ -762,8 +762,8 @@ class npc_alexstraza_the_lifebinder : public CreatureScript
{
timer = 0;
phase = 0;
- playerGUID = 0;
- orphanGUID = 0;
+ playerGUID.Clear();
+ orphanGUID.Clear();
}
void Reset() override
@@ -900,8 +900,8 @@ class npc_alexstraza_the_lifebinder : public CreatureScript
private:
int8 phase;
uint32 timer;
- uint64 playerGUID;
- uint64 orphanGUID;
+ ObjectGuid playerGUID;
+ ObjectGuid orphanGUID;
};
diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp
index 88188a45296..229d32e6c4a 100644
--- a/src/server/scripts/Examples/example_escort.cpp
+++ b/src/server/scripts/Examples/example_escort.cpp
@@ -166,7 +166,7 @@ class example_escort : public CreatureScript
{
if (m_uiChatTimer <= uiDiff)
{
- if (me->HasAura(SPELL_ELIXIR_OF_FORTITUDE, 0))
+ if (me->HasAura(SPELL_ELIXIR_OF_FORTITUDE))
{
Talk(SAY_RAND_1);
DoCast(me, SPELL_BLUE_FIREWORK, false);
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp
index 9097f7cd650..f90cc069780 100644
--- a/src/server/scripts/Examples/example_spell.cpp
+++ b/src/server/scripts/Examples/example_spell.cpp
@@ -117,11 +117,11 @@ class spell_ex_5581 : public SpellScriptLoader
void HandleDummyLaunchTarget(SpellEffIndex /*effIndex*/)
{
- uint64 targetGUID = 0;
+ ObjectGuid targetGUID;
if (Unit* unitTarget = GetHitUnit())
targetGUID = unitTarget->GetGUID();
// we're handling SPELL_EFFECT_DUMMY in effIndex 0 here
- TC_LOG_INFO("misc", "Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID);
+ TC_LOG_INFO("misc", "Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID.GetRawValue());
}
void HandleDummyHit(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
index f8ba2ab6646..0fe3eee2805 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
@@ -210,7 +210,7 @@ public:
{
Talk(SAY_MORRIDUNE_1);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- Start(false, false, 0);
+ Start(false);
}
void WaypointReached(uint32 waypointId) override
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
index 28b414ba9ca..b23d0cdaa3c 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
@@ -66,14 +66,14 @@ public:
{
instance_blackfathom_deeps_InstanceMapScript(Map* map) : InstanceScript(map) { }
- uint64 twilightLordKelrisGUID;
- uint64 shrine1GUID;
- uint64 shrine2GUID;
- uint64 shrine3GUID;
- uint64 shrine4GUID;
- uint64 shrineOfGelihastGUID;
- uint64 altarOfTheDeepsGUID;
- uint64 mainDoorGUID;
+ ObjectGuid twilightLordKelrisGUID;
+ ObjectGuid shrine1GUID;
+ ObjectGuid shrine2GUID;
+ ObjectGuid shrine3GUID;
+ ObjectGuid shrine4GUID;
+ ObjectGuid shrineOfGelihastGUID;
+ ObjectGuid altarOfTheDeepsGUID;
+ ObjectGuid mainDoorGUID;
uint8 encounter[MAX_ENCOUNTER];
uint8 countFires;
@@ -84,14 +84,6 @@ public:
SetHeaders(DataHeader);
memset(&encounter, 0, sizeof(encounter));
- twilightLordKelrisGUID = 0;
- shrine1GUID = 0;
- shrine2GUID = 0;
- shrine3GUID = 0;
- shrine4GUID = 0;
- shrineOfGelihastGUID = 0;
- altarOfTheDeepsGUID = 0;
- mainDoorGUID = 0;
countFires = 0;
deathTimes = 0;
}
@@ -137,7 +129,7 @@ public:
break;
case GO_AKU_MAI_DOOR:
if (encounter[2] == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
mainDoorGUID = go->GetGUID();
break;
}
@@ -234,7 +226,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -254,7 +246,7 @@ public:
return mainDoorGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
};
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
index 782632602b3..131f875bc05 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
@@ -100,7 +100,7 @@ public:
{
if (waypointId == 7)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -194,12 +194,12 @@ public:
ImmolationTimer = 5000;
CheckTimer = 5000;
instance = creature->GetInstanceScript();
- AnetheronGUID = instance->GetData64(DATA_ANETHERON);
+ AnetheronGUID = instance->GetGuidData(DATA_ANETHERON);
}
uint32 ImmolationTimer;
uint32 CheckTimer;
- uint64 AnetheronGUID;
+ ObjectGuid AnetheronGUID;
InstanceScript* instance;
void Reset() override
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
index 2885a838cee..992b20d2580 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
@@ -97,18 +97,18 @@ public:
void Initialize()
{
CheckTimer = 1000;
- ArchimondeGUID = 0;
+ ArchimondeGUID.Clear();
}
InstanceScript* instance;
- uint64 ArchimondeGUID;
+ ObjectGuid ArchimondeGUID;
uint32 CheckTimer;
void Reset() override
{
Initialize();
- ArchimondeGUID = instance->GetData64(DATA_ARCHIMONDE);
+ ArchimondeGUID = instance->GetGuidData(DATA_ARCHIMONDE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
@@ -187,11 +187,11 @@ public:
void Initialize()
{
- TargetGUID = 0;
+ TargetGUID.Clear();
ChangeTargetTimer = 5000;
}
- uint64 TargetGUID;
+ ObjectGuid TargetGUID;
uint32 ChangeTargetTimer;
void Reset() override
@@ -222,7 +222,7 @@ public:
if (Unit* temp = ObjectAccessor::GetUnit(*me, TargetGUID))
{
me->GetMotionMaster()->MoveFollow(temp, 0.0f, 0.0f);
- TargetGUID = 0;
+ TargetGUID.Clear();
}
else
{
@@ -264,9 +264,9 @@ public:
void Initialize()
{
- DoomfireSpiritGUID = 0;
+ DoomfireSpiritGUID.Clear();
damageTaken = 0;
- WorldTreeGUID = 0;
+ WorldTreeGUID.Clear();
DrainNordrassilTimer = 0;
FearTimer = 42000;
@@ -290,8 +290,8 @@ public:
InstanceScript* instance;
- uint64 DoomfireSpiritGUID;
- uint64 WorldTreeGUID;
+ ObjectGuid DoomfireSpiritGUID;
+ ObjectGuid WorldTreeGUID;
uint32 DrainNordrassilTimer;
uint32 FearTimer;
@@ -429,7 +429,7 @@ public:
if (Unit* DoomfireSpirit = ObjectAccessor::GetUnit(*me, DoomfireSpiritGUID))
{
summoned->GetMotionMaster()->MoveFollow(DoomfireSpirit, 0.0f, 0.0f);
- DoomfireSpiritGUID = 0;
+ DoomfireSpiritGUID.Clear();
}
}
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
index 7e50fd7b775..aa411707952 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
@@ -105,7 +105,7 @@ public:
{
if (waypointId == 7 && instance)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -201,13 +201,13 @@ public:
WarstompTimer = 10000;
CheckTimer = 5000;
instance = creature->GetInstanceScript();
- AzgalorGUID = instance->GetData64(DATA_AZGALOR);
+ AzgalorGUID = instance->GetGuidData(DATA_AZGALOR);
}
uint32 CrippleTimer;
uint32 WarstompTimer;
uint32 CheckTimer;
- uint64 AzgalorGUID;
+ ObjectGuid AzgalorGUID;
InstanceScript* instance;
void Reset() override
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
index dcad4480fde..22c10fcec10 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
@@ -100,7 +100,7 @@ public:
{
if (waypointId == 7 && instance)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
index 5ce9b30eb58..cecad84e099 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
@@ -95,7 +95,7 @@ public:
{
if (waypointId == 7 && instance)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
index b5c226b15cb..a4745eade7d 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
@@ -321,8 +321,6 @@ hyjalAI::hyjalAI(Creature* creature) : npc_escortAI(creature), Summons(me)
instance = creature->GetInstanceScript();
VeinsSpawned[0] = false;
VeinsSpawned[1] = false;
- for (uint8 i=0; i<14; ++i)
- VeinGUID[i] = 0;
InfernalCount = 0;
TeleportTimer = 1000;
Overrun = false;
@@ -335,7 +333,6 @@ hyjalAI::hyjalAI(Creature* creature) : npc_escortAI(creature), Summons(me)
DoRespawn = false;
MassTeleportTimer = 0;
DoMassTeleport = false;
- DummyGuid = 0;
}
void hyjalAI::Initialize()
@@ -343,9 +340,9 @@ void hyjalAI::Initialize()
IsDummy = false;
// GUIDs
- PlayerGUID = 0;
- BossGUID[0] = 0;
- BossGUID[1] = 0;
+ PlayerGUID.Clear();
+ BossGUID[0].Clear();
+ BossGUID[1].Clear();
// Timers
NextWaveTimer = 10000;
@@ -651,21 +648,23 @@ void hyjalAI::SpawnVeins()
{
if (VeinsSpawned[0])//prevent any buggers
return;
- for (uint8 i = 0; i<7; ++i)
+ for (uint8 i = 0; i < 7; ++i)
{
GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7], 0);
if (gem)
VeinGUID[i]=gem->GetGUID();
}
VeinsSpawned[0] = true;
- }else{
+ }
+ else
+ {
if (VeinsSpawned[1])
return;
- for (uint8 i = 7; i<14; ++i)
+ for (uint8 i = 7; i < 14; ++i)
{
GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7], 0);
if (gem)
- VeinGUID[i]=gem->GetGUID();
+ VeinGUID[i] = gem->GetGUID();
}
VeinsSpawned[1] = true;
}
@@ -675,22 +674,25 @@ void hyjalAI::DeSpawnVeins()
{
if (Faction == 1)
{
- Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_JAINAPROUDMOORE));
+ Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (!unit)return;
hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
if (!ai)return;
- for (uint8 i = 0; i<7; ++i)
+ for (uint8 i = 0; i < 7; ++i)
{
if (GameObject* gem = instance->instance->GetGameObject(ai->VeinGUID[i]))
gem->Delete();
}
- } else if (Faction)
+ }
+ else if (Faction)
{
- Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_THRALL));
- if (!unit)return;
+ Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_THRALL));
+ if (!unit)
+ return;
hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
- if (!ai)return;
- for (uint8 i = 7; i<14; ++i)
+ if (!ai)
+ return;
+ for (uint8 i = 7; i < 14; ++i)
{
if (GameObject* gem = instance->instance->GetGameObject(ai->VeinGUID[i]))
gem->Delete();
@@ -706,7 +708,9 @@ void hyjalAI::UpdateAI(uint32 diff)
{
DoCast(me, SPELL_MASS_TELEPORT, false);
DoMassTeleport = false;
- } else MassTeleportTimer -= diff;
+ }
+ else
+ MassTeleportTimer -= diff;
return;
}
if (DoHide)
@@ -830,7 +834,7 @@ void hyjalAI::UpdateAI(uint32 diff)
EventBegun = false;
CheckTimer = 0;
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- BossGUID[i] = 0;
+ BossGUID[i].Clear();
instance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0); // Reset world state for enemies to disable it
}
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
index 43afc58879c..468decbd43a 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
@@ -160,9 +160,9 @@ struct hyjalAI : public npc_escortAI
public:
InstanceScript* instance;
- uint64 PlayerGUID;
- uint64 BossGUID[2];
- uint64 VeinGUID[14];
+ ObjectGuid PlayerGUID;
+ ObjectGuid BossGUID[2];
+ ObjectGuid VeinGUID[14];
uint32 NextWaveTimer;
uint32 WaveCount;
@@ -193,7 +193,7 @@ struct hyjalAI : public npc_escortAI
bool IsDummy;
uint32 MassTeleportTimer;
bool DoMassTeleport;
- uint64 DummyGuid;
+ ObjectGuid DummyGuid;
struct Spell
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index 8e1a78ea5f2..c6adbd58c4a 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -447,7 +447,7 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -486,7 +486,7 @@ public:
CanMove = true;
if (instance->GetData(DATA_ALLIANCE_RETREAT) && !instance->GetData(DATA_HORDE_RETREAT))
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
} else if (instance->GetData(DATA_ALLIANCE_RETREAT) && instance->GetData(DATA_HORDE_RETREAT)){
@@ -563,13 +563,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -662,13 +662,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -773,13 +773,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -886,13 +886,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -982,13 +982,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -1068,13 +1068,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -1160,7 +1160,7 @@ public:
{
if (waypointId == 2 && !IsOverrun)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
{
me->AddThreat(target, 0.0f);
@@ -1281,7 +1281,7 @@ public:
{
if (waypointId == 2 && !IsOverrun)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL));
+ Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
{
me->AddThreat(target, 0.0f);
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
index 9bcc7c933fb..71835c3db94 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
@@ -62,18 +62,6 @@ public:
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
- m_uiAncientGemGUID.clear();
-
- RageWinterchill = 0;
- Anetheron = 0;
- Kazrogal = 0;
- Azgalor = 0;
- Archimonde = 0;
- JainaProudmoore = 0;
- Thrall = 0;
- TyrandeWhisperwind = 0;
- HordeGate = 0;
- ElfGate = 0;
RaidDamage = 0;
Trash = 0;
hordeRetreat = 0;
@@ -98,16 +86,16 @@ public:
case GO_HORDE_ENCAMPMENT_PORTAL:
HordeGate = go->GetGUID();
if (allianceRetreat)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
else
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_NIGHT_ELF_VILLAGE_PORTAL:
ElfGate = go->GetGUID();
if (hordeRetreat)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
else
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
break;
case GO_ANCIENT_GEM:
m_uiAncientGemGUID.push_back(go->GetGUID());
@@ -130,7 +118,7 @@ public:
}
}
- uint64 GetData64(uint32 identifier) const override
+ ObjectGuid GetGuidData(uint32 identifier) const override
{
switch (identifier)
{
@@ -144,7 +132,7 @@ public:
case DATA_TYRANDEWHISPERWIND: return TyrandeWhisperwind;
}
- return 0;
+ return ObjectGuid::Empty;
}
void SetData(uint32 type, uint32 data) override
@@ -217,7 +205,7 @@ public:
{
if (!m_uiAncientGemGUID.empty())
{
- for (std::list<uint64>::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr)
+ for (GuidList::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr)
{
//don't know how long it expected
DoRespawnGameObject(*itr, DAY);
@@ -307,17 +295,17 @@ public:
protected:
uint32 m_auiEncounter[EncounterCount];
std::string str_data;
- std::list<uint64> m_uiAncientGemGUID;
- uint64 RageWinterchill;
- uint64 Anetheron;
- uint64 Kazrogal;
- uint64 Azgalor;
- uint64 Archimonde;
- uint64 JainaProudmoore;
- uint64 Thrall;
- uint64 TyrandeWhisperwind;
- uint64 HordeGate;
- uint64 ElfGate;
+ GuidList m_uiAncientGemGUID;
+ ObjectGuid RageWinterchill;
+ ObjectGuid Anetheron;
+ ObjectGuid Kazrogal;
+ ObjectGuid Azgalor;
+ ObjectGuid Archimonde;
+ ObjectGuid JainaProudmoore;
+ ObjectGuid Thrall;
+ ObjectGuid TyrandeWhisperwind;
+ ObjectGuid HordeGate;
+ ObjectGuid ElfGate;
uint32 Trash;
uint32 hordeRetreat;
uint32 allianceRetreat;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
index 7b3314ef4e9..3f74ed2eb88 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
@@ -150,7 +150,7 @@ public:
return;
}
- if (Creature* pArthas = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ARTHAS)))
+ if (Creature* pArthas = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ARTHAS)))
if (pArthas->isDead())
{
EnterEvadeMode();
@@ -199,7 +199,7 @@ public:
uiOutroTimer = 8000;
break;
case 2:
- me->SetTarget(instance->GetData64(DATA_ARTHAS));
+ me->SetTarget(instance->GetGuidData(DATA_ARTHAS));
me->HandleEmoteCommand(29);
Talk(SAY_ESCAPE_SPEECH_2);
++uiOutroStep;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
index 3c80be2734a..ff104a28197 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
@@ -360,23 +360,23 @@ public:
void Initialize()
{
- utherGUID = 0;
- jainaGUID = 0;
+ utherGUID.Clear();
+ jainaGUID.Clear();
for (uint8 i = 0; i < 2; ++i)
- citymenGUID[i] = 0;
+ citymenGUID[i].Clear();
for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i)
- waveGUID[i] = 0;
+ waveGUID[i].Clear();
for (uint8 i = 0; i < ENCOUNTER_DRACONIAN_NUMBER; ++i)
- infiniteDraconianGUID[i] = 0;
+ infiniteDraconianGUID[i].Clear();
- stalkerGUID = 0;
- bossGUID = 0;
- epochGUID = 0;
- malganisGUID = 0;
- infiniteGUID = 0;
+ stalkerGUID.Clear();
+ bossGUID.Clear();
+ epochGUID.Clear();
+ malganisGUID.Clear();
+ infiniteGUID.Clear();
phaseTimer = 1000;
exorcismTimer = 7300;
@@ -393,17 +393,17 @@ public:
uint32 wave;
uint32 WavesCounter;
- uint64 utherGUID;
- uint64 jainaGUID;
- uint64 citymenGUID[2];
- uint64 waveGUID[ENCOUNTER_WAVES_MAX_SPAWNS];
- uint64 infiniteDraconianGUID[ENCOUNTER_DRACONIAN_NUMBER];
- uint64 stalkerGUID;
+ ObjectGuid utherGUID;
+ ObjectGuid jainaGUID;
+ ObjectGuid citymenGUID[2];
+ ObjectGuid waveGUID[ENCOUNTER_WAVES_MAX_SPAWNS];
+ ObjectGuid infiniteDraconianGUID[ENCOUNTER_DRACONIAN_NUMBER];
+ ObjectGuid stalkerGUID;
- uint64 bossGUID;
- uint64 epochGUID;
- uint64 malganisGUID;
- uint64 infiniteGUID;
+ ObjectGuid bossGUID;
+ ObjectGuid epochGUID;
+ ObjectGuid malganisGUID;
+ ObjectGuid infiniteGUID;
uint32 exorcismTimer;
@@ -436,7 +436,7 @@ public:
instance->SetBossState(DATA_ARTHAS, FAIL);
}
- void SpawnTimeRift(uint32 timeRiftID, uint64* guidVector)
+ void SpawnTimeRift(uint32 timeRiftID, ObjectGuid* guidVector)
{
me->SummonCreature((uint32)RiftAndSpawnsLocations[timeRiftID][0], RiftAndSpawnsLocations[timeRiftID][1], RiftAndSpawnsLocations[timeRiftID][2], RiftAndSpawnsLocations[timeRiftID][3], RiftAndSpawnsLocations[timeRiftID][4], TEMPSUMMON_TIMED_DESPAWN, 11000);
@@ -455,7 +455,7 @@ public:
}
}
- void SpawnWaveGroup(uint32 waveID, uint64* guidVector)
+ void SpawnWaveGroup(uint32 waveID, ObjectGuid* guidVector)
{
for (uint32 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i)
{
@@ -568,7 +568,7 @@ public:
Talk(SAY_PHASE403);
break;
case 36:
- if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_SHKAF_GATE)))
+ if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_SHKAF_GATE)))
gate->SetGoState(GO_STATE_ACTIVE);
break;
case 45:
@@ -736,7 +736,7 @@ public:
case 21:
SetEscortPaused(false);
bStepping = false;
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
JumpToNextStep(0);
break;
//After waypoint 3
@@ -756,7 +756,7 @@ public:
if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID))
uther->DisappearAndDie();
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
JumpToNextStep(0);
break;
//After Gossip 1 (waypoint 8)
@@ -779,7 +779,7 @@ public:
SetEscortPaused(false);
bStepping = false;
SetRun(false);
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
JumpToNextStep(0);
break;
//After waypoint 9
@@ -938,7 +938,7 @@ public:
uint32 deadCounter = 0;
for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i)
{
- if (waveGUID[i] == 0)
+ if (waveGUID[i].IsEmpty())
break;
++mobCounter;
Unit* temp = ObjectAccessor::GetCreature(*me, waveGUID[i]);
@@ -1168,7 +1168,7 @@ public:
malganisGUID = malganis->GetGUID();
malganis->SetReactState(REACT_PASSIVE);
}
- if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MAL_GANIS_GATE_1)))
+ if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MAL_GANIS_GATE_1)))
gate->SetGoState(GO_STATE_ACTIVE);
SetHoldState(false);
bStepping = false;
@@ -1208,7 +1208,7 @@ public:
break;
case 90:
instance->SetBossState(DATA_ARTHAS, DONE); //Rewards: Achiev & Chest ;D
- me->SetTarget(instance->GetData64(DATA_MAL_GANIS_GATE_2)); //Look behind
+ me->SetTarget(instance->GetGuidData(DATA_MAL_GANIS_GATE_2)); //Look behind
Talk(SAY_PHASE504);
bStepping = false;
break;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
index ab86b5d8f42..c25a061d622 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
@@ -61,19 +61,6 @@ class instance_culling_of_stratholme : public InstanceMapScript
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- _chromieGUID = 0;
- _arthasGUID = 0;
- _meathookGUID = 0;
- _salrammGUID = 0;
- _epochGUID = 0;
- _malGanisGUID = 0;
- _infiniteGUID = 0;
- _shkafGateGUID = 0;
- _malGanisGate1GUID = 0;
- _malGanisGate2GUID = 0;
- _exitGateGUID = 0;
- _malGanisChestGUID = 0;
- _genericBunnyGUID = 0;
_crateCount = 0;
_eventTimer = 0;
_infiniteCouterState = NOT_STARTED;
@@ -176,7 +163,7 @@ class instance_culling_of_stratholme : public InstanceMapScript
// Summon Chromie and global whisper
if (Creature* chromie = instance->SummonCreature(NPC_CHROMIE_2, ChromieSummonPos[0]))
if (!instance->GetPlayers().isEmpty())
- chromie->AI()->TalkToMap(SAY_CRATES_COMPLETED);
+ chromie->AI()->Talk(SAY_CRATES_COMPLETED);
}
DoUpdateWorldState(WORLDSTATE_CRATES_REVEALED, _crateCount);
break;
@@ -242,7 +229,7 @@ class instance_culling_of_stratholme : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 identifier) const override
+ ObjectGuid GetGuidData(uint32 identifier) const override
{
switch (identifier)
{
@@ -271,7 +258,7 @@ class instance_culling_of_stratholme : public InstanceMapScript
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
void Update(uint32 diff) override
@@ -290,17 +277,17 @@ class instance_culling_of_stratholme : public InstanceMapScript
case 25:
if (instance->HavePlayers())
if (Creature* chromie = instance->GetCreature(_chromieGUID))
- chromie->AI()->TalkToMap(SAY_INFINITE_START);
+ chromie->AI()->Talk(SAY_INFINITE_START);
break;
case 5:
if (instance->HavePlayers())
if (Creature* chromie = instance->GetCreature(_chromieGUID))
- chromie->AI()->TalkToMap(SAY_INFINITE);
+ chromie->AI()->Talk(SAY_INFINITE);
break;
case 0:
if (instance->HavePlayers())
if (Creature* chromie = instance->GetCreature(_chromieGUID))
- chromie->AI()->TalkToMap(SAY_INFINITE_FAIL);
+ chromie->AI()->Talk(SAY_INFINITE_FAIL);
if (Creature* infinite = instance->GetCreature(_infiniteGUID))
{
@@ -331,19 +318,19 @@ class instance_culling_of_stratholme : public InstanceMapScript
}
private:
- uint64 _chromieGUID;
- uint64 _arthasGUID;
- uint64 _meathookGUID;
- uint64 _salrammGUID;
- uint64 _epochGUID;
- uint64 _malGanisGUID;
- uint64 _infiniteGUID;
- uint64 _shkafGateGUID;
- uint64 _malGanisGate1GUID;
- uint64 _malGanisGate2GUID;
- uint64 _exitGateGUID;
- uint64 _malGanisChestGUID;
- uint64 _genericBunnyGUID;
+ ObjectGuid _chromieGUID;
+ ObjectGuid _arthasGUID;
+ ObjectGuid _meathookGUID;
+ ObjectGuid _salrammGUID;
+ ObjectGuid _epochGUID;
+ ObjectGuid _malGanisGUID;
+ ObjectGuid _infiniteGUID;
+ ObjectGuid _shkafGateGUID;
+ ObjectGuid _malGanisGate1GUID;
+ ObjectGuid _malGanisGate2GUID;
+ ObjectGuid _exitGateGUID;
+ ObjectGuid _malGanisChestGUID;
+ ObjectGuid _genericBunnyGUID;
uint32 _crateCount;
uint32 _eventTimer;
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 32062be6f3c..0220ff98750 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
@@ -58,9 +58,9 @@ public:
uint32 mBarrelCount;
uint32 mThrallEventCount;
- uint64 ThrallGUID;
- uint64 TarethaGUID;
- uint64 EpochGUID;
+ ObjectGuid ThrallGUID;
+ ObjectGuid TarethaGUID;
+ ObjectGuid EpochGUID;
void Initialize() override
{
@@ -69,9 +69,6 @@ public:
mBarrelCount = 0;
mThrallEventCount = 0;
- ThrallGUID = 0;
- TarethaGUID = 0;
- EpochGUID = 0;
}
Player* GetPlayerInMap()
@@ -100,7 +97,7 @@ public:
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
if (Player* player = itr->GetSource())
- player->KilledMonsterCredit(LODGE_QUEST_TRIGGER, 0);
+ player->KilledMonsterCredit(LODGE_QUEST_TRIGGER);
}
}
}
@@ -115,9 +112,9 @@ public:
case TARETHA_ENTRY:
TarethaGUID = creature->GetGUID();
break;
- case EPOCH_ENTRY:
- EpochGUID = creature->GetGUID();
- break;
+ case EPOCH_ENTRY:
+ EpochGUID = creature->GetGUID();
+ break;
}
}
@@ -224,7 +221,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -232,10 +229,10 @@ public:
return ThrallGUID;
case DATA_TARETHA:
return TarethaGUID;
- case DATA_EPOCH:
- return EpochGUID;
+ case DATA_EPOCH:
+ return EpochGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
index 56e95fafece..66ce5e93720 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
@@ -404,7 +404,7 @@ public:
me->SummonCreature(NPC_INN_GUARDSMAN, 2656.39f, 659.77f, 61.93f, 2.61f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
break;
case 94:
- if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TARETHA)))
+ if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TARETHA)))
Taretha->AI()->Talk(SAY_TA_ESCAPED, me);
break;
case 95:
@@ -426,7 +426,7 @@ public:
case 106:
{
//trigger taretha to run down outside
- if (Creature* Taretha = instance->instance->GetCreature(instance->GetData64(DATA_TARETHA)))
+ if (Creature* Taretha = instance->instance->GetCreature(instance->GetGuidData(DATA_TARETHA)))
{
if (Player* player = GetPlayerForEscort())
ENSURE_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, player->GetGUID());
@@ -440,7 +440,7 @@ public:
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
if (Player* player = itr->GetSource())
- player->KilledMonsterCredit(20156, 0);
+ player->KilledMonsterCredit(20156);
}
}
@@ -588,10 +588,10 @@ public:
if (instance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS)
{
instance->SetData(TYPE_THRALL_PART4, IN_PROGRESS);
- if (instance->GetData64(DATA_EPOCH) == 0)
+ if (instance->GetGuidData(DATA_EPOCH).IsEmpty())
creature->SummonCreature(ENTRY_EPOCH, 2639.13f, 698.55f, 65.43f, 4.59f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
- if (Creature* thrall = (ObjectAccessor::GetCreature(*creature, instance->GetData64(DATA_THRALL))))
+ if (Creature* thrall = (ObjectAccessor::GetCreature(*creature, instance->GetGuidData(DATA_THRALL))))
ENSURE_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, thrall->AI())->StartWP();
}
}
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 35497b1f9ce..ed49cc41c39 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
@@ -89,13 +89,12 @@ public:
uint8 mRiftWaveCount;
uint8 mRiftWaveId;
- uint64 _medivhGUID;
+ ObjectGuid _medivhGUID;
uint8 _currentRiftId;
void Initialize() override
{
SetHeaders(DataHeader);
- _medivhGUID = 0;
Clear();
}
@@ -253,12 +252,12 @@ public:
return 0;
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
if (data == DATA_MEDIVH)
return _medivhGUID;
- return 0;
+ return ObjectGuid::Empty;
}
Creature* SummonedPortalBoss(Creature* me)
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 1fa104ada00..64d99c03dab 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp
@@ -321,7 +321,7 @@ public:
pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY));
if (Unit* Summon = DoSummon(creature_entry, pos, 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT))
- if (Unit* temp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MEDIVH)))
+ if (Unit* temp = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_MEDIVH)))
Summon->AddThreat(temp, 0.0f);
}
diff --git a/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp b/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp
index d76de6eeb42..9b8b435e93c 100644
--- a/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp
+++ b/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp
@@ -179,7 +179,7 @@ class npc_harbinger_of_flame : public CreatureScript
void EnterCombat(Unit* /*target*/)
{
- if (Creature* bird = ObjectAccessor::GetCreature(*me, me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)))
+ if (Creature* bird = ObjectAccessor::GetCreature(*me, me->GetChannelObjectGuid()))
DoZoneInCombat(bird, 200.0f);
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp
index c8963331702..84a267543c5 100644
--- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp
+++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp
@@ -168,7 +168,7 @@ public:
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
Talk(ANRAPHET_SAY_DEATH);
- if (Creature* brann = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRANN_0_GUID)))
+ if (Creature* brann = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRANN_0_GUID)))
brann->AI()->DoAction(ACTION_ANRAPHET_DIED);
_JustDied();
@@ -304,7 +304,7 @@ class npc_alpha_beam : public CreatureScript
void IsSummonedBy(Unit* /*summoner*/) override
{
- if (Creature* anraphet = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ANRAPHET_GUID)))
+ if (Creature* anraphet = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ANRAPHET_GUID)))
anraphet->CastSpell(me, SPELL_ALPHA_BEAMS_BACK_CAST);
}
@@ -357,7 +357,7 @@ class npc_brann_bronzebeard_anraphet : public CreatureScript
if (dead == 4)
{
_instance->DoCastSpellOnPlayers(SPELL_VAULT_OF_LIGHTS_CREDIT);
- if (Creature* anraphet = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ANRAPHET_GUID)))
+ if (Creature* anraphet = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ANRAPHET_GUID)))
anraphet->AI()->DoAction(ACTION_ANRAPHET_INTRO);
}
break;
diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp
index 7aed7a66a00..47a40dd56ef 100644
--- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp
+++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp
@@ -126,7 +126,7 @@ public:
DoCastAOE(SPELL_ACTIVATE_BEACONS);
std::list<Creature*> stalkers;
- GameObject* door = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ANHUUR_DOOR));
+ GameObject* door = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ANHUUR_DOOR));
GetCreatureListWithEntryInGrid(stalkers, me, NPC_CAVE_IN_STALKER, 100.0f);
stalkers.remove_if(Trinity::HeightDifferenceCheck(door, 0.0f, false)); // Target only the bottom ones
@@ -228,7 +228,7 @@ public:
std::list<Creature*> stalkers;
GetCreatureListWithEntryInGrid(stalkers, me, NPC_CAVE_IN_STALKER, 100.0f);
- stalkers.remove_if(Trinity::HeightDifferenceCheck(ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ANHUUR_DOOR)), 5.0f, true));
+ stalkers.remove_if(Trinity::HeightDifferenceCheck(ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ANHUUR_DOOR)), 5.0f, true));
if (stalkers.empty())
break;
@@ -278,7 +278,7 @@ class spell_anhuur_shield_of_light : public SpellScriptLoader
{
if (InstanceScript* const script = instance->GetInstanceScript())
{
- if (GameObject* go = ObjectAccessor::GetGameObject(*GetCaster(), script->GetData64(DATA_ANHUUR_DOOR)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*GetCaster(), script->GetGuidData(DATA_ANHUUR_DOOR)))
{
targets.remove_if(Trinity::HeightDifferenceCheck(go, 5.0f, false));
targets.remove(GetCaster());
@@ -319,7 +319,7 @@ class spell_anhuur_disable_beacon_beams : public SpellScriptLoader
{
if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap())
if (InstanceScript* const script = instance->GetInstanceScript())
- if (Creature* anhuur = instance->GetCreature(script->GetData64(DATA_ANHUUR_GUID)))
+ if (Creature* anhuur = instance->GetCreature(script->GetGuidData(DATA_ANHUUR_GUID)))
anhuur->AI()->DoAction(ACTION_DISABLE_BEACON);
}
diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp
index 3273d3d7850..4377344fb26 100644
--- a/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp
+++ b/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp
@@ -56,15 +56,6 @@ class instance_halls_of_origination : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- TempleGuardianAnhuurGUID = 0;
- AnhuursBridgeGUID = 0;
- AnhuursDoorGUID = 0;
- AnhuurRightBeaconGUID = 0;
- AnhuurLeftBeaconGUID = 0;
- BrannBronzebeardGUID = 0;
- AnraphetGUID = 0;
- AnraphetDoorGUID = 0;
- SunMirrorGUID = 0;
_deadElementals = 0;
}
@@ -155,7 +146,7 @@ class instance_halls_of_origination : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 index) const override
+ ObjectGuid GetGuidData(uint32 index) const override
{
switch (index)
{
@@ -175,7 +166,7 @@ class instance_halls_of_origination : public InstanceMapScript
return AnraphetGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
void IncreaseDeadElementals(uint32 inc)
@@ -225,15 +216,15 @@ class instance_halls_of_origination : public InstanceMapScript
}
protected:
- uint64 TempleGuardianAnhuurGUID;
- uint64 AnhuursBridgeGUID;
- uint64 AnhuursDoorGUID;
- uint64 AnhuurRightBeaconGUID;
- uint64 AnhuurLeftBeaconGUID;
- uint64 BrannBronzebeardGUID;
- uint64 AnraphetGUID;
- uint64 AnraphetDoorGUID;
- uint64 SunMirrorGUID;
+ ObjectGuid TempleGuardianAnhuurGUID;
+ ObjectGuid AnhuursBridgeGUID;
+ ObjectGuid AnhuursDoorGUID;
+ ObjectGuid AnhuurRightBeaconGUID;
+ ObjectGuid AnhuurLeftBeaconGUID;
+ ObjectGuid BrannBronzebeardGUID;
+ ObjectGuid AnraphetGUID;
+ ObjectGuid AnraphetDoorGUID;
+ ObjectGuid SunMirrorGUID;
uint32 _deadElementals;
};
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
index 0a6b2e88b26..5c083e43d3d 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
@@ -140,8 +140,8 @@ public:
MovePoint = urand(0, 5);
PointData = GetMoveData();
SummonWhelpCount = 0;
- triggerGUID = 0;
- tankGUID = 0;
+ triggerGUID.Clear();
+ tankGUID.Clear();
IsMoving = false;
}
@@ -355,7 +355,7 @@ public:
Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, Floor, check);
me->VisitNearbyGridObject(30, searcher);
if (Floor)
- instance->SetData64(DATA_FLOOR_ERUPTION_GUID, Floor->GetGUID());
+ instance->SetGuidData(DATA_FLOOR_ERUPTION_GUID, Floor->GetGUID());
events.ScheduleEvent(EVENT_BELLOWING_ROAR, 30000);
break;
}
@@ -473,8 +473,8 @@ public:
uint8 Phase;
uint8 MovePoint;
uint8 SummonWhelpCount;
- uint64 triggerGUID;
- uint64 tankGUID;
+ ObjectGuid triggerGUID;
+ ObjectGuid tankGUID;
bool IsMoving;
};
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
index 6aa50e71b17..4bbbf26b84e 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
@@ -53,7 +53,6 @@ public:
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
- onyxiaGUID = 0;
onyxiaLiftoffTimer = 0;
manyWhelpsCounter = 0;
eruptTimer = 0;
@@ -102,7 +101,7 @@ public:
}
}
- void FloorEruption(uint64 floorEruptedGUID)
+ void FloorEruption(ObjectGuid floorEruptedGUID)
{
if (GameObject* floorEruption = instance->GetGameObject(floorEruptedGUID))
{
@@ -121,7 +120,7 @@ public:
{
if (((*itr)->GetGOInfo()->displayId == 4392 || (*itr)->GetGOInfo()->displayId == 4472) && (*itr)->GetGOInfo()->trap.spellId == 17731)
{
- uint64 nearFloorGUID = (*itr)->GetGUID();
+ ObjectGuid nearFloorGUID = (*itr)->GetGUID();
if (FloorEruptionGUID[1].find(nearFloorGUID) != FloorEruptionGUID[1].end() && (*FloorEruptionGUID[1].find(nearFloorGUID)).second == 0)
{
(*FloorEruptionGUID[1].find(nearFloorGUID)).second = (*FloorEruptionGUID[1].find(floorEruptedGUID)).second+1;
@@ -173,7 +172,7 @@ public:
}
}
- void SetData64(uint32 type, uint64 data) override
+ void SetGuidData(uint32 type, ObjectGuid data) override
{
switch (type)
{
@@ -185,7 +184,7 @@ public:
}
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -193,7 +192,7 @@ public:
return onyxiaGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
void Update(uint32 diff) override
@@ -212,8 +211,8 @@ public:
{
if (eruptTimer <= diff)
{
- uint64 frontGuid = FloorEruptionGUIDQueue.front();
- std::map<uint64, uint32>::iterator itr = FloorEruptionGUID[1].find(frontGuid);
+ ObjectGuid frontGuid = FloorEruptionGUIDQueue.front();
+ std::map<ObjectGuid, uint32>::iterator itr = FloorEruptionGUID[1].find(frontGuid);
if (itr != FloorEruptionGUID[1].end())
{
uint32 treeHeight = itr->second;
@@ -252,11 +251,9 @@ public:
}
protected:
- std::map<uint64, uint32> FloorEruptionGUID[2];
- std::queue<uint64> FloorEruptionGUIDQueue;
- uint64 onyxiaGUID;
- uint64 triggerGUID;
- uint64 tankGUID;
+ std::map<ObjectGuid, uint32> FloorEruptionGUID[2];
+ std::queue<ObjectGuid> FloorEruptionGUIDQueue;
+ ObjectGuid onyxiaGUID;
uint32 onyxiaLiftoffTimer;
uint32 manyWhelpsCounter;
uint32 eruptTimer;
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
index ca5e6a9828c..8a82f782918 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
@@ -59,7 +59,6 @@ public:
void Initialize() override
{
- goGongGUID = 0;
gongWave = 0;
fiendsKilled = 0;
reaversKilled = 0;
@@ -172,7 +171,7 @@ public:
}
protected:
- uint64 goGongGUID;
+ ObjectGuid goGongGUID;
uint16 gongWave;
uint8 fiendsKilled;
uint8 reaversKilled;
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
index 6f9ba0afa7b..07cb6e65ee9 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
@@ -44,14 +44,13 @@ public:
{
instance_razorfen_kraul_InstanceMapScript(Map* map) : InstanceScript(map) { }
- uint64 DoorWardGUID;
+ ObjectGuid DoorWardGUID;
int WardKeeperDeath;
void Initialize() override
{
SetHeaders(DataHeader);
WardKeeperDeath = 0;
- DoorWardGUID = 0;
}
Player* GetPlayerInMap()
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
index e3021ff7a95..8cbd611a18a 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
@@ -159,13 +159,12 @@ public:
npc_snufflenose_gopherAI(Creature* creature) : PetAI(creature)
{
IsMovementActive = false;
- TargetTubberGUID = 0;
}
void Reset() override
{
IsMovementActive = false;
- TargetTubberGUID = 0;
+ TargetTubberGUID.Clear();
}
void MovementInform(uint32 type, uint32 id) override
@@ -227,7 +226,7 @@ public:
bool IsMovementActive;
- uint64 TargetTubberGUID;
+ ObjectGuid TargetTubberGUID;
};
};
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
index 19cc5316fa4..1a09ef27b04 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
@@ -200,14 +200,14 @@ class boss_ayamiss : public CreatureScript
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true))
{
DoCast(target, SPELL_PARALYZE);
- instance->SetData64(DATA_PARALYZED, target->GetGUID());
+ instance->SetGuidData(DATA_PARALYZED, target->GetGUID());
uint8 Index = urand(0, 1);
me->SummonCreature(NPC_LARVA, LarvaPos[Index], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
}
events.ScheduleEvent(EVENT_PARALYZE, 15000);
break;
case EVENT_SWARMER_ATTACK:
- for (std::list<uint64>::iterator i = _swarmers.begin(); i != _swarmers.end(); ++i)
+ for (GuidList::iterator i = _swarmers.begin(); i != _swarmers.end(); ++i)
if (Creature* swarmer = me->GetMap()->GetCreature(*i))
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
swarmer->AI()->AttackStart(target);
@@ -234,7 +234,7 @@ class boss_ayamiss : public CreatureScript
}
}
private:
- std::list<uint64> _swarmers;
+ GuidList _swarmers;
uint8 _phase;
bool _enraged;
};
@@ -261,7 +261,7 @@ class npc_hive_zara_larva : public CreatureScript
{
if (type == POINT_MOTION_TYPE)
if (id == POINT_PARALYZE)
- if (Player* target = ObjectAccessor::GetPlayer(*me, _instance->GetData64(DATA_PARALYZED)))
+ if (Player* target = ObjectAccessor::GetPlayer(*me, _instance->GetGuidData(DATA_PARALYZED)))
DoCast(target, SPELL_FEED); // Omnomnom
}
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
index cf6703a01f5..d6640b5a0ab 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
@@ -76,8 +76,8 @@ class boss_buru : public CreatureScript
{
BossAI::EnterEvadeMode();
- for (std::list<uint64>::iterator i = Eggs.begin(); i != Eggs.end(); ++i)
- if (Creature* egg = me->GetMap()->GetCreature(*Eggs.begin()))
+ for (ObjectGuid eggGuid : Eggs)
+ if (Creature* egg = me->GetMap()->GetCreature(eggGuid))
egg->Respawn();
Eggs.clear();
@@ -127,7 +127,7 @@ class boss_buru : public CreatureScript
}
}
- void ManageRespawn(uint64 EggGUID)
+ void ManageRespawn(ObjectGuid EggGUID)
{
ChaseNewVictim();
Eggs.push_back(EggGUID);
@@ -183,8 +183,8 @@ class boss_buru : public CreatureScript
DoMeleeAttackIfReady();
}
private:
+ GuidList Eggs;
uint8 _phase;
- std::list<uint64> Eggs;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -208,7 +208,7 @@ class npc_buru_egg : public CreatureScript
void EnterCombat(Unit* attacker) override
{
- if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU)))
+ if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU)))
if (!buru->IsInCombat())
buru->AI()->AttackStart(attacker);
}
@@ -216,7 +216,7 @@ class npc_buru_egg : public CreatureScript
void JustSummoned(Creature* who) override
{
if (who->GetEntry() == NPC_HATCHLING)
- if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU)))
+ if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU)))
if (Unit* target = buru->AI()->SelectTarget(SELECT_TARGET_RANDOM))
who->AI()->AttackStart(target);
}
@@ -227,7 +227,7 @@ class npc_buru_egg : public CreatureScript
DoCastAOE(SPELL_EXPLODE_2, true); // Unknown purpose
DoCast(me, SPELL_SUMMON_HATCHLING, true);
- if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU)))
+ if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU)))
if (boss_buru::boss_buruAI* buruAI = dynamic_cast<boss_buru::boss_buruAI*>(buru->AI()))
buruAI->ManageRespawn(me->GetGUID());
}
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
index adb6723d2af..776971b1f9f 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
@@ -83,7 +83,7 @@ class boss_kurinnaxx : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
_JustDied();
- if (Creature* Ossirian = me->GetMap()->GetCreature(instance->GetData64(DATA_OSSIRIAN)))
+ if (Creature* Ossirian = me->GetMap()->GetCreature(instance->GetGuidData(DATA_OSSIRIAN)))
sCreatureTextMgr->SendChat(Ossirian, SAY_KURINAXX_DEATH, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
}
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
index 0180bbeddac..2ba755d3c4e 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
@@ -95,12 +95,12 @@ class boss_ossirian : public CreatureScript
void Initialize()
{
CrystalIterator = 0;
- TriggerGUID = 0;
- CrystalGUID = 0;
+ TriggerGUID.Clear();
+ CrystalGUID.Clear();
}
- uint64 TriggerGUID;
- uint64 CrystalGUID;
+ ObjectGuid TriggerGUID;
+ ObjectGuid CrystalGUID;
uint8 CrystalIterator;
bool SaidIntro;
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
index 1b62527dab7..0e34f4a5595 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
@@ -30,14 +30,6 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript
{
SetHeaders(DataHeader);
SetBossNumber(NUM_ENCOUNTER);
-
- _kurinaxxGUID = 0;
- _rajaxxGUID = 0;
- _moamGUID = 0;
- _buruGUID = 0;
- _ayamissGUID = 0;
- _ossirianGUID = 0;
- _paralyzedGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -73,13 +65,13 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript
return true;
}
- void SetData64(uint32 type, uint64 data) override
+ void SetGuidData(uint32 type, ObjectGuid data) override
{
if (type == DATA_PARALYZED)
_paralyzedGUID = data;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -99,17 +91,17 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript
return _paralyzedGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
private:
- uint64 _kurinaxxGUID;
- uint64 _rajaxxGUID;
- uint64 _moamGUID;
- uint64 _buruGUID;
- uint64 _ayamissGUID;
- uint64 _ossirianGUID;
- uint64 _paralyzedGUID;
+ ObjectGuid _kurinaxxGUID;
+ ObjectGuid _rajaxxGUID;
+ ObjectGuid _moamGUID;
+ ObjectGuid _buruGUID;
+ ObjectGuid _ayamissGUID;
+ ObjectGuid _ossirianGUID;
+ ObjectGuid _paralyzedGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
index be103541989..4ed4c3c2e26 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
@@ -315,11 +315,11 @@ public:
switch (urand(0, 2))
{
case 0:
- if (Creature* kri = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KRI)))
+ if (Creature* kri = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KRI)))
DoCast(kri, SPELL_HEAL);
break;
case 1:
- if (Creature* vem = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VEM)))
+ if (Creature* vem = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VEM)))
DoCast(vem, SPELL_HEAL);
break;
case 2:
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
index c9795133d14..218aa69304c 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
@@ -307,7 +307,7 @@ public:
me->SetReactState(REACT_PASSIVE);
//Remove any target
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
//Select random target for dark beam to start on
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
@@ -384,7 +384,7 @@ public:
//Transition phase
case PHASE_CTHUN_TRANSITION:
//Remove any target
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
me->SetHealth(0);
me->SetVisible(false);
break;
@@ -420,7 +420,7 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
//Remove Target field
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
//Death animation/respawning;
instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_TRANSITION);
@@ -475,7 +475,7 @@ public:
PhaseTimer = 10000; //Emerge in 10 seconds
//No hold player for transition
- HoldPlayer = 0;
+ HoldPlayer.Clear();
//Body Phase
EyeTentacleTimer = 30000;
@@ -485,7 +485,7 @@ public:
StomachAcidTimer = 4000; //Every 4 seconds
StomachEnterTimer = 10000; //Every 10 seconds
StomachEnterVisTimer = 0; //Always 3.5 seconds after Stomach Enter Timer
- StomachEnterTarget = 0; //Target to be teleported to stomach
+ StomachEnterTarget.Clear(); //Target to be teleported to stomach
}
InstanceScript* instance;
@@ -499,7 +499,7 @@ public:
//-------------------
//Phase transition
- uint64 HoldPlayer;
+ ObjectGuid HoldPlayer;
//Body Phase
uint32 EyeTentacleTimer;
@@ -509,10 +509,10 @@ public:
uint32 StomachAcidTimer;
uint32 StomachEnterTimer;
uint32 StomachEnterVisTimer;
- uint64 StomachEnterTarget;
+ ObjectGuid StomachEnterTarget;
//Stomach map, bool = true then in stomach
- std::unordered_map<uint64, bool> Stomach_Map;
+ std::unordered_map<ObjectGuid, bool> Stomach_Map;
void Reset() override
{
@@ -548,7 +548,7 @@ public:
if (Stomach_Map.empty())
return NULL;
- std::unordered_map<uint64, bool>::const_iterator i = Stomach_Map.begin();
+ std::unordered_map<ObjectGuid, bool>::const_iterator i = Stomach_Map.begin();
std::list<Unit*> temp;
std::list<Unit*>::const_iterator j;
@@ -610,7 +610,7 @@ public:
return;
}
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
uint32 currentPhase = instance->GetData(DATA_CTHUN_PHASE);
if (currentPhase == PHASE_CTHUN_STOMACH || currentPhase == PHASE_CTHUN_WEAK)
@@ -680,7 +680,7 @@ public:
//Body Phase
case PHASE_CTHUN_STOMACH:
//Remove Target field
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
//Weaken
if (FleshTentaclesKilled > 1)
@@ -692,7 +692,7 @@ public:
DoCast(me, SPELL_PURPLE_COLORATION, true);
- std::unordered_map<uint64, bool>::iterator i = Stomach_Map.begin();
+ std::unordered_map<ObjectGuid, bool>::iterator i = Stomach_Map.begin();
//Kick all players out of stomach
while (i != Stomach_Map.end())
@@ -724,7 +724,7 @@ public:
if (StomachAcidTimer <= diff)
{
//Apply aura to all players in stomach
- std::unordered_map<uint64, bool>::iterator i = Stomach_Map.begin();
+ std::unordered_map<ObjectGuid, bool>::iterator i = Stomach_Map.begin();
while (i != Stomach_Map.end())
{
@@ -786,7 +786,7 @@ public:
DoTeleportPlayer(unit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O);
}
- StomachEnterTarget = 0;
+ StomachEnterTarget.Clear();
StomachEnterVisTimer = 0;
} else StomachEnterVisTimer -= diff;
}
@@ -913,7 +913,6 @@ public:
MindflayTimer = 500;
KillSelfTimer = 35000;
- Portal = 0;
if (Creature* pPortal = me->SummonCreature(NPC_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);
@@ -925,7 +924,7 @@ public:
uint32 MindflayTimer;
uint32 KillSelfTimer;
- uint64 Portal;
+ ObjectGuid Portal;
void JustDied(Unit* /*killer*/) override
{
@@ -995,7 +994,6 @@ public:
SetCombatMovement(false);
- Portal = 0;
if (Creature* pPortal = me->SummonCreature(NPC_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);
@@ -1006,7 +1004,7 @@ public:
uint32 GroundRuptureTimer;
uint32 HamstringTimer;
uint32 EvadeTimer;
- uint64 Portal;
+ ObjectGuid Portal;
void JustDied(Unit* /*killer*/) override
{
@@ -1111,7 +1109,6 @@ public:
SetCombatMovement(false);
- Portal = 0;
if (Creature* pPortal = me->SummonCreature(NPC_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);
@@ -1123,7 +1120,7 @@ public:
uint32 ThrashTimer;
uint32 HamstringTimer;
uint32 EvadeTimer;
- uint64 Portal;
+ ObjectGuid Portal;
void JustDied(Unit* /*killer*/) override
{
@@ -1233,7 +1230,6 @@ public:
SetCombatMovement(false);
- Portal = 0;
if (Creature* pPortal = me->SummonCreature(NPC_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);
@@ -1242,7 +1238,7 @@ public:
}
uint32 BeamTimer;
- uint64 Portal;
+ ObjectGuid Portal;
void JustDied(Unit* /*killer*/) override
{
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index e65dbacc1f2..c653064d62c 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -110,7 +110,7 @@ struct boss_twinemperorsAI : public ScriptedAI
Creature* GetOtherBoss()
{
- return ObjectAccessor::GetCreature(*me, instance->GetData64(IAmVeklor() ? DATA_VEKNILASH : DATA_VEKLOR));
+ return ObjectAccessor::GetCreature(*me, instance->GetGuidData(IAmVeklor() ? DATA_VEKNILASH : DATA_VEKLOR));
}
void DamageTaken(Unit* /*done_by*/, uint32 &damage) override
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
index 7f223f21269..fe6e0a435a7 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
@@ -272,7 +272,7 @@ class npc_glob_of_viscidus : public CreatureScript
{
InstanceScript* Instance = me->GetInstanceScript();
- if (Creature* Viscidus = me->GetMap()->GetCreature(Instance->GetData64(DATA_VISCIDUS)))
+ if (Creature* Viscidus = me->GetMap()->GetCreature(Instance->GetGuidData(DATA_VISCIDUS)))
{
if (BossAI* ViscidusAI = dynamic_cast<BossAI*>(Viscidus->GetAI()))
ViscidusAI->SummonedCreatureDespawn(me);
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
index e6d9bd86a4d..456ff749e84 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
@@ -45,12 +45,12 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript
bool IsBossDied[3];
//Storing Skeram, Vem and Kri.
- uint64 SkeramGUID;
- uint64 VemGUID;
- uint64 KriGUID;
- uint64 VeklorGUID;
- uint64 VeknilashGUID;
- uint64 ViscidusGUID;
+ ObjectGuid SkeramGUID;
+ ObjectGuid VemGUID;
+ ObjectGuid KriGUID;
+ ObjectGuid VeklorGUID;
+ ObjectGuid VeknilashGUID;
+ ObjectGuid ViscidusGUID;
uint32 BugTrioDeathCount;
@@ -63,13 +63,6 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript
IsBossDied[1] = false;
IsBossDied[2] = false;
- SkeramGUID = 0;
- VemGUID = 0;
- KriGUID = 0;
- VeklorGUID = 0;
- VeknilashGUID = 0;
- ViscidusGUID = 0;
-
BugTrioDeathCount = 0;
CthunPhase = 0;
@@ -134,7 +127,7 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 identifier) const override
+ ObjectGuid GetGuidData(uint32 identifier) const override
{
switch (identifier)
{
@@ -151,8 +144,8 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript
case DATA_VISCIDUS:
return ViscidusGUID;
}
- return 0;
- } // end GetData64
+ return ObjectGuid::Empty;
+ } // end GetGuidData
void SetData(uint32 type, uint32 data) override
{
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
index b8f6c0ed80e..7b20e5dd8a9 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
@@ -103,14 +103,16 @@ public:
gatherOthersWhenAggro = true;
}
- uint64 NearbyGUID[3];
+ ObjectGuid NearbyGUID[3];
void ClearBuddyList()
{
- NearbyGUID[0] = NearbyGUID[1] = NearbyGUID[2] = 0;
+ NearbyGUID[0].Clear();
+ NearbyGUID[1].Clear();
+ NearbyGUID[2].Clear();
}
- void AddBuddyToList(uint64 CreatureGUID)
+ void AddBuddyToList(ObjectGuid CreatureGUID)
{
if (CreatureGUID == me->GetGUID())
return;
@@ -130,7 +132,7 @@ public:
void GiveBuddyMyList(Creature* c)
{
aqsentinelAI* cai = ENSURE_AI(aqsentinelAI, (c)->AI());
- for (int i=0; i<3; ++i)
+ for (int32 i = 0; i < 3; ++i)
if (NearbyGUID[i] && NearbyGUID[i] != c->GetGUID())
cai->AddBuddyToList(NearbyGUID[i]);
cai->AddBuddyToList(me->GetGUID());
@@ -138,14 +140,14 @@ public:
void SendMyListToBuddies()
{
- for (int i=0; i<3; ++i)
+ for (int32 i = 0; i < 3; ++i)
if (Creature* pNearby = ObjectAccessor::GetCreature(*me, NearbyGUID[i]))
GiveBuddyMyList(pNearby);
}
void CallBuddiesToAttack(Unit* who)
{
- for (int i=0; i<3; ++i)
+ for (int32 i = 0; i < 3; ++i)
{
Creature* c = ObjectAccessor::GetCreature(*me, NearbyGUID[i]);
if (c)
@@ -222,7 +224,7 @@ public:
{
if (!me->isDead())
{
- for (int i=0; i<3; ++i)
+ for (int i = 0; i < 3; ++i)
{
if (!NearbyGUID[i])
continue;
@@ -252,7 +254,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- for (int ni=0; ni<3; ++ni)
+ for (int ni = 0; ni < 3; ++ni)
{
Creature* sent = ObjectAccessor::GetCreature(*me, NearbyGUID[ni]);
if (!sent)
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
index bb2fc8bca20..5d7202588a9 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
@@ -46,7 +46,7 @@ public:
uint32 m_auiEncounter[MAX_ENCOUNTER];
bool yelled;
- uint64 NaralexGUID;
+ ObjectGuid NaralexGUID;
void Initialize() override
{
@@ -54,7 +54,6 @@ public:
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
yelled = false;
- NaralexGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -99,10 +98,10 @@ public:
return 0;
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
if (data == DATA_NARALEX)return NaralexGUID;
- return 0;
+ return ObjectGuid::Empty;
}
std::string GetSaveData() override
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
index bb872421197..522d6eee464 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
@@ -259,7 +259,7 @@ public:
++eventProgress;
eventTimer = 15000;
//CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false);
- if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
+ if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
DoCast(naralex, SPELL_NARALEXS_AWAKENING, true);
Talk(EMOTE_AWAKENING_RITUAL);
}
@@ -268,7 +268,7 @@ public:
{
++eventProgress;
eventTimer = 15000;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
+ if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
naralex->AI()->Talk(EMOTE_TROUBLED_SLEEP);
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943f, 199.701f, -103.529f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08f, 221.13f, -103.609f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
@@ -279,7 +279,7 @@ public:
{
++eventProgress;
eventTimer = 30000;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
+ if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
naralex->AI()->Talk(EMOTE_WRITHE_IN_AGONY);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413f, 207.188f, -102.469f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857f, 218.645f, -102.905f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
@@ -293,7 +293,7 @@ public:
if (eventProgress == 5)
{
++eventProgress;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
+ if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
naralex->AI()->Talk(EMOTE_HORRENDOUS_VISION);
me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872f, 262.905f, -103.503f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
Talk(SAY_MUTANUS_THE_DEVOURER);
@@ -304,7 +304,7 @@ public:
{
++eventProgress;
eventTimer = 3000;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
+ if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
{
if (me->HasAura(SPELL_NARALEXS_AWAKENING))
me->RemoveAura(SPELL_NARALEXS_AWAKENING);
@@ -318,7 +318,7 @@ public:
{
++eventProgress;
eventTimer = 6000;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
+ if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
naralex->AI()->Talk(SAY_THANK_YOU);
}
else
@@ -326,7 +326,7 @@ public:
{
++eventProgress;
eventTimer = 8000;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
+ if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
{
naralex->AI()->Talk(SAY_FAREWELL);
naralex->AddAura(SPELL_FLIGHT_FORM, naralex);
@@ -340,7 +340,7 @@ public:
{
++eventProgress;
eventTimer = 1500;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
+ if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ());
}
else
@@ -348,7 +348,7 @@ public:
{
++eventProgress;
eventTimer = 2500;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
+ if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
{
naralex->GetMotionMaster()->MovePoint(0, 117.095512f, 247.107971f, -96.167870f);
naralex->GetMotionMaster()->MovePoint(1, 90.388809f, 276.135406f, -83.389801f);
@@ -359,7 +359,7 @@ public:
else
if (eventProgress == 11)
{
- if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
+ if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
naralex->SetVisible(false);
me->SetVisible(false);
instance->SetData(TYPE_NARALEX_PART3, DONE);
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
index 83f1724130c..393028e0446 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
@@ -111,13 +111,13 @@ public:
instance_zulfarrak_InstanceMapScript(Map* map) : InstanceScript(map) { }
uint32 GahzRillaEncounter;
- uint64 ZumrahGUID;
- uint64 BlyGUID;
- uint64 WeegliGUID;
- uint64 OroGUID;
- uint64 RavenGUID;
- uint64 MurtaGUID;
- uint64 EndDoorGUID;
+ ObjectGuid ZumrahGUID;
+ ObjectGuid BlyGUID;
+ ObjectGuid WeegliGUID;
+ ObjectGuid OroGUID;
+ ObjectGuid RavenGUID;
+ ObjectGuid MurtaGUID;
+ ObjectGuid EndDoorGUID;
uint32 PyramidPhase;
uint32 major_wave_Timer;
uint32 minor_wave_Timer;
@@ -127,14 +127,6 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
- GahzRillaEncounter = NOT_STARTED;
- ZumrahGUID = 0;
- BlyGUID = 0;
- WeegliGUID = 0;
- OroGUID = 0;
- RavenGUID = 0;
- MurtaGUID = 0;
- EndDoorGUID = 0;
PyramidPhase = 0;
major_wave_Timer = 0;
minor_wave_Timer = 0;
@@ -198,7 +190,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -217,7 +209,7 @@ public:
case GO_END_DOOR:
return EndDoorGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
void SetData(uint32 type, uint32 data) override
@@ -315,11 +307,11 @@ public:
};
}
- std::list<uint64> addsAtBase, movedadds;
+ GuidList addsAtBase, movedadds;
void MoveNPCIfAlive(uint32 entry, float x, float y, float z, float o)
{
- if (Creature* npc = instance->GetCreature(GetData64(entry)))
+ if (Creature* npc = instance->GetCreature(GetGuidData(entry)))
{
if (npc->IsAlive())
{
@@ -346,7 +338,7 @@ public:
bool IsWaveAllDead()
{
- for (std::list<uint64>::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr)
+ for (GuidList::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr)
{
if (Creature* add = instance->GetCreature((*itr)))
{
@@ -354,7 +346,7 @@ public:
return false;
}
}
- for (std::list<uint64>::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr)
+ for (GuidList::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr)
{
if (Creature* add = instance->GetCreature(((*itr))))
{
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
index 47d269a00ff..443bd1578d7 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
@@ -108,7 +108,6 @@ public:
instance = creature->GetInstanceScript();
postGossipStep = 0;
Text_Timer = 0;
- PlayerGUID = 0;
}
void Initialize()
@@ -123,7 +122,7 @@ public:
uint32 Text_Timer;
uint32 ShieldBash_Timer;
uint32 Revenge_Timer; //this is wrong, spell should never be used unless me->GetVictim() dodge, parry or block attack. Trinity support required.
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
void Reset() override
{
@@ -142,7 +141,7 @@ public:
{
case 1:
//weegli doesn't fight - he goes & blows up the door
- if (Creature* pWeegli = instance->instance->GetCreature(instance->GetData64(ENTRY_WEEGLI)))
+ if (Creature* pWeegli = instance->instance->GetCreature(instance->GetGuidData(ENTRY_WEEGLI)))
pWeegli->AI()->DoAction(0);
Talk(SAY_1);
Text_Timer = 5000;
@@ -195,7 +194,7 @@ public:
void switchFactionIfAlive(uint32 entry)
{
- if (Creature* crew = ObjectAccessor::GetCreature(*me, instance->GetData64(entry)))
+ if (Creature* crew = ObjectAccessor::GetCreature(*me, instance->GetGuidData(entry)))
if (crew->IsAlive())
crew->setFaction(FACTION_HOSTILE);
}
@@ -230,7 +229,7 @@ public:
private:
void initBlyCrewMember(InstanceScript* instance, uint32 entry, float x, float y, float z)
{
- if (Creature* crew = instance->instance->GetCreature(instance->GetData64(entry)))
+ if (Creature* crew = instance->instance->GetCreature(instance->GetGuidData(entry)))
{
crew->SetReactState(REACT_AGGRESSIVE);
crew->SetWalk(true);
@@ -370,7 +369,7 @@ public:
else
if (destroyingDoor)
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_END_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_END_DOOR));
/// @todo leave the area...
me->DespawnOrUnsummon();
};
diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
index 7974e1c0347..df695727866 100644
--- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
@@ -67,7 +67,7 @@ public:
void Initialize()
{
- pCaster = 0;
+ pCaster.Clear();
SayThanksTimer = 0;
RunAwayTimer = 0;
@@ -76,7 +76,7 @@ public:
CanSayHelp = true;
}
- uint64 pCaster;
+ ObjectGuid pCaster;
uint32 SayThanksTimer;
uint32 RunAwayTimer;
@@ -430,13 +430,13 @@ public:
void Initialize()
{
- SparkGUID = 0;
+ SparkGUID.Clear();
Step = 0;
EventStarted = false;
SayTimer = 0;
}
- uint64 SparkGUID;
+ ObjectGuid SparkGUID;
uint8 Step;
uint32 SayTimer;
@@ -527,7 +527,7 @@ public:
for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE && (*itr)->HasAura(SPELL_TREE_DISGUISE))
- (*itr)->KilledMonsterCredit(NPC_SPARK, 0);
+ (*itr)->KilledMonsterCredit(NPC_SPARK);
}
void DespawnNagaFlag(bool despawn)
@@ -686,7 +686,7 @@ class npc_stillpine_capitive : public CreatureScript
void Initialize()
{
- _playerGUID = 0;
+ _playerGUID.Clear();
_movementComplete = false;
}
@@ -736,7 +736,7 @@ class npc_stillpine_capitive : public CreatureScript
}
private:
- uint64 _playerGUID;
+ ObjectGuid _playerGUID;
EventMap _events;
bool _movementComplete;
};
diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
index 81a175b57b7..5e2f4519b1e 100644
--- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
@@ -64,7 +64,7 @@ public:
{
case 0:
if (Player* player = killer->ToPlayer())
- player->KilledMonsterCredit(NPC_EXPEDITION_RESEARCHER, 0);
+ player->KilledMonsterCredit(NPC_EXPEDITION_RESEARCHER);
break;
case 1:
case 2:
diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp
index 5cb58058151..371784aec42 100644
--- a/src/server/scripts/Kalimdor/zone_desolace.cpp
+++ b/src/server/scripts/Kalimdor/zone_desolace.cpp
@@ -100,7 +100,7 @@ public:
{
if (player->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) && creature->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF))
{
- player->TalkedToCreature(creature->GetEntry(), 0);
+ player->TalkedToCreature(creature->GetEntry(), ObjectGuid::Empty);
player->RemoveAurasDueToSpell(SPELL_KODO_KOMBO_PLAYER_BUFF);
}
diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
index 46d4d3cd88c..e0b03d54f69 100644
--- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
+++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
@@ -652,7 +652,7 @@ public:
if (Creature* prisoner = go->FindNearestCreature(NPC_THERAMORE_PRISONER, 1.0f))
{
if (player)
- player->KilledMonsterCredit(NPC_THERAMORE_PRISONER, 0);
+ player->KilledMonsterCredit(NPC_THERAMORE_PRISONER);
prisoner->AI()->Talk(SAY_FREE); // We also emote cry here (handled in creature_text.emote)
prisoner->DespawnOrUnsummon(6000);
diff --git a/src/server/scripts/Kalimdor/zone_felwood.cpp b/src/server/scripts/Kalimdor/zone_felwood.cpp
index f8d9d1bbc2a..e4d5925c950 100644
--- a/src/server/scripts/Kalimdor/zone_felwood.cpp
+++ b/src/server/scripts/Kalimdor/zone_felwood.cpp
@@ -77,7 +77,7 @@ public:
lasher_clicked = true;
if (Player* player = clicker->ToPlayer())
- player->KilledMonsterCredit(NPC_WHISPERWIND_LASHER, 0);
+ player->KilledMonsterCredit(NPC_WHISPERWIND_LASHER);
}
void UpdateAI(uint32 diff) override
diff --git a/src/server/scripts/Kalimdor/zone_mulgore.cpp b/src/server/scripts/Kalimdor/zone_mulgore.cpp
index 0ad44c29b13..2ee3d20e44d 100644
--- a/src/server/scripts/Kalimdor/zone_mulgore.cpp
+++ b/src/server/scripts/Kalimdor/zone_mulgore.cpp
@@ -70,14 +70,14 @@ public:
{
EventActive = false;
IsMovingToLunch = false;
- PlayerGUID = 0;
+ PlayerGUID.Clear();
EventTimer = 5000;
EventPhase = 0;
}
bool EventActive;
bool IsMovingToLunch;
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
uint32 EventTimer;
uint8 EventPhase;
diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp
index e6e03d923c9..6bb33cf2cd4 100644
--- a/src/server/scripts/Kalimdor/zone_silithus.cpp
+++ b/src/server/scripts/Kalimdor/zone_silithus.cpp
@@ -97,7 +97,7 @@ public:
case GOSSIP_ACTION_INFO_DEF + 6:
player->SEND_GOSSIP_MENU(7761, creature->GetGUID());
//'kill' our trigger to update quest status
- player->KilledMonsterCredit(TRIGGER_RUTGAR, 0);
+ player->KilledMonsterCredit(TRIGGER_RUTGAR);
break;
case GOSSIP_ACTION_INFO_DEF + 9:
@@ -123,7 +123,7 @@ public:
case GOSSIP_ACTION_INFO_DEF + 14:
player->SEND_GOSSIP_MENU(7767, creature->GetGUID());
//'kill' our trigger to update quest status
- player->KilledMonsterCredit(TRIGGER_FRANKAL, 0);
+ player->KilledMonsterCredit(TRIGGER_FRANKAL);
break;
}
return true;
@@ -431,24 +431,24 @@ public:
{
AnimationTimer = 1500;
AnimationCount = 0;
- AnachronosQuestTriggerGUID = 0;
- MerithraGUID = 0;
- ArygosGUID = 0;
- CaelestraszGUID = 0;
- FandralGUID = 0;
- PlayerGUID = 0;
+ AnachronosQuestTriggerGUID.Clear();
+ MerithraGUID.Clear();
+ ArygosGUID.Clear();
+ CaelestraszGUID.Clear();
+ FandralGUID.Clear();
+ PlayerGUID.Clear();
eventEnd = false;
}
uint32 AnimationTimer;
uint8 AnimationCount;
- uint64 AnachronosQuestTriggerGUID;
- uint64 MerithraGUID;
- uint64 ArygosGUID;
- uint64 CaelestraszGUID;
- uint64 FandralGUID;
- uint64 PlayerGUID;
+ ObjectGuid AnachronosQuestTriggerGUID;
+ ObjectGuid MerithraGUID;
+ ObjectGuid ArygosGUID;
+ ObjectGuid CaelestraszGUID;
+ ObjectGuid FandralGUID;
+ ObjectGuid PlayerGUID;
bool eventEnd;
void Reset() override
@@ -485,7 +485,7 @@ public:
Fandral->AI()->Talk(FANDRAL_SAY_1, me);
break;
case 2:
- Fandral->SetTarget(0);
+ Fandral->SetTarget(ObjectGuid::Empty);
Merithra->AI()->Talk(MERITHRA_EMOTE_1);
break;
case 3:
@@ -502,7 +502,7 @@ public:
Merithra->AI()->Talk(MERITHRA_SAY_2);
break;
case 7:
- Caelestrasz->SetTarget(0);
+ Caelestrasz->SetTarget(ObjectGuid::Empty);
Merithra->GetMotionMaster()->MoveCharge(-8065, 1530, 2.61f, 10);
break;
case 8:
@@ -769,14 +769,14 @@ public:
void Initialize()
{
- MobGUID = 0;
- PlayerGUID = 0;
+ MobGUID.Clear();
+ PlayerGUID.Clear();
Timers = false;
hasTarget = false;
}
- uint64 MobGUID;
- uint64 PlayerGUID;
+ ObjectGuid MobGUID;
+ ObjectGuid PlayerGUID;
uint32 SpellTimer1, SpellTimer2, SpellTimer3, SpellTimer4;
bool Timers;
bool hasTarget;
@@ -890,7 +890,7 @@ public:
void Initialize()
{
- PlayerGUID = 0;
+ PlayerGUID.Clear();
WaveTimer = 2000;
AnnounceTimer = 1000;
@@ -902,7 +902,7 @@ public:
Failed = false;
}
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
uint32 WaveTimer;
uint32 AnnounceTimer;
diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp
index 6c0151ff931..4528409c126 100644
--- a/src/server/scripts/Kalimdor/zone_tanaris.cpp
+++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp
@@ -46,7 +46,12 @@ enum Aquementas
AGGRO_YELL_AQUE = 0,
SPELL_AQUA_JET = 13586,
- SPELL_FROST_SHOCK = 15089
+ SPELL_FROST_SHOCK = 15089,
+
+ ITEM_BOOK_OF_AQUOR = 11169,
+ ITEM_SILVERY_CLAWS = 11172,
+ ITEM_IRONTREE_HEART = 11173,
+ ITEM_SILVER_TOTEM = 11522
};
class npc_aquementas : public CreatureScript
@@ -94,15 +99,15 @@ public:
{
Player* player = receiver->ToPlayer();
- if (player && player->HasItemCount(11169, 1, false) &&
- player->HasItemCount(11172, 11, false) &&
- player->HasItemCount(11173, 1, false) &&
- !player->HasItemCount(11522, 1, true))
+ if (player && player->HasItemCount(ITEM_BOOK_OF_AQUOR, 1, false) &&
+ player->HasItemCount(ITEM_SILVERY_CLAWS, 11, false) &&
+ player->HasItemCount(ITEM_IRONTREE_HEART, 1, false) &&
+ !player->HasItemCount(ITEM_SILVER_TOTEM, 1, true))
{
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, NULL);
if (msg == EQUIP_ERR_OK)
- player->StoreNewItem(dest, 11522, 1, true);
+ player->StoreNewItem(dest, ITEM_SILVER_TOTEM, true);
}
}
@@ -172,7 +177,10 @@ enum CustodianOfTime
WHISPER_CUSTODIAN_11 = 10,
WHISPER_CUSTODIAN_12 = 11,
WHISPER_CUSTODIAN_13 = 12,
- WHISPER_CUSTODIAN_14 = 13
+ WHISPER_CUSTODIAN_14 = 13,
+
+ QUEST_CAVERNS_OF_TIME = 10277,
+ SPELL_QID_10277 = 34883
};
class npc_custodian_of_time : public CreatureScript
@@ -248,9 +256,9 @@ public:
break;
case 24:
Talk(WHISPER_CUSTODIAN_14, player);
- DoCast(player, 34883);
+ DoCast(player, SPELL_QID_10277);
// below here is temporary workaround, to be removed when spell works properly
- player->AreaExploredOrEventHappens(10277);
+ player->AreaExploredOrEventHappens(QUEST_CAVERNS_OF_TIME);
break;
}
}
@@ -478,14 +486,14 @@ public:
PostEventTimer = 1000;
PhasePostEvent = 0;
- TortaGUID = 0;
+ TortaGUID.Clear();
}
uint32 CheckSpeechTimer;
uint32 PostEventTimer;
uint32 PhasePostEvent;
- uint64 TortaGUID;
+ ObjectGuid TortaGUID;
void Reset() override
{
diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
index 3670e225fd7..c2b0d864b79 100644
--- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
@@ -328,14 +328,14 @@ public:
WaveTimer = 600000;
ChallengerChecker = 0;
Wave = 0;
- PlayerGUID = 0;
+ PlayerGUID.Clear();
for (uint8 i = 0; i < 6; ++i)
{
- AffrayChallenger[i] = 0;
+ AffrayChallenger[i].Clear();
ChallengerDown[i] = false;
}
- BigWill = 0;
+ BigWill.Clear();
}
bool EventInProgress;
@@ -345,9 +345,9 @@ public:
uint8 Wave;
uint32 WaveTimer;
uint32 ChallengerChecker;
- uint64 PlayerGUID;
- uint64 AffrayChallenger[6];
- uint64 BigWill;
+ ObjectGuid PlayerGUID;
+ ObjectGuid AffrayChallenger[6];
+ ObjectGuid BigWill;
void Reset() override
{
diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp
index 58d9b115398..ee73d9b27a9 100644
--- a/src/server/scripts/Kalimdor/zone_winterspring.cpp
+++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp
@@ -318,11 +318,6 @@ public:
DialogueHelper(introDialogue)
{
Initialize();
- _firstPriestessGUID = 0;
- _secondPriestessGUID = 0;
- _guardEluneGUID = 0;
- _voiceEluneGUID = 0;
- _altarGUID = 0;
}
void Initialize()
@@ -332,11 +327,11 @@ public:
uint32 _delayTimer;
- uint64 _firstPriestessGUID;
- uint64 _secondPriestessGUID;
- uint64 _guardEluneGUID;
- uint64 _voiceEluneGUID;
- uint64 _altarGUID;
+ ObjectGuid _firstPriestessGUID;
+ ObjectGuid _secondPriestessGUID;
+ ObjectGuid _guardEluneGUID;
+ ObjectGuid _voiceEluneGUID;
+ ObjectGuid _altarGUID;
void Reset() override
{
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
index 7ae8730d57b..4cb401a6e16 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
@@ -107,8 +107,8 @@ public:
if (!bFirstTime)
instance->SetBossState(DATA_JEDOGA_SHADOWSEEKER, FAIL);
- instance->SetData64(DATA_PL_JEDOGA_TARGET, 0);
- instance->SetData64(DATA_ADD_JEDOGA_OPFER, 0);
+ instance->SetGuidData(DATA_PL_JEDOGA_TARGET, ObjectGuid::Empty);
+ instance->SetGuidData(DATA_ADD_JEDOGA_OPFER, ObjectGuid::Empty);
instance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0);
MoveUp();
@@ -215,7 +215,7 @@ public:
}
else
{
- if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PL_JEDOGA_TARGET)))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PL_JEDOGA_TARGET)))
{
AttackStart(target);
instance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0);
@@ -248,13 +248,14 @@ public:
void OpferRufen()
{
- uint64 opfer = instance->GetData64(DATA_ADD_JEDOGA_INITIAND);
+ ObjectGuid opfer = instance->GetGuidData(DATA_ADD_JEDOGA_INITIAND);
if (opfer)
{
Talk(TEXT_SACRIFICE_1);
- instance->SetData64(DATA_ADD_JEDOGA_OPFER, opfer);
- } else
+ instance->SetGuidData(DATA_ADD_JEDOGA_OPFER, opfer);
+ }
+ else
bCanDown = true;
}
@@ -380,7 +381,7 @@ public:
if (bWalking)
{
- if (Creature* boss = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_JEDOGA_SHADOWSEEKER)))
+ if (Creature* boss = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JEDOGA_SHADOWSEEKER)))
{
if (!ENSURE_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok)
ENSURE_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = true;
@@ -389,12 +390,12 @@ public:
boss->AI()->DoAction(ACTION_INITIAND_KILLED);
}
- instance->SetData64(DATA_ADD_JEDOGA_OPFER, 0);
+ instance->SetGuidData(DATA_ADD_JEDOGA_OPFER, ObjectGuid::Empty);
bWalking = false;
}
if (killer->GetTypeId() == TYPEID_PLAYER)
- instance->SetData64(DATA_PL_JEDOGA_TARGET, killer->GetGUID());
+ instance->SetGuidData(DATA_PL_JEDOGA_TARGET, killer->GetGUID());
}
void EnterCombat(Unit* /*who*/) override
@@ -427,7 +428,7 @@ public:
{
case 1:
{
- Creature* boss = me->GetMap()->GetCreature(instance->GetData64(DATA_JEDOGA_SHADOWSEEKER));
+ Creature* boss = me->GetMap()->GetCreature(instance->GetGuidData(DATA_JEDOGA_SHADOWSEEKER));
if (boss)
{
ENSURE_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok = true;
@@ -443,7 +444,7 @@ public:
{
if (bCheckTimer <= diff)
{
- if (me->GetGUID() == instance->GetData64(DATA_ADD_JEDOGA_OPFER) && !bWalking)
+ if (me->GetGUID() == instance->GetGuidData(DATA_ADD_JEDOGA_OPFER) && !bWalking)
{
me->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL);
me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, false);
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
index 9cc8540342f..cf80f21d290 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
@@ -88,16 +88,14 @@ class boss_prince_taldaram : public CreatureScript
boss_prince_taldaramAI(Creature* creature) : BossAI(creature, DATA_PRINCE_TALDARAM)
{
me->SetDisableGravity(true);
- _flameSphereTargetGUID = 0;
- _embraceTargetGUID = 0;
_embraceTakenDamage = 0;
}
void Reset() override
{
_Reset();
- _flameSphereTargetGUID = 0;
- _embraceTargetGUID = 0;
+ _flameSphereTargetGUID.Clear();
+ _embraceTargetGUID.Clear();
_embraceTakenDamage = 0;
}
@@ -194,7 +192,7 @@ class boss_prince_taldaram : public CreatureScript
events.ScheduleEvent(EVENT_FEEDING, 20000);
break;
case EVENT_FEEDING:
- _embraceTargetGUID = 0;
+ _embraceTargetGUID.Clear();
break;
default:
break;
@@ -213,7 +211,7 @@ class boss_prince_taldaram : public CreatureScript
_embraceTakenDamage += damage;
if (_embraceTakenDamage > DUNGEON_MODE<uint32>(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG))
{
- _embraceTargetGUID = 0;
+ _embraceTargetGUID.Clear();
me->CastStop();
}
}
@@ -231,7 +229,7 @@ class boss_prince_taldaram : public CreatureScript
return;
if (victim->GetGUID() == _embraceTargetGUID)
- _embraceTargetGUID = 0;
+ _embraceTargetGUID.Clear();
Talk(SAY_SLAY);
}
@@ -263,12 +261,12 @@ class boss_prince_taldaram : public CreatureScript
me->SetDisableGravity(false);
me->GetMotionMaster()->MoveLand(0, me->GetHomePosition());
Talk(SAY_WARNING);
- instance->HandleGameObject(instance->GetData64(DATA_PRINCE_TALDARAM_PLATFORM), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_PRINCE_TALDARAM_PLATFORM), true);
}
private:
- uint64 _flameSphereTargetGUID;
- uint64 _embraceTargetGUID;
+ ObjectGuid _flameSphereTargetGUID;
+ ObjectGuid _embraceTargetGUID;
uint32 _embraceTakenDamage;
};
@@ -288,7 +286,6 @@ class npc_prince_taldaram_flame_sphere : public CreatureScript
{
npc_prince_taldaram_flame_sphereAI(Creature* creature) : ScriptedAI(creature)
{
- _flameSphereTargetGUID = 0;
}
void Reset() override
@@ -296,13 +293,13 @@ class npc_prince_taldaram_flame_sphere : public CreatureScript
DoCast(me, SPELL_FLAME_SPHERE_SPAWN_EFFECT, true);
DoCast(me, SPELL_FLAME_SPHERE_VISUAL, true);
- _flameSphereTargetGUID = 0;
+ _flameSphereTargetGUID.Clear();
_events.Reset();
_events.ScheduleEvent(EVENT_START_MOVE, 3 * IN_MILLISECONDS);
_events.ScheduleEvent(EVENT_DESPAWN, 13 * IN_MILLISECONDS);
}
- void SetGUID(uint64 guid, int32 /*id = 0*/) override
+ void SetGUID(ObjectGuid guid, int32 /*id = 0*/) override
{
_flameSphereTargetGUID = guid;
}
@@ -364,7 +361,7 @@ class npc_prince_taldaram_flame_sphere : public CreatureScript
private:
EventMap _events;
- uint64 _flameSphereTargetGUID;
+ ObjectGuid _flameSphereTargetGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -385,7 +382,7 @@ class go_prince_taldaram_sphere : public GameObjectScript
if (!instance)
return false;
- Creature* PrinceTaldaram = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_PRINCE_TALDARAM));
+ Creature* PrinceTaldaram = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_PRINCE_TALDARAM));
if (PrinceTaldaram && PrinceTaldaram->IsAlive())
{
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
index 7c9ed240959..0bb2010a9d6 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
@@ -39,21 +39,10 @@ class instance_ahnkahet : public InstanceMapScript
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- ElderNadoxGUID = 0;
- PrinceTaldaramGUID = 0;
- JedogaShadowseekerGUID = 0;
- AmanitarGUID = 0;
- HeraldVolazjGUID = 0;
-
- PrinceTaldaramPlatformGUID = 0;
- JedogaSacrifices = 0;
- JedogaTarget = 0;
SwitchTrigger = 0;
SpheresState[0] = 0;
SpheresState[1] = 0;
-
- InitiandGUIDs.clear();
}
void OnCreatureCreate(Creature* creature) override
@@ -90,7 +79,7 @@ class instance_ahnkahet : public InstanceMapScript
case GO_PRINCE_TALDARAM_PLATFORM:
PrinceTaldaramPlatformGUID = go->GetGUID();
if (GetBossState(DATA_PRINCE_TALDARAM) == DONE)
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_SPHERE_1:
if (SpheresState[0])
@@ -142,7 +131,7 @@ class instance_ahnkahet : public InstanceMapScript
SwitchTrigger = data;
break;
case DATA_JEDOGA_RESET_INITIANDS:
- for (uint64 guid : InitiandGUIDs)
+ for (ObjectGuid guid : InitiandGUIDs)
{
if (Creature* creature = instance->GetCreature(guid))
{
@@ -165,7 +154,7 @@ class instance_ahnkahet : public InstanceMapScript
case DATA_SPHERE_2:
return SpheresState[type - DATA_SPHERE_1];
case DATA_ALL_INITIAND_DEAD:
- for (uint64 guid : InitiandGUIDs)
+ for (ObjectGuid guid : InitiandGUIDs)
{
Creature* cr = instance->GetCreature(guid);
if (!cr || cr->IsAlive())
@@ -180,7 +169,7 @@ class instance_ahnkahet : public InstanceMapScript
return 0;
}
- void SetData64(uint32 type, uint64 data) override
+ void SetGuidData(uint32 type, ObjectGuid data) override
{
switch (type)
{
@@ -195,7 +184,7 @@ class instance_ahnkahet : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -213,16 +202,16 @@ class instance_ahnkahet : public InstanceMapScript
return PrinceTaldaramPlatformGUID;
case DATA_ADD_JEDOGA_INITIAND:
{
- std::vector<uint64> vInitiands;
- vInitiands.clear();
- for (uint64 guid : InitiandGUIDs)
+ GuidVector vInitiands;
+ vInitiands.reserve(InitiandGUIDs.size());
+ for (ObjectGuid guid : InitiandGUIDs)
{
Creature* cr = instance->GetCreature(guid);
if (cr && cr->IsAlive())
vInitiands.push_back(guid);
}
if (vInitiands.empty())
- return 0;
+ return ObjectGuid::Empty;
return Trinity::Containers::SelectRandomContainerElement(vInitiands);
}
@@ -233,7 +222,7 @@ class instance_ahnkahet : public InstanceMapScript
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
bool SetBossState(uint32 type, EncounterState state) override
@@ -246,11 +235,9 @@ class instance_ahnkahet : public InstanceMapScript
case DATA_JEDOGA_SHADOWSEEKER:
if (state == DONE)
{
- for (uint64 guid : InitiandGUIDs)
- {
+ for (ObjectGuid guid : InitiandGUIDs)
if (Creature* cr = instance->GetCreature(guid))
cr->DespawnOrUnsummon();
- }
}
break;
default:
@@ -271,17 +258,17 @@ class instance_ahnkahet : public InstanceMapScript
}
protected:
- uint64 ElderNadoxGUID;
- uint64 PrinceTaldaramGUID;
- uint64 JedogaShadowseekerGUID;
- uint64 AmanitarGUID;
- uint64 HeraldVolazjGUID;
+ ObjectGuid ElderNadoxGUID;
+ ObjectGuid PrinceTaldaramGUID;
+ ObjectGuid JedogaShadowseekerGUID;
+ ObjectGuid AmanitarGUID;
+ ObjectGuid HeraldVolazjGUID;
- uint64 PrinceTaldaramPlatformGUID;
- uint64 JedogaSacrifices;
- uint64 JedogaTarget;
+ ObjectGuid PrinceTaldaramPlatformGUID;
+ ObjectGuid JedogaSacrifices;
+ ObjectGuid JedogaTarget;
- std::set<uint64> InitiandGUIDs;
+ GuidSet InitiandGUIDs;
uint32 SpheresState[2];
uint8 SwitchTrigger;
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
index 49d0840f08a..1d437fb18a5 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
@@ -96,7 +96,6 @@ public:
VenomancerTimer = 0;
DatterTimer = 0;
DelayTimer = 0;
- ImpaleTarget = 0;
}
void Initialize()
@@ -110,6 +109,7 @@ public:
UndergroundPhase = 0;
Channeling = false;
ImpalePhase = IMPALE_PHASE_TARGET;
+ ImpaleTarget.Clear();
}
InstanceScript* instance;
@@ -130,7 +130,7 @@ public:
uint32 ImpaleTimer;
uint32 ImpalePhase;
- uint64 ImpaleTarget;
+ ObjectGuid ImpaleTarget;
SummonList Summons;
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp
index 00aa2120225..bdb060815d2 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp
@@ -441,7 +441,7 @@ class npc_watcher_gashra : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- Creature* krikthir = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KRIKTHIR_THE_GATEWATCHER));
+ Creature* krikthir = _instance->GetCreature(DATA_KRIKTHIR_THE_GATEWATCHER);
if (krikthir && krikthir->IsAlive())
krikthir->AI()->Talk(SAY_PREFIGHT);
}
@@ -514,7 +514,7 @@ class npc_watcher_narjil : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- Creature* krikthir = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KRIKTHIR_THE_GATEWATCHER));
+ Creature* krikthir = _instance->GetCreature(DATA_KRIKTHIR_THE_GATEWATCHER);
if (krikthir && krikthir->IsAlive())
krikthir->AI()->Talk(SAY_PREFIGHT);
}
@@ -591,7 +591,7 @@ class npc_watcher_silthik : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- Creature* krikthir = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KRIKTHIR_THE_GATEWATCHER));
+ Creature* krikthir = _instance->GetCreature(DATA_KRIKTHIR_THE_GATEWATCHER);
if (krikthir && krikthir->IsAlive())
krikthir->AI()->Talk(SAY_PREFIGHT);
}
@@ -645,9 +645,7 @@ class npc_watcher_silthik : public CreatureScript
class achievement_watch_him_die : public AchievementCriteriaScript
{
public:
- achievement_watch_him_die() : AchievementCriteriaScript("achievement_watch_him_die")
- {
- }
+ achievement_watch_him_die() : AchievementCriteriaScript("achievement_watch_him_die") { }
bool OnCheck(Player* /*player*/, Unit* target) override
{
@@ -660,7 +658,7 @@ class achievement_watch_him_die : public AchievementCriteriaScript
for (uint8 n = 0; n < 3; ++n)
{
- if (Creature* watcher = ObjectAccessor::GetCreature(*target, instance->GetData64(DATA_WATCHER_GASHRA + n)))
+ if (Creature* watcher = instance->GetCreature(DATA_WATCHER_GASHRA + n))
if (!watcher->IsAlive())
return false;
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
index 1ae68f5a33e..1f474e5ddd5 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
@@ -28,6 +28,15 @@ DoorData const doorData[] =
{ 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END
};
+ObjectData const creatureData[] =
+{
+ { NPC_KRIKTHIR, DATA_KRIKTHIR_THE_GATEWATCHER },
+ { NPC_WATCHER_NARJIL, DATA_WATCHER_GASHRA },
+ { NPC_WATCHER_GASHRA, DATA_WATCHER_SILTHIK },
+ { NPC_WATCHER_SILTHIK, DATA_WATCHER_NARJIL },
+ { 0, 0 } // END
+};
+
class instance_azjol_nerub : public InstanceMapScript
{
public:
@@ -40,102 +49,8 @@ class instance_azjol_nerub : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
-
- KrikthirGUID = 0;
- HadronoxGUID = 0;
- AnubarakGUID = 0;
- WatcherGashraGUID = 0;
- WatcherSilthikGUID = 0;
- WatcherNarjilGUID = 0;
- }
-
- void OnCreatureCreate(Creature* creature) override
- {
- switch (creature->GetEntry())
- {
- case NPC_KRIKTHIR:
- KrikthirGUID = creature->GetGUID();
- break;
- case NPC_HADRONOX:
- HadronoxGUID = creature->GetGUID();
- break;
- case NPC_ANUBARAK:
- AnubarakGUID = creature->GetGUID();
- break;
- case NPC_WATCHER_NARJIL:
- WatcherNarjilGUID = creature->GetGUID();
- break;
- case NPC_WATCHER_GASHRA:
- WatcherGashraGUID = creature->GetGUID();
- break;
- case NPC_WATCHER_SILTHIK:
- WatcherSilthikGUID = creature->GetGUID();
- break;
- default:
- break;
- }
- }
-
- void OnGameObjectCreate(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_KRIKTHIR_DOOR:
- case GO_ANUBARAK_DOOR_1:
- case GO_ANUBARAK_DOOR_2:
- case GO_ANUBARAK_DOOR_3:
- AddDoor(go, true);
- break;
- default:
- break;
- }
+ LoadObjectData(creatureData, nullptr);
}
-
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_KRIKTHIR_DOOR:
- case GO_ANUBARAK_DOOR_1:
- case GO_ANUBARAK_DOOR_2:
- case GO_ANUBARAK_DOOR_3:
- AddDoor(go, false);
- break;
- default:
- break;
- }
- }
-
- uint64 GetData64(uint32 type) const override
- {
- switch (type)
- {
- case DATA_KRIKTHIR_THE_GATEWATCHER:
- return KrikthirGUID;
- case DATA_HADRONOX:
- return HadronoxGUID;
- case DATA_ANUBARAK:
- return AnubarakGUID;
- case DATA_WATCHER_GASHRA:
- return WatcherGashraGUID;
- case DATA_WATCHER_SILTHIK:
- return WatcherSilthikGUID;
- case DATA_WATCHER_NARJIL:
- return WatcherNarjilGUID;
- default:
- break;
- }
-
- return 0;
- }
-
- protected:
- uint64 KrikthirGUID;
- uint64 HadronoxGUID;
- uint64 AnubarakGUID;
- uint64 WatcherGashraGUID;
- uint64 WatcherSilthikGUID;
- uint64 WatcherNarjilGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
index 77ced6acef1..6afb56316b3 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
@@ -184,15 +184,15 @@ public:
Talk(SAY_SARTHARION_DEATH);
_JustDied();
- if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON)))
+ if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TENEBRON)))
if (tenebron->IsAlive())
tenebron->DisappearAndDie();
- if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
+ if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON)))
if (shadron->IsAlive())
shadron->DisappearAndDie();
- if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON)))
+ if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON)))
if (vesperon->IsAlive())
vesperon->DisappearAndDie();
}
@@ -217,7 +217,7 @@ public:
void DrakeRespawn() // Drakes respawning system
{
- if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON)))
+ if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TENEBRON)))
{
tenebron->SetHomePosition(3239.07f, 657.235f, 86.8775f, 4.74729f);
if (tenebron->IsAlive())
@@ -237,7 +237,7 @@ public:
}
}
- if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
+ if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON)))
{
shadron->SetHomePosition(3363.06f, 525.28f, 98.362f, 4.76475f);
if (shadron->IsAlive())
@@ -257,7 +257,7 @@ public:
}
}
- if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON)))
+ if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON)))
{
vesperon->SetHomePosition(3145.68f, 520.71f, 89.7f, 4.64258f);
if (vesperon->IsAlive())
@@ -286,7 +286,7 @@ public:
//if at least one of the dragons are alive and are being called
bool _canUseWill = false;
- if (Creature* fetchTene = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON)))
+ if (Creature* fetchTene = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TENEBRON)))
{
if (fetchTene->IsAlive() && !fetchTene->GetVictim())
{
@@ -304,7 +304,7 @@ public:
}
}
- if (Creature* fetchShad = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
+ if (Creature* fetchShad = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON)))
{
if (fetchShad->IsAlive() && !fetchShad->GetVictim())
{
@@ -322,7 +322,7 @@ public:
}
}
- if (Creature* fetchVesp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON)))
+ if (Creature* fetchVesp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON)))
{
if (fetchVesp && fetchVesp->IsAlive() && !fetchVesp->GetVictim())
{
@@ -346,7 +346,7 @@ public:
void CallDragon(uint32 dataId)
{
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(dataId)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(dataId)))
{
if (temp->IsAlive() && !temp->GetVictim())
{
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
index 5e4a31d6b5e..9f55ca8dc17 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
@@ -35,10 +35,6 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
- sartharionGUID = 0;
- tenebronGUID = 0;
- shadronGUID = 0;
- vesperonGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -83,7 +79,7 @@ public:
return true;
}
- uint64 GetData64(uint32 Data) const override
+ ObjectGuid GetGuidData(uint32 Data) const override
{
switch (Data)
{
@@ -96,14 +92,14 @@ public:
case DATA_VESPERON:
return vesperonGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
protected:
- uint64 sartharionGUID;
- uint64 tenebronGUID;
- uint64 shadronGUID;
- uint64 vesperonGUID;
+ ObjectGuid sartharionGUID;
+ ObjectGuid tenebronGUID;
+ ObjectGuid shadronGUID;
+ ObjectGuid vesperonGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp
index 58d7c6141b4..f4ef869b0b4 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp
@@ -359,7 +359,7 @@ struct dummy_dragonAI : public ScriptedAI
return;
// Twilight Revenge to main boss
- if (Unit* sartharion = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SARTHARION)))
+ if (Unit* sartharion = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_SARTHARION)))
if (sartharion->IsAlive())
{
sartharion->RemoveAurasDueToSpell(spellId);
@@ -635,12 +635,12 @@ class npc_acolyte_of_shadron : public CreatureScript
//if not solo fight, buff main boss, else place debuff on mini-boss. both spells TARGET_SCRIPT
if (instance->GetBossState(DATA_SARTHARION) == IN_PROGRESS)
{
- if (Creature* sartharion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SARTHARION)))
+ if (Creature* sartharion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARTHARION)))
sartharion->AddAura(SPELL_GIFT_OF_TWILIGTH_SAR, sartharion);
}
else
{
- if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
+ if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON)))
shadron->AddAura(SPELL_GIFT_OF_TWILIGTH_SHA, shadron);
}
@@ -649,7 +649,7 @@ class npc_acolyte_of_shadron : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
+ if (ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON)))
instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED);
Map* map = me->GetMap();
@@ -662,7 +662,7 @@ class npc_acolyte_of_shadron : public CreatureScript
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
- if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT, 0) && !i->GetSource()->GetVictim())
+ if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT) && !i->GetSource()->GetVictim())
{
i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true);
i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true);
@@ -673,12 +673,12 @@ class npc_acolyte_of_shadron : public CreatureScript
}
// not solo fight, so main boss has debuff
- if (Creature* debuffTarget = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SARTHARION)))
+ if (Creature* debuffTarget = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARTHARION)))
if (debuffTarget->IsAlive() && debuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR))
debuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR);
// event not in progress, then solo fight and must remove debuff mini-boss
- if (Creature* debuffTarget = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON)))
+ if (Creature* debuffTarget = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON)))
if (debuffTarget->IsAlive() && debuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA))
debuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA);
}
@@ -732,7 +732,7 @@ class npc_acolyte_of_vesperon : public CreatureScript
me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP_ACO);
// remove twilight torment on Vesperon
- if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON)))
+ if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON)))
{
instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED);
@@ -750,14 +750,14 @@ class npc_acolyte_of_vesperon : public CreatureScript
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
- if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT, 0) && !i->GetSource()->GetVictim())
+ if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT) && !i->GetSource()->GetVictim())
{
i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true);
i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true);
i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT);
i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER);
}
- if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP, 0) && !i->GetSource()->GetVictim())
+ if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP) && !i->GetSource()->GetVictim())
i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP);
}
}
@@ -836,7 +836,7 @@ public:
if (events.ExecuteEvent() == EVENT_TWILIGHT_EGGS)
{
- if (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON)))
+ if (ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TENEBRON)))
instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED);
SpawnWhelps();
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp
index 4e02b3ad2e8..c826b8fc9ef 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp
@@ -132,7 +132,7 @@ class boss_baltharus_the_warborn : public CreatureScript
{
_JustDied();
Talk(SAY_DEATH);
- if (Creature* xerestrasza = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_XERESTRASZA)))
+ if (Creature* xerestrasza = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_XERESTRASZA)))
xerestrasza->AI()->DoAction(ACTION_BALTHARUS_DEATH);
}
@@ -190,7 +190,7 @@ class boss_baltharus_the_warborn : public CreatureScript
Talk(SAY_BALTHARUS_INTRO);
break;
case EVENT_OOC_CHANNEL:
- if (Creature* channelTarget = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CRYSTAL_CHANNEL_TARGET)))
+ if (Creature* channelTarget = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CRYSTAL_CHANNEL_TARGET)))
DoCast(channelTarget, SPELL_BARRIER_CHANNEL);
events.ScheduleEvent(EVENT_OOC_CHANNEL, 7000, 0, PHASE_INTRO);
break;
@@ -258,7 +258,7 @@ class npc_baltharus_the_warborn_clone : public CreatureScript
void JustDied(Unit* killer) override
{
// This is here because DamageTaken wont trigger if the damage is deadly.
- if (Creature* baltharus = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_BALTHARUS_THE_WARBORN)))
+ if (Creature* baltharus = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_BALTHARUS_THE_WARBORN)))
killer->Kill(baltharus);
}
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
index e41ea8de38b..f4e36b87f7d 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
@@ -163,10 +163,10 @@ class boss_general_zarithrian : public CreatureScript
{
case EVENT_SUMMON_ADDS:
{
- if (Creature* stalker1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ZARITHRIAN_SPAWN_STALKER_1)))
+ if (Creature* stalker1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ZARITHRIAN_SPAWN_STALKER_1)))
stalker1->CastSpell(stalker1, SPELL_SUMMON_FLAMECALLER, false);
- if (Creature* stalker2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ZARITHRIAN_SPAWN_STALKER_2)))
+ if (Creature* stalker2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ZARITHRIAN_SPAWN_STALKER_2)))
stalker2->CastSpell(stalker2, SPELL_SUMMON_FLAMECALLER, false);
Talk(SAY_ADDS);
@@ -236,7 +236,7 @@ class npc_onyx_flamecaller : public CreatureScript
void IsSummonedBy(Unit* /*summoner*/) override
{
// Let Zarithrian count as summoner.
- if (Creature* zarithrian = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_GENERAL_ZARITHRIAN)))
+ if (Creature* zarithrian = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_GENERAL_ZARITHRIAN)))
zarithrian->AI()->JustSummoned(me);
}
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
index 565c581a727..58f62c8bf4e 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
@@ -266,7 +266,7 @@ struct generic_halionAI : public BossAI
// Rough radius, it is not an exactly perfect circle
if (me->GetDistance2d(HalionControllerSpawnPos.GetPositionX(), HalionControllerSpawnPos.GetPositionY()) > 48.5f)
{
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->EnterEvadeMode();
return false;
}
@@ -351,7 +351,7 @@ class boss_halion : public CreatureScript
events.ScheduleEvent(EVENT_METEOR_STRIKE, urand(20000, 25000));
events.ScheduleEvent(EVENT_FIERY_COMBUSTION, urand(15000, 18000));
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->SetData(DATA_FIGHT_PHASE, PHASE_ONE);
}
@@ -362,11 +362,11 @@ class boss_halion : public CreatureScript
Talk(SAY_DEATH);
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
- if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TWILIGHT_HALION)))
+ if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TWILIGHT_HALION)))
if (twilightHalion->IsAlive())
twilightHalion->Kill(twilightHalion);
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER)))
if (controller->IsAlive())
controller->Kill(controller);
}
@@ -384,7 +384,7 @@ class boss_halion : public CreatureScript
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_TWILIGHT_PHASING);
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->SetData(DATA_FIGHT_PHASE, PHASE_TWO);
return;
}
@@ -395,7 +395,7 @@ class boss_halion : public CreatureScript
if (!me->IsInPhase(attacker))
return;
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->SetData(DATA_MATERIAL_DAMAGE_TAKEN, damage);
}
}
@@ -415,8 +415,8 @@ class boss_halion : public CreatureScript
case EVENT_ACTIVATE_FIREWALL:
// Flame ring is activated 5 seconds after starting encounter, DOOR_TYPE_ROOM is only instant.
for (uint8 i = DATA_FLAME_RING; i <= DATA_TWILIGHT_FLAME_RING; ++i)
- if (GameObject* flameRing = ObjectAccessor::GetGameObject(*me, instance->GetData64(i)))
- instance->HandleGameObject(instance->GetData64(DATA_FLAME_RING), false, flameRing);
+ if (GameObject* flameRing = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(i)))
+ instance->HandleGameObject(instance->GetGuidData(DATA_FLAME_RING), false, flameRing);
break;
case EVENT_METEOR_STRIKE:
{
@@ -475,7 +475,7 @@ class boss_twilight_halion : public CreatureScript
{
boss_twilight_halionAI(Creature* creature) : generic_halionAI(creature, DATA_TWILIGHT_HALION)
{
- Creature* halion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION));
+ Creature* halion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION));
if (!halion)
return;
@@ -515,7 +515,7 @@ class boss_twilight_halion : public CreatureScript
void JustDied(Unit* killer) override
{
- if (Creature* halion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION)))
+ if (Creature* halion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION)))
{
// Ensure looting
if (me->IsDamageEnoughForLootingAndReward())
@@ -525,7 +525,7 @@ class boss_twilight_halion : public CreatureScript
killer->Kill(halion);
}
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER)))
if (controller->IsAlive())
controller->Kill(controller);
@@ -549,7 +549,7 @@ class boss_twilight_halion : public CreatureScript
if (!me->IsInPhase(attacker))
return;
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->SetData(DATA_TWILIGHT_DAMAGE_TAKEN, damage);
}
}
@@ -559,7 +559,7 @@ class boss_twilight_halion : public CreatureScript
switch (spell->Id)
{
case SPELL_TWILIGHT_DIVISION:
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->DoAction(ACTION_MONITOR_CORPOREALITY);
break;
default:
@@ -643,10 +643,10 @@ class npc_halion_controller : public CreatureScript
void JustReachedHome() override
{
- if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TWILIGHT_HALION)))
+ if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_TWILIGHT_HALION)))
twilightHalion->DespawnOrUnsummon();
- if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION)))
+ if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION)))
{
halion->AI()->SetData(DATA_EVADE_METHOD, 1);
halion->AI()->EnterEvadeMode();
@@ -668,7 +668,7 @@ class npc_halion_controller : public CreatureScript
{
for (uint8 itr = DATA_HALION; itr <= DATA_TWILIGHT_HALION; itr++)
{
- Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(itr));
+ Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(itr));
if (!halion)
continue;
@@ -720,14 +720,14 @@ class npc_halion_controller : public CreatureScript
break;
case EVENT_INTRO_PROGRESS_1:
for (uint8 i = DATA_BURNING_TREE_3; i <= DATA_BURNING_TREE_4; ++i)
- if (GameObject* tree = ObjectAccessor::GetGameObject(*me, _instance->GetData64(i)))
- _instance->HandleGameObject(_instance->GetData64(i), true, tree);
+ if (GameObject* tree = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(i)))
+ _instance->HandleGameObject(_instance->GetGuidData(i), true, tree);
_events.ScheduleEvent(EVENT_INTRO_PROGRESS_2, 4000);
break;
case EVENT_INTRO_PROGRESS_2:
for (uint8 i = DATA_BURNING_TREE_1; i <= DATA_BURNING_TREE_2; ++i)
- if (GameObject* tree = ObjectAccessor::GetGameObject(*me, _instance->GetData64(i)))
- _instance->HandleGameObject(_instance->GetData64(i), true, tree);
+ if (GameObject* tree = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(i)))
+ _instance->HandleGameObject(_instance->GetGuidData(i), true, tree);
_events.ScheduleEvent(EVENT_INTRO_PROGRESS_3, 4000);
break;
case EVENT_INTRO_PROGRESS_3:
@@ -736,20 +736,20 @@ class npc_halion_controller : public CreatureScript
halion->AI()->Talk(SAY_INTRO);
break;
case EVENT_TWILIGHT_MENDING:
- if (ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION))) // Just check if physical Halion is spawned
- if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TWILIGHT_HALION)))
+ if (ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION))) // Just check if physical Halion is spawned
+ if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_TWILIGHT_HALION)))
twilightHalion->CastSpell((Unit*)NULL, SPELL_TWILIGHT_MENDING, true);
break;
case EVENT_TRIGGER_BERSERK:
for (uint8 i = DATA_HALION; i <= DATA_TWILIGHT_HALION; i++)
- if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(i)))
+ if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(i)))
halion->CastSpell(halion, SPELL_BERSERK, true);
break;
case EVENT_SHADOW_PULSARS_SHOOT:
- if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TWILIGHT_HALION)))
+ if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_TWILIGHT_HALION)))
twilightHalion->AI()->Talk(SAY_SPHERE_PULSE);
- if (Creature* orbCarrier = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ORB_CARRIER)))
+ if (Creature* orbCarrier = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ORB_CARRIER)))
orbCarrier->AI()->DoAction(ACTION_SHOOT);
_events.ScheduleEvent(EVENT_SHADOW_PULSARS_SHOOT, 29000);
@@ -860,7 +860,7 @@ class npc_halion_controller : public CreatureScript
for (uint8 itr = DATA_HALION; itr <= DATA_TWILIGHT_HALION; itr++)
{
- if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(itr)))
+ if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(itr)))
{
halion->CastSpell(halion, GetSpell(_materialCorporealityValue, itr == DATA_TWILIGHT_HALION), true);
@@ -920,7 +920,7 @@ class npc_orb_carrier : public CreatureScript
/// we are having two creatures involded here. This attribute is handled clientside, meaning the client
/// sends orientation update itself. Here, no packet is sent, and the creature does not rotate. By
/// forcing the carrier to always be facing the rotation focus, we ensure everything works as it should.
- if (Creature* rotationFocus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ORB_ROTATION_FOCUS)))
+ if (Creature* rotationFocus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ORB_ROTATION_FOCUS)))
me->SetFacingToObject(rotationFocus); // setInFront
}
@@ -997,7 +997,7 @@ class npc_meteor_strike_initial : public CreatureScript
return;
// Let Halion Controller count as summoner
- if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->JustSummoned(me);
DoCast(me, SPELL_METEOR_STRIKE_COUNTDOWN);
@@ -1066,7 +1066,7 @@ class npc_meteor_strike : public CreatureScript
void IsSummonedBy(Unit* /*summoner*/) override
{
// Let Halion Controller count as summoner.
- if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->JustSummoned(me);
}
@@ -1083,7 +1083,7 @@ class npc_meteor_strike : public CreatureScript
if (Creature* flame = me->SummonCreature(NPC_METEOR_STRIKE_FLAME, pos, TEMPSUMMON_TIMED_DESPAWN, 25000))
{
- if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->JustSummoned(flame);
flame->CastSpell(flame, SPELL_METEOR_STRIKE_FIRE_AURA_2, true);
@@ -1115,7 +1115,7 @@ class npc_combustion_consumption : public CreatureScript
struct npc_combustion_consumptionAI : public ScriptedAI
{
npc_combustion_consumptionAI(Creature* creature) : ScriptedAI(creature),
- _instance(creature->GetInstanceScript()), _summonerGuid(0)
+ _instance(creature->GetInstanceScript())
{
SetCombatMovement(false);
@@ -1144,7 +1144,7 @@ class npc_combustion_consumption : public CreatureScript
void IsSummonedBy(Unit* summoner) override
{
// Let Halion Controller count as summoner
- if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->JustSummoned(me);
_summonerGuid = summoner->GetGUID();
@@ -1170,7 +1170,7 @@ class npc_combustion_consumption : public CreatureScript
InstanceScript* _instance;
uint32 _explosionSpell;
uint32 _damageSpell;
- uint64 _summonerGuid;
+ ObjectGuid _summonerGuid;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -1194,7 +1194,7 @@ class npc_living_inferno : public CreatureScript
me->CastSpell(me, SPELL_BLAZING_AURA, true);
if (InstanceScript* instance = me->GetInstanceScript())
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->JustSummoned(me);
}
@@ -1243,7 +1243,7 @@ class npc_living_ember : public CreatureScript
void IsSummonedBy(Unit* /*summoner*/) override
{
if (InstanceScript* instance = me->GetInstanceScript())
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HALION_CONTROLLER)))
controller->AI()->JustSummoned(me);
}
@@ -1393,7 +1393,7 @@ class spell_halion_combustion_consumption : public SpellScriptLoader
return;
if (GetTarget()->HasAura(_markSpell))
- GetTarget()->RemoveAurasDueToSpell(_markSpell, 0, 0, AURA_REMOVE_BY_EXPIRE);
+ GetTarget()->RemoveAurasDueToSpell(_markSpell, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE);
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1454,7 +1454,7 @@ class spell_halion_marks : public SpellScriptLoader
if (Unit* dispelledUnit = GetUnitOwner())
if (dispelledUnit->HasAura(_removeSpellId))
- dispelledUnit->RemoveAurasDueToSpell(_removeSpellId, 0, 0, AURA_REMOVE_BY_EXPIRE);
+ dispelledUnit->RemoveAurasDueToSpell(_removeSpellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE);
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1557,7 +1557,7 @@ class spell_halion_twilight_realm_handlers : public SpellScriptLoader
if (!target)
return;
- target->RemoveAurasDueToSpell(_beforeHitSpellId, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL);
+ target->RemoveAurasDueToSpell(_beforeHitSpellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL);
if (InstanceScript* instance = target->GetInstanceScript())
instance->SendEncounterUnit(ENCOUNTER_FRAME_UNK7);
}
@@ -1653,7 +1653,7 @@ class spell_halion_twilight_cutter : public SpellScriptLoader
return;
Unit* caster = GetCaster();
- if (Unit* channelTarget = ObjectAccessor::GetUnit(*caster, caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)))
+ if (Unit* channelTarget = ObjectAccessor::GetUnit(*caster, caster->GetChannelObjectGuid()))
{
unitList.remove_if(TwilightCutterSelector(caster, channelTarget));
return;
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
index be756a8ab36..98aed37a1d2 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
@@ -41,28 +41,12 @@ class instance_ruby_sanctum : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- BaltharusTheWarbornGUID = 0;
- GeneralZarithrianGUID = 0;
- SavianaRagefireGUID = 0;
- HalionGUID = 0;
- TwilightHalionGUID = 0;
- OrbCarrierGUID = 0;
- OrbRotationFocusGUID = 0;
- HalionControllerGUID = 0;
- CrystalChannelTargetGUID = 0;
- XerestraszaGUID = 0;
BaltharusSharedHealth = 0;
- FlameWallsGUID = 0;
- FlameRingGUID = 0;
- TwilightFlameRingGUID = 0;
-
- memset(ZarithrianSpawnStalkerGUID, 0, 2 * sizeof(uint64));
- memset(BurningTreeGUID, 0, 4 * sizeof(uint64));
}
void OnPlayerEnter(Player* /*player*/)
{
- if (!GetData64(DATA_HALION_CONTROLLER) && GetBossState(DATA_HALION) != DONE && GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE)
+ if (!GetGuidData(DATA_HALION_CONTROLLER) && GetBossState(DATA_HALION) != DONE && GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE)
{
instance->LoadGrid(HalionControllerSpawnPos.GetPositionX(), HalionControllerSpawnPos.GetPositionY());
if (Creature* halionController = instance->SummonCreature(NPC_HALION_CONTROLLER, HalionControllerSpawnPos))
@@ -184,7 +168,7 @@ class instance_ruby_sanctum : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -224,7 +208,7 @@ class instance_ruby_sanctum : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
bool SetBossState(uint32 type, EncounterState state) override
@@ -305,21 +289,21 @@ class instance_ruby_sanctum : public InstanceMapScript
}
protected:
- uint64 BaltharusTheWarbornGUID;
- uint64 GeneralZarithrianGUID;
- uint64 SavianaRagefireGUID;
- uint64 HalionGUID;
- uint64 TwilightHalionGUID;
- uint64 HalionControllerGUID;
- uint64 OrbCarrierGUID;
- uint64 OrbRotationFocusGUID;
- uint64 CrystalChannelTargetGUID;
- uint64 XerestraszaGUID;
- uint64 FlameWallsGUID;
- uint64 ZarithrianSpawnStalkerGUID[2];
- uint64 BurningTreeGUID[4];
- uint64 FlameRingGUID;
- uint64 TwilightFlameRingGUID;
+ ObjectGuid BaltharusTheWarbornGUID;
+ ObjectGuid GeneralZarithrianGUID;
+ ObjectGuid SavianaRagefireGUID;
+ ObjectGuid HalionGUID;
+ ObjectGuid TwilightHalionGUID;
+ ObjectGuid HalionControllerGUID;
+ ObjectGuid OrbCarrierGUID;
+ ObjectGuid OrbRotationFocusGUID;
+ ObjectGuid CrystalChannelTargetGUID;
+ ObjectGuid XerestraszaGUID;
+ ObjectGuid FlameWallsGUID;
+ ObjectGuid ZarithrianSpawnStalkerGUID[2];
+ ObjectGuid BurningTreeGUID[4];
+ ObjectGuid FlameRingGUID;
+ ObjectGuid TwilightFlameRingGUID;
uint32 BaltharusSharedHealth;
};
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
index 0d2b98dbd1c..9f088a4cdfa 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
@@ -154,10 +154,10 @@ class at_baltharus_plateau : public AreaTriggerScript
// Only trigger once
if (InstanceScript* instance = player->GetInstanceScript())
{
- if (Creature* xerestrasza = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_XERESTRASZA)))
+ if (Creature* xerestrasza = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_XERESTRASZA)))
xerestrasza->AI()->DoAction(ACTION_INTRO_BALTHARUS);
- if (Creature* baltharus = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_BALTHARUS_THE_WARBORN)))
+ if (Creature* baltharus = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_BALTHARUS_THE_WARBORN)))
baltharus->AI()->DoAction(ACTION_INTRO_BALTHARUS);
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
index f2d2c3e3d5b..abf57ad68d1 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
@@ -269,7 +269,6 @@ public:
Initialize();
instance = creature->GetInstanceScript();
- MemoryGUID = 0;
creature->SetReactState(REACT_PASSIVE);
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
creature->RestoreFaction();
@@ -288,7 +287,7 @@ public:
}
InstanceScript* instance;
- uint64 MemoryGUID;
+ ObjectGuid MemoryGUID;
bool bHealth;
bool bDone;
@@ -584,7 +583,7 @@ public:
break;
}
- Start(false, true, 0);
+ Start(false, true);
uiWaypoint = uiType;
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
index e342b3bbfb1..60b25a649ca 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
@@ -81,7 +81,7 @@ public:
struct boss_black_knightAI : public ScriptedAI
{
- boss_black_knightAI(Creature* creature) : ScriptedAI(creature)
+ boss_black_knightAI(Creature* creature) : ScriptedAI(creature), summons(creature)
{
Initialize();
instance = creature->GetInstanceScript();
@@ -110,7 +110,7 @@ public:
InstanceScript* instance;
- std::list<uint64> SummonList;
+ SummonList summons;
bool bEventInProgress;
bool bEvent;
@@ -132,31 +132,22 @@ public:
void Reset() override
{
- RemoveSummons();
+ summons.DespawnAll();
me->SetDisplayId(me->GetNativeDisplayId());
me->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED);
Initialize();
}
- void RemoveSummons()
+ void JustSummoned(Creature* summon) override
{
- if (SummonList.empty())
- return;
-
- for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
- {
- if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr))
- if (temp)
- temp->DisappearAndDie();
- }
- SummonList.clear();
+ summons.Summon(summon);
+ summon->AI()->AttackStart(me->GetVictim());
}
- void JustSummoned(Creature* summon) override
+ void SummonedCreatureDespawn(Creature* summon) override
{
- SummonList.push_back(summon->GetGUID());
- summon->AI()->AttackStart(me->GetVictim());
+ summons.Despawn(summon);
}
void UpdateAI(uint32 uiDiff) override
@@ -281,7 +272,7 @@ public:
uiDamage = 0;
me->SetHealth(0);
me->AddUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED);
- RemoveSummons();
+ summons.DespawnAll();
switch (uiPhase)
{
case PHASE_UNDEAD:
@@ -367,20 +358,16 @@ public:
{
npc_black_knight_skeletal_gryphonAI(Creature* creature) : npc_escortAI(creature)
{
- Start(false, true, 0, NULL);
+ Start(false, true);
}
- void WaypointReached(uint32 /*waypointId*/) override
- {
-
- }
+ void WaypointReached(uint32 /*waypointId*/) override { }
void UpdateAI(uint32 uiDiff) override
{
npc_escortAI::UpdateAI(uiDiff);
- if (!UpdateVictim())
- return;
+ UpdateVictim();
}
};
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
index a0cb4ca6d6f..b6f43371232 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
@@ -126,9 +126,9 @@ bool GrandChampionsOutVehicle(Creature* me)
if (!instance)
return false;
- Creature* pGrandChampion1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_1));
- Creature* pGrandChampion2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_2));
- Creature* pGrandChampion3 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_3));
+ Creature* pGrandChampion1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GRAND_CHAMPION_1));
+ Creature* pGrandChampion2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GRAND_CHAMPION_2));
+ Creature* pGrandChampion3 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GRAND_CHAMPION_3));
if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3)
{
@@ -208,7 +208,7 @@ public:
}
if (uiType <= 3)
- Start(false, true, 0, NULL);
+ Start(false, true);
}
void WaypointReached(uint32 waypointId) override
@@ -375,11 +375,11 @@ public:
{
bDone = true;
- if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1))
+ if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_1))
me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f);
- else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2))
+ else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_2))
me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f);
- else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3))
+ else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_3))
me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f);
EnterEvadeMode();
@@ -514,11 +514,11 @@ public:
{
bDone = true;
- if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1))
+ if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_1))
me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f);
- else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2))
+ else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_2))
me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f);
- else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3))
+ else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_3))
me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f);
instance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS);
@@ -663,11 +663,11 @@ public:
{
bDone = true;
- if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1))
+ if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_1))
me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f);
- else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2))
+ else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_2))
me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f);
- else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3))
+ else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_3))
me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f);
instance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS);
@@ -769,7 +769,7 @@ public:
uiMultiShotTimer = 0;
uiLightningArrowsTimer = 7000;
- uiTargetGUID = 0;
+ uiTargetGUID.Clear();
bShoot = false;
}
@@ -783,7 +783,7 @@ public:
uint32 uiMultiShotTimer;
uint32 uiLightningArrowsTimer;
- uint64 uiTargetGUID;
+ ObjectGuid uiTargetGUID;
bool bShoot;
bool bDone;
@@ -813,11 +813,11 @@ public:
{
bDone = true;
- if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1))
+ if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_1))
me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f);
- else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2))
+ else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_2))
me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f);
- else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3))
+ else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_3))
me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f);
instance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS);
@@ -965,11 +965,11 @@ public:
{
bDone = true;
- if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1))
+ if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_1))
me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f);
- else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2))
+ else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_2))
me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f);
- else if (me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3))
+ else if (me->GetGUID() == instance->GetGuidData(DATA_GRAND_CHAMPION_3))
me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f);
instance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS);
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 021947db0f7..94bf20bc41f 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
@@ -49,18 +49,18 @@ public:
uint16 uiGrandChampionsDeaths;
uint8 uiArgentSoldierDeaths;
- uint64 uiAnnouncerGUID;
- uint64 uiMainGateGUID;
- uint64 uiGrandChampionVehicle1GUID;
- uint64 uiGrandChampionVehicle2GUID;
- uint64 uiGrandChampionVehicle3GUID;
- uint64 uiGrandChampion1GUID;
- uint64 uiGrandChampion2GUID;
- uint64 uiGrandChampion3GUID;
- uint64 uiChampionLootGUID;
- uint64 uiArgentChampionGUID;
-
- std::list<uint64> VehicleList;
+ ObjectGuid uiAnnouncerGUID;
+ ObjectGuid uiMainGateGUID;
+ ObjectGuid uiGrandChampionVehicle1GUID;
+ ObjectGuid uiGrandChampionVehicle2GUID;
+ ObjectGuid uiGrandChampionVehicle3GUID;
+ ObjectGuid uiGrandChampion1GUID;
+ ObjectGuid uiGrandChampion2GUID;
+ ObjectGuid uiGrandChampion3GUID;
+ ObjectGuid uiChampionLootGUID;
+ ObjectGuid uiArgentChampionGUID;
+
+ GuidList VehicleList;
std::string str_data;
@@ -73,21 +73,8 @@ public:
uiGrandChampionsDeaths = 0;
uiArgentSoldierDeaths = 0;
- uiAnnouncerGUID = 0;
- uiMainGateGUID = 0;
- uiGrandChampionVehicle1GUID = 0;
- uiGrandChampionVehicle2GUID = 0;
- uiGrandChampionVehicle3GUID = 0;
- uiGrandChampion1GUID = 0;
- uiGrandChampion2GUID = 0;
- uiGrandChampion3GUID = 0;
- uiChampionLootGUID = 0;
- uiArgentChampionGUID = 0;
-
bDone = false;
- VehicleList.clear();
-
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
}
@@ -183,7 +170,7 @@ public:
m_auiEncounter[0] = uiData;
if (uiData == IN_PROGRESS)
{
- for (std::list<uint64>::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr)
+ for (GuidList::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr)
if (Creature* summon = instance->GetCreature(*itr))
summon->RemoveFromWorld();
}else if (uiData == DONE)
@@ -252,7 +239,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 uiData) const override
+ ObjectGuid GetGuidData(uint32 uiData) const override
{
switch (uiData)
{
@@ -264,10 +251,10 @@ public:
case DATA_GRAND_CHAMPION_3: return uiGrandChampion3GUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
- void SetData64(uint32 uiType, uint64 uiData) override
+ void SetGuidData(uint32 uiType, ObjectGuid uiData) override
{
switch (uiType)
{
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
index f601f06e16c..a66096ae615 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
@@ -80,14 +80,6 @@ public:
uiPhase = 0;
uiTimer = 0;
- uiVehicle1GUID = 0;
- uiVehicle2GUID = 0;
- uiVehicle3GUID = 0;
-
- Champion1List.clear();
- Champion2List.clear();
- Champion3List.clear();
-
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@@ -111,13 +103,13 @@ public:
uint32 uiPhase;
uint32 uiTimer;
- uint64 uiVehicle1GUID;
- uint64 uiVehicle2GUID;
- uint64 uiVehicle3GUID;
+ ObjectGuid uiVehicle1GUID;
+ ObjectGuid uiVehicle2GUID;
+ ObjectGuid uiVehicle3GUID;
- std::list<uint64> Champion1List;
- std::list<uint64> Champion2List;
- std::list<uint64> Champion3List;
+ GuidList Champion1List;
+ GuidList Champion2List;
+ GuidList Champion3List;
void NextStep(uint32 uiTimerStep, bool bNextStep = true, uint8 uiPhaseStep = 0)
{
@@ -138,14 +130,14 @@ public:
break;
case DATA_IN_POSITION: //movement done.
me->GetMotionMaster()->MovePoint(1, 735.81f, 661.92f, 412.39f);
- if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MAIN_GATE)))
instance->HandleGameObject(go->GetGUID(), false);
NextStep(10000, false, 3);
break;
case DATA_LESSER_CHAMPIONS_DEFEATED:
{
++uiLesserChampions;
- std::list<uint64> TempList;
+ GuidList TempList;
if (uiLesserChampions == 3 || uiLesserChampions == 6)
{
switch (uiLesserChampions)
@@ -158,7 +150,7 @@ public:
break;
}
- for (std::list<uint64>::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr)
+ for (GuidList::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr)
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
AggroAllPlayers(summon);
}else if (uiLesserChampions == 9)
@@ -230,36 +222,36 @@ public:
case 1:
{
uiVehicle1GUID = pBoss->GetGUID();
- uint64 uiGrandChampionBoss1 = 0;
+ ObjectGuid uiGrandChampionBoss1;
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
if (Unit* unit = pVehicle->GetPassenger(0))
uiGrandChampionBoss1 = unit->GetGUID();
- instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID);
- instance->SetData64(DATA_GRAND_CHAMPION_1, uiGrandChampionBoss1);
+ instance->SetGuidData(DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID);
+ instance->SetGuidData(DATA_GRAND_CHAMPION_1, uiGrandChampionBoss1);
pBoss->AI()->SetData(1, 0);
break;
}
case 2:
{
uiVehicle2GUID = pBoss->GetGUID();
- uint64 uiGrandChampionBoss2 = 0;
+ ObjectGuid uiGrandChampionBoss2;
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
if (Unit* unit = pVehicle->GetPassenger(0))
uiGrandChampionBoss2 = unit->GetGUID();
- instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID);
- instance->SetData64(DATA_GRAND_CHAMPION_2, uiGrandChampionBoss2);
+ instance->SetGuidData(DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID);
+ instance->SetGuidData(DATA_GRAND_CHAMPION_2, uiGrandChampionBoss2);
pBoss->AI()->SetData(2, 0);
break;
}
case 3:
{
uiVehicle3GUID = pBoss->GetGUID();
- uint64 uiGrandChampionBoss3 = 0;
+ ObjectGuid uiGrandChampionBoss3;
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
if (Unit* unit = pVehicle->GetPassenger(0))
uiGrandChampionBoss3 = unit->GetGUID();
- instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID);
- instance->SetData64(DATA_GRAND_CHAMPION_3, uiGrandChampionBoss3);
+ instance->SetGuidData(DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID);
+ instance->SetGuidData(DATA_GRAND_CHAMPION_3, uiGrandChampionBoss3);
pBoss->AI()->SetData(3, 0);
break;
}
@@ -414,7 +406,7 @@ public:
case 3:
if (!Champion1List.empty())
{
- for (std::list<uint64>::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr)
+ for (GuidList::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr)
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
AggroAllPlayers(summon);
NextStep(0, false);
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
index 2f29e03a2f2..d5bd2bcae7e 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
@@ -196,7 +196,7 @@ class boss_anubarak_trial : public CreatureScript
std::list<Creature*> FrostSphereList;
me->GetCreatureListWithEntryInGrid(FrostSphereList, NPC_FROST_SPHERE, 150.0f);
if (!FrostSphereList.empty())
- for (std::list<Creature*>::iterator itr = FrostSphereList.begin(); itr != FrostSphereList.end(); itr++)
+ for (std::list<Creature*>::iterator itr = FrostSphereList.begin(); itr != FrostSphereList.end(); ++itr)
(*itr)->DespawnOrUnsummon();
_burrowGUID.clear();
@@ -243,7 +243,7 @@ class boss_anubarak_trial : public CreatureScript
me->GetCreatureListWithEntryInGrid(AddList, NPC_FROST_SPHERE, 150.0f);
me->GetCreatureListWithEntryInGrid(AddList, NPC_BURROWER, 150.0f);
if (!AddList.empty())
- for (std::list<Creature*>::iterator itr = AddList.begin(); itr != AddList.end(); itr++)
+ for (std::list<Creature*>::iterator itr = AddList.begin(); itr != AddList.end(); ++itr)
(*itr)->DespawnOrUnsummon();
}
@@ -346,7 +346,7 @@ class boss_anubarak_trial : public CreatureScript
/* WORKAROUND
* - The correct implementation is more likely the comment below but it needs spell knowledge
*/
- std::list<uint64>::iterator i = _burrowGUID.begin();
+ GuidList::iterator i = _burrowGUID.begin();
uint32 at = urand(0, _burrowGUID.size()-1);
for (uint32 k = 0; k < at; k++)
++i;
@@ -421,8 +421,8 @@ class boss_anubarak_trial : public CreatureScript
}
private:
- std::list<uint64> _burrowGUID;
- uint64 _sphereGUID[6];
+ GuidList _burrowGUID;
+ ObjectGuid _sphereGUID[6];
bool _intro;
bool _reachedPhase3;
};
@@ -458,7 +458,7 @@ class npc_swarm_scarab : public CreatureScript
DoCast(me, SPELL_ACID_MANDIBLE);
me->SetInCombatWithZone();
if (me->IsInCombat())
- if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK)))
+ if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_ANUBARAK)))
Anubarak->AI()->JustSummoned(me);
}
@@ -538,7 +538,7 @@ class npc_nerubian_burrower : public CreatureScript
DoCast(me, SPELL_AWAKENED);
me->SetInCombatWithZone();
if (me->IsInCombat())
- if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK)))
+ if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_ANUBARAK)))
Anubarak->AI()->JustSummoned(me);
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
index 3d59f24b6dd..562e67f4b6a 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
@@ -483,7 +483,7 @@ class boss_toc_champion_controller : public CreatureScript
SummonChampions((Team)uiData);
break;
case 1:
- for (std::list<uint64>::iterator i = _summons.begin(); i != _summons.end(); ++i)
+ for (SummonList::iterator i = _summons.begin(); i != _summons.end(); ++i)
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, *i))
{
@@ -565,7 +565,7 @@ struct boss_faction_championsAI : public BossAI
void JustReachedHome() override
{
- if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
+ if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetGuidData(NPC_CHAMPIONS_CONTROLLER)))
pChampionController->AI()->SetData(2, FAIL);
me->DespawnOrUnsummon();
}
@@ -615,7 +615,7 @@ struct boss_faction_championsAI : public BossAI
void JustDied(Unit* /*killer*/) override
{
if (_aiType != AI_PET)
- if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
+ if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetGuidData(NPC_CHAMPIONS_CONTROLLER)))
pChampionController->AI()->SetData(2, DONE);
}
@@ -623,7 +623,7 @@ struct boss_faction_championsAI : public BossAI
{
DoCast(me, SPELL_ANTI_AOE, true);
_EnterCombat();
- if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
+ if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetGuidData(NPC_CHAMPIONS_CONTROLLER)))
pChampionController->AI()->SetData(2, IN_PROGRESS);
}
@@ -640,11 +640,11 @@ struct boss_faction_championsAI : public BossAI
if (TeamInInstance == ALLIANCE)
{
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_VARIAN)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_VARIAN)))
temp->AI()->Talk(SAY_KILL_PLAYER);
}
else
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GARROSH)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_GARROSH)))
temp->AI()->Talk(SAY_KILL_PLAYER);
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
index f4112b7a43b..771151632ff 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
@@ -171,7 +171,7 @@ class boss_gormok : public CreatureScript
void EnterEvadeMode() override
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR));
ScriptedAI::EnterEvadeMode();
}
@@ -183,7 +183,7 @@ class boss_gormok : public CreatureScript
switch (pointId)
{
case 0:
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR));
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_AGGRESSIVE);
me->SetInCombatWithZone();
@@ -200,7 +200,7 @@ class boss_gormok : public CreatureScript
void JustReachedHome() override
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR));
instance->SetData(TYPE_NORTHREND_BEASTS, FAIL);
me->DespawnOrUnsummon();
@@ -294,7 +294,6 @@ class npc_snobold_vassal : public CreatureScript
{
npc_snobold_vassalAI(Creature* creature) : ScriptedAI(creature)
{
- _targetGUID = 0;
_targetDied = false;
_instance = creature->GetInstanceScript();
_instance->SetData(DATA_SNOBOLD_COUNT, INCREASE);
@@ -305,7 +304,7 @@ class npc_snobold_vassal : public CreatureScript
_events.ScheduleEvent(EVENT_BATTER, 5*IN_MILLISECONDS);
_events.ScheduleEvent(EVENT_HEAD_CRACK, 25*IN_MILLISECONDS);
- _targetGUID = 0;
+ _targetGUID.Clear();
_targetDied = false;
//Workaround for Snobold
@@ -378,7 +377,7 @@ class npc_snobold_vassal : public CreatureScript
{
if (!target->IsAlive())
{
- Unit* gormok = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_GORMOK));
+ Unit* gormok = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_GORMOK));
if (gormok && gormok->IsAlive())
{
SetCombatMovement(false);
@@ -442,7 +441,7 @@ class npc_snobold_vassal : public CreatureScript
private:
EventMap _events;
InstanceScript* _instance;
- uint64 _targetGUID;
+ ObjectGuid _targetGUID;
bool _targetDied;
};
@@ -520,7 +519,7 @@ struct boss_jormungarAI : public BossAI
void JustDied(Unit* /*killer*/) override
{
- if (Creature* otherWorm = ObjectAccessor::GetCreature(*me, instance->GetData64(OtherWormEntry)))
+ if (Creature* otherWorm = ObjectAccessor::GetCreature(*me, instance->GetGuidData(OtherWormEntry)))
{
if (!otherWorm->IsAlive())
{
@@ -753,7 +752,7 @@ class boss_dreadscale : public CreatureScript
switch (pointId)
{
case 0:
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR));
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_AGGRESSIVE);
me->SetInCombatWithZone();
@@ -765,13 +764,13 @@ class boss_dreadscale : public CreatureScript
void EnterEvadeMode() override
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR));
boss_jormungarAI::EnterEvadeMode();
}
void JustReachedHome() override
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR));
boss_jormungarAI::JustReachedHome();
}
@@ -877,7 +876,7 @@ class boss_icehowl : public CreatureScript
_movementStarted = false;
_movementFinish = false;
_trampleCast = false;
- _trampleTargetGUID = 0;
+ _trampleTargetGUID.Clear();
_trampleTargetX = 0;
_trampleTargetY = 0;
_trampleTargetZ = 0;
@@ -926,7 +925,7 @@ class boss_icehowl : public CreatureScript
_movementFinish = true;
break;
case 2:
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR));
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_AGGRESSIVE);
me->SetInCombatWithZone();
@@ -938,13 +937,13 @@ class boss_icehowl : public CreatureScript
void EnterEvadeMode() override
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR));
ScriptedAI::EnterEvadeMode();
}
void JustReachedHome() override
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR));
instance->SetData(TYPE_NORTHREND_BEASTS, FAIL);
me->DespawnOrUnsummon();
}
@@ -1077,7 +1076,7 @@ class boss_icehowl : public CreatureScript
if (Player* target = ObjectAccessor::GetPlayer(*me, _trampleTargetGUID))
Talk(EMOTE_TRAMPLE_START, target);
me->GetMotionMaster()->MoveCharge(_trampleTargetX, _trampleTargetY, _trampleTargetZ, 42, 1);
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
_stage = 5;
break;
case 5:
@@ -1134,7 +1133,7 @@ class boss_icehowl : public CreatureScript
private:
float _trampleTargetX, _trampleTargetY, _trampleTargetZ;
- uint64 _trampleTargetGUID;
+ ObjectGuid _trampleTargetGUID;
bool _movementStarted;
bool _movementFinish;
bool _trampleCast;
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
index 1118c1ec27b..a645f3ca666 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
@@ -267,7 +267,7 @@ struct boss_twin_baseAI : public BossAI
// Called when sister pointer needed
Creature* GetSister()
{
- return ObjectAccessor::GetCreature((*me), instance->GetData64(SisterNpcId));
+ return ObjectAccessor::GetCreature((*me), instance->GetGuidData(SisterNpcId));
}
void EnterCombat(Unit* /*who*/) override
@@ -447,13 +447,13 @@ class boss_fjola : public CreatureScript
void EnterEvadeMode() override
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR));
boss_twin_baseAI::EnterEvadeMode();
}
void JustReachedHome() override
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR));
boss_twin_baseAI::JustReachedHome();
}
@@ -864,7 +864,7 @@ class spell_power_of_the_twins : public SpellScriptLoader
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
- if (Creature* Valk = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(GetCaster()->GetEntry())))
+ if (Creature* Valk = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(GetCaster()->GetEntry())))
ENSURE_AI(boss_twin_baseAI, Valk->AI())->EnableDualWield(true);
}
}
@@ -873,7 +873,7 @@ class spell_power_of_the_twins : public SpellScriptLoader
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
- if (Creature* Valk = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(GetCaster()->GetEntry())))
+ if (Creature* Valk = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(GetCaster()->GetEntry())))
ENSURE_AI(boss_twin_baseAI, Valk->AI())->EnableDualWield(false);
}
}
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 a8d3f223664..30d831da30c 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
@@ -45,29 +45,6 @@ class instance_trial_of_the_crusader : public InstanceMapScript
MistressOfPainCount = 0;
TributeToImmortalityEligible = true;
NeedSave = false;
-
- TirionFordringGUID = 0;
- BarrentGUID = 0;
- TirionGUID = 0;
- FizzlebangGUID = 0;
- GarroshGUID = 0;
- VarianGUID = 0;
- GormokGUID = 0;
- AcidmawGUID = 0;
- DreadscaleGUID = 0;
- IcehowlGUID = 0;
- JaraxxusGUID = 0;
- ChampionsControllerGUID = 0;
- DarkbaneGUID = 0;
- LightbaneGUID = 0;
- AnubarakGUID = 0;
-
- TributeChestGUID = 0;
- MainGateDoorGUID = 0;
- EastPortcullisGUID = 0;
- WebDoorGUID = 0;
- CrusadersCacheGUID = 0;
- FloorGUID = 0;
}
bool IsEncounterInProgress() const override
@@ -96,15 +73,15 @@ class instance_trial_of_the_crusader : public InstanceMapScript
// make sure Anub'arak isnt missing and floor is destroyed after a crash
if (GetBossState(BOSS_LICH_KING) == DONE && TrialCounter && GetBossState(BOSS_ANUBARAK) != DONE)
{
- if (Creature* anubArak = ObjectAccessor::GetCreature(*player, GetData64(NPC_ANUBARAK)))
+ if (Creature* anubArak = ObjectAccessor::GetCreature(*player, GetGuidData(NPC_ANUBARAK)))
anubArak = player->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
- if (GameObject* floor = ObjectAccessor::GetGameObject(*player, GetData64(GO_ARGENT_COLISEUM_FLOOR)))
+ if (GameObject* floor = ObjectAccessor::GetGameObject(*player, GetGuidData(GO_ARGENT_COLISEUM_FLOOR)))
floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
}
}
- void OpenDoor(uint64 guid)
+ void OpenDoor(ObjectGuid guid)
{
if (!guid)
return;
@@ -113,7 +90,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
}
- void CloseDoor(uint64 guid)
+ void CloseDoor(ObjectGuid guid)
{
if (!guid)
return;
@@ -356,13 +333,13 @@ class instance_trial_of_the_crusader : public InstanceMapScript
if (IsEncounterInProgress())
{
- CloseDoor(GetData64(GO_EAST_PORTCULLIS));
- CloseDoor(GetData64(GO_WEB_DOOR));
+ CloseDoor(GetGuidData(GO_EAST_PORTCULLIS));
+ CloseDoor(GetGuidData(GO_WEB_DOOR));
}
else
{
- OpenDoor(GetData64(GO_EAST_PORTCULLIS));
- OpenDoor(GetData64(GO_WEB_DOOR));
+ OpenDoor(GetGuidData(GO_EAST_PORTCULLIS));
+ OpenDoor(GetGuidData(GO_WEB_DOOR));
}
if (type < MAX_ENCOUNTERS)
@@ -382,10 +359,10 @@ class instance_trial_of_the_crusader : public InstanceMapScript
// if theres no more attemps allowed
if (!TrialCounter)
{
- if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT)))
+ if (Unit* announcer = instance->GetCreature(GetGuidData(NPC_BARRENT)))
announcer->ToCreature()->DespawnOrUnsummon();
- if (Creature* anubArak = instance->GetCreature(GetData64(NPC_ANUBARAK)))
+ if (Creature* anubArak = instance->GetCreature(GetGuidData(NPC_ANUBARAK)))
anubArak->DespawnOrUnsummon();
}
}
@@ -396,7 +373,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
if (state == DONE || NeedSave)
{
- if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT)))
+ if (Unit* announcer = instance->GetCreature(GetGuidData(NPC_BARRENT)))
announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
Save();
}
@@ -473,7 +450,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -521,7 +498,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
uint32 GetData(uint32 type) const override
@@ -743,29 +720,29 @@ class instance_trial_of_the_crusader : public InstanceMapScript
bool NeedSave;
std::string SaveDataBuffer;
- uint64 BarrentGUID;
- uint64 TirionGUID;
- uint64 TirionFordringGUID;
- uint64 FizzlebangGUID;
- uint64 GarroshGUID;
- uint64 VarianGUID;
-
- uint64 GormokGUID;
- uint64 AcidmawGUID;
- uint64 DreadscaleGUID;
- uint64 IcehowlGUID;
- uint64 JaraxxusGUID;
- uint64 ChampionsControllerGUID;
- uint64 DarkbaneGUID;
- uint64 LightbaneGUID;
- uint64 AnubarakGUID;
-
- uint64 CrusadersCacheGUID;
- uint64 FloorGUID;
- uint64 TributeChestGUID;
- uint64 MainGateDoorGUID;
- uint64 EastPortcullisGUID;
- uint64 WebDoorGUID;
+ ObjectGuid BarrentGUID;
+ ObjectGuid TirionGUID;
+ ObjectGuid TirionFordringGUID;
+ ObjectGuid FizzlebangGUID;
+ ObjectGuid GarroshGUID;
+ ObjectGuid VarianGUID;
+
+ ObjectGuid GormokGUID;
+ ObjectGuid AcidmawGUID;
+ ObjectGuid DreadscaleGUID;
+ ObjectGuid IcehowlGUID;
+ ObjectGuid JaraxxusGUID;
+ ObjectGuid ChampionsControllerGUID;
+ ObjectGuid DarkbaneGUID;
+ ObjectGuid LightbaneGUID;
+ ObjectGuid AnubarakGUID;
+
+ ObjectGuid CrusadersCacheGUID;
+ ObjectGuid FloorGUID;
+ ObjectGuid TributeChestGUID;
+ ObjectGuid MainGateDoorGUID;
+ ObjectGuid EastPortcullisGUID;
+ ObjectGuid WebDoorGUID;
// Achievement stuff
uint32 NotOneButTwoJormungarsTimer;
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
index b068b458073..d8ec322c57c 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
@@ -173,7 +173,7 @@ class npc_announcer_toc10 : public CreatureScript
else if (instance->GetBossState(BOSS_JARAXXUS) != DONE)
{
// if Jaraxxus is spawned, but the raid wiped
- if (Creature* jaraxxus = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* jaraxxus = ObjectAccessor::GetCreature(*player, instance->GetGuidData(NPC_JARAXXUS)))
{
jaraxxus->RemoveAurasDueToSpell(SPELL_JARAXXUS_CHAINS);
jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -201,13 +201,13 @@ class npc_announcer_toc10 : public CreatureScript
}
else if (instance->GetBossState(BOSS_LICH_KING) != DONE)
{
- if (GameObject* floor = ObjectAccessor::GetGameObject(*player, instance->GetData64(GO_ARGENT_COLISEUM_FLOOR)))
+ if (GameObject* floor = ObjectAccessor::GetGameObject(*player, instance->GetGuidData(GO_ARGENT_COLISEUM_FLOOR)))
floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
creature->CastSpell(creature, SPELL_CORPSE_TELEPORT, false);
creature->CastSpell(creature, SPELL_DESTROY_FLOOR_KNOCKUP, false);
- Creature* anubArak = ObjectAccessor::GetCreature(*creature, instance->GetData64(NPC_ANUBARAK));
+ Creature* anubArak = ObjectAccessor::GetCreature(*creature, instance->GetGuidData(NPC_ANUBARAK));
if (!anubArak || !anubArak->IsAlive())
anubArak = creature->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
@@ -318,7 +318,7 @@ class boss_lich_king_toc : public CreatureScript
break;
case 5080:
{
- if (GameObject* go = ObjectAccessor::GetGameObject(*me, _instance->GetData64(GO_ARGENT_COLISEUM_FLOOR)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(GO_ARGENT_COLISEUM_FLOOR)))
{
go->SetDisplayId(DISPLAYID_DESTROYED_FLOOR);
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_NODESPAWN);
@@ -329,7 +329,7 @@ class boss_lich_king_toc : public CreatureScript
me->CastSpell(me, SPELL_DESTROY_FLOOR_KNOCKUP, false);
_instance->SetBossState(BOSS_LICH_KING, DONE);
- Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK));
+ Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_ANUBARAK));
if (!temp || !temp->IsAlive())
temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
@@ -368,21 +368,14 @@ class npc_fizzlebang_toc : public CreatureScript
{
npc_fizzlebang_tocAI(Creature* creature) : ScriptedAI(creature), _summons(me)
{
- Initialize();
_instance = me->GetInstanceScript();
- _triggerGUID = 0;
- }
-
- void Initialize()
- {
- _portalGUID = 0;
}
void JustDied(Unit* killer) override
{
Talk(SAY_STAGE_1_06, killer);
_instance->SetData(TYPE_EVENT, 1180);
- if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_JARAXXUS)))
{
temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
temp->SetReactState(REACT_AGGRESSIVE);
@@ -392,8 +385,8 @@ class npc_fizzlebang_toc : public CreatureScript
void Reset() override
{
+ _portalGUID.Clear();
me->SetWalk(true);
- Initialize();
me->GetMotionMaster()->MovePoint(1, ToCCommonLoc[10].GetPositionX(), ToCCommonLoc[10].GetPositionY()-60, ToCCommonLoc[10].GetPositionZ());
}
@@ -406,7 +399,7 @@ class npc_fizzlebang_toc : public CreatureScript
{
case 1:
me->SetWalk(false);
- _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
+ _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR));
_instance->SetData(TYPE_EVENT, 1120);
_instance->SetData(TYPE_EVENT_TIMER, 1*IN_MILLISECONDS);
break;
@@ -489,7 +482,7 @@ class npc_fizzlebang_toc : public CreatureScript
_updateTimer = 5*IN_MILLISECONDS;
break;
case 1142:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_JARAXXUS)))
temp->SetTarget(me->GetGUID());
if (Creature* pTrigger = ObjectAccessor::GetCreature(*me, _triggerGUID))
pTrigger->DespawnOrUnsummon();
@@ -499,13 +492,13 @@ class npc_fizzlebang_toc : public CreatureScript
_updateTimer = 10*IN_MILLISECONDS;
break;
case 1144:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_JARAXXUS)))
temp->AI()->Talk(SAY_STAGE_1_05);
_instance->SetData(TYPE_EVENT, 1150);
_updateTimer = 5*IN_MILLISECONDS;
break;
case 1150:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_JARAXXUS)))
{
//1-shot Fizzlebang
temp->CastSpell(me, 67888, false);
@@ -526,8 +519,8 @@ class npc_fizzlebang_toc : public CreatureScript
private:
InstanceScript* _instance;
SummonList _summons;
- uint64 _portalGUID;
- uint64 _triggerGUID;
+ ObjectGuid _portalGUID;
+ ObjectGuid _triggerGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -581,7 +574,7 @@ class npc_tirion_toc : public CreatureScript
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
if (_instance->GetBossState(BOSS_BEASTS) != DONE)
{
- _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
+ _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR));
if (Creature* temp = me->SummonCreature(NPC_GORMOK, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30*IN_MILLISECONDS))
{
@@ -603,7 +596,7 @@ class npc_tirion_toc : public CreatureScript
Talk(SAY_STAGE_0_04);
if (_instance->GetBossState(BOSS_BEASTS) != DONE)
{
- _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
+ _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR));
if (Creature* temp = me->SummonCreature(NPC_DREADSCALE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN))
{
temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ());
@@ -621,7 +614,7 @@ class npc_tirion_toc : public CreatureScript
Talk(SAY_STAGE_0_05);
if (_instance->GetBossState(BOSS_BEASTS) != DONE)
{
- _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
+ _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR));
if (Creature* temp = me->SummonCreature(NPC_ICEHOWL, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_DEAD_DESPAWN))
{
temp->GetMotionMaster()->MovePoint(2, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ());
@@ -649,7 +642,7 @@ class npc_tirion_toc : public CreatureScript
case 1010:
Talk(SAY_STAGE_1_01);
_updateTimer = 7*IN_MILLISECONDS;
- _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
+ _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR));
me->SummonCreature(NPC_FIZZLEBANG, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
_instance->SetData(TYPE_EVENT, 0);
break;
@@ -703,7 +696,7 @@ class npc_tirion_toc : public CreatureScript
_instance->SetData(TYPE_EVENT, 3092);
break;
case 3092:
- if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
+ if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_CHAMPIONS_CONTROLLER)))
pChampionController->AI()->SetData(1, NOT_STARTED);
_instance->SetData(TYPE_EVENT, 3095);
break;
@@ -738,13 +731,13 @@ class npc_tirion_toc : public CreatureScript
_instance->SetData(TYPE_EVENT, 4015);
break;
case 4015:
- _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
- if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_LIGHTBANE)))
+ _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR));
+ if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_LIGHTBANE)))
{
temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ());
temp->SetVisible(true);
}
- if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_DARKBANE)))
+ if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_DARKBANE)))
{
temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ());
temp->SetVisible(true);
@@ -753,7 +746,7 @@ class npc_tirion_toc : public CreatureScript
_instance->SetData(TYPE_EVENT, 4016);
break;
case 4016:
- _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
+ _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR));
_instance->SetData(TYPE_EVENT, 4017);
break;
case 4040:
@@ -783,7 +776,7 @@ class npc_tirion_toc : public CreatureScript
_instance->SetData(TYPE_EVENT, 6005);
break;
case 6005:
- if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING)))
+ if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_TIRION_FORDRING)))
tirionFordring->AI()->Talk(SAY_STAGE_4_06);
_updateTimer = 20*IN_MILLISECONDS;
_instance->SetData(TYPE_EVENT, 6010);
@@ -791,7 +784,7 @@ class npc_tirion_toc : public CreatureScript
case 6010:
if (IsHeroic())
{
- if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING)))
+ if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_TIRION_FORDRING)))
tirionFordring->AI()->Talk(SAY_STAGE_4_07);
_updateTimer = 1*MINUTE*IN_MILLISECONDS;
_instance->SetBossState(BOSS_ANUBARAK, SPECIAL);
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp
index 694e502e508..9c6d9082db4 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp
@@ -211,7 +211,7 @@ class npc_drakkari_gutripper : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KING_DRED)))
+ if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KING_DRED)))
Dred->AI()->DoAction(ACTION_RAPTOR_KILLED);
}
};
@@ -267,7 +267,7 @@ class npc_drakkari_scytheclaw : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KING_DRED)))
+ if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KING_DRED)))
Dred->AI()->DoAction(ACTION_RAPTOR_KILLED);
}
};
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
index 6b26143745b..6c3b4378bec 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
@@ -216,7 +216,7 @@ public:
void SetSummonerStatus(bool active)
{
for (uint8 i = 0; i < 4; i++)
- if (uint64 guid = instance->GetData64(summoners[i].data))
+ if (ObjectGuid guid = instance->GetGuidData(summoners[i].data))
if (Creature* crystalChannelTarget = ObjectAccessor::GetCreature(*me, guid))
{
if (active)
@@ -229,7 +229,7 @@ public:
void SetCrystalsStatus(bool active)
{
for (uint8 i = 0; i < 4; i++)
- if (uint64 guid = instance->GetData64(DATA_NOVOS_CRYSTAL_1 + i))
+ if (ObjectGuid guid = instance->GetGuidData(DATA_NOVOS_CRYSTAL_1 + i))
if (GameObject* crystal = ObjectAccessor::GetGameObject(*me, guid))
SetCrystalStatus(crystal, active);
}
@@ -249,7 +249,7 @@ public:
void CrystalHandlerDied()
{
for (uint8 i = 0; i < 4; i++)
- if (uint64 guid = instance->GetData64(DATA_NOVOS_CRYSTAL_1 + i))
+ if (ObjectGuid guid = instance->GetGuidData(DATA_NOVOS_CRYSTAL_1 + i))
if (GameObject* crystal = ObjectAccessor::GetGameObject(*me, guid))
if (crystal->GetGoState() == GO_STATE_ACTIVE)
{
@@ -266,7 +266,7 @@ public:
if (IsHeroic())
events.ScheduleEvent(EVENT_SUMMON_MINIONS, 15000);
}
- else if (uint64 guid = instance->GetData64(DATA_NOVOS_SUMMONER_4))
+ else if (ObjectGuid guid = instance->GetGuidData(DATA_NOVOS_SUMMONER_4))
if (Creature* crystalChannelTarget = ObjectAccessor::GetCreature(*me, guid))
crystalChannelTarget->AI()->SetData(SPELL_SUMMON_CRYSTAL_HANDLER, 15000);
}
@@ -330,7 +330,7 @@ public:
void JustSummoned(Creature* summon) override
{
if (InstanceScript* instance = me->GetInstanceScript())
- if (uint64 guid = instance->GetData64(DATA_NOVOS))
+ if (ObjectGuid guid = instance->GetGuidData(DATA_NOVOS))
if (Creature* novos = ObjectAccessor::GetCreature(*me, guid))
novos->AI()->JustSummoned(summon);
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
index a8f083c97ee..b91ca893955 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
@@ -135,7 +135,7 @@ class boss_trollgore : public CreatureScript
break;
case EVENT_SPAWN:
for (uint8 i = 0; i < 3; ++i)
- if (Creature* trigger = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TROLLGORE_INVADER_SUMMONER_1 + i)))
+ if (Creature* trigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TROLLGORE_INVADER_SUMMONER_1 + i)))
trigger->CastSpell(trigger, RAND(SPELL_SUMMON_INVADER_A, SPELL_SUMMON_INVADER_B, SPELL_SUMMON_INVADER_C), true, NULL, NULL, me->GetGUID());
events.ScheduleEvent(EVENT_SPAWN, urand(30000, 40000));
diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
index 30b473b6ebc..4e58d4dac03 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
@@ -31,15 +31,6 @@ class instance_drak_tharon_keep : public InstanceMapScript
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
-
- TrollgoreGUID = 0;
- NovosGUID = 0;
- KingDredGUID = 0;
- TharonJaGUID = 0;
-
- memset(TrollgoreInvaderSummonerGuids, 0, 3 * sizeof(uint64));
- memset(NovosCrystalGUIDs, 0, 4 * sizeof(uint64));
- memset(NovosSummonerGUIDs, 0, 4 * sizeof(uint64));
}
void OnCreatureCreate(Creature* creature) override
@@ -122,7 +113,7 @@ class instance_drak_tharon_keep : public InstanceMapScript
NovosSummonerGUIDs[3] = creature->GetGUID();
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -150,7 +141,7 @@ class instance_drak_tharon_keep : public InstanceMapScript
return NovosSummonerGUIDs[type - DATA_NOVOS_SUMMONER_1];
}
- return 0;
+ return ObjectGuid::Empty;
}
void OnUnitDeath(Unit* unit) override
@@ -161,14 +152,14 @@ class instance_drak_tharon_keep : public InstanceMapScript
}
protected:
- uint64 TrollgoreGUID;
- uint64 NovosGUID;
- uint64 KingDredGUID;
- uint64 TharonJaGUID;
-
- uint64 TrollgoreInvaderSummonerGuids[3];
- uint64 NovosCrystalGUIDs[4];
- uint64 NovosSummonerGUIDs[4];
+ ObjectGuid TrollgoreGUID;
+ ObjectGuid NovosGUID;
+ ObjectGuid KingDredGUID;
+ ObjectGuid TharonJaGUID;
+
+ ObjectGuid TrollgoreInvaderSummonerGuids[3];
+ ObjectGuid NovosCrystalGUIDs[4];
+ ObjectGuid NovosSummonerGUIDs[4];
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
index 670591a058c..77c97cc8342 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
@@ -203,8 +203,8 @@ class npc_corrupted_soul_fragment : public CreatureScript
if (TempSummon* summ = me->ToTempSummon())
{
- uint64 BronjahmGUID = instance->GetData64(DATA_BRONJAHM);
- if (GUID_LOPART(BronjahmGUID) != id)
+ ObjectGuid BronjahmGUID(instance->GetGuidData(DATA_BRONJAHM));
+ if (BronjahmGUID.GetCounter() != id)
return;
if (Creature* bronjahm = ObjectAccessor::GetCreature(*me, BronjahmGUID))
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
index 4b4fd398e72..32590135f27 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
@@ -301,7 +301,7 @@ class boss_devourer_of_souls : public CreatureScript
me->SetReactState(REACT_PASSIVE);
//Remove any target
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
me->GetMotionMaster()->Clear();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
index f3034fa0796..97c9d407622 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
@@ -38,8 +38,6 @@ class instance_forge_of_souls : public InstanceMapScript
{
SetHeaders(DataHeader);
SetBossNumber(MAX_ENCOUNTER);
- bronjahm = 0;
- devourerOfSouls = 0;
teamInInstance = 0;
}
@@ -96,7 +94,7 @@ class instance_forge_of_souls : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -108,12 +106,12 @@ class instance_forge_of_souls : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
private:
- uint64 bronjahm;
- uint64 devourerOfSouls;
+ ObjectGuid bronjahm;
+ ObjectGuid devourerOfSouls;
uint32 teamInInstance;
};
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
index d0ad42d38e1..eeb05f44a71 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
@@ -347,8 +347,6 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
npc_jaina_or_sylvanas_intro_horAI(Creature* creature) : ScriptedAI(creature)
{
_instance = me->GetInstanceScript();
- _utherGUID = 0;
- _lichkingGUID = 0;
}
void sGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
@@ -376,8 +374,8 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
{
_events.Reset();
- _utherGUID = 0;
- _lichkingGUID = 0;
+ _utherGUID.Clear();
+ _lichkingGUID.Clear();
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
me->SetStandState(UNIT_STAND_STATE_STAND);
@@ -391,7 +389,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
switch (_events.ExecuteEvent())
{
case EVENT_WALK_INTRO1:
- if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KORELN_LORALEN)))
+ if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KORELN_LORALEN)))
korelnOrLoralen->GetMotionMaster()->MovePoint(0, KorelnOrLoralenPos[0]);
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
@@ -415,7 +413,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
break;
case EVENT_START_INTRO:
- if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KORELN_LORALEN)))
+ if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KORELN_LORALEN)))
korelnOrLoralen->GetMotionMaster()->MovePoint(0, KorelnOrLoralenPos[1]);
// Begining of intro is differents between factions as the speech sequence and timers are differents.
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
@@ -441,7 +439,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
case EVENT_INTRO_A2_3:
me->CastSpell(me, SPELL_CAST_VISUAL, false);
me->CastSpell(me, SPELL_FROSTMOURNE_SOUNDS, true);
- _instance->HandleGameObject(_instance->GetData64(DATA_FROSTMOURNE), true);
+ _instance->HandleGameObject(_instance->GetGuidData(DATA_FROSTMOURNE), true);
_events.ScheduleEvent(EVENT_INTRO_A2_4, 10000);
break;
case EVENT_INTRO_A2_4:
@@ -533,7 +531,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
Talk(SAY_SYLVANAS_INTRO_3);
me->CastSpell(me, SPELL_CAST_VISUAL, false);
me->CastSpell(me, SPELL_FROSTMOURNE_SOUNDS, true);
- _instance->HandleGameObject(_instance->GetData64(DATA_FROSTMOURNE), true);
+ _instance->HandleGameObject(_instance->GetGuidData(DATA_FROSTMOURNE), true);
_events.ScheduleEvent(EVENT_INTRO_H2_4, 6000);
break;
case EVENT_INTRO_H2_4:
@@ -627,7 +625,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
{
uther->CastSpell(uther, SPELL_UTHER_DESPAWN, true);
uther->DespawnOrUnsummon(5000);
- _utherGUID = 0;
+ _utherGUID.Clear();
}
_events.ScheduleEvent(EVENT_INTRO_LK_4, 9000);
break;
@@ -635,7 +633,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
// He steps forward and removes the runeblade from the heap of skulls.
if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
- if (GameObject* frostmourne = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_FROSTMOURNE)))
+ if (GameObject* frostmourne = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_FROSTMOURNE)))
frostmourne->SetLootState(GO_JUST_DEACTIVATED);
lichking->CastSpell(lichking, SPELL_TAKE_FROSTMOURNE, true);
lichking->CastSpell(lichking, SPELL_FROSTMOURNE_VISUAL, true);
@@ -649,12 +647,12 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
break;
case EVENT_INTRO_LK_6:
// summon Falric and Marwyn. then go back to the door
- if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FALRIC)))
+ if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_FALRIC)))
{
falric->CastSpell(falric, SPELL_BOSS_SPAWN_AURA, true);
falric->SetVisible(true);
}
- if (Creature* marwyn = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MARWYN)))
+ if (Creature* marwyn = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MARWYN)))
{
marwyn->CastSpell(marwyn, SPELL_BOSS_SPAWN_AURA, true);
marwyn->SetVisible(true);
@@ -669,7 +667,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
_events.ScheduleEvent(EVENT_OPEN_IMPENETRABLE_DOOR, 5000);
break;
case EVENT_INTRO_LK_7:
- if (Creature* marwyn = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MARWYN)))
+ if (Creature* marwyn = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MARWYN)))
{
marwyn->AI()->Talk(SAY_MARWYN_INTRO_1);
marwyn->SetWalk(true);
@@ -678,7 +676,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_LK_8, 1000);
break;
case EVENT_INTRO_LK_8:
- if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FALRIC)))
+ if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_FALRIC)))
{
falric->AI()->Talk(SAY_FALRIC_INTRO_1);
falric->SetWalk(true);
@@ -687,7 +685,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_LK_9, 5000);
break;
case EVENT_INTRO_LK_9:
- if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FALRIC)))
+ if (Creature* falric = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_FALRIC)))
falric->AI()->Talk(SAY_FALRIC_INTRO_2);
_instance->ProcessEvent(0, EVENT_SPAWN_WAVES);
_events.ScheduleEvent(EVENT_INTRO_LK_10, 4000);
@@ -699,7 +697,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
Talk(SAY_SYLVANAS_INTRO_END);
me->GetMotionMaster()->MovePoint(0, LichKingMoveAwayPos);
/// @todo: needs some improvements
- if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KORELN_LORALEN)))
+ if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KORELN_LORALEN)))
korelnOrLoralen->GetMotionMaster()->MovePoint(1, KorelnOrLoralenPos[2]);
_events.ScheduleEvent(EVENT_INTRO_LK_11, 5000);
break;
@@ -719,7 +717,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID))
{
lichking->DespawnOrUnsummon(5000);
- _lichkingGUID = 0;
+ _lichkingGUID.Clear();
}
me->DespawnOrUnsummon(10000);
_events.ScheduleEvent(EVENT_CLOSE_IMPENETRABLE_DOOR, 7000);
@@ -730,7 +728,7 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
else
me->GetMotionMaster()->MovePoint(0, SylvanasIntroPosition[2]);
- if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KORELN_LORALEN)))
+ if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KORELN_LORALEN)))
korelnOrLoralen->GetMotionMaster()->MovePoint(0, KorelnOrLoralenPos[1]);
if (Creature* lichking = me->SummonCreature(NPC_THE_LICH_KING_INTRO, LichKingIntroPosition[0], TEMPSUMMON_MANUAL_DESPAWN))
@@ -745,13 +743,13 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_LK_4, 15000);
break;
case EVENT_OPEN_IMPENETRABLE_DOOR:
- _instance->HandleGameObject(_instance->GetData64(DATA_IMPENETRABLE_DOOR), true);
+ _instance->HandleGameObject(_instance->GetGuidData(DATA_IMPENETRABLE_DOOR), true);
break;
case EVENT_CLOSE_IMPENETRABLE_DOOR:
- _instance->HandleGameObject(_instance->GetData64(DATA_IMPENETRABLE_DOOR), false);
+ _instance->HandleGameObject(_instance->GetGuidData(DATA_IMPENETRABLE_DOOR), false);
break;
case EVENT_KORELN_LORALEN_DEATH:
- if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KORELN_LORALEN)))
+ if (Creature* korelnOrLoralen = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_KORELN_LORALEN)))
korelnOrLoralen->CastSpell(korelnOrLoralen, SPELL_FEIGN_DEATH);
break;
default:
@@ -762,8 +760,8 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
private:
InstanceScript* _instance;
EventMap _events;
- uint64 _utherGUID;
- uint64 _lichkingGUID;
+ ObjectGuid _utherGUID;
+ ObjectGuid _lichkingGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -807,7 +805,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
lichking->AI()->EnterEvadeMode(); // event failed
}
@@ -868,10 +866,10 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
else
me->RemoveAurasDueToSpell(SPELL_SYLVANAS_DESTROY_ICE_WALL);
- _instance->HandleGameObject(_instance->GetData64(DATA_ICEWALL), true);
- me->m_Events.AddEvent(new GameObjectDeleteDelayEvent(me, _instance->GetData64(DATA_ICEWALL)), me->m_Events.CalculateTime(5000));
+ _instance->HandleGameObject(_instance->GetGuidData(DATA_ICEWALL), true);
+ me->m_Events.AddEvent(new GameObjectDeleteDelayEvent(me, _instance->GetGuidData(DATA_ICEWALL)), me->m_Events.CalculateTime(5000));
- if (Creature* wallTarget = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ICEWALL_TARGET)))
+ if (Creature* wallTarget = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ICEWALL_TARGET)))
wallTarget->DespawnOrUnsummon();
}
@@ -879,7 +877,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
{
if (_icewall < 4)
{
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
{
lichking->StopMoving();
if (Creature* wallTarget = me->SummonCreature(NPC_ICE_WALL_TARGET, IceWallTargetPosition[_icewall], TEMPSUMMON_MANUAL_DESPAWN, 720000))
@@ -895,7 +893,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
if (_icewall < 4)
Talk(SAY_JAINA_SYLVANAS_ESCAPE_2 + _icewall);
- if (Creature* wallTarget = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ICEWALL_TARGET)))
+ if (Creature* wallTarget = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ICEWALL_TARGET)))
me->SetFacingToObject(wallTarget);
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
@@ -925,7 +923,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
break;
case POINT_TRAP:
Talk(SAY_JAINA_SYLVANAS_ESCAPE_8);
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
me->SetFacingToObject(lichking);
break;
default:
@@ -933,7 +931,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
}
}
- void DeleteAllFromThreatList(Unit* target, uint64 except)
+ void DeleteAllFromThreatList(Unit* target, ObjectGuid except)
{
ThreatContainer::StorageType threatlist = target->getThreatManager().getThreatList();
for (auto i : threatlist)
@@ -959,7 +957,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
else
DoCast(me, SPELL_SYLVANAS_CLOAK_OF_DARKNESS);
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
{
me->CastSpell(lichking, SPELL_TAUNT_ARTHAS, true);
lichking->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
@@ -971,7 +969,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
break;
case EVENT_ESCAPE_1:
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
{
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
lichking->AI()->Talk(SAY_LK_ESCAPE_1);
@@ -990,7 +988,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
else
DoCast(me, SPELL_SYLVANAS_BLINDING_RETREAT, true);
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
{
lichking->SetReactState(REACT_PASSIVE);
lichking->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
@@ -1010,7 +1008,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
DoCast(me, SPELL_CREDIT_FINDING_SYLVANAS);
Talk(SAY_JAINA_SYLVANAS_ESCAPE_1);
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
{
lichking->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
lichking->RemoveAllAttackers();
@@ -1024,7 +1022,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
me->GetMotionMaster()->MovePoint(POINT_SHADOW_THRONE_DOOR, SylvanasShadowThroneDoorPosition);
break;
case EVENT_ESCAPE_6:
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
{
lichking->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_PACIFIED);
@@ -1044,13 +1042,13 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
_events.ScheduleEvent(EVENT_ESCAPE_7, 1000);
break;
case EVENT_ESCAPE_7:
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
lichking->HandleEmoteCommand(TEXT_EMOTE_ROAR);
me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[0]);
_events.ScheduleEvent(EVENT_ESCAPE_8, 3000);
break;
case EVENT_ESCAPE_8:
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
lichking->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[0]);
_events.ScheduleEvent(EVENT_ESCAPE_9, 1000);
break;
@@ -1060,7 +1058,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
break;
case EVENT_ESCAPE_10:
me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[2]);
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
lichking->GetMotionMaster()->MovePoint(1, LichKingFirstSummon);
_events.ScheduleEvent(EVENT_ESCAPE_11, 6000);
break;
@@ -1069,7 +1067,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
_events.ScheduleEvent(EVENT_ESCAPE_12, 4000);
break;
case EVENT_ESCAPE_12:
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
lichking->CastSpell(lichking, SPELL_PAIN_AND_SUFFERING, true);
me->GetMotionMaster()->MovePoint(POINT_ATTACK_ICEWALL, NpcJainaOrSylvanasEscapeRoute[3]);
@@ -1089,7 +1087,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
Talk(SAY_JAINA_SYLVANAS_ESCAPE_6);
- if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING_ESCAPE)))
+ if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE)))
{
lichking->GetMotionMaster()->MovePoint(2, LichKingFinalPos);
lichking->RemoveAurasDueToSpell(SPELL_REMORSELESS_WINTER);
@@ -1100,7 +1098,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
me->RemoveAurasDueToSpell(SPELL_HARVEST_SOUL);
if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
Talk(SAY_JAINA_ESCAPE_9);
- if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetData64(DATA_GUNSHIP)))
+ if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetGuidData(DATA_GUNSHIP)))
gunship->EnableMovement(true);
_instance->SetBossState(DATA_THE_LICH_KING_ESCAPE, DONE);
break;
@@ -1163,16 +1161,16 @@ class npc_the_lich_king_escape_hor : public CreatureScript
switch (pointId)
{
case 1:
- if (Creature* target = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ESCAPE_LEADER)))
+ if (Creature* target = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ESCAPE_LEADER)))
me->GetMotionMaster()->MoveChase(target);
break;
case 2:
Talk(SAY_LK_ESCAPE_HARVEST_SOUL);
- if (Creature* target = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ESCAPE_LEADER)))
+ if (Creature* target = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ESCAPE_LEADER)))
DoCast(target, SPELL_HARVEST_SOUL);
- if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetData64(DATA_GUNSHIP)))
+ if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetGuidData(DATA_GUNSHIP)))
gunship->EnableMovement(true);
break;
default:
@@ -1197,7 +1195,7 @@ class npc_the_lich_king_escape_hor : public CreatureScript
// All summons dead and no summon events scheduled
if (!_summonsCount && _events.Empty())
{
- if (Creature* jainaOrSylvanas = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ESCAPE_LEADER)))
+ if (Creature* jainaOrSylvanas = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ESCAPE_LEADER)))
jainaOrSylvanas->AI()->DoAction(ACTION_WALL_BROKEN);
}
}
@@ -2023,12 +2021,12 @@ class at_hor_waves_restarter : public AreaTriggerScript
{
_instance->ProcessEvent(0, EVENT_SPAWN_WAVES);
- if (Creature* falric = ObjectAccessor::GetCreature(*player, _instance->GetData64(DATA_FALRIC)))
+ if (Creature* falric = ObjectAccessor::GetCreature(*player, _instance->GetGuidData(DATA_FALRIC)))
{
falric->CastSpell(falric, SPELL_BOSS_SPAWN_AURA, true);
falric->SetVisible(true);
}
- if (Creature* marwyn = ObjectAccessor::GetCreature(*player, _instance->GetData64(DATA_MARWYN)))
+ if (Creature* marwyn = ObjectAccessor::GetCreature(*player, _instance->GetGuidData(DATA_MARWYN)))
{
marwyn->CastSpell(marwyn, SPELL_BOSS_SPAWN_AURA, true);
marwyn->SetVisible(true);
@@ -2133,7 +2131,7 @@ struct npc_escape_event_trash : public ScriptedAI
void IsSummonedBy(Unit* /*summoner*/) override
{
DoZoneInCombat(me, 0.0f);
- if (Creature* leader = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ESCAPE_LEADER)))
+ if (Creature* leader = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ESCAPE_LEADER)))
{
me->SetInCombatWith(leader);
leader->SetInCombatWith(me);
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
index 578cf4f84fa..e44bf1d5aed 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
@@ -213,7 +213,7 @@ struct boss_horAI : BossAI
class GameObjectDeleteDelayEvent : public BasicEvent
{
public:
- GameObjectDeleteDelayEvent(Unit* owner, uint64 gameObjectGUID) : _owner(owner), _gameObjectGUID(gameObjectGUID) { }
+ GameObjectDeleteDelayEvent(Unit* owner, ObjectGuid gameObjectGUID) : _owner(owner), _gameObjectGUID(gameObjectGUID) { }
void DeleteGameObject()
{
@@ -234,7 +234,7 @@ class GameObjectDeleteDelayEvent : public BasicEvent
private:
Unit* _owner;
- uint64 _gameObjectGUID;
+ ObjectGuid _gameObjectGUID;
};
template<class AI>
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
index f73181ba1f3..6a157be26ee 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
@@ -85,27 +85,6 @@ class instance_halls_of_reflection : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
- JainaOrSylvanasIntroGUID = 0;
- KorelnOrLoralenGUID = 0;
- TheLichkingIntroGUID = 0;
- FalricGUID = 0;
- MarwynGUID = 0;
- FrostmourneAltarBunnyGUID = 0;
- FrostswornGeneralGUID = 0;
- JainaOrSylvanasEscapeGUID = 0;
- TheLichKingEscapeGUID = 0;
-
- FrostmourneGUID = 0;
- EntranceDoorGUID = 0;
- ImpenetrableDoorGUID = 0;
- ShadowThroneDoorGUID = 0;
- CaveInGUID = 0;
- GunshipGUID = 0;
- CaptainsChestGUID = 0;
- CaptainGUID = 0;
- IcewallGUID = 0;
- IcewallTargetGUID = 0;
-
_teamInInstance = 0;
_waveCount = 0;
_introState = NOT_STARTED;
@@ -200,7 +179,7 @@ class instance_halls_of_reflection : public InstanceMapScript
break;
}
case NPC_ICE_WALL_TARGET:
- IcewallTargetGUID = 0;
+ IcewallTargetGUID.Clear();
break;
case NPC_WORLD_TRIGGER:
case NPC_GUNSHIP_CANNON_HORDE:
@@ -256,11 +235,11 @@ class instance_halls_of_reflection : public InstanceMapScript
break;
case GO_IMPENETRABLE_DOOR:
ImpenetrableDoorGUID = go->GetGUID();
- HandleGameObject(0, GetBossState(DATA_MARWYN) == DONE, go);
+ HandleGameObject(ObjectGuid::Empty, GetBossState(DATA_MARWYN) == DONE, go);
break;
case GO_SHADOW_THRONE_DOOR:
ShadowThroneDoorGUID = go->GetGUID();
- HandleGameObject(0, GetData(DATA_FROSTSWORN_GENERAL) == DONE, go);
+ HandleGameObject(ObjectGuid::Empty, GetData(DATA_FROSTSWORN_GENERAL) == DONE, go);
break;
case GO_CAVE_IN:
CaveInGUID = go->GetGUID();
@@ -282,7 +261,7 @@ class instance_halls_of_reflection : public InstanceMapScript
CaptainsChestGUID = go->GetGUID();
break;
case GO_ICE_WALL:
- HandleGameObject(0, false, go);
+ HandleGameObject(ObjectGuid::Empty, false, go);
IcewallGUID = go->GetGUID();
break;
default:
@@ -483,7 +462,7 @@ class instance_halls_of_reflection : public InstanceMapScript
case NPC_WAVE_MAGE:
{
uint32 waveId = creature->AI()->GetData(0);
- for (uint64 guid : waveGuidList[waveId])
+ for (ObjectGuid guid : waveGuidList[waveId])
{
if (Creature* npc = instance->GetCreature(guid))
if (npc->IsAlive())
@@ -539,7 +518,7 @@ class instance_halls_of_reflection : public InstanceMapScript
{
tempList = possibilityList;
- uint64 bossGuid = i <= 3 ? FalricGUID : MarwynGUID;
+ ObjectGuid bossGuid = i <= 3 ? FalricGUID : MarwynGUID;
if (!i)
Trinity::Containers::RandomResizeList(tempList, 3);
@@ -571,7 +550,7 @@ class instance_halls_of_reflection : public InstanceMapScript
if (_waveCount % 5)
{
uint32 internalWaveId = _waveCount - ((_waveCount < 5) ? 1 : 2);
- for (uint64 guid : waveGuidList[internalWaveId])
+ for (ObjectGuid guid : waveGuidList[internalWaveId])
{
if (Creature* temp = instance->GetCreature(guid))
{
@@ -610,7 +589,7 @@ class instance_halls_of_reflection : public InstanceMapScript
// despawn wave npcs
for (uint8 i = 0; i < 8; ++i)
{
- for (uint64 guid : waveGuidList[i])
+ for (ObjectGuid guid : waveGuidList[i])
if (Creature* creature = instance->GetCreature(guid))
creature->DespawnOrUnsummon(1);
waveGuidList[i].clear();
@@ -630,9 +609,9 @@ class instance_halls_of_reflection : public InstanceMapScript
if (Creature* captain = instance->GetCreature(CaptainGUID))
captain->AI()->Talk(SAY_CAPTAIN_FIRE);
- for (uint64 guid : GunshipCannonGUIDs)
+ for (ObjectGuid guid : GunshipCannonGUIDs)
{
- uint32 entry = GUID_ENPART(guid);
+ uint32 entry = guid.GetEntry();
if ((entry == NPC_WORLD_TRIGGER && _teamInInstance == ALLIANCE) || (entry == NPC_GUNSHIP_CANNON_HORDE && _teamInInstance == HORDE))
if (Creature* cannon = instance->GetCreature(guid))
cannon->CastSpell(cannon, SPELL_GUNSHIP_CANNON_FIRE, true);
@@ -642,7 +621,7 @@ class instance_halls_of_reflection : public InstanceMapScript
if (Transport* gunship = instance->GetTransport(GunshipGUID))
gunship->EnableMovement(false);
- for (uint64 guid : GunshipStairGUIDs)
+ for (ObjectGuid guid : GunshipStairGUIDs)
if (GameObject* stairs = instance->GetGameObject(guid))
stairs->SetRespawnTime(DAY);
@@ -677,7 +656,7 @@ class instance_halls_of_reflection : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -707,7 +686,7 @@ class instance_halls_of_reflection : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
void WriteSaveDataMore(std::ostringstream& data) override
@@ -732,21 +711,21 @@ class instance_halls_of_reflection : public InstanceMapScript
}
private:
- uint64 JainaOrSylvanasIntroGUID; // unused
- uint64 KorelnOrLoralenGUID;
- uint64 TheLichkingIntroGUID; // unused
- uint64 FalricGUID;
- uint64 MarwynGUID;
- uint64 FrostmourneAltarBunnyGUID;
- uint64 FrostswornGeneralGUID;
- uint64 JainaOrSylvanasEscapeGUID;
- uint64 TheLichKingEscapeGUID;
-
- uint64 FrostmourneGUID;
- uint64 EntranceDoorGUID;
- uint64 ImpenetrableDoorGUID;
- uint64 ShadowThroneDoorGUID;
- uint64 CaveInGUID;
+ ObjectGuid JainaOrSylvanasIntroGUID; // unused
+ ObjectGuid KorelnOrLoralenGUID;
+ ObjectGuid TheLichkingIntroGUID; // unused
+ ObjectGuid FalricGUID;
+ ObjectGuid MarwynGUID;
+ ObjectGuid FrostmourneAltarBunnyGUID;
+ ObjectGuid FrostswornGeneralGUID;
+ ObjectGuid JainaOrSylvanasEscapeGUID;
+ ObjectGuid TheLichKingEscapeGUID;
+
+ ObjectGuid FrostmourneGUID;
+ ObjectGuid EntranceDoorGUID;
+ ObjectGuid ImpenetrableDoorGUID;
+ ObjectGuid ShadowThroneDoorGUID;
+ ObjectGuid CaveInGUID;
uint32 _teamInInstance;
uint32 _waveCount;
@@ -754,16 +733,16 @@ class instance_halls_of_reflection : public InstanceMapScript
uint32 _frostswornGeneralState;
EventMap events;
- std::set<uint64> waveGuidList[8];
+ GuidSet waveGuidList[8];
- uint64 GunshipGUID;
- uint64 CaptainsChestGUID;
- uint64 CaptainGUID;
- uint64 IcewallGUID;
- uint64 IcewallTargetGUID;
+ ObjectGuid GunshipGUID;
+ ObjectGuid CaptainsChestGUID;
+ ObjectGuid CaptainGUID;
+ ObjectGuid IcewallGUID;
+ ObjectGuid IcewallTargetGUID;
- std::set<uint64> GunshipCannonGUIDs;
- std::set<uint64> GunshipStairGUIDs;
+ GuidSet GunshipCannonGUIDs;
+ GuidSet GunshipStairGUIDs;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
index 62a6ac41074..3ac5ec3070a 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
@@ -121,7 +121,7 @@ class boss_garfrost : public CreatureScript
Talk(SAY_DEATH);
me->RemoveAllGameObjects();
- if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TYRANNUS)))
+ if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TYRANNUS)))
tyrannus->AI()->Talk(SAY_TYRANNUS_DEATH);
}
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
index 5b147344a59..327ea2c9b7b 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
@@ -151,7 +151,7 @@ class boss_ick : public CreatureScript
Creature* GetKrick()
{
- return ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KRICK));
+ return ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KRICK));
}
void EnterCombat(Unit* /*who*/) override
@@ -293,8 +293,8 @@ class boss_krick : public CreatureScript
void Initialize()
{
_phase = PHASE_COMBAT;
- _outroNpcGUID = 0;
- _tyrannusGUID = 0;
+ _outroNpcGUID.Clear();
+ _tyrannusGUID.Clear();
}
void Reset() override
@@ -308,7 +308,7 @@ class boss_krick : public CreatureScript
Creature* GetIck()
{
- return ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_ICK));
+ return ObjectAccessor::GetCreature(*me, _instanceScript->GetGuidData(DATA_ICK));
}
void KilledUnit(Unit* victim) override
@@ -333,7 +333,7 @@ class boss_krick : public CreatureScript
{
if (actionId == ACTION_OUTRO)
{
- Creature* tyrannusPtr = ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_TYRANNUS_EVENT));
+ Creature* tyrannusPtr = ObjectAccessor::GetCreature(*me, _instanceScript->GetGuidData(DATA_TYRANNUS_EVENT));
if (tyrannusPtr)
tyrannusPtr->NearTeleportTo(outroPos[1].GetPositionX(), outroPos[1].GetPositionY(), outroPos[1].GetPositionZ(), outroPos[1].GetOrientation());
else
@@ -369,7 +369,7 @@ class boss_krick : public CreatureScript
{
case EVENT_OUTRO_1:
{
- if (Creature* temp = ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_JAINA_SYLVANAS_1)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, _instanceScript->GetGuidData(DATA_JAINA_SYLVANAS_1)))
temp->DespawnOrUnsummon();
Creature* jainaOrSylvanas = NULL;
@@ -417,7 +417,7 @@ class boss_krick : public CreatureScript
_events.ScheduleEvent(EVENT_OUTRO_6, 1000);
break;
case EVENT_OUTRO_6:
- if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_TYRANNUS_EVENT)))
+ if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _instanceScript->GetGuidData(DATA_TYRANNUS_EVENT)))
{
tyrannus->SetSpeed(MOVE_FLIGHT, 3.5f, true);
tyrannus->GetMotionMaster()->MovePoint(1, outroPos[4]);
@@ -494,8 +494,8 @@ class boss_krick : public CreatureScript
EventMap _events;
KrickPhase _phase;
- uint64 _outroNpcGUID;
- uint64 _tyrannusGUID;
+ ObjectGuid _outroNpcGUID;
+ ObjectGuid _tyrannusGUID;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
index f392b21b173..c2b1b91a200 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
@@ -153,7 +153,7 @@ class boss_tyrannus : public CreatureScript
Creature* GetRimefang()
{
- return ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RIMEFANG));
+ return ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_RIMEFANG));
}
void EnterCombat(Unit* /*who*/) override
@@ -235,7 +235,7 @@ class boss_tyrannus : public CreatureScript
me->GetMotionMaster()->MovePoint(0, miscPos);
break;
case EVENT_COMBAT_START:
- if (Creature* rimefang = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RIMEFANG)))
+ if (Creature* rimefang = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_RIMEFANG)))
rimefang->AI()->DoAction(ACTION_START_RIMEFANG); //set rimefang also infight
events.SetPhase(PHASE_COMBAT);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -299,7 +299,7 @@ class boss_rimefang : public CreatureScript
void Initialize()
{
_currentWaypoint = 0;
- _hoarfrostTargetGUID = 0;
+ _hoarfrostTargetGUID.Clear();
}
void Reset() override
@@ -330,7 +330,7 @@ class boss_rimefang : public CreatureScript
_EnterEvadeMode();
}
- void SetGUID(uint64 guid, int32 type) override
+ void SetGUID(ObjectGuid guid, int32 type) override
{
if (type == GUID_HOARFROST)
{
@@ -366,7 +366,7 @@ class boss_rimefang : public CreatureScript
if (Unit* target = ObjectAccessor::GetUnit(*me, _hoarfrostTargetGUID))
{
DoCast(target, SPELL_HOARFROST);
- _hoarfrostTargetGUID = 0;
+ _hoarfrostTargetGUID.Clear();
}
break;
default:
@@ -377,7 +377,7 @@ class boss_rimefang : public CreatureScript
private:
Vehicle* _vehicle;
- uint64 _hoarfrostTargetGUID;
+ ObjectGuid _hoarfrostTargetGUID;
EventMap _events;
uint8 _currentWaypoint;
};
@@ -391,7 +391,7 @@ class boss_rimefang : public CreatureScript
class player_overlord_brandAI : public PlayerAI
{
public:
- player_overlord_brandAI(Player* player, uint64 casterGUID) : PlayerAI(player), _tyrannusGUID(casterGUID) { }
+ player_overlord_brandAI(Player* player, ObjectGuid casterGUID) : PlayerAI(player), _tyrannusGUID(casterGUID) { }
void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) override
{
@@ -409,7 +409,7 @@ class player_overlord_brandAI : public PlayerAI
void UpdateAI(uint32 /*diff*/) override { }
private:
- uint64 _tyrannusGUID;
+ ObjectGuid _tyrannusGUID;
};
class spell_tyrannus_overlord_brand : public SpellScriptLoader
@@ -480,7 +480,7 @@ class spell_tyrannus_mark_of_rimefang : public SpellScriptLoader
return;
if (InstanceScript* instance = caster->GetInstanceScript())
- if (Creature* rimefang = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_RIMEFANG)))
+ if (Creature* rimefang = ObjectAccessor::GetCreature(*caster, instance->GetGuidData(DATA_RIMEFANG)))
rimefang->AI()->SetGUID(GetTarget()->GetGUID(), GUID_HOARFROST);
}
@@ -545,7 +545,7 @@ class at_tyrannus_event_starter : public AreaTriggerScript
return false;
if (instance->GetBossState(DATA_TYRANNUS) != IN_PROGRESS && instance->GetBossState(DATA_TYRANNUS) != DONE)
- if (Creature* tyrannus = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_TYRANNUS)))
+ if (Creature* tyrannus = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_TYRANNUS)))
{
tyrannus->AI()->DoAction(ACTION_START_INTRO);
return true;
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
index d829b98f926..29fbc0be2b3 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
@@ -44,15 +44,7 @@ class instance_pit_of_saron : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(Doors);
- _garfrostGUID = 0;
- _krickGUID = 0;
- _ickGUID = 0;
- _tyrannusGUID = 0;
- _rimefangGUID = 0;
- _jainaOrSylvanas1GUID = 0;
- _jainaOrSylvanas2GUID = 0;
_teamInInstance = 0;
- _tyrannusEventGUID = 0;
}
void OnPlayerEnter(Player* player) override
@@ -239,7 +231,7 @@ class instance_pit_of_saron : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -263,19 +255,19 @@ class instance_pit_of_saron : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
private:
- uint64 _garfrostGUID;
- uint64 _krickGUID;
- uint64 _ickGUID;
- uint64 _tyrannusGUID;
- uint64 _rimefangGUID;
+ ObjectGuid _garfrostGUID;
+ ObjectGuid _krickGUID;
+ ObjectGuid _ickGUID;
+ ObjectGuid _tyrannusGUID;
+ ObjectGuid _rimefangGUID;
- uint64 _tyrannusEventGUID;
- uint64 _jainaOrSylvanas1GUID;
- uint64 _jainaOrSylvanas2GUID;
+ ObjectGuid _tyrannusEventGUID;
+ ObjectGuid _jainaOrSylvanas1GUID;
+ ObjectGuid _jainaOrSylvanas2GUID;
uint32 _teamInInstance;
};
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
index 4d2ebd44db8..062d6a13390 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
@@ -230,7 +230,7 @@ class spell_trash_npc_glacial_strike : public SpellScriptLoader
{
if (GetTarget()->IsFullHealth())
{
- GetTarget()->RemoveAura(GetId(), 0, 0, AURA_REMOVE_BY_ENEMY_SPELL);
+ GetTarget()->RemoveAura(GetId(), ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL);
PreventDefaultAction();
}
}
diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
index 001f19679c4..f1fececfa7f 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
@@ -24,6 +24,13 @@
#include "gundrak.h"
#include "SpellInfo.h"
+enum Texts
+{
+ // Drakkari Elemental
+ EMOTE_MOJO = 0,
+ EMOTE_ACTIVATE_ALTAR = 1
+};
+
enum Spells
{
SPELL_EMERGE = 54850,
@@ -80,7 +87,7 @@ class boss_drakkari_colossus : public CreatureScript
struct boss_drakkari_colossusAI : public BossAI
{
- boss_drakkari_colossusAI(Creature* creature) : BossAI(creature, DATA_DRAKKARI_COLOSSUS_EVENT)
+ boss_drakkari_colossusAI(Creature* creature) : BossAI(creature, DATA_DRAKKARI_COLOSSUS)
{
Initialize();
me->SetReactState(REACT_PASSIVE);
@@ -103,41 +110,20 @@ class boss_drakkari_colossus : public CreatureScript
me->RemoveAura(SPELL_FREEZE_ANIM);
}
- //events.Reset(); -> done in _Reset();
events.ScheduleEvent(EVENT_MIGHTY_BLOW, urand(10000, 30000));
Initialize();
-
- // Note: This should not be called, but before use SetBossState function we should use BossAI
- // in all the bosses of the instance
- instance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, NOT_STARTED);
}
void EnterCombat(Unit* /*who*/) override
{
_EnterCombat();
-
me->RemoveAura(SPELL_FREEZE_ANIM);
-
- // Note: This should not be called, but before use SetBossState function we should use BossAI
- // in all the bosses of the instance
- instance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, IN_PROGRESS);
}
void JustDied(Unit* /*killer*/) override
{
_JustDied();
-
- // Note: This should not be called, but before use SetBossState function we should use BossAI
- // in all the bosses of the instance
- instance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, DONE);
- }
-
- void JustReachedHome() override
- {
- // Note: This should not be called, but before use SetBossState function we should use BossAI
- // in all the bosses of the instance
- instance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, FAIL);
}
void DoAction(int32 action) override
@@ -181,13 +167,12 @@ class boss_drakkari_colossus : public CreatureScript
if (phase == COLOSSUS_PHASE_NORMAL ||
phase == COLOSSUS_PHASE_FIRST_ELEMENTAL_SUMMON)
{
- if (HealthBelowPct( phase == COLOSSUS_PHASE_NORMAL ? 50 : 5))
+ if (HealthBelowPct(phase == COLOSSUS_PHASE_NORMAL ? 50 : 5))
{
damage = 0;
phase = (phase == COLOSSUS_PHASE_NORMAL ? COLOSSUS_PHASE_FIRST_ELEMENTAL_SUMMON : COLOSSUS_PHASE_SECOND_ELEMENTAL_SUMMON);
DoAction(ACTION_FREEZE_COLOSSUS);
DoAction(ACTION_SUMMON_ELEMENTAL);
-
}
}
}
@@ -248,7 +233,7 @@ class boss_drakkari_colossus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_drakkari_colossusAI>(creature);
+ return GetGundrakAI<boss_drakkari_colossusAI>(creature);
}
};
@@ -275,10 +260,9 @@ class boss_drakkari_elemental : public CreatureScript
void JustDied(Unit* killer) override
{
- if (killer == me)
- return;
+ Talk(EMOTE_ACTIVATE_ALTAR);
- if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
+ if (Creature* colossus = instance->GetCreature(DATA_DRAKKARI_COLOSSUS))
killer->Kill(colossus);
}
@@ -313,8 +297,9 @@ class boss_drakkari_elemental : public CreatureScript
switch (action)
{
case ACTION_RETURN_TO_COLOSSUS:
+ Talk(EMOTE_MOJO);
DoCast(SPELL_SURGE_VISUAL);
- if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
+ if (Creature* colossus = instance->GetCreature(DATA_DRAKKARI_COLOSSUS))
// what if the elemental is more than 80 yards from drakkari colossus ?
DoCast(colossus, SPELL_MERGE, true);
break;
@@ -323,11 +308,11 @@ class boss_drakkari_elemental : public CreatureScript
void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
- if (HealthBelowPct(50) && instance)
+ if (HealthBelowPct(50))
{
- if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
+ if (Creature* colossus = instance->GetCreature(DATA_DRAKKARI_COLOSSUS))
{
- if (colossus->AI()->GetData(DATA_COLOSSUS_PHASE) == COLOSSUS_PHASE_FIRST_ELEMENTAL_SUMMON)
+ if (colossus->AI()->GetData(DATA_COLOSSUS_PHASE) == COLOSSUS_PHASE_FIRST_ELEMENTAL_SUMMON)
{
damage = 0;
@@ -375,7 +360,7 @@ class boss_drakkari_elemental : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_drakkari_elementalAI>(creature);
+ return GetGundrakAI<boss_drakkari_elementalAI>(creature);
}
};
@@ -386,7 +371,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_living_mojoAI>(creature);
+ return GetGundrakAI<npc_living_mojoAI>(creature);
}
struct npc_living_mojoAI : public ScriptedAI
@@ -429,7 +414,7 @@ public:
if (id == 1)
{
- if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
+ if (Creature* colossus = instance->GetCreature(DATA_DRAKKARI_COLOSSUS))
{
colossus->AI()->DoAction(ACTION_UNFREEZE_COLOSSUS);
if (!colossus->AI()->GetData(DATA_INTRO_DONE))
@@ -446,13 +431,11 @@ public:
return;
// we do this checks to see if the creature is one of the creatures that sorround the boss
- if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS)))
+ if (Creature* colossus = instance->GetCreature(DATA_DRAKKARI_COLOSSUS))
{
Position homePosition = me->GetHomePosition();
- Position colossusHomePosition = colossus->GetHomePosition();
-
- float distance = homePosition.GetExactDist(colossusHomePosition.GetPositionX(), colossusHomePosition.GetPositionY(), colossusHomePosition.GetPositionZ());
+ float distance = homePosition.GetExactDist(&colossus->GetHomePosition());
if (distance < 12.0f)
{
@@ -484,6 +467,7 @@ public:
DoMeleeAttackIfReady();
}
+
private:
InstanceScript* instance;
uint32 mojoWaveTimer;
diff --git a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
index 9f8cc818958..baf749fec51 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
@@ -19,13 +19,18 @@
#include "ScriptedCreature.h"
#include "gundrak.h"
+enum Texts
+{
+ EMOTE_SPAWN = 0
+};
+
enum Spells
{
- SPELL_ECK_BERSERK = 55816, //Eck goes berserk, increasing his attack speed by 150% and all damage he deals by 500%.
- SPELL_ECK_BITE = 55813, //Eck bites down hard, inflicting 150% of his normal damage to an enemy.
- SPELL_ECK_SPIT = 55814, //Eck spits toxic bile at enemies in a cone in front of him, inflicting 2970 Nature damage and draining 220 mana every 1 sec for 3 sec.
- SPELL_ECK_SPRING_1 = 55815, //Eck leaps at a distant target. --> Drops aggro and charges a random player. Tank can simply taunt him back.
- SPELL_ECK_SPRING_2 = 55837 //Eck leaps at a distant target.
+ SPELL_ECK_BERSERK = 55816, // Eck goes berserk, increasing his attack speed by 150% and all damage he deals by 500%.
+ SPELL_ECK_BITE = 55813, // Eck bites down hard, inflicting 150% of his normal damage to an enemy.
+ SPELL_ECK_SPIT = 55814, // Eck spits toxic bile at enemies in a cone in front of him, inflicting 2970 Nature damage and draining 220 mana every 1 sec for 3 sec.
+ SPELL_ECK_SPRING_1 = 55815, // Eck leaps at a distant target. --> Drops aggro and charges a random player. Tank can simply taunt him back.
+ SPELL_ECK_SPRING_2 = 55837 // Eck leaps at a distant target.
};
enum Events
@@ -38,79 +43,80 @@ enum Events
class boss_eck : public CreatureScript
{
-public:
- boss_eck() : CreatureScript("boss_eck") { }
+ public:
+ boss_eck() : CreatureScript("boss_eck") { }
- struct boss_eckAI : public BossAI
- {
- boss_eckAI(Creature* creature) : BossAI(creature, DATA_ECK_THE_FEROCIOUS_EVENT)
+ struct boss_eckAI : public BossAI
{
- Initialize();
- }
+ boss_eckAI(Creature* creature) : BossAI(creature, DATA_ECK_THE_FEROCIOUS)
+ {
+ Initialize();
+ Talk(EMOTE_SPAWN);
+ }
- void Initialize()
- {
- Berserk = false;
- }
+ void Initialize()
+ {
+ _berserk = false;
+ }
- void Reset() override
- {
- _Reset();
- Initialize();
- }
+ void Reset() override
+ {
+ _Reset();
+ Initialize();
+ }
- void EnterCombat(Unit* /*who*/) override
- {
- _EnterCombat();
- events.ScheduleEvent(EVENT_BITE, 5 * IN_MILLISECONDS);
- events.ScheduleEvent(EVENT_SPIT, 10 * IN_MILLISECONDS);
- events.ScheduleEvent(EVENT_SPRING, 8 * IN_MILLISECONDS);
- events.ScheduleEvent(EVENT_BERSERK, urand(60 * IN_MILLISECONDS, 90 * IN_MILLISECONDS)); //60-90 secs according to wowwiki
- }
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _EnterCombat();
+ events.ScheduleEvent(EVENT_BITE, 5 * IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_SPIT, 10 * IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_SPRING, 8 * IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_BERSERK, urand(60 * IN_MILLISECONDS, 90 * IN_MILLISECONDS)); // 60-90 secs according to wowwiki
+ }
- void DamageTaken(Unit* /*attacker*/, uint32& damage) override
- {
- if (me->HealthBelowPctDamaged(20, damage) && !Berserk)
+ void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
- events.RescheduleEvent(EVENT_BERSERK, 1000);
- Berserk = true;
+ if (!_berserk && me->HealthBelowPctDamaged(20, damage))
+ {
+ events.RescheduleEvent(EVENT_BERSERK, 1000);
+ _berserk = true;
+ }
}
- }
- void ExecuteEvent(uint32 eventId) override
- {
- switch (eventId)
+ void ExecuteEvent(uint32 eventId) override
{
- case EVENT_BITE:
- DoCastVictim(SPELL_ECK_BITE);
- events.ScheduleEvent(EVENT_BITE, urand(8 * IN_MILLISECONDS, 12 * IN_MILLISECONDS));
- break;
- case EVENT_SPIT:
- DoCastVictim(SPELL_ECK_SPIT);
- events.ScheduleEvent(EVENT_SPIT, urand(6 * IN_MILLISECONDS, 14 * IN_MILLISECONDS));
- break;
- case EVENT_SPRING:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 35.0f, true))
- DoCast(target, RAND(SPELL_ECK_SPRING_1, SPELL_ECK_SPRING_2));
- events.ScheduleEvent(EVENT_SPRING, urand(5 * IN_MILLISECONDS, 10 * IN_MILLISECONDS));
- break;
- case EVENT_BERSERK:
- DoCast(me, SPELL_ECK_BERSERK);
- Berserk = true;
- break;
- default:
- break;
+ switch (eventId)
+ {
+ case EVENT_BITE:
+ DoCastVictim(SPELL_ECK_BITE);
+ events.ScheduleEvent(EVENT_BITE, urand(8 * IN_MILLISECONDS, 12 * IN_MILLISECONDS));
+ break;
+ case EVENT_SPIT:
+ DoCastVictim(SPELL_ECK_SPIT);
+ events.ScheduleEvent(EVENT_SPIT, urand(6 * IN_MILLISECONDS, 14 * IN_MILLISECONDS));
+ break;
+ case EVENT_SPRING:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 35.0f, true))
+ DoCast(target, RAND(SPELL_ECK_SPRING_1, SPELL_ECK_SPRING_2));
+ events.ScheduleEvent(EVENT_SPRING, urand(5 * IN_MILLISECONDS, 10 * IN_MILLISECONDS));
+ break;
+ case EVENT_BERSERK:
+ DoCast(me, SPELL_ECK_BERSERK);
+ _berserk = true;
+ break;
+ default:
+ break;
+ }
}
- }
private:
- bool Berserk;
- };
+ bool _berserk;
+ };
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetInstanceAI<boss_eckAI>(creature);
- }
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetGundrakAI<boss_eckAI>(creature);
+ }
};
void AddSC_boss_eck()
diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
index 22e7ac280fd..c9ea3a26f4d 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
@@ -17,281 +17,272 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "gundrak.h"
-//Spells
+/// @todo: implement stampede
+
enum Spells
{
- SPELL_ENRAGE = 55285,
- H_SPELL_ENRAGE = 59828,
- SPELL_IMPALING_CHARGE = 54956,
- H_SPELL_IMPALING_CHARGE = 59827,
- SPELL_STOMP = 55292,
- H_SPELL_STOMP = 59829,
- SPELL_PUNCTURE = 55276,
- H_SPELL_PUNCTURE = 59826,
- SPELL_STAMPEDE = 55218,
- SPELL_WHIRLING_SLASH = 55250,
- H_SPELL_WHIRLING_SLASH = 59824,
+ SPELL_IMPALING_CHARGE = 54956,
+ SPELL_IMPALING_CHARGE_CONTROL_VEHICLE = 54958,
+ SPELL_STOMP = 55292,
+ SPELL_PUNCTURE = 55276,
+ SPELL_STAMPEDE = 55218,
+ SPELL_WHIRLING_SLASH = 55250,
+ SPELL_ENRAGE = 55285,
+ SPELL_HEARTH_BEAM_VISUAL = 54988,
+ SPELL_TRANSFORM_RHINO = 55297,
+ SPELL_TRANSFORM_BACK = 55299
};
-//Yells
enum Yells
{
- SAY_AGGRO = 0,
- SAY_SLAY = 1,
- SAY_DEATH = 2,
- SAY_SUMMON_RHINO = 3,
- SAY_TRANSFORM_1 = 4,
- SAY_TRANSFORM_2 = 5
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_SUMMON_RHINO = 3,
+ SAY_TRANSFORM_1 = 4,
+ SAY_TRANSFORM_2 = 5,
+ EMOTE_IMPALE = 6
};
-enum Displays
+enum CombatPhase
{
- DISPLAY_RHINO = 26265,
- DISPLAY_TROLL = 27061
+ PHASE_TROLL = 1,
+ PHASE_RHINO = 2
};
-enum CombatPhase
+enum Events
{
- TROLL,
- RHINO
+ EVENT_IMPALING_CHARGE = 1,
+ EVENT_STOMP,
+ EVENT_PUNCTURE,
+ EVENT_STAMPEDE,
+ EVENT_WHIRLING_SLASH,
+ EVENT_ENRAGE,
+ EVENT_TRANSFORM,
+
+ EVENT_GROUP_TROLL = PHASE_TROLL,
+ EVENT_GROUP_RHINO = PHASE_RHINO
};
enum Misc
{
- DATA_SHARE_THE_LOVE = 1
+ DATA_SHARE_THE_LOVE = 1
};
class boss_gal_darah : public CreatureScript
{
-public:
- boss_gal_darah() : CreatureScript("boss_gal_darah") { }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetInstanceAI<boss_gal_darahAI>(creature);
- }
+ public:
+ boss_gal_darah() : CreatureScript("boss_gal_darah") { }
- struct boss_gal_darahAI : public ScriptedAI
- {
- boss_gal_darahAI(Creature* creature) : ScriptedAI(creature)
+ struct boss_gal_darahAI : public BossAI
{
- Initialize();
- instance = creature->GetInstanceScript();
- }
+ boss_gal_darahAI(Creature* creature) : BossAI(creature, DATA_GAL_DARAH)
+ {
+ Initialize();
+ }
- void Initialize()
- {
- uiStampedeTimer = 10 * IN_MILLISECONDS;
- uiWhirlingSlashTimer = 21 * IN_MILLISECONDS;
- uiPunctureTimer = 10 * IN_MILLISECONDS;
- uiEnrageTimer = 15 * IN_MILLISECONDS;
- uiImpalingChargeTimer = 21 * IN_MILLISECONDS;
- uiStompTimer = 25 * IN_MILLISECONDS;
- uiTransformationTimer = 9 * IN_MILLISECONDS;
- uiPhaseCounter = 0;
-
- shareTheLove = 0;
- bStartOfTransformation = true;
- Phase = TROLL;
- }
+ void Initialize()
+ {
+ _phaseCounter = 0;
+ }
- uint32 uiStampedeTimer;
- uint32 uiWhirlingSlashTimer;
- uint32 uiPunctureTimer;
- uint32 uiEnrageTimer;
- uint32 uiImpalingChargeTimer;
- uint32 uiStompTimer;
- uint32 uiTransformationTimer;
- std::list<uint64> impaledList;
- uint8 shareTheLove;
+ void InitializeAI() override
+ {
+ BossAI::InitializeAI();
+ DoCastAOE(SPELL_HEARTH_BEAM_VISUAL, true);
+ }
- CombatPhase Phase;
+ void Reset() override
+ {
+ Initialize();
+ _Reset();
+ impaledPlayers.clear();
+ }
- uint8 uiPhaseCounter;
+ void JustReachedHome() override
+ {
+ _JustReachedHome();
+ DoCastAOE(SPELL_HEARTH_BEAM_VISUAL, true);
+ }
- bool bStartOfTransformation;
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _EnterCombat();
+ Talk(SAY_AGGRO);
- InstanceScript* instance;
+ SetPhase(PHASE_TROLL);
+ }
- void Reset() override
- {
- Initialize();
+ void SetPhase(CombatPhase phase)
+ {
+ events.SetPhase(phase);
+ switch (phase)
+ {
+ case PHASE_TROLL:
+ events.ScheduleEvent(EVENT_STAMPEDE, 10 * IN_MILLISECONDS, 0, PHASE_TROLL);
+ events.ScheduleEvent(EVENT_WHIRLING_SLASH, 21 * IN_MILLISECONDS, 0, PHASE_TROLL);
+ break;
+ case PHASE_RHINO:
+ events.ScheduleEvent(EVENT_STOMP, 25 * IN_MILLISECONDS, 0, PHASE_RHINO);
+ events.ScheduleEvent(EVENT_IMPALING_CHARGE, 21 * IN_MILLISECONDS, 0, PHASE_RHINO);
+ events.ScheduleEvent(EVENT_ENRAGE, 15 * IN_MILLISECONDS, 0, PHASE_RHINO);
+ events.ScheduleEvent(EVENT_PUNCTURE, 10 * IN_MILLISECONDS, 0, PHASE_RHINO);
+ break;
+ }
+ }
- impaledList.clear();
+ void SetGUID(ObjectGuid guid, int32 type /*= 0*/) override
+ {
+ if (type == DATA_SHARE_THE_LOVE)
+ {
+ if (Unit* target = ObjectAccessor::GetUnit(*me, guid))
+ Talk(EMOTE_IMPALE, target);
+ impaledPlayers.insert(guid);
+ }
+ }
- me->SetDisplayId(DISPLAY_TROLL);
+ uint32 GetData(uint32 type) const override
+ {
+ if (type == DATA_SHARE_THE_LOVE)
+ return impaledPlayers.size();
- instance->SetData(DATA_GAL_DARAH_EVENT, NOT_STARTED);
- }
+ return 0;
+ }
- void EnterCombat(Unit* /*who*/) override
- {
- Talk(SAY_AGGRO);
+ void JustDied(Unit* /*killer*/) override
+ {
+ _JustDied();
+ Talk(SAY_DEATH);
+ }
- instance->SetData(DATA_GAL_DARAH_EVENT, IN_PROGRESS);
- }
+ void KilledUnit(Unit* victim) override
+ {
+ if (victim->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_SLAY);
+ }
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
+ {
+ if (spellInfo->Id == SPELL_TRANSFORM_BACK)
+ me->RemoveAurasDueToSpell(SPELL_TRANSFORM_RHINO);
+ }
- switch (Phase)
+ void ExecuteEvent(uint32 eventId) override
{
- case TROLL:
- if (uiPhaseCounter == 2)
- {
- if (uiTransformationTimer <= diff)
+ switch (eventId)
+ {
+ case EVENT_IMPALING_CHARGE:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true))
+ DoCast(target, SPELL_IMPALING_CHARGE);
+ if (++_phaseCounter >= 2)
+ events.ScheduleEvent(EVENT_TRANSFORM, 5 * IN_MILLISECONDS);
+ events.ScheduleEvent(eventId, 31 * IN_MILLISECONDS, 0, PHASE_RHINO);
+ break;
+ case EVENT_STOMP:
+ DoCastAOE(SPELL_STOMP);
+ events.ScheduleEvent(eventId, 20 * IN_MILLISECONDS, 0, PHASE_RHINO);
+ break;
+ case EVENT_PUNCTURE:
+ DoCastVictim(SPELL_PUNCTURE);
+ events.ScheduleEvent(eventId, 8 * IN_MILLISECONDS, 0, PHASE_RHINO);
+ break;
+ case EVENT_STAMPEDE:
+ Talk(SAY_SUMMON_RHINO);
+ DoCast(me, SPELL_STAMPEDE);
+ events.ScheduleEvent(eventId, 15 * IN_MILLISECONDS, 0, PHASE_TROLL);
+ break;
+ case EVENT_WHIRLING_SLASH:
+ DoCastVictim(SPELL_WHIRLING_SLASH);
+ if (++_phaseCounter >= 2)
+ events.ScheduleEvent(EVENT_TRANSFORM, 5 * IN_MILLISECONDS);
+ events.ScheduleEvent(eventId, 21 * IN_MILLISECONDS, 0, PHASE_TROLL);
+ break;
+ case EVENT_ENRAGE:
+ DoCast(me, SPELL_ENRAGE);
+ events.ScheduleEvent(eventId, 20 * IN_MILLISECONDS, 0, PHASE_RHINO);
+ break;
+ case EVENT_TRANSFORM:
+ if (events.IsInPhase(PHASE_TROLL))
{
- me->SetDisplayId(DISPLAY_RHINO);
- Phase = RHINO;
- uiPhaseCounter = 0;
Talk(SAY_TRANSFORM_1);
- uiTransformationTimer = 5*IN_MILLISECONDS;
- bStartOfTransformation = true;
- me->ClearUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT);
- me->SetReactState(REACT_AGGRESSIVE);
+ DoCast(me, SPELL_TRANSFORM_RHINO);
+ SetPhase(PHASE_RHINO);
}
- else
+ else if (events.IsInPhase(PHASE_RHINO))
{
- uiTransformationTimer -= diff;
-
- if (bStartOfTransformation)
- {
- bStartOfTransformation = false;
- me->AddUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT);
- me->SetReactState(REACT_PASSIVE);
- }
- }
- }
- else
- {
- if (uiStampedeTimer <= diff)
- {
- DoCast(me, SPELL_STAMPEDE);
- Talk(SAY_SUMMON_RHINO);
- uiStampedeTimer = 15*IN_MILLISECONDS;
- } else uiStampedeTimer -= diff;
-
- if (uiWhirlingSlashTimer <= diff)
- {
- DoCastVictim(SPELL_WHIRLING_SLASH);
- uiWhirlingSlashTimer = 21*IN_MILLISECONDS;
- ++uiPhaseCounter;
- } else uiWhirlingSlashTimer -= diff;
- }
- break;
- case RHINO:
- if (uiPhaseCounter == 2)
- {
- if (uiTransformationTimer <= diff)
- {
- me->SetDisplayId(DISPLAY_TROLL);
- Phase = TROLL;
- uiPhaseCounter = 0;
Talk(SAY_TRANSFORM_2);
- uiTransformationTimer = 9*IN_MILLISECONDS;
- bStartOfTransformation = true;
- me->ClearUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT);
- me->SetReactState(REACT_AGGRESSIVE);
+ DoCast(me, SPELL_TRANSFORM_BACK);
+ SetPhase(PHASE_TROLL);
}
- else
- {
- uiTransformationTimer -= diff;
-
- if (bStartOfTransformation)
- {
- bStartOfTransformation = false;
- me->AddUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT);
- me->SetReactState(REACT_PASSIVE);
- }
- }
- }
- else
- {
- if (uiPunctureTimer <= diff)
- {
- DoCastVictim(SPELL_PUNCTURE);
- uiPunctureTimer = 8*IN_MILLISECONDS;
- } else uiPunctureTimer -= diff;
-
- if (uiEnrageTimer <= diff)
- {
- DoCastVictim(SPELL_ENRAGE);
- uiEnrageTimer = 20*IN_MILLISECONDS;
- } else uiEnrageTimer -= diff;
-
- if (uiStompTimer <= diff)
- {
- DoCastVictim(SPELL_STOMP);
- uiStompTimer = 20*IN_MILLISECONDS;
- } else uiStompTimer -= diff;
-
- if (uiImpalingChargeTimer <= diff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- {
- DoCast(target, SPELL_IMPALING_CHARGE);
- CheckAchievement(target->GetGUID());
- }
- uiImpalingChargeTimer = 31*IN_MILLISECONDS;
- ++uiPhaseCounter;
- } else uiImpalingChargeTimer -= diff;
- }
- break;
+ _phaseCounter = 0;
+ break;
+ default:
+ break;
+ }
}
- DoMeleeAttackIfReady();
- }
+ private:
+ std::set<uint64> impaledPlayers;
+ uint8 _phaseCounter;
+ };
- // 5 UNIQUE party members
- void CheckAchievement(uint64 guid)
+ CreatureAI* GetAI(Creature* creature) const override
{
- bool playerExists = false;
- for (std::list<uint64>::iterator itr = impaledList.begin(); itr != impaledList.end(); ++itr)
- if (guid != *itr)
- playerExists = true;
-
- if (playerExists)
- ++shareTheLove;
-
- impaledList.push_back(guid);
+ return GetGundrakAI<boss_gal_darahAI>(creature);
}
+};
- uint32 GetData(uint32 type) const override
+// 54956, 59827 - Impaling Charge
+class spell_gal_darah_impaling_charge : public SpellScriptLoader
+{
+ public:
+ spell_gal_darah_impaling_charge() : SpellScriptLoader("spell_gal_darah_impaling_charge") { }
+
+ class spell_gal_darah_impaling_charge_SpellScript : public SpellScript
{
- if (type == DATA_SHARE_THE_LOVE)
- return shareTheLove;
+ PrepareSpellScript(spell_gal_darah_impaling_charge_SpellScript);
- return 0;
- }
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_IMPALING_CHARGE_CONTROL_VEHICLE))
+ return false;
+ return true;
+ }
- void JustDied(Unit* /*killer*/) override
- {
- Talk(SAY_DEATH);
+ bool Load() override
+ {
+ return GetCaster()->GetVehicleKit() && GetCaster()->GetEntry() == NPC_GAL_DARAH;
+ }
- instance->SetData(DATA_GAL_DARAH_EVENT, DONE);
- }
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ {
+ Unit* caster = GetCaster();
+ target->CastSpell(caster, SPELL_IMPALING_CHARGE_CONTROL_VEHICLE, true);
+ caster->ToCreature()->AI()->SetGUID(target->GetGUID(), DATA_SHARE_THE_LOVE);
+ }
+ }
- void KilledUnit(Unit* victim) override
- {
- if (victim->GetTypeId() != TYPEID_PLAYER)
- return;
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gal_darah_impaling_charge_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_CHARGE);
+ }
+ };
- Talk(SAY_SLAY);
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_gal_darah_impaling_charge_SpellScript();
}
- };
-
};
class achievement_share_the_love : public AchievementCriteriaScript
{
public:
- achievement_share_the_love() : AchievementCriteriaScript("achievement_share_the_love")
- {
- }
+ achievement_share_the_love() : AchievementCriteriaScript("achievement_share_the_love") { }
bool OnCheck(Player* /*player*/, Unit* target) override
{
@@ -309,5 +300,6 @@ class achievement_share_the_love : public AchievementCriteriaScript
void AddSC_boss_gal_darah()
{
new boss_gal_darah();
+ new spell_gal_darah_impaling_charge();
new achievement_share_the_love();
}
diff --git a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
index 255a5ece261..7d7cac5601c 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
@@ -17,170 +17,165 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "gundrak.h"
+/// @todo: implement mojo frenzy
+
enum Spells
{
- SPELL_DETERMINED_STAB = 55104,
- SPELL_GROUND_TREMOR = 55142,
- SPELL_NUMBING_SHOUT = 55106,
- SPELL_DETERMINED_GORE = 55102,
- H_SPELL_DETERMINED_GORE = 59444,
- SPELL_QUAKE = 55101,
- SPELL_NUMBING_ROAR = 55100,
- SPELL_MOJO_FRENZY = 55163,
- SPELL_TRANSFORMATION = 55098, //Periodic, The caster transforms into a powerful mammoth, increasing Physical damage done by 25% and granting immunity to Stun effects.
+ SPELL_DETERMINED_GORE = 55102,
+ SPELL_DETERMINED_STAB = 55104,
+ SPELL_GROUND_TREMOR = 55142,
+ SPELL_NUMBING_SHOUT = 55106,
+ SPELL_QUAKE = 55101,
+ SPELL_NUMBING_ROAR = 55100,
+ SPELL_MOJO_FRENZY = 55163,
+ SPELL_TRANSFORMATION = 55098, // Periodic, The caster transforms into a powerful mammoth, increasing Physical damage done by 25% and granting immunity to Stun effects.
};
enum Says
{
- SAY_AGGRO = 0,
- SAY_SLAY = 1,
- SAY_DEATH = 2,
- SAY_TRANSFORM = 3,
- SAY_QUAKE = 4,
- EMOTE_TRANSFORM = 5
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_TRANSFORM = 3,
+ SAY_QUAKE = 4,
+ EMOTE_BEGIN_TRANSFORM = 5,
+ EMOTE_TRANSFORMED = 6,
+ EMOTE_ACTIVATE_ALTAR = 7
+};
+
+enum Events
+{
+ EVENT_GROUND_TREMOR = 1,
+ EVENT_NUMBLING_SHOUT,
+ EVENT_DETERMINED_STAB,
+ EVENT_TRANFORMATION
};
enum Misc
{
- DATA_LESS_RABI = 1
+ DATA_LESS_RABI = 1
};
class boss_moorabi : public CreatureScript
{
-public:
- boss_moorabi() : CreatureScript("boss_moorabi") { }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetInstanceAI<boss_moorabiAI>(creature);
- }
-
- struct boss_moorabiAI : public ScriptedAI
- {
- boss_moorabiAI(Creature* creature) : ScriptedAI(creature)
- {
- Initialize();
- instance = creature->GetInstanceScript();
- }
-
- void Initialize()
- {
- uiGroundTremorTimer = 18 * IN_MILLISECONDS;
- uiNumblingShoutTimer = 10 * IN_MILLISECONDS;
- uiDeterminedStabTimer = 20 * IN_MILLISECONDS;
- uiTransformationTImer = 12 * IN_MILLISECONDS;
- bPhase = false;
- }
-
- InstanceScript* instance;
-
- bool bPhase;
-
- uint32 uiNumblingShoutTimer;
- uint32 uiGroundTremorTimer;
- uint32 uiDeterminedStabTimer;
- uint32 uiTransformationTImer;
-
- void Reset() override
- {
- Initialize();
-
- instance->SetData(DATA_MOORABI_EVENT, NOT_STARTED);
- }
-
- void EnterCombat(Unit* /*who*/) override
- {
- Talk(SAY_AGGRO);
- DoCast(me, SPELL_MOJO_FRENZY, true);
-
- instance->SetData(DATA_MOORABI_EVENT, IN_PROGRESS);
- }
+ public:
+ boss_moorabi() : CreatureScript("boss_moorabi") { }
- void UpdateAI(uint32 uiDiff) override
+ struct boss_moorabiAI : public BossAI
{
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- if (!bPhase && me->HasAura(SPELL_TRANSFORMATION))
+ boss_moorabiAI(Creature* creature) : BossAI(creature, DATA_MOORABI)
{
- bPhase = true;
- me->RemoveAura(SPELL_MOJO_FRENZY);
+ Initialize();
}
- if (uiGroundTremorTimer <= uiDiff)
+ void Initialize()
{
- Talk(SAY_QUAKE);
- if (bPhase)
- DoCastVictim(SPELL_QUAKE, true);
- else
- DoCastVictim(SPELL_GROUND_TREMOR, true);
- uiGroundTremorTimer = 10*IN_MILLISECONDS;
- } else uiGroundTremorTimer -= uiDiff;
-
- if (uiNumblingShoutTimer <= uiDiff)
+ _transformed = false;
+ }
+
+ void Reset() override
{
- if (bPhase)
- DoCastVictim(SPELL_NUMBING_ROAR, true);
- else
- DoCastVictim(SPELL_NUMBING_SHOUT, true);
- uiNumblingShoutTimer = 10*IN_MILLISECONDS;
- } else uiNumblingShoutTimer -=uiDiff;
-
- if (uiDeterminedStabTimer <= uiDiff)
+ Initialize();
+ _Reset();
+ }
+
+ void EnterCombat(Unit* /*who*/) override
{
- if (bPhase)
- DoCastVictim(SPELL_DETERMINED_GORE);
- else
- DoCastVictim(SPELL_DETERMINED_STAB, true);
- uiDeterminedStabTimer = 8*IN_MILLISECONDS;
- } else uiDeterminedStabTimer -=uiDiff;
-
- if (!bPhase && uiTransformationTImer <= uiDiff)
+ _EnterCombat();
+ Talk(SAY_AGGRO);
+ DoCast(me, SPELL_MOJO_FRENZY, true);
+
+ events.ScheduleEvent(EVENT_GROUND_TREMOR, 18 * IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_NUMBLING_SHOUT, 10 * IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_DETERMINED_STAB, 20 * IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_TRANFORMATION, 12 * IN_MILLISECONDS);
+ }
+
+ uint32 GetData(uint32 type) const override
{
- Talk(EMOTE_TRANSFORM);
- Talk(SAY_TRANSFORM);
- DoCast(me, SPELL_TRANSFORMATION, false);
- uiTransformationTImer = 10*IN_MILLISECONDS;
- } else uiTransformationTImer -= uiDiff;
+ if (type == DATA_LESS_RABI)
+ return _transformed ? 0 : 1;
+ return 0;
+ }
- DoMeleeAttackIfReady();
- }
+ void KilledUnit(Unit* victim) override
+ {
+ if (victim->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_SLAY);
+ }
- uint32 GetData(uint32 type) const override
- {
- if (type == DATA_LESS_RABI)
- return bPhase ? 0 : 1;
+ void JustDied(Unit* /*killer*/) override
+ {
+ _JustDied();
+ Talk(SAY_DEATH);
+ Talk(EMOTE_ACTIVATE_ALTAR);
+ }
- return 0;
- }
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
+ {
+ if (spellInfo->Id == SPELL_TRANSFORMATION)
+ {
+ _transformed = true;
+ Talk(EMOTE_TRANSFORMED);
+ events.CancelEvent(EVENT_TRANFORMATION);
+ me->RemoveAurasDueToSpell(SPELL_MOJO_FRENZY);
+ }
+ }
- void JustDied(Unit* /*killer*/) override
- {
- Talk(SAY_DEATH);
+ void ExecuteEvent(uint32 eventId) override
+ {
+ switch (eventId)
+ {
+ case EVENT_GROUND_TREMOR:
+ Talk(SAY_QUAKE);
+ if (_transformed)
+ DoCastAOE(SPELL_QUAKE);
+ else
+ DoCastAOE(SPELL_GROUND_TREMOR);
+ events.ScheduleEvent(eventId, 10 * IN_MILLISECONDS);
+ break;
+ case EVENT_NUMBLING_SHOUT:
+ if (_transformed)
+ DoCastAOE(SPELL_NUMBING_ROAR);
+ else
+ DoCastAOE(SPELL_NUMBING_SHOUT);
+ events.ScheduleEvent(eventId, 10 * IN_MILLISECONDS);
+ break;
+ case EVENT_DETERMINED_STAB:
+ if (_transformed)
+ DoCastVictim(SPELL_DETERMINED_GORE);
+ else
+ DoCastVictim(SPELL_DETERMINED_STAB);
+ events.ScheduleEvent(eventId, 8 * IN_MILLISECONDS);
+ break;
+ case EVENT_TRANFORMATION:
+ Talk(EMOTE_BEGIN_TRANSFORM);
+ Talk(SAY_TRANSFORM);
+ DoCast(me, SPELL_TRANSFORMATION);
+ events.ScheduleEvent(eventId, 10 * IN_MILLISECONDS);
+ break;
+ default:
+ break;
+ }
+ }
- instance->SetData(DATA_MOORABI_EVENT, DONE);
- }
+ private:
+ bool _transformed;
+ };
- void KilledUnit(Unit* victim) override
+ CreatureAI* GetAI(Creature* creature) const override
{
- if (victim->GetTypeId() != TYPEID_PLAYER)
- return;
-
- Talk(SAY_SLAY);
+ return GetGundrakAI<boss_moorabiAI>(creature);
}
- };
-
};
class achievement_less_rabi : public AchievementCriteriaScript
{
public:
- achievement_less_rabi() : AchievementCriteriaScript("achievement_less_rabi")
- {
- }
+ achievement_less_rabi() : AchievementCriteriaScript("achievement_less_rabi") { }
bool OnCheck(Player* /*player*/, Unit* target) override
{
diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
index 5db49415604..9520736cdb5 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
@@ -24,11 +24,10 @@
enum Spells
{
SPELL_POISON_NOVA = 55081,
- H_SPELL_POISON_NOVA = 59842,
SPELL_POWERFULL_BITE = 48287,
- H_SPELL_POWERFULL_BITE = 59840,
SPELL_VENOM_BOLT = 54970,
- H_SPELL_VENOM_BOLT = 59839
+ SPELL_SUMMON_SNAKES = 55060, // NYI
+ SPELL_SUMMON_CONSTRICTORS = 54969 // NYI
};
enum Yells
@@ -38,7 +37,8 @@ enum Yells
SAY_DEATH = 2,
SAY_SUMMON_SNAKES = 3,
SAY_SUMMON_CONSTRICTORS = 4,
- EMOTE_NOVA = 5
+ EMOTE_NOVA = 5,
+ EMOTE_ACTIVATE_ALTAR = 6
};
enum Creatures
@@ -50,18 +50,17 @@ enum Creatures
enum ConstrictorSpells
{
SPELL_GRIP_OF_SLAD_RAN = 55093,
- SPELL_SNAKE_WRAP = 55126,
- SPELL_VENOMOUS_BITE = 54987,
- H_SPELL_VENOMOUS_BITE = 58996
+ SPELL_SNAKE_WRAP = 55126, // 55099 -> 55126
+ SPELL_VENOMOUS_BITE = 54987
};
static Position SpawnLoc[]=
{
- {1783.81f, 646.637f, 133.948f, 3.71755f},
- {1775.03f, 606.586f, 134.165f, 1.43117f},
- {1717.39f, 630.041f, 129.282f, 5.96903f},
- {1765.66f, 646.542f, 134.02f, 5.11381f},
- {1716.76f, 635.159f, 129.282f, 0.191986f}
+ {1783.81f, 646.637f, 133.948f, 3.71755f},
+ {1775.03f, 606.586f, 134.165f, 1.43117f},
+ {1717.39f, 630.041f, 129.282f, 5.96903f},
+ {1765.66f, 646.542f, 134.02f, 5.11381f},
+ {1716.76f, 635.159f, 129.282f, 0.191986f}
};
enum Misc
@@ -74,17 +73,11 @@ class boss_slad_ran : public CreatureScript
public:
boss_slad_ran() : CreatureScript("boss_slad_ran") { }
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetInstanceAI<boss_slad_ranAI>(creature);
- }
-
- struct boss_slad_ranAI : public ScriptedAI
+ struct boss_slad_ranAI : public BossAI
{
- boss_slad_ranAI(Creature* creature) : ScriptedAI(creature), lSummons(me)
+ boss_slad_ranAI(Creature* creature) : BossAI(creature, DATA_SLAD_RAN)
{
Initialize();
- instance = creature->GetInstanceScript();
}
void Initialize()
@@ -103,26 +96,19 @@ public:
uint8 uiPhase;
- std::set<uint64> lWrappedPlayers;
- SummonList lSummons;
-
- InstanceScript* instance;
+ GuidSet lWrappedPlayers;
void Reset() override
{
Initialize();
+ _Reset();
lWrappedPlayers.clear();
-
- lSummons.DespawnAll();
-
- instance->SetData(DATA_SLAD_RAN_EVENT, NOT_STARTED);
}
void EnterCombat(Unit* /*who*/) override
{
+ _EnterCombat();
Talk(SAY_AGGRO);
-
- instance->SetData(DATA_SLAD_RAN_EVENT, IN_PROGRESS);
}
void UpdateAI(uint32 diff) override
@@ -181,10 +167,9 @@ public:
void JustDied(Unit* /*killer*/) override
{
+ _JustDied();
Talk(SAY_DEATH);
- lSummons.DespawnAll();
-
- instance->SetData(DATA_SLAD_RAN_EVENT, DONE);
+ Talk(EMOTE_ACTIVATE_ALTAR);
}
void KilledUnit(Unit* who) override
@@ -193,24 +178,28 @@ public:
Talk(SAY_SLAY);
}
- void JustSummoned(Creature* summoned) override
+ void JustSummoned(Creature* summon) override
{
- summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
- lSummons.Summon(summoned);
+ summon->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
+ summons.Summon(summon);
}
- void SetGUID(uint64 guid, int32 type) override
+ void SetGUID(ObjectGuid guid, int32 type) override
{
if (type == DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES)
lWrappedPlayers.insert(guid);
}
- bool WasWrapped(uint64 guid)
+ bool WasWrapped(ObjectGuid guid)
{
return lWrappedPlayers.count(guid) != 0;
}
};
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetGundrakAI<boss_slad_ranAI>(creature);
+ }
};
class npc_slad_ran_constrictor : public CreatureScript
@@ -310,9 +299,7 @@ public:
class achievement_snakes_whyd_it_have_to_be_snakes : public AchievementCriteriaScript
{
public:
- achievement_snakes_whyd_it_have_to_be_snakes() : AchievementCriteriaScript("achievement_snakes_whyd_it_have_to_be_snakes")
- {
- }
+ achievement_snakes_whyd_it_have_to_be_snakes() : AchievementCriteriaScript("achievement_snakes_whyd_it_have_to_be_snakes") { }
bool OnCheck(Player* player, Unit* target) override
{
diff --git a/src/server/scripts/Northrend/Gundrak/gundrak.h b/src/server/scripts/Northrend/Gundrak/gundrak.h
index fffeca82f39..9963c6caee8 100644
--- a/src/server/scripts/Northrend/Gundrak/gundrak.h
+++ b/src/server/scripts/Northrend/Gundrak/gundrak.h
@@ -15,59 +15,85 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef DEF_GUNDRAK_H
-#define DEF_GUNDRAK_H
+#ifndef GUNDRAK_H_
+#define GUNDRAK_H_
+#define GundrakScriptName "instance_gundrak"
#define DataHeader "GD"
-enum Data
+uint32 const EncounterCount = 5;
+
+enum DataTypes
{
- DATA_SLAD_RAN_EVENT,
- DATA_MOORABI_EVENT,
- DATA_DRAKKARI_COLOSSUS_EVENT,
- DATA_GAL_DARAH_EVENT,
- DATA_ECK_THE_FEROCIOUS_EVENT
+ // Encounter Ids // Encounter States // Boss GUIDs
+ DATA_SLAD_RAN = 0,
+ DATA_DRAKKARI_COLOSSUS = 1,
+ DATA_MOORABI = 2,
+ DATA_GAL_DARAH = 3,
+ DATA_ECK_THE_FEROCIOUS = 4,
+
+ // Additional Objects
+ DATA_SLAD_RAN_ALTAR = 5,
+ DATA_DRAKKARI_COLOSSUS_ALTAR = 6,
+ DATA_MOORABI_ALTAR = 7,
+
+ DATA_SLAD_RAN_STATUE = 8,
+ DATA_DRAKKARI_COLOSSUS_STATUE = 9,
+ DATA_MOORABI_STATUE = 10,
+ DATA_GAL_DARAH_STATUE = 11,
+
+ DATA_TRAPDOOR = 12,
+ DATA_COLLISION = 13,
+ DATA_BRIDGE = 14,
+
+ DATA_STATUE_ACTIVATE = 15,
};
-enum Data64
+enum CreatureIds
{
- DATA_SLAD_RAN_ALTAR,
- DATA_MOORABI_ALTAR,
- DATA_DRAKKARI_COLOSSUS_ALTAR,
- DATA_SLAD_RAN_STATUE,
- DATA_MOORABI_STATUE,
- DATA_DRAKKARI_COLOSSUS_STATUE,
- DATA_DRAKKARI_COLOSSUS,
- DATA_STATUE_ACTIVATE
+ NPC_SLAD_RAN = 29304,
+ NPC_MOORABI = 29305,
+ NPC_GAL_DARAH = 29306,
+ NPC_DRAKKARI_COLOSSUS = 29307,
+ NPC_RUIN_DWELLER = 29920,
+ NPC_ECK_THE_FEROCIOUS = 29932,
+ NPC_ALTAR_TRIGGER = 30298
};
-enum mainCreatures
+enum GameObjectIds
{
- CREATURE_RUIN_DWELLER = 29920,
- CREATURE_SLAD_RAN = 29304,
- CREATURE_MOORABI = 29305,
- CREATURE_GALDARAH = 29306,
- CREATURE_DRAKKARICOLOSSUS = 29307,
- CREATURE_ECK = 29932
+ GO_SLAD_RAN_ALTAR = 192518,
+ GO_MOORABI_ALTAR = 192519,
+ GO_DRAKKARI_COLOSSUS_ALTAR = 192520,
+ GO_SLAD_RAN_STATUE = 192564,
+ GO_MOORABI_STATUE = 192565,
+ GO_GAL_DARAH_STATUE = 192566,
+ GO_DRAKKARI_COLOSSUS_STATUE = 192567,
+ GO_ECK_THE_FEROCIOUS_DOOR = 192632,
+ GO_ECK_THE_FEROCIOUS_DOOR_BEHIND = 192569,
+ GO_GAL_DARAH_DOOR_1 = 193208,
+ GO_GAL_DARAH_DOOR_2 = 193209,
+ GO_GAL_DARAH_DOOR_3 = 192568,
+ GO_TRAPDOOR = 193188,
+ GO_COLLISION = 192633,
};
-enum Gameobjects
+enum SpellIds
{
+ SPELL_FIRE_BEAM_MAMMOTH = 57068,
+ SPELL_FIRE_BEAM_SNAKE = 57071,
+ SPELL_FIRE_BEAM_ELEMENTAL = 57072
+};
- GO_SLADRAN_ALTAR = 192518,
- GO_MOORABI_ALTAR = 192519,
- GO_DRAKKARI_COLOSSUS_ALTAR = 192520,
- GO_SLADRAN_STATUE = 192564,
- GO_MOORABI_STATUE = 192565,
- GO_GALDARAH_STATUE = 192566,
- GO_DRAKKARI_COLOSSUS_STATUE = 192567,
- GO_ECK_THE_FEROCIOUS_DOOR = 192632,
- GO_ECK_THE_FEROCIOUS_DOOR_BEHIND = 192569,
- GO_GALDARAH_DOOR1 = 193208,
- GO_GALDARAH_DOOR2 = 193209,
- GO_GALDARAH_DOOR3 = 192568,
- GO_BRIDGE = 193188,
- GO_COLLISION = 192633
+enum InstanceMisc
+{
+ TIMER_STATUE_ACTIVATION = 3500
};
-#endif
+template<class AI>
+inline AI* GetGundrakAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, GundrakScriptName);
+}
+
+#endif // GUNDRAK_H_
diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
index 388d43e8dca..31722b06be8 100644
--- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
+++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
@@ -15,577 +15,354 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptMgr.h"
#include "InstanceScript.h"
-#include "gundrak.h"
#include "Player.h"
-#include "TemporarySummon.h"
+#include "ScriptMgr.h"
+#include "WorldSession.h"
+#include "gundrak.h"
+
+DoorData const doorData[] =
+{
+ { GO_GAL_DARAH_DOOR_1, DATA_GAL_DARAH, DOOR_TYPE_PASSAGE, BOUNDARY_NONE },
+ { GO_GAL_DARAH_DOOR_2, DATA_GAL_DARAH, DOOR_TYPE_PASSAGE, BOUNDARY_NONE },
+ { GO_GAL_DARAH_DOOR_3, DATA_GAL_DARAH, DOOR_TYPE_ROOM, BOUNDARY_NONE },
+ { GO_ECK_THE_FEROCIOUS_DOOR, DATA_MOORABI, DOOR_TYPE_PASSAGE, BOUNDARY_NONE },
+ { GO_ECK_THE_FEROCIOUS_DOOR_BEHIND, DATA_ECK_THE_FEROCIOUS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE },
+ { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END
+};
-#define MAX_ENCOUNTER 5
+ObjectData const creatureData[] =
+{
+ { NPC_DRAKKARI_COLOSSUS, DATA_DRAKKARI_COLOSSUS },
+ { 0, 0 } // END
+};
-/* GunDrak encounters:
-0 - Slad'Ran
-1 - Moorabi
-2 - Drakkari Colossus
-3 - Gal'Darah
-4 - Eck the Ferocious
-*/
+ObjectData const gameObjectData[] =
+{
+ { GO_SLAD_RAN_ALTAR, DATA_SLAD_RAN_ALTAR },
+ { GO_MOORABI_ALTAR, DATA_MOORABI_ALTAR },
+ { GO_DRAKKARI_COLOSSUS_ALTAR, DATA_DRAKKARI_COLOSSUS_ALTAR },
+ { GO_SLAD_RAN_STATUE, DATA_SLAD_RAN_STATUE },
+ { GO_MOORABI_STATUE, DATA_MOORABI_STATUE },
+ { GO_DRAKKARI_COLOSSUS_STATUE, DATA_DRAKKARI_COLOSSUS_STATUE },
+ { GO_GAL_DARAH_STATUE, DATA_GAL_DARAH_STATUE },
+ { GO_TRAPDOOR, DATA_TRAPDOOR },
+ { GO_COLLISION, DATA_COLLISION },
+ { 0, 0 } // END
+};
Position const EckSpawnPoint = { 1643.877930f, 936.278015f, 107.204948f, 0.668432f };
class instance_gundrak : public InstanceMapScript
{
-public:
- instance_gundrak() : InstanceMapScript("instance_gundrak", 604) { }
-
- InstanceScript* GetInstanceScript(InstanceMap* map) const override
- {
- return new instance_gundrak_InstanceMapScript(map);
- }
+ public:
+ instance_gundrak() : InstanceMapScript(GundrakScriptName, 604) { }
- struct instance_gundrak_InstanceMapScript : public InstanceScript
- {
- instance_gundrak_InstanceMapScript(Map* map) : InstanceScript(map)
+ struct instance_gundrak_InstanceMapScript : public InstanceScript
{
- SetHeaders(DataHeader);
- isHeroic = map->IsHeroic();
- }
-
- bool isHeroic;
- bool spawnSupport;
-
- uint32 timer;
- uint32 phase;
- uint64 toActivate;
-
- uint64 sladRanGUID;
- uint64 moorabiGUID;
- uint64 drakkariColossusGUID;
- uint64 galDarahGUID;
- uint64 eckTheFerociousGUID;
-
- uint64 sladRanAltarGUID;
- uint64 moorabiAltarGUID;
- uint64 drakkariColossusAltarGUID;
- uint64 sladRanStatueGUID;
- uint64 moorabiStatueGUID;
- uint64 drakkariColossusStatueGUID;
- uint64 galDarahStatueGUID;
- uint64 eckTheFerociousDoorGUID;
- uint64 eckTheFerociousDoorBehindGUID;
- uint64 galDarahDoor1GUID;
- uint64 galDarahDoor2GUID;
- uint64 galDarahDoor3GUID;
- uint64 bridgeGUID;
- uint64 collisionGUID;
-
- uint32 m_auiEncounter[MAX_ENCOUNTER];
-
- GOState sladRanStatueState;
- GOState moorabiStatueState;
- GOState drakkariColossusStatueState;
- GOState galDarahStatueState;
- GOState bridgeState;
- GOState collisionState;
-
- std::set<uint64> DwellerGUIDs;
-
- std::string str_data;
-
- void Initialize() override
- {
- spawnSupport = false;
-
- timer = 0;
- phase = 0;
- toActivate = 0;
-
- sladRanGUID = 0;
- moorabiGUID = 0;
- drakkariColossusGUID = 0;
- galDarahGUID = 0;
- eckTheFerociousGUID = 0;
-
- sladRanAltarGUID = 0;
- moorabiAltarGUID = 0;
- drakkariColossusAltarGUID = 0;
-
- sladRanStatueGUID = 0;
- moorabiStatueGUID = 0;
- drakkariColossusStatueGUID = 0;
- galDarahStatueGUID = 0;
-
- eckTheFerociousDoorGUID = 0;
- eckTheFerociousDoorBehindGUID = 0;
- galDarahDoor1GUID = 0;
- galDarahDoor2GUID = 0;
- galDarahDoor3GUID = 0;
-
- bridgeGUID = 0;
- collisionGUID = 0;
-
- sladRanStatueState = GO_STATE_ACTIVE;
- moorabiStatueState = GO_STATE_ACTIVE;
- drakkariColossusStatueState = GO_STATE_ACTIVE;
- galDarahStatueState = GO_STATE_READY;
- bridgeState = GO_STATE_ACTIVE;
- collisionState = GO_STATE_READY;
-
- DwellerGUIDs.clear();
-
- memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
- }
-
- bool IsEncounterInProgress() const override
- {
- for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
- if (m_auiEncounter[i] == IN_PROGRESS)
- return true;
-
- return false;
- }
+ instance_gundrak_InstanceMapScript(Map* map) : InstanceScript(map)
+ {
+ SetHeaders(DataHeader);
+ SetBossNumber(EncounterCount);
+ LoadDoorData(doorData);
+ LoadObjectData(creatureData, gameObjectData);
+
+ SladRanStatueState = GO_STATE_ACTIVE;
+ DrakkariColossusStatueState = GO_STATE_ACTIVE;
+ MoorabiStatueState = GO_STATE_ACTIVE;
+ }
- void OnCreatureCreate(Creature* creature) override
- {
- switch (creature->GetEntry())
+ void OnCreatureCreate(Creature* creature) override
{
- case CREATURE_SLAD_RAN:
- sladRanGUID = creature->GetGUID();
- break;
- case CREATURE_MOORABI:
- moorabiGUID = creature->GetGUID();
- break;
- case CREATURE_GALDARAH:
- galDarahGUID = creature->GetGUID();
- break;
- case CREATURE_DRAKKARICOLOSSUS:
- drakkariColossusGUID = creature->GetGUID();
- break;
- case CREATURE_ECK:
- eckTheFerociousGUID = creature->GetGUID();
- break;
- case CREATURE_RUIN_DWELLER:
- if (creature->IsAlive())
- DwellerGUIDs.insert(creature->GetGUID());
- break;
+ switch (creature->GetEntry())
+ {
+ case NPC_RUIN_DWELLER:
+ if (creature->IsAlive())
+ DwellerGUIDs.insert(creature->GetGUID());
+ break;
+ default:
+ break;
+ }
+
+ InstanceScript::OnCreatureCreate(creature);
}
- }
- void OnGameObjectCreate(GameObject* go) override
- {
- switch (go->GetEntry())
+ void OnGameObjectCreate(GameObject* go) override
{
- case GO_SLADRAN_ALTAR:
- sladRanAltarGUID = go->GetGUID();
- // Make sure that they start out as unusuable
- go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- if (m_auiEncounter[0] == DONE)
- {
- if (sladRanStatueState == GO_STATE_ACTIVE)
- go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- else
+ switch (go->GetEntry())
+ {
+ case GO_SLAD_RAN_ALTAR:
+ if (GetBossState(DATA_SLAD_RAN) == DONE)
{
- ++phase;
- go->SetGoState(GO_STATE_ACTIVE);
+ if (SladRanStatueState == GO_STATE_ACTIVE)
+ go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
+ else
+ go->SetGoState(GO_STATE_ACTIVE);
}
- }
- break;
- case GO_MOORABI_ALTAR:
- moorabiAltarGUID = go->GetGUID();
- // Make sure that they start out as unusuable
- go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- if (m_auiEncounter[0] == DONE)
- {
- if (moorabiStatueState == GO_STATE_ACTIVE)
- go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- else
+ break;
+ case GO_MOORABI_ALTAR:
+ if (GetBossState(DATA_MOORABI) == DONE)
{
- ++phase;
- go->SetGoState(GO_STATE_ACTIVE);
+ if (MoorabiStatueState == GO_STATE_ACTIVE)
+ go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
+ else
+ go->SetGoState(GO_STATE_ACTIVE);
}
- }
- break;
- case GO_DRAKKARI_COLOSSUS_ALTAR:
- drakkariColossusAltarGUID = go->GetGUID();
- // Make sure that they start out as unusuable
- go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- if (m_auiEncounter[0] == DONE)
- {
- if (drakkariColossusStatueState == GO_STATE_ACTIVE)
- go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- else
+ break;
+ case GO_DRAKKARI_COLOSSUS_ALTAR:
+ if (GetBossState(DATA_DRAKKARI_COLOSSUS) == DONE)
{
- ++phase;
- go->SetGoState(GO_STATE_ACTIVE);
+ if (DrakkariColossusStatueState == GO_STATE_ACTIVE)
+ go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
+ else
+ go->SetGoState(GO_STATE_ACTIVE);
}
- }
- break;
- case GO_SLADRAN_STATUE:
- sladRanStatueGUID = go->GetGUID();
- go->SetGoState(sladRanStatueState);
- break;
- case GO_MOORABI_STATUE:
- moorabiStatueGUID = go->GetGUID();
- go->SetGoState(moorabiStatueState);
- break;
- case GO_GALDARAH_STATUE:
- galDarahStatueGUID = go->GetGUID();
- go->SetGoState(galDarahStatueState);
- break;
- case GO_DRAKKARI_COLOSSUS_STATUE:
- drakkariColossusStatueGUID = go->GetGUID();
- go->SetGoState(drakkariColossusStatueState);
- break;
- case GO_ECK_THE_FEROCIOUS_DOOR:
- eckTheFerociousDoorGUID = go->GetGUID();
- if (isHeroic && m_auiEncounter[1] == DONE)
- HandleGameObject(0, true, go);
- break;
- case GO_ECK_THE_FEROCIOUS_DOOR_BEHIND:
- eckTheFerociousDoorBehindGUID = go->GetGUID();
- if (isHeroic && m_auiEncounter[4] == DONE)
- HandleGameObject(0, true, go);
- break;
- case GO_GALDARAH_DOOR1:
- galDarahDoor1GUID = go->GetGUID();
- if (m_auiEncounter[3] == DONE)
- HandleGameObject(0, true, go);
- break;
- case GO_GALDARAH_DOOR2:
- galDarahDoor2GUID = go->GetGUID();
- if (m_auiEncounter[3] == DONE)
- HandleGameObject(0, true, go);
- break;
- case GO_BRIDGE:
- bridgeGUID = go->GetGUID();
- go->SetGoState(bridgeState);
- break;
- case GO_COLLISION:
- collisionGUID = go->GetGUID();
- go->SetGoState(collisionState);
-
- // Can't spawn here with SpawnGameObject because go isn't added to world yet...
- if (collisionState == GO_STATE_ACTIVE_ALTERNATIVE)
- spawnSupport = true;
- break;
- case GO_GALDARAH_DOOR3:
- galDarahDoor3GUID = go->GetGUID();
- if (m_auiEncounter[3] != IN_PROGRESS)
- HandleGameObject(galDarahDoor3GUID, true, go);
- break;
+ break;
+ case GO_SLAD_RAN_STATUE:
+ go->SetGoState(SladRanStatueState);
+ break;
+ case GO_MOORABI_STATUE:
+ go->SetGoState(MoorabiStatueState);
+ break;
+ case GO_GAL_DARAH_STATUE:
+ go->SetGoState(CheckRequiredBosses(DATA_GAL_DARAH) ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_READY);
+ break;
+ case GO_DRAKKARI_COLOSSUS_STATUE:
+ go->SetGoState(DrakkariColossusStatueState);
+ break;
+ case GO_ECK_THE_FEROCIOUS_DOOR:
+ // Don't store door on non-heroic
+ if (!instance->IsHeroic())
+ return;
+ break;
+ case GO_TRAPDOOR:
+ go->SetGoState(CheckRequiredBosses(DATA_GAL_DARAH) ? GO_STATE_READY : GO_STATE_ACTIVE);
+ break;
+ case GO_COLLISION:
+ go->SetGoState(CheckRequiredBosses(DATA_GAL_DARAH) ? GO_STATE_ACTIVE : GO_STATE_READY);
+ break;
+ default:
+ break;
+ }
+
+ InstanceScript::OnGameObjectCreate(go);
}
- }
- void OnUnitDeath(Unit* unit) override
- {
- if (unit->GetEntry() == CREATURE_RUIN_DWELLER)
+ void OnUnitDeath(Unit* unit) override
{
- DwellerGUIDs.erase(unit->GetGUID());
+ if (unit->GetEntry() == NPC_RUIN_DWELLER)
+ {
+ DwellerGUIDs.erase(unit->GetGUID());
- if (DwellerGUIDs.empty())
- unit->SummonCreature(CREATURE_ECK, EckSpawnPoint, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300 * IN_MILLISECONDS);
+ if (DwellerGUIDs.empty())
+ unit->SummonCreature(NPC_ECK_THE_FEROCIOUS, EckSpawnPoint, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300 * IN_MILLISECONDS);
+ }
}
- }
- void SetData(uint32 type, uint32 data) override
- {
- switch (type)
+ bool SetBossState(uint32 type, EncounterState state) override
{
- case DATA_SLAD_RAN_EVENT:
- m_auiEncounter[0] = data;
- if (data == DONE)
- {
- GameObject* go = instance->GetGameObject(sladRanAltarGUID);
- if (go)
- go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- }
- break;
- case DATA_MOORABI_EVENT:
- m_auiEncounter[1] = data;
- if (data == DONE)
- {
- GameObject* go = instance->GetGameObject(moorabiAltarGUID);
- if (go)
- go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- if (isHeroic)
- HandleGameObject(eckTheFerociousDoorGUID, true);
- }
- break;
- case DATA_DRAKKARI_COLOSSUS_EVENT:
- m_auiEncounter[2] = data;
- if (data == DONE)
+ if (!InstanceScript::SetBossState(type, state))
+ return false;
+
+ switch (type)
{
- GameObject* go = instance->GetGameObject(drakkariColossusAltarGUID);
- if (go)
- go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
+ case DATA_SLAD_RAN:
+ if (state == DONE)
+ if (GameObject* go = GetGameObject(DATA_SLAD_RAN_ALTAR))
+ go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
+ break;
+ case DATA_DRAKKARI_COLOSSUS:
+ if (state == DONE)
+ if (GameObject* go = GetGameObject(DATA_DRAKKARI_COLOSSUS_ALTAR))
+ go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
+ break;
+ case DATA_MOORABI:
+ if (state == DONE)
+ if (GameObject* go = GetGameObject(DATA_MOORABI_ALTAR))
+ go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
+ break;
+ default:
+ break;
}
- break;
- case DATA_GAL_DARAH_EVENT:
- m_auiEncounter[3] = data;
- if (data == DONE)
+
+ return true;
+ }
+
+ bool CheckRequiredBosses(uint32 bossId, Player const* player = nullptr) const override
+ {
+ if (player && player->GetSession()->HasPermission(rbac::RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES))
+ return true;
+
+ switch (bossId)
{
- HandleGameObject(galDarahDoor1GUID, true);
- HandleGameObject(galDarahDoor2GUID, true);
+ case DATA_ECK_THE_FEROCIOUS:
+ if (!instance->IsHeroic() || GetBossState(DATA_MOORABI) != DONE)
+ return false;
+ break;
+ case DATA_GAL_DARAH:
+ if (SladRanStatueState != GO_STATE_ACTIVE_ALTERNATIVE
+ || DrakkariColossusStatueState != GO_STATE_ACTIVE_ALTERNATIVE
+ || MoorabiStatueState != GO_STATE_ACTIVE_ALTERNATIVE)
+ return false;
+ break;
+ default:
+ break;
}
- HandleGameObject(galDarahDoor3GUID, data == IN_PROGRESS ? false : true);
- break;
- case DATA_ECK_THE_FEROCIOUS_EVENT:
- m_auiEncounter[4] = data;
- if (isHeroic && data == DONE)
- HandleGameObject(eckTheFerociousDoorBehindGUID, true);
- break;
- }
- if (data == DONE)
- SaveToDB();
- }
+ return true;
+ }
- void SetData64(uint32 type, uint64 data) override
- {
- if (type == DATA_STATUE_ACTIVATE)
+ bool IsBridgeReady() const
{
- toActivate = data;
- timer = 3500;
- ++phase;
+ return SladRanStatueState == GO_STATE_READY && DrakkariColossusStatueState == GO_STATE_READY && MoorabiStatueState == GO_STATE_READY;
}
- }
- uint32 GetData(uint32 type) const override
- {
- switch (type)
+ void SetData(uint32 type, uint32 data) override
{
- case DATA_SLAD_RAN_EVENT:
- return m_auiEncounter[0];
- case DATA_MOORABI_EVENT:
- return m_auiEncounter[1];
- case DATA_GAL_DARAH_EVENT:
- return m_auiEncounter[2];
- case DATA_DRAKKARI_COLOSSUS_EVENT:
- return m_auiEncounter[3];
- case DATA_ECK_THE_FEROCIOUS_EVENT:
- return m_auiEncounter[4];
+ if (type == DATA_STATUE_ACTIVATE)
+ {
+ switch (data)
+ {
+ case GO_SLAD_RAN_ALTAR:
+ Events.ScheduleEvent(DATA_SLAD_RAN_STATUE, TIMER_STATUE_ACTIVATION);
+ break;
+ case GO_DRAKKARI_COLOSSUS_ALTAR:
+ Events.ScheduleEvent(DATA_DRAKKARI_COLOSSUS_STATUE, TIMER_STATUE_ACTIVATION);
+ break;
+ case GO_MOORABI_ALTAR:
+ Events.ScheduleEvent(DATA_MOORABI_STATUE, TIMER_STATUE_ACTIVATION);
+ break;
+ default:
+ break;
+ }
+ }
}
- return 0;
- }
-
- uint64 GetData64(uint32 type) const override
- {
- switch (type)
+ void WriteSaveDataMore(std::ostringstream& data) override
{
- case DATA_SLAD_RAN_ALTAR:
- return sladRanAltarGUID;
- case DATA_MOORABI_ALTAR:
- return moorabiAltarGUID;
- case DATA_DRAKKARI_COLOSSUS_ALTAR:
- return drakkariColossusAltarGUID;
- case DATA_SLAD_RAN_STATUE:
- return sladRanStatueGUID;
- case DATA_MOORABI_STATUE:
- return moorabiStatueGUID;
- case DATA_DRAKKARI_COLOSSUS_STATUE:
- return drakkariColossusStatueGUID;
- case DATA_DRAKKARI_COLOSSUS:
- return drakkariColossusGUID;
- case DATA_STATUE_ACTIVATE:
- return toActivate;
+ data << uint32(SladRanStatueState) << ' ';
+ data << uint32(DrakkariColossusStatueState) << ' ';
+ data << uint32(MoorabiStatueState) << ' ';
}
- return 0;
- }
+ void ReadSaveDataMore(std::istringstream& data) override
+ {
+ uint32 temp;
- std::string GetSaveData() override
- {
- OUT_SAVE_INST_DATA;
+ data >> temp;
+ SladRanStatueState = GOState(temp);
- std::ostringstream saveStream;
- saveStream << "G D " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
- << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' '
- << (sladRanStatueGUID ? GetObjState(sladRanStatueGUID) : GO_STATE_ACTIVE) << ' ' << (moorabiStatueGUID ? GetObjState(moorabiStatueGUID) : GO_STATE_ACTIVE) << ' '
- << (drakkariColossusStatueGUID ? GetObjState(drakkariColossusStatueGUID) : GO_STATE_ACTIVE) << ' ' << (galDarahStatueGUID ? GetObjState(galDarahStatueGUID) : GO_STATE_READY) << ' '
- << (bridgeGUID ? GetObjState(bridgeGUID) : GO_STATE_ACTIVE) << ' ' << (collisionGUID ? GetObjState(collisionGUID) : GO_STATE_READY);
+ data >> temp;
+ DrakkariColossusStatueState = GOState(temp);
- str_data = saveStream.str();
+ data >> temp;
+ MoorabiStatueState = GOState(temp);
- OUT_SAVE_INST_DATA_COMPLETE;
- return str_data;
- }
+ if (IsBridgeReady())
+ Events.ScheduleEvent(DATA_BRIDGE, TIMER_STATUE_ACTIVATION);
+ }
- void Load(const char* in) override
- {
- if (!in)
+ void ToggleGameObject(uint32 type, GOState state)
{
- OUT_LOAD_INST_DATA_FAIL;
- return;
+ if (GameObject* go = GetGameObject(type))
+ go->SetGoState(state);
+
+ switch (type)
+ {
+ case DATA_SLAD_RAN_STATUE:
+ SladRanStatueState = state;
+ break;
+ case DATA_DRAKKARI_COLOSSUS_STATUE:
+ DrakkariColossusStatueState = state;
+ break;
+ case DATA_MOORABI_STATUE:
+ MoorabiStatueState = state;
+ break;
+ default:
+ break;
+ }
}
- OUT_LOAD_INST_DATA(in);
+ void Update(uint32 diff) override
+ {
+ Events.Update(diff);
- char dataHead1, dataHead2;
- uint16 data0, data1, data2, data3, data4, data5, data6, data7, data8, data9, data10;
+ while (uint32 eventId = Events.ExecuteEvent())
+ {
+ uint32 spellId = 0;
+ uint32 altarId = 0;
+ switch (eventId)
+ {
+ case DATA_SLAD_RAN_STATUE:
+ spellId = SPELL_FIRE_BEAM_SNAKE;
+ altarId = DATA_SLAD_RAN_ALTAR;
+ break;
+ case DATA_DRAKKARI_COLOSSUS_STATUE:
+ spellId = SPELL_FIRE_BEAM_ELEMENTAL;
+ altarId = DATA_DRAKKARI_COLOSSUS_ALTAR;
+ break;
+ case DATA_MOORABI_STATUE:
+ spellId = SPELL_FIRE_BEAM_MAMMOTH;
+ altarId = DATA_MOORABI_ALTAR;
+ break;
+ case DATA_BRIDGE:
+ for (uint32 type = DATA_SLAD_RAN_STATUE; type <= DATA_GAL_DARAH_STATUE; ++type)
+ ToggleGameObject(type, GO_STATE_ACTIVE_ALTERNATIVE);
+ ToggleGameObject(DATA_TRAPDOOR, GO_STATE_READY);
+ ToggleGameObject(DATA_COLLISION, GO_STATE_ACTIVE);
+ SaveToDB();
+ return;
+ default:
+ return;
+ }
- std::istringstream loadStream(in);
- loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3
- >> data4 >> data5 >> data6 >> data7 >> data8 >> data9 >> data10;
+ if (GameObject* altar = GetGameObject(altarId))
+ if (Creature* trigger = altar->FindNearestCreature(NPC_ALTAR_TRIGGER, 10.0f))
+ trigger->CastSpell((Unit*)nullptr, spellId, true);
- if (dataHead1 == 'G' && dataHead2 == 'D')
- {
- m_auiEncounter[0] = data0;
- m_auiEncounter[1] = data1;
- m_auiEncounter[2] = data2;
- m_auiEncounter[3] = data3;
- m_auiEncounter[4] = data4;
- sladRanStatueState = GOState(data5);
- moorabiStatueState = GOState(data6);
- drakkariColossusStatueState = GOState(data7);
- galDarahStatueState = GOState(data8);
- bridgeState = GOState(data9);
- collisionState = GOState(data10);
-
- for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
- if (m_auiEncounter[i] == IN_PROGRESS)
- m_auiEncounter[i] = NOT_STARTED;
- } else OUT_LOAD_INST_DATA_FAIL;
-
- OUT_LOAD_INST_DATA_COMPLETE;
- }
+ // eventId equals statueId
+ ToggleGameObject(eventId, GO_STATE_READY);
- void Update(uint32 diff) override
- {
- // Spawn the support for the bridge if necessary
- if (spawnSupport)
- {
- if (GameObject* collision = instance->GetGameObject(collisionGUID))
- collision->SummonGameObject(192743, collision->GetPositionX(), collision->GetPositionY(), collision->GetPositionZ(), collision->GetOrientation(), 0, 0, 0, 0, 0);
- spawnSupport = false;
- }
-
- // If there is nothing to activate, then return
- if (!toActivate)
- return;
-
- if (timer < diff)
- {
- timer = 0;
- if (toActivate == bridgeGUID)
- {
- GameObject* bridge = instance->GetGameObject(bridgeGUID);
- GameObject* collision = instance->GetGameObject(collisionGUID);
- GameObject* sladRanStatue = instance->GetGameObject(sladRanStatueGUID);
- GameObject* moorabiStatue = instance->GetGameObject(moorabiStatueGUID);
- GameObject* drakkariColossusStatue = instance->GetGameObject(drakkariColossusStatueGUID);
- GameObject* galDarahStatue = instance->GetGameObject(galDarahStatueGUID);
-
- toActivate = 0;
-
- if (bridge && collision && sladRanStatue && moorabiStatue && drakkariColossusStatue && galDarahStatue)
- {
- bridge->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
- collision->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
- sladRanStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
- moorabiStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
- drakkariColossusStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
- galDarahStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
-
- // Add the GO that solidifies the bridge so you can walk on it
- spawnSupport = true;
- SaveToDB();
- }
- }
- else
- {
- uint32 spell = 0;
- GameObject* altar = NULL;
- if (toActivate == sladRanStatueGUID)
- {
- spell = 57071;
- altar = instance->GetGameObject(sladRanAltarGUID);
- }
- else if (toActivate == moorabiStatueGUID)
- {
- spell = 57068;
- altar = instance->GetGameObject(moorabiAltarGUID);
- }
- else if (toActivate == drakkariColossusStatueGUID)
- {
- spell = 57072;
- altar = instance->GetGameObject(drakkariColossusAltarGUID);
- }
-
- // This is a workaround to make the beam cast properly. The caster should be ID 30298 but since the spells
- // all are with scripted target for that same ID, it will hit itself.
- if (altar)
- if (Creature* trigger = altar->SummonCreature(18721, altar->GetPositionX(), altar->GetPositionY(), altar->GetPositionZ() + 3, altar->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 5000))
- {
- // Set the trigger model to invisible
- trigger->SetDisplayId(11686);
- trigger->CastSpell(trigger, spell, false);
- }
-
- if (GameObject* statueGO = instance->GetGameObject(toActivate))
- statueGO->SetGoState(GO_STATE_READY);
-
- toActivate = 0;
-
- if (phase == 3)
- SetData64(DATA_STATUE_ACTIVATE, bridgeGUID);
- else
- SaveToDB(); // Don't save in between last statue and bridge turning in case of crash leading to stuck instance
+ if (IsBridgeReady())
+ Events.ScheduleEvent(DATA_BRIDGE, TIMER_STATUE_ACTIVATION);
+
+ SaveToDB();
}
}
- else
- timer -= diff;
- }
- GOState GetObjState(uint64 guid)
- {
- if (GameObject* go = instance->GetGameObject(guid))
- return go->GetGoState();
- return GO_STATE_ACTIVE;
- }
- };
+ protected:
+ EventMap Events;
+ GuidSet DwellerGUIDs;
+
+ GOState SladRanStatueState;
+ GOState DrakkariColossusStatueState;
+ GOState MoorabiStatueState;
+ };
+ InstanceScript* GetInstanceScript(InstanceMap* map) const override
+ {
+ return new instance_gundrak_InstanceMapScript(map);
+ }
};
class go_gundrak_altar : public GameObjectScript
{
-public:
- go_gundrak_altar() : GameObjectScript("go_gundrak_altar") { }
-
- bool OnGossipHello(Player* /*player*/, GameObject* go) override
- {
- InstanceScript* instance = go->GetInstanceScript();
- uint64 statueGUID = 0;
+ public:
+ go_gundrak_altar() : GameObjectScript("go_gundrak_altar") { }
- go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- go->SetGoState(GO_STATE_ACTIVE);
-
- if (instance)
+ bool OnGossipHello(Player* /*player*/, GameObject* go) override
{
- switch (go->GetEntry())
- {
- case GO_SLADRAN_ALTAR:
- statueGUID = instance->GetData64(DATA_SLAD_RAN_STATUE);
- break;
- case GO_MOORABI_ALTAR:
- statueGUID = instance->GetData64(DATA_MOORABI_STATUE);
- break;
- case GO_DRAKKARI_COLOSSUS_ALTAR:
- statueGUID = instance->GetData64(DATA_DRAKKARI_COLOSSUS_STATUE);
- break;
- }
+ go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
+ go->SetGoState(GO_STATE_ACTIVE);
- if (!instance->GetData64(DATA_STATUE_ACTIVATE))
+ if (InstanceScript* instance = go->GetInstanceScript())
{
- instance->SetData64(DATA_STATUE_ACTIVATE, statueGUID);
- go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- go->SetGoState(GO_STATE_ACTIVE);
+ instance->SetData(DATA_STATUE_ACTIVATE, go->GetEntry());
+ return true;
}
- return true;
- }
- return false;
- }
+ return false;
+ }
};
void AddSC_instance_gundrak()
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
index 4b3c50d1388..640c06b1c28 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -216,19 +216,19 @@ class boss_blood_council_controller : public CreatureScript
DoCast(me, SPELL_INVOCATION_OF_BLOOD_VALANAR);
- if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID)))
+ if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_KELESETH_GUID)))
{
instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, keleseth);
DoZoneInCombat(keleseth);
}
- if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID)))
+ if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID)))
{
instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, taldaram);
DoZoneInCombat(taldaram);
}
- if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID)))
+ if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_VALANAR_GUID)))
{
instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, valanar);
DoZoneInCombat(valanar);
@@ -236,16 +236,16 @@ class boss_blood_council_controller : public CreatureScript
events.ScheduleEvent(EVENT_INVOCATION_OF_BLOOD, 46500);
- _invocationOrder[0] = InvocationData(instance->GetData64(DATA_PRINCE_VALANAR_GUID), SPELL_INVOCATION_OF_BLOOD_VALANAR, EMOTE_VALANAR_INVOCATION, 71070);
+ _invocationOrder[0] = InvocationData(instance->GetGuidData(DATA_PRINCE_VALANAR_GUID), SPELL_INVOCATION_OF_BLOOD_VALANAR, EMOTE_VALANAR_INVOCATION, 71070);
if (urand(0, 1))
{
- _invocationOrder[1] = InvocationData(instance->GetData64(DATA_PRINCE_TALDARAM_GUID), SPELL_INVOCATION_OF_BLOOD_TALDARAM, EMOTE_TALDARAM_INVOCATION, 71081);
- _invocationOrder[2] = InvocationData(instance->GetData64(DATA_PRINCE_KELESETH_GUID), SPELL_INVOCATION_OF_BLOOD_KELESETH, EMOTE_KELESETH_INVOCATION, 71080);
+ _invocationOrder[1] = InvocationData(instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID), SPELL_INVOCATION_OF_BLOOD_TALDARAM, EMOTE_TALDARAM_INVOCATION, 71081);
+ _invocationOrder[2] = InvocationData(instance->GetGuidData(DATA_PRINCE_KELESETH_GUID), SPELL_INVOCATION_OF_BLOOD_KELESETH, EMOTE_KELESETH_INVOCATION, 71080);
}
else
{
- _invocationOrder[1] = InvocationData(instance->GetData64(DATA_PRINCE_KELESETH_GUID), SPELL_INVOCATION_OF_BLOOD_KELESETH, EMOTE_KELESETH_INVOCATION, 71080);
- _invocationOrder[2] = InvocationData(instance->GetData64(DATA_PRINCE_TALDARAM_GUID), SPELL_INVOCATION_OF_BLOOD_TALDARAM, EMOTE_TALDARAM_INVOCATION, 71081);
+ _invocationOrder[1] = InvocationData(instance->GetGuidData(DATA_PRINCE_KELESETH_GUID), SPELL_INVOCATION_OF_BLOOD_KELESETH, EMOTE_KELESETH_INVOCATION, 71080);
+ _invocationOrder[2] = InvocationData(instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID), SPELL_INVOCATION_OF_BLOOD_TALDARAM, EMOTE_TALDARAM_INVOCATION, 71081);
}
}
@@ -259,13 +259,13 @@ class boss_blood_council_controller : public CreatureScript
void JustReachedHome() override
{
_resetCounter = 0;
- if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID)))
+ if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_KELESETH_GUID)))
keleseth->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID)))
+ if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID)))
taldaram->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID)))
+ if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_VALANAR_GUID)))
valanar->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
@@ -335,12 +335,12 @@ class boss_blood_council_controller : public CreatureScript
private:
struct InvocationData
{
- uint64 guid;
+ ObjectGuid guid;
uint32 spellId;
uint32 textId;
uint32 visualSpell;
- InvocationData(uint64 _guid, uint32 _spellId, uint32 _textId, uint32 _visualSpell)
+ InvocationData(ObjectGuid _guid, uint32 _spellId, uint32 _textId, uint32 _visualSpell)
{
guid = _guid;
spellId = _spellId;
@@ -348,7 +348,7 @@ class boss_blood_council_controller : public CreatureScript
visualSpell = _visualSpell;
}
- InvocationData() : guid(0), spellId(0), textId(0), visualSpell(0) { }
+ InvocationData() : spellId(0), textId(0), visualSpell(0) { }
} _invocationOrder[3];
uint32 _invocationStage;
@@ -400,7 +400,7 @@ class boss_prince_keleseth_icc : public CreatureScript
void EnterCombat(Unit* /*who*/) override
{
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL)))
DoZoneInCombat(controller);
events.ScheduleEvent(EVENT_BERSERK, 600000);
@@ -428,7 +428,7 @@ class boss_prince_keleseth_icc : public CreatureScript
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
me->SetHealth(_spawnHealth);
_isEmpowered = false;
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL)))
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
controller->AI()->SetData(0, 1);
@@ -515,10 +515,10 @@ class boss_prince_keleseth_icc : public CreatureScript
if (!CheckBoundary(me))
{
EnterEvadeMode();
- if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID)))
+ if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID)))
taldaram->AI()->EnterEvadeMode();
- if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID)))
+ if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_VALANAR_GUID)))
valanar->AI()->EnterEvadeMode();
return false;
@@ -620,7 +620,7 @@ class boss_prince_taldaram_icc : public CreatureScript
void EnterCombat(Unit* /*who*/) override
{
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL)))
DoZoneInCombat(controller);
events.ScheduleEvent(EVENT_BERSERK, 600000);
@@ -644,7 +644,7 @@ class boss_prince_taldaram_icc : public CreatureScript
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
me->SetHealth(_spawnHealth);
_isEmpowered = false;
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL)))
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
controller->AI()->SetData(0, 1);
@@ -734,10 +734,10 @@ class boss_prince_taldaram_icc : public CreatureScript
if (!CheckBoundary(me))
{
EnterEvadeMode();
- if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID)))
+ if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_KELESETH_GUID)))
keleseth->AI()->EnterEvadeMode();
- if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID)))
+ if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_VALANAR_GUID)))
valanar->AI()->EnterEvadeMode();
return false;
@@ -844,7 +844,7 @@ class boss_prince_valanar_icc : public CreatureScript
void EnterCombat(Unit* /*who*/) override
{
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL)))
DoZoneInCombat(controller);
events.ScheduleEvent(EVENT_BERSERK, 600000);
@@ -868,7 +868,7 @@ class boss_prince_valanar_icc : public CreatureScript
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
me->SetHealth(me->GetMaxHealth());
_isEmpowered = false;
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_PRINCES_CONTROL)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL)))
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
controller->AI()->SetData(0, 1);
@@ -973,10 +973,10 @@ class boss_prince_valanar_icc : public CreatureScript
if (!CheckBoundary(me))
{
EnterEvadeMode();
- if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID)))
+ if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_KELESETH_GUID)))
keleseth->AI()->EnterEvadeMode();
- if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID)))
+ if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID)))
taldaram->AI()->EnterEvadeMode();
return false;
@@ -1112,13 +1112,13 @@ class npc_blood_queen_lana_thel : public CreatureScript
_events.Reset();
// remove Feign Death from princes
- if (Creature* keleseth = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_KELESETH_GUID)))
+ if (Creature* keleseth = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_PRINCE_KELESETH_GUID)))
keleseth->AI()->DoAction(ACTION_STAND_UP);
- if (Creature* taldaram = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_TALDARAM_GUID)))
+ if (Creature* taldaram = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_PRINCE_TALDARAM_GUID)))
taldaram->AI()->DoAction(ACTION_STAND_UP);
- if (Creature* valanar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_VALANAR_GUID)))
+ if (Creature* valanar = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_PRINCE_VALANAR_GUID)))
{
valanar->AI()->DoAction(ACTION_STAND_UP);
valanar->SetHealth(valanar->GetMaxHealth());
@@ -1148,7 +1148,6 @@ class npc_ball_of_flame : public CreatureScript
npc_ball_of_flameAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
{
_despawnTimer = 0;
- _chaseGUID = 0;
}
void Reset() override
@@ -1163,16 +1162,16 @@ class npc_ball_of_flame : public CreatureScript
void MovementInform(uint32 type, uint32 id) override
{
- if (type == CHASE_MOTION_TYPE && id == GUID_LOPART(_chaseGUID) && _chaseGUID)
+ if (type == CHASE_MOTION_TYPE && id == _chaseGUID.GetCounter() && _chaseGUID)
{
me->RemoveAurasDueToSpell(SPELL_BALL_OF_FLAMES_PERIODIC);
DoCast(me, SPELL_FLAMES);
_despawnTimer = 1000;
- _chaseGUID = 0;
+ _chaseGUID.Clear();
}
}
- void SetGUID(uint64 guid, int32 /*type*/) override
+ void SetGUID(ObjectGuid guid, int32 /*type*/) override
{
_chaseGUID = guid;
}
@@ -1213,7 +1212,7 @@ class npc_ball_of_flame : public CreatureScript
}
private:
- uint64 _chaseGUID;
+ ObjectGuid _chaseGUID;
InstanceScript* _instance;
uint32 _despawnTimer;
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
index 29d50f1db2a..8a325dee7b4 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
@@ -148,7 +148,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
void Initialize()
{
- _offtankGUID = 0;
+ _offtankGUID.Clear();
_creditBloodQuickening = false;
_killMinchar = false;
}
@@ -210,7 +210,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
minchar->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
minchar->SetCanFly(false);
minchar->RemoveAllAuras();
- minchar->GetMotionMaster()->MoveCharge(4629.3711f, 2782.6089f, 401.5301f, SPEED_CHARGE/3.0f);
+ minchar->GetMotionMaster()->MoveCharge(4629.3711f, 2782.6089f, 401.5301f, SPEED_CHARGE / 3.0f);
}
}
}
@@ -278,7 +278,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
Talk(SAY_KILL);
}
- void SetGUID(uint64 guid, int32 type = 0) override
+ void SetGUID(ObjectGuid guid, int32 type = 0) override
{
switch (type)
{
@@ -390,7 +390,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
}
}
else
- _offtankGUID = 0;
+ _offtankGUID.Clear();
}
events.ScheduleEvent(EVENT_BLOOD_MIRROR, 2500, EVENT_GROUP_CANCELLABLE);
break;
@@ -458,12 +458,12 @@ class boss_blood_queen_lana_thel : public CreatureScript
DoMeleeAttackIfReady();
}
- bool WasVampire(uint64 guid)
+ bool WasVampire(ObjectGuid guid) const
{
return _vampires.count(guid) != 0;
}
- bool WasBloodbolted(uint64 guid)
+ bool WasBloodbolted(ObjectGuid guid) const
{
return _bloodboltedPlayers.count(guid) != 0;
}
@@ -501,9 +501,9 @@ class boss_blood_queen_lana_thel : public CreatureScript
return Trinity::Containers::SelectRandomContainerElement(tempTargets);
}
- std::set<uint64> _vampires;
- std::set<uint64> _bloodboltedPlayers;
- uint64 _offtankGUID;
+ GuidSet _vampires;
+ GuidSet _bloodboltedPlayers;
+ ObjectGuid _offtankGUID;
bool _creditBloodQuickening;
bool _killMinchar;
};
@@ -554,7 +554,7 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader
return;
uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_FRENZIED_BLOODTHIRST, GetCaster());
- GetCaster()->RemoveAura(spellId, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL);
+ GetCaster()->RemoveAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL);
GetCaster()->CastSpell(GetCaster(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR, TRIGGERED_FULL_MASK);
// Shadowmourne questline
@@ -570,7 +570,7 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader
}
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL)))
+ if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL)))
bloodQueen->AI()->SetGUID(GetHitUnit()->GetGUID(), GUID_VAMPIRE);
}
@@ -606,7 +606,7 @@ class spell_blood_queen_frenzied_bloodthirst : public SpellScriptLoader
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (InstanceScript* instance = GetTarget()->GetInstanceScript())
- if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetTarget(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL)))
+ if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetTarget(), instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL)))
bloodQueen->AI()->Talk(EMOTE_BLOODTHIRST, GetTarget());
}
@@ -615,7 +615,7 @@ class spell_blood_queen_frenzied_bloodthirst : public SpellScriptLoader
Unit* target = GetTarget();
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
if (InstanceScript* instance = target->GetInstanceScript())
- if (Creature* bloodQueen = ObjectAccessor::GetCreature(*target, instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL)))
+ if (Creature* bloodQueen = ObjectAccessor::GetCreature(*target, instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL)))
{
// this needs to be done BEFORE charm aura or we hit an assert in Unit::SetCharmedBy
if (target->GetVehicleKit())
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
index 2909946a0db..15cf0d31af9 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
@@ -299,7 +299,7 @@ class boss_deathbringer_saurfang : public CreatureScript
if (!_introDone)
{
DoCast(me, SPELL_GRIP_OF_AGONY);
- if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SAURFANG_EVENT_NPC)))
+ if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SAURFANG_EVENT_NPC)))
creature->AI()->DoAction(ACTION_INTERRUPT_INTRO);
}
@@ -375,7 +375,7 @@ class boss_deathbringer_saurfang : public CreatureScript
//instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MARK_OF_THE_FALLEN_CHAMPION);
DoCast(me, SPELL_PERMANENT_FEIGN_DEATH);
- if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SAURFANG_EVENT_NPC)))
+ if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SAURFANG_EVENT_NPC)))
creature->AI()->DoAction(ACTION_START_OUTRO);
}
}
@@ -410,7 +410,7 @@ class boss_deathbringer_saurfang : public CreatureScript
if (type != POINT_MOTION_TYPE && id != POINT_SAURFANG)
return;
- instance->HandleGameObject(instance->GetData64(GO_SAURFANG_S_DOOR), false);
+ instance->HandleGameObject(instance->GetGuidData(GO_SAURFANG_S_DOOR), false);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
@@ -650,8 +650,8 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
Talk(SAY_INTRO_HORDE_1);
_events.SetPhase(PHASE_INTRO_H);
_events.ScheduleEvent(EVENT_INTRO_HORDE_3, 18500, 0, PHASE_INTRO_H);
- _instance->HandleGameObject(_instance->GetData64(GO_SAURFANG_S_DOOR), true);
- if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)))
+ _instance->HandleGameObject(_instance->GetGuidData(GO_SAURFANG_S_DOOR), true);
+ if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
deathbringer->AI()->DoAction(PHASE_INTRO_H);
break;
}
@@ -703,11 +703,11 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
_events.ScheduleEvent(EVENT_INTRO_HORDE_6, 29500, 0, PHASE_INTRO_H);
_events.ScheduleEvent(EVENT_INTRO_HORDE_7, 43800, 0, PHASE_INTRO_H);
_events.ScheduleEvent(EVENT_INTRO_HORDE_8, 47000, 0, PHASE_INTRO_H);
- if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)))
+ if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
deathbringer->AI()->DoAction(ACTION_CONTINUE_INTRO);
break;
case POINT_CORPSE:
- if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)))
+ if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
{
deathbringer->CastSpell(me, SPELL_RIDE_VEHICLE, true); // for the packet logs.
deathbringer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -717,7 +717,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
_events.ScheduleEvent(EVENT_OUTRO_HORDE_6, 4000); // say
break;
case POINT_FINAL:
- if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)))
+ if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
deathbringer->DespawnOrUnsummon();
me->DespawnOrUnsummon();
break;
@@ -762,7 +762,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
me->GetMotionMaster()->MoveCharge(chargePos[0].GetPositionX(), chargePos[0].GetPositionY(), chargePos[0].GetPositionZ(), 8.5f, POINT_CHARGE);
break;
case EVENT_OUTRO_HORDE_2: // say
- if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)))
+ if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
me->SetFacingToObject(deathbringer);
Talk(SAY_OUTRO_HORDE_2);
break;
@@ -770,7 +770,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
Talk(SAY_OUTRO_HORDE_3);
break;
case EVENT_OUTRO_HORDE_4: // move
- if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)))
+ if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
{
float x, y, z;
deathbringer->GetClosePoint(x, y, z, deathbringer->GetObjectSize());
@@ -859,8 +859,8 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
Talk(SAY_INTRO_ALLIANCE_1);
_events.ScheduleEvent(EVENT_INTRO_ALLIANCE_4, 2500+17500+9500, 0, PHASE_INTRO_A);
- _instance->HandleGameObject(_instance->GetData64(GO_SAURFANG_S_DOOR), true);
- if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)))
+ _instance->HandleGameObject(_instance->GetGuidData(GO_SAURFANG_S_DOOR), true);
+ if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
deathbringer->AI()->DoAction(PHASE_INTRO_A);
break;
}
@@ -874,7 +874,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
(*itr)->AI()->DoAction(ACTION_DESPAWN);
// temp until outro fully done - to put deathbringer on respawn timer (until next reset)
- if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)))
+ if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
deathbringer->DespawnOrUnsummon(5000);
break;
}
@@ -902,7 +902,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
me->SetWalk(false);
Talk(SAY_INTRO_ALLIANCE_4);
_events.ScheduleEvent(EVENT_INTRO_ALLIANCE_5, 5000, 0, PHASE_INTRO_A);
- if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)))
+ if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
deathbringer->AI()->DoAction(ACTION_CONTINUE_INTRO);
}
else if (type == WAYPOINT_MOTION_TYPE && id == POINT_EXIT)
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
index 90d91199e7a..b1f6a4a5e83 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
@@ -88,7 +88,6 @@ class boss_festergut : public CreatureScript
{
_maxInoculatedStack = 0;
_inhaleCounter = 0;
- _gasDummyGUID = 0;
}
void Reset() override
@@ -126,7 +125,7 @@ class boss_festergut : public CreatureScript
Talk(SAY_AGGRO);
if (Creature* gasDummy = me->FindNearestCreature(NPC_GAS_DUMMY, 100.0f, true))
_gasDummyGUID = gasDummy->GetGUID();
- if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->DoAction(ACTION_FESTERGUT_COMBAT);
DoZoneInCombat();
}
@@ -135,7 +134,7 @@ class boss_festergut : public CreatureScript
{
_JustDied();
Talk(SAY_DEATH);
- if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->DoAction(ACTION_FESTERGUT_DEATH);
RemoveBlight();
@@ -150,7 +149,7 @@ class boss_festergut : public CreatureScript
void EnterEvadeMode() override
{
ScriptedAI::EnterEvadeMode();
- if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->EnterEvadeMode();
}
@@ -189,7 +188,7 @@ class boss_festergut : public CreatureScript
Talk(SAY_PUNGENT_BLIGHT);
DoCast(me, SPELL_PUNGENT_BLIGHT);
_inhaleCounter = 0;
- if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->DoAction(ACTION_FESTERGUT_GAS);
events.RescheduleEvent(EVENT_GAS_SPORE, urand(20000, 25000));
}
@@ -279,7 +278,7 @@ class boss_festergut : public CreatureScript
}
private:
- uint64 _gasDummyGUID;
+ ObjectGuid _gasDummyGUID;
uint32 _maxInoculatedStack;
uint32 _inhaleCounter;
};
@@ -346,7 +345,7 @@ class npc_stinky_icc : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* festergut = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FESTERGUT)))
+ if (Creature* festergut = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_FESTERGUT)))
if (festergut->IsAlive())
festergut->AI()->Talk(SAY_STINKY_DEAD);
}
@@ -456,7 +455,7 @@ class spell_festergut_blighted_spores : public SpellScriptLoader
{
GetTarget()->CastSpell(GetTarget(), SPELL_INOCULATED, true);
if (InstanceScript* instance = GetTarget()->GetInstanceScript())
- if (Creature* festergut = ObjectAccessor::GetCreature(*GetTarget(), instance->GetData64(DATA_FESTERGUT)))
+ if (Creature* festergut = ObjectAccessor::GetCreature(*GetTarget(), instance->GetGuidData(DATA_FESTERGUT)))
festergut->AI()->SetData(DATA_INOCULATED_STACK, GetStackAmount());
HandleResidue();
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
index 535ace3259c..74a09887dd2 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
@@ -383,7 +383,9 @@ public:
void ResetSlots(uint32 team)
{
_transport = NULL;
- memset(_controlledSlots, 0, sizeof(uint64)* MAX_SLOTS);
+ for (uint32 i = 0; i < MAX_SLOTS; ++i)
+ _controlledSlots[i].Clear();
+
memset(_respawnCooldowns, 0, sizeof(time_t)* MAX_SLOTS);
_spawnPoint = team == HORDE ? &OrgrimsHammerAddsSpawnPos : &SkybreakerAddsSpawnPos;
_slotInfo = team == HORDE ? OrgrimsHammerSlotInfo : SkybreakerSlotInfo;
@@ -422,7 +424,7 @@ public:
void ClearSlot(PassengerSlots slot)
{
- _controlledSlots[slot] = 0;
+ _controlledSlots[slot].Clear();
_respawnCooldowns[slot] = time(NULL) + _slotInfo[slot].Cooldown;
}
@@ -448,7 +450,7 @@ private:
}
Transport* _transport;
- uint64 _controlledSlots[MAX_SLOTS];
+ ObjectGuid _controlledSlots[MAX_SLOTS];
time_t _respawnCooldowns[MAX_SLOTS];
Position const* _spawnPoint;
SlotInfo const* _slotInfo;
@@ -482,7 +484,7 @@ private:
class ResetEncounterEvent : public BasicEvent
{
public:
- ResetEncounterEvent(Unit* caster, uint32 spellId, uint64 otherTransport) : _caster(caster), _spellId(spellId), _otherTransport(otherTransport) { }
+ ResetEncounterEvent(Unit* caster, uint32 spellId, ObjectGuid otherTransport) : _caster(caster), _spellId(spellId), _otherTransport(otherTransport) { }
bool Execute(uint64, uint32) override
{
@@ -498,7 +500,7 @@ public:
private:
Unit* _caster;
uint32 _spellId;
- uint64 _otherTransport;
+ ObjectGuid _otherTransport;
};
class BattleExperienceEvent : public BasicEvent
@@ -744,7 +746,7 @@ class npc_gunship : public CreatureScript
cannon->CastSpell(cannon, SPELL_EJECT_ALL_PASSENGERS_BELOW_ZERO, TRIGGERED_FULL_MASK);
WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, cannon->GetPackGUID().size() + 4);
- data.append(cannon->GetPackGUID());
+ data << cannon->GetPackGUID();
data << uint32(0);
cannon->SendMessageToSet(&data, true);
@@ -767,7 +769,7 @@ class npc_gunship : public CreatureScript
if (isVictory)
{
- if (GameObject* go = HashMapHolder<GameObject>::Find(instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE)))
+ if (GameObject* go = HashMapHolder<GameObject>::Find(instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
if (Transport* otherTransport = go->ToTransport())
otherTransport->EnableMovement(true);
@@ -791,17 +793,17 @@ class npc_gunship : public CreatureScript
else
{
uint32 teleportSpellId = _teamInInstance == HORDE ? SPELL_TELEPORT_PLAYERS_ON_RESET_H : SPELL_TELEPORT_PLAYERS_ON_RESET_A;
- me->m_Events.AddEvent(new ResetEncounterEvent(me, teleportSpellId, me->GetInstanceScript()->GetData64(DATA_ENEMY_GUNSHIP)),
+ me->m_Events.AddEvent(new ResetEncounterEvent(me, teleportSpellId, me->GetInstanceScript()->GetGuidData(DATA_ENEMY_GUNSHIP)),
me->m_Events.CalculateTime(8000));
}
}
- void SetGUID(uint64 guid, int32 id/* = 0*/) override
+ void SetGUID(ObjectGuid guid, int32 id/* = 0*/) override
{
if (id != ACTION_SHIP_VISITS)
return;
- std::map<uint64, uint32>::iterator itr = _shipVisits.find(guid);
+ std::map<ObjectGuid, uint32>::iterator itr = _shipVisits.find(guid);
if (itr == _shipVisits.end())
_shipVisits[guid] = 1;
else
@@ -814,7 +816,7 @@ class npc_gunship : public CreatureScript
return 0;
uint32 max = 0;
- for (std::map<uint64, uint32>::const_iterator itr = _shipVisits.begin(); itr != _shipVisits.end(); ++itr)
+ for (std::map<ObjectGuid, uint32>::const_iterator itr = _shipVisits.begin(); itr != _shipVisits.end(); ++itr)
max = std::max(max, itr->second);
return max;
@@ -822,7 +824,7 @@ class npc_gunship : public CreatureScript
private:
uint32 _teamInInstance;
- std::map<uint64, uint32> _shipVisits;
+ std::map<ObjectGuid, uint32> _shipVisits;
bool _summonedFirstMage;
bool _died;
};
@@ -1032,7 +1034,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
if (Transport* orgrimsHammer = me->GetTransport())
orgrimsHammer->SummonPassenger(NPC_TELEPORT_PORTAL, OrgrimsHammerTeleportPortal, TEMPSUMMON_TIMED_DESPAWN, NULL, 21000);
- if (GameObject* go = HashMapHolder<GameObject>::Find(_instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE)))
+ if (GameObject* go = HashMapHolder<GameObject>::Find(_instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
if (Transport* skybreaker = go->ToTransport())
skybreaker->SummonPassenger(NPC_TELEPORT_EXIT, SkybreakerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, NULL, 23000);
@@ -1305,7 +1307,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
if (Transport* skybreaker = me->GetTransport())
skybreaker->SummonPassenger(NPC_TELEPORT_PORTAL, SkybreakerTeleportPortal, TEMPSUMMON_TIMED_DESPAWN, NULL, 21000);
- if (GameObject* go = HashMapHolder<GameObject>::Find(_instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE)))
+ if (GameObject* go = HashMapHolder<GameObject>::Find(_instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
if (Transport* orgrimsHammer = go->ToTransport())
orgrimsHammer->SummonPassenger(NPC_TELEPORT_EXIT, OrgrimsHammerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, NULL, 23000);
@@ -1451,7 +1453,7 @@ struct npc_gunship_boarding_addAI : public gunship_npc_AI
if (!myTransport)
return;
- if (GameObject* go = HashMapHolder<GameObject>::Find(Instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE)))
+ if (GameObject* go = HashMapHolder<GameObject>::Find(Instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
if (Transport* destTransport = go->ToTransport())
destTransport->CalculatePassengerPosition(x, y, z, &o);
@@ -2085,7 +2087,7 @@ class spell_igb_overheat : public SpellScriptLoader
if (Player* player = passenger->ToPlayer())
{
WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, GetUnitOwner()->GetPackGUID().size() + 1);
- data.append(GetUnitOwner()->GetPackGUID());
+ data << GetUnitOwner()->GetPackGUID();
data << uint8(value);
player->GetSession()->SendPacket(&data);
}
@@ -2335,7 +2337,7 @@ class spell_igb_gunship_fall_teleport : public SpellScriptLoader
void SelectTransport(WorldObject*& target)
{
if (InstanceScript* instance = target->GetInstanceScript())
- target = HashMapHolder<GameObject>::Find(instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE));
+ target = HashMapHolder<GameObject>::Find(instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE));
}
void RelocateDest(SpellEffIndex /*effIndex*/)
@@ -2426,7 +2428,7 @@ class spell_igb_teleport_players_on_victory : public SpellScriptLoader
InstanceScript* instance = GetCaster()->GetInstanceScript();
targets.remove_if([instance](WorldObject* target) -> bool
{
- return target->GetTransGUID() != instance->GetData64(DATA_ENEMY_GUNSHIP);
+ return target->GetTransGUID() != instance->GetGuidData(DATA_ENEMY_GUNSHIP);
});
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
index 6cc86ff0096..3e78865c924 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
@@ -224,8 +224,8 @@ class boss_lady_deathwhisper : public CreatureScript
void Initialize()
{
_waveCounter = 0;
- _nextVengefulShadeTargetGUID = 0;
- _darnavanGUID = 0;
+ _nextVengefulShadeTargetGUID.Clear();
+ _darnavanGUID.Clear();
}
void Reset() override
@@ -329,10 +329,10 @@ class boss_lady_deathwhisper : public CreatureScript
{
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
if (Player* member = itr->GetSource())
- member->KilledMonsterCredit(NPC_DARNAVAN_CREDIT, 0);
+ member->KilledMonsterCredit(NPC_DARNAVAN_CREDIT);
}
else
- owner->KilledMonsterCredit(NPC_DARNAVAN_CREDIT, 0);
+ owner->KilledMonsterCredit(NPC_DARNAVAN_CREDIT);
}
}
}
@@ -349,7 +349,7 @@ class boss_lady_deathwhisper : public CreatureScript
if (Creature* darnavan = ObjectAccessor::GetCreature(*me, _darnavanGUID))
{
darnavan->DespawnOrUnsummon();
- _darnavanGUID = 0;
+ _darnavanGUID.Clear();
}
}
@@ -396,7 +396,7 @@ class boss_lady_deathwhisper : public CreatureScript
if (summon->GetEntry() == NPC_VENGEFUL_SHADE)
{
target = ObjectAccessor::GetUnit(*me, _nextVengefulShadeTargetGUID); // Vengeful Shade
- _nextVengefulShadeTargetGUID = 0;
+ _nextVengefulShadeTargetGUID.Clear();
}
else
target = SelectTarget(SELECT_TARGET_RANDOM); // Wave adds
@@ -554,7 +554,7 @@ class boss_lady_deathwhisper : public CreatureScript
summon->CastSpell(summon, SPELL_TELEPORT_VISUAL);
}
- void SetGUID(uint64 guid, int32 id/* = 0*/) override
+ void SetGUID(ObjectGuid guid, int32 id/* = 0*/) override
{
if (id != GUID_CULTIST)
return;
@@ -568,7 +568,7 @@ class boss_lady_deathwhisper : public CreatureScript
if (_reanimationQueue.empty())
return;
- uint64 cultistGUID = _reanimationQueue.front();
+ ObjectGuid cultistGUID = _reanimationQueue.front();
Creature* cultist = ObjectAccessor::GetCreature(*me, cultistGUID);
_reanimationQueue.pop_front();
if (!cultist)
@@ -615,9 +615,9 @@ class boss_lady_deathwhisper : public CreatureScript
}
private:
- uint64 _nextVengefulShadeTargetGUID;
- uint64 _darnavanGUID;
- std::deque<uint64> _reanimationQueue;
+ ObjectGuid _nextVengefulShadeTargetGUID;
+ ObjectGuid _darnavanGUID;
+ GuidDeque _reanimationQueue;
uint32 _waveCounter;
uint8 const _dominateMindCount;
bool _introDone;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
index b7bf27177ea..7ab8c956757 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
@@ -133,7 +133,6 @@ class boss_lord_marrowgar : public CreatureScript
_coldflameLastPos.Relocate(creature);
_introDone = false;
_boneSlice = false;
- _coldflameTarget = 0;
}
void Reset() override
@@ -211,7 +210,7 @@ class boss_lord_marrowgar : public CreatureScript
break;
case EVENT_COLDFLAME:
_coldflameLastPos.Relocate(me);
- _coldflameTarget = 0LL;
+ _coldflameTarget.Clear();
if (!me->HasAura(SPELL_BONE_STORM))
DoCastAOE(SPELL_COLDFLAME_NORMAL);
else
@@ -289,7 +288,7 @@ class boss_lord_marrowgar : public CreatureScript
return &_coldflameLastPos;
}
- uint64 GetGUID(int32 type /*= 0 */) const override
+ ObjectGuid GetGUID(int32 type /*= 0 */) const override
{
switch (type)
{
@@ -307,10 +306,10 @@ class boss_lord_marrowgar : public CreatureScript
}
}
- return 0LL;
+ return ObjectGuid::Empty;
}
- void SetGUID(uint64 guid, int32 type /*= 0 */) override
+ void SetGUID(ObjectGuid guid, int32 type /*= 0 */) override
{
switch (type)
{
@@ -333,8 +332,8 @@ class boss_lord_marrowgar : public CreatureScript
private:
Position _coldflameLastPos;
- std::vector<uint64> _boneSpikeImmune;
- uint64 _coldflameTarget;
+ GuidVector _boneSpikeImmune;
+ ObjectGuid _coldflameTarget;
uint32 _boneStormDuration;
float _baseSpeed;
bool _introDone;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index c1a13c90780..2e353e5f9dc 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -174,7 +174,7 @@ class AbominationDespawner
public:
explicit AbominationDespawner(Unit* owner) : _owner(owner) { }
- bool operator()(uint64 guid)
+ bool operator()(ObjectGuid guid)
{
if (Unit* summon = ObjectAccessor::GetUnit(*_owner, guid))
{
@@ -373,7 +373,7 @@ class boss_professor_putricide : public CreatureScript
instance->SetBossState(DATA_FESTERGUT, IN_PROGRESS); // needed here for delayed gate close
me->SetSpeed(MOVE_RUN, _baseSpeed, true);
DoAction(ACTION_FESTERGUT_GAS);
- if (Creature* festergut = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FESTERGUT)))
+ if (Creature* festergut = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FESTERGUT)))
festergut->CastSpell(festergut, SPELL_GASEOUS_BLIGHT_LARGE, false, NULL, NULL, festergut->GetGUID());
break;
case POINT_ROTFACE:
@@ -386,7 +386,7 @@ class boss_professor_putricide : public CreatureScript
// stop attack
me->GetMotionMaster()->MoveIdle();
me->SetSpeed(MOVE_RUN, _baseSpeed, true);
- if (GameObject* table = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_PUTRICIDE_TABLE)))
+ if (GameObject* table = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_PUTRICIDE_TABLE)))
me->SetFacingToObject(table);
// operating on new phase already
switch (_phase)
@@ -443,7 +443,7 @@ class boss_professor_putricide : public CreatureScript
_oozeFloodStage = 0;
DoZoneInCombat(me);
// init random sequence of floods
- if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE)))
+ if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ROTFACE)))
{
std::list<Creature*> list;
GetCreatureListWithEntryInGrid(list, rotface, NPC_PUDDLE_STALKER, 50.0f);
@@ -702,7 +702,7 @@ class boss_professor_putricide : public CreatureScript
events.SetPhase(newPhase);
}
- uint64 _oozeFloodDummyGUIDs[4];
+ ObjectGuid _oozeFloodDummyGUIDs[4];
Phases _phase; // external of EventMap because event phase gets reset on evade
float const _baseSpeed;
uint8 _oozeFloodStage;
@@ -1152,7 +1152,7 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
if (!GetHitUnit()->HasAura(plagueId))
{
- if (Creature* professor = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
{
if (Aura* oldPlague = GetCaster()->GetAura(plagueId, professor->GetGUID()))
{
@@ -1307,7 +1307,7 @@ class spell_putricide_mutation_init : public SpellScriptLoader
if (!instance)
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
- Creature* professor = ObjectAccessor::GetCreature(*GetExplTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE));
+ Creature* professor = ObjectAccessor::GetCreature(*GetExplTargetUnit(), instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE));
if (!professor)
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
@@ -1428,7 +1428,7 @@ class spell_putricide_mutated_transformation : public SpellScriptLoader
if (!instance)
return;
- Creature* putricide = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_PROFESSOR_PUTRICIDE));
+ Creature* putricide = ObjectAccessor::GetCreature(*caster, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE));
if (!putricide)
return;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
index 2f2889a9cf3..205b90fa159 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
@@ -126,7 +126,7 @@ class boss_rotface : public CreatureScript
me->setActive(true);
Talk(SAY_AGGRO);
- if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->DoAction(ACTION_ROTFACE_COMBAT);
DoZoneInCombat();
@@ -138,7 +138,7 @@ class boss_rotface : public CreatureScript
instance->DoRemoveAurasDueToSpellOnPlayers(MUTATED_INFECTION);
_JustDied();
Talk(SAY_DEATH);
- if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->DoAction(ACTION_ROTFACE_DEATH);
}
@@ -158,7 +158,7 @@ class boss_rotface : public CreatureScript
void EnterEvadeMode() override
{
ScriptedAI::EnterEvadeMode();
- if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->EnterEvadeMode();
}
@@ -176,7 +176,7 @@ class boss_rotface : public CreatureScript
void JustSummoned(Creature* summon) override
{
if (summon->GetEntry() == NPC_VILE_GAS_STALKER)
- if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
+ if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
professor->CastSpell(summon, SPELL_VILE_GAS_H, true);
}
@@ -308,13 +308,13 @@ class npc_big_ooze : public CreatureScript
DoCast(me, SPELL_GREEN_ABOMINATION_HITTIN__YA_PROC, true);
events.ScheduleEvent(EVENT_STICKY_OOZE, 5000);
// register in Rotface's summons - not summoned with Rotface as owner
- if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE)))
+ if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ROTFACE)))
rotface->AI()->JustSummoned(me);
}
void JustDied(Unit* /*killer*/) override
{
- if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE)))
+ if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ROTFACE)))
rotface->AI()->SummonedCreatureDespawn(me);
me->DespawnOrUnsummon();
}
@@ -395,7 +395,7 @@ class npc_precious_icc : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
_summons.DespawnAll();
- if (Creature* rotface = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ROTFACE)))
+ if (Creature* rotface = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ROTFACE)))
if (rotface->IsAlive())
rotface->AI()->Talk(SAY_PRECIOUS_DIES);
}
@@ -469,7 +469,7 @@ class spell_rotface_ooze_flood : public SpellScriptLoader
return;
triggers.sort(Trinity::ObjectDistanceOrderPred(GetHitUnit()));
- GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, NULL, NULL, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : 0);
+ GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, NULL, NULL, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : ObjectGuid::Empty);
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -657,7 +657,7 @@ class spell_rotface_large_ooze_buff_combine : public SpellScriptLoader
GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE);
GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE);
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_ROTFACE)))
+ if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_ROTFACE)))
if (rotface->IsAlive())
{
rotface->AI()->Talk(EMOTE_UNSTABLE_EXPLOSION);
@@ -748,7 +748,7 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader
GetExplTargetDest()->GetPosition(x, y, z);
// let Rotface handle the cast - caster dies before this executes
if (InstanceScript* script = GetCaster()->GetInstanceScript())
- if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE)))
+ if (Creature* rotface = script->instance->GetCreature(script->GetGuidData(DATA_ROTFACE)))
rotface->CastSpell(x, y, z, triggered_spell_id, true, NULL, NULL, GetCaster()->GetGUID());
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index 3b65c10aaa9..551ec9ad0a2 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -182,7 +182,7 @@ class FrostwyrmLandEvent : public BasicEvent
class FrostBombExplosion : public BasicEvent
{
public:
- FrostBombExplosion(Creature* owner, uint64 sindragosaGUID) : _owner(owner), _sindragosaGUID(sindragosaGUID) { }
+ FrostBombExplosion(Creature* owner, ObjectGuid sindragosaGUID) : _owner(owner), _sindragosaGUID(sindragosaGUID) { }
bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/)
{
@@ -193,7 +193,7 @@ class FrostBombExplosion : public BasicEvent
private:
Creature* _owner;
- uint64 _sindragosaGUID;
+ ObjectGuid _sindragosaGUID;
};
class FrostBeaconSelector
@@ -563,7 +563,6 @@ class npc_ice_tomb : public CreatureScript
{
npc_ice_tombAI(Creature* creature) : ScriptedAI(creature)
{
- _trappedPlayerGUID = 0;
_existenceCheckTimer = 0;
SetCombatMovement(false);
}
@@ -573,7 +572,7 @@ class npc_ice_tomb : public CreatureScript
me->SetReactState(REACT_PASSIVE);
}
- void SetGUID(uint64 guid, int32 type/* = 0 */) override
+ void SetGUID(ObjectGuid guid, int32 type/* = 0 */) override
{
if (type == DATA_TRAPPED_PLAYER)
{
@@ -595,7 +594,7 @@ class npc_ice_tomb : public CreatureScript
if (Player* player = ObjectAccessor::GetPlayer(*me, _trappedPlayerGUID))
{
- _trappedPlayerGUID = 0;
+ _trappedPlayerGUID.Clear();
player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_DAMAGE);
player->RemoveAurasDueToSpell(SPELL_ASPHYXIATION);
}
@@ -623,7 +622,7 @@ class npc_ice_tomb : public CreatureScript
}
private:
- uint64 _trappedPlayerGUID;
+ ObjectGuid _trappedPlayerGUID;
uint32 _existenceCheckTimer;
};
@@ -1574,14 +1573,14 @@ class at_sindragosa_lair : public AreaTriggerScript
if (InstanceScript* instance = player->GetInstanceScript())
{
if (!instance->GetData(DATA_SPINESTALKER))
- if (Creature* spinestalker = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_SPINESTALKER)))
+ if (Creature* spinestalker = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_SPINESTALKER)))
spinestalker->AI()->DoAction(ACTION_START_FROSTWYRM);
if (!instance->GetData(DATA_RIMEFANG))
- if (Creature* rimefang = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_RIMEFANG)))
+ if (Creature* rimefang = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_RIMEFANG)))
rimefang->AI()->DoAction(ACTION_START_FROSTWYRM);
- if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && !instance->GetData64(DATA_SINDRAGOSA) && instance->GetBossState(DATA_SINDRAGOSA) != DONE)
+ if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && !instance->GetGuidData(DATA_SINDRAGOSA) && instance->GetBossState(DATA_SINDRAGOSA) != DONE)
{
if (player->GetMap()->IsHeroic() && !instance->GetData(DATA_HEROIC_ATTEMPTS))
return true;
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 50e98422481..e67edc473f4 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
@@ -546,7 +546,7 @@ class boss_the_lich_king : public CreatureScript
// Restore Tirion's gossip only after The Lich King fully resets to prevent
// restarting the encounter while LK still runs back to spawn point
- if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING)))
+ if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING)))
tirion->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
// Reset any light override
@@ -563,7 +563,7 @@ class boss_the_lich_king : public CreatureScript
{
instance->SetBossState(DATA_THE_LICH_KING, FAIL);
BossAI::EnterEvadeMode();
- if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING)))
+ if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING)))
tirion->AI()->EnterEvadeMode();
DoCastAOE(SPELL_KILL_FROSTMOURNE_PLAYERS);
EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE);
@@ -802,7 +802,7 @@ class boss_the_lich_king : public CreatureScript
events.ScheduleEvent(EVENT_INTRO_MOVE_3, 1, 0, PHASE_INTRO);
break;
case POINT_LK_INTRO_3:
- if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING)))
+ if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING)))
tirion->AI()->DoAction(ACTION_CONTINUE_INTRO);
events.ScheduleEvent(EVENT_INTRO_TALK_1, 9000, 0, PHASE_INTRO);
break;
@@ -843,7 +843,7 @@ class boss_the_lich_king : public CreatureScript
events.ScheduleEvent(EVENT_OUTRO_TALK_5, 29000, 0, PHASE_OUTRO);
break;
case POINT_LK_OUTRO_2:
- if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING)))
+ if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING)))
tirion->AI()->Talk(SAY_TIRION_OUTRO_2);
if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f))
frostmourne->AI()->DoAction(ACTION_SUMMON_TERENAS);
@@ -1049,7 +1049,7 @@ class boss_the_lich_king : public CreatureScript
me->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NO_SHEATHE);
break;
case EVENT_OUTRO_TALK_3:
- if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING)))
+ if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING)))
me->SetFacingToObject(tirion);
Talk(SAY_LK_OUTRO_3);
break;
@@ -1067,12 +1067,12 @@ class boss_the_lich_king : public CreatureScript
break;
case EVENT_OUTRO_TALK_5:
Talk(SAY_LK_OUTRO_5);
- if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING)))
+ if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING)))
tirion->AI()->DoAction(ACTION_OUTRO);
break;
case EVENT_OUTRO_TALK_6:
Talk(SAY_LK_OUTRO_6);
- if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING)))
+ if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING)))
tirion->SetFacingToObject(me);
me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE_3, TRIGGERED_IGNORE_CAST_IN_PROGRESS);
SetEquipmentSlots(false, EQUIP_UNEQUIP);
@@ -1142,7 +1142,7 @@ class npc_tirion_fordring_tft : public CreatureScript
{
case POINT_TIRION_INTRO:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
- if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
theLichKing->AI()->DoAction(ACTION_START_ENCOUNTER);
break;
case POINT_TIRION_OUTRO_1:
@@ -1228,7 +1228,7 @@ class npc_tirion_fordring_tft : public CreatureScript
case EVENT_OUTRO_REMOVE_ICE:
me->RemoveAurasDueToSpell(SPELL_ICE_LOCK);
SetEquipmentSlots(false, EQUIP_ASHBRINGER_GLOWING);
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
{
me->SetFacingToObject(lichKing);
lichKing->AI()->DoAction(ACTION_PLAY_MUSIC);
@@ -1355,13 +1355,13 @@ class npc_raging_spirit : public CreatureScript
void IsSummonedBy(Unit* /*summoner*/) override
{
// player is the spellcaster so register summon manually
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
lichKing->AI()->JustSummoned(me);
}
void JustDied(Unit* /*killer*/) override
{
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
lichKing->AI()->SummonedCreatureDespawn(me);
if (TempSummon* summon = me->ToTempSummon())
summon->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN);
@@ -1412,7 +1412,7 @@ class npc_valkyr_shadowguard : public CreatureScript
struct npc_valkyr_shadowguardAI : public ScriptedAI
{
npc_valkyr_shadowguardAI(Creature* creature) : ScriptedAI(creature),
- _grabbedPlayer(0), _instance(creature->GetInstanceScript())
+ _instance(creature->GetInstanceScript())
{
}
@@ -1474,7 +1474,7 @@ class npc_valkyr_shadowguard : public CreatureScript
if (Player* target = ObjectAccessor::GetPlayer(*me, _grabbedPlayer))
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- if (GameObject* platform = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_ARTHAS_PLATFORM)))
+ if (GameObject* platform = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_ARTHAS_PLATFORM)))
{
std::list<Creature*> triggers;
GetCreatureListWithEntryInGrid(triggers, me, NPC_WORLD_TRIGGER, 150.0f);
@@ -1497,7 +1497,7 @@ class npc_valkyr_shadowguard : public CreatureScript
}
}
- void SetGUID(uint64 guid, int32 /* = 0*/) override
+ void SetGUID(ObjectGuid guid, int32 /* = 0*/) override
{
_grabbedPlayer = guid;
}
@@ -1542,7 +1542,7 @@ class npc_valkyr_shadowguard : public CreatureScript
private:
EventMap _events;
Position _dropPoint;
- uint64 _grabbedPlayer;
+ ObjectGuid _grabbedPlayer;
InstanceScript* _instance;
};
@@ -1573,7 +1573,7 @@ class npc_strangulate_vehicle : public CreatureScript
_events.ScheduleEvent(EVENT_TELEPORT, 6000);
// this will let us easily access all creatures of this entry on heroic mode when its time to teleport back
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
lichKing->AI()->JustSummoned(me);
}
@@ -1591,7 +1591,7 @@ class npc_strangulate_vehicle : public CreatureScript
}
}
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
lichKing->AI()->SummonedCreatureDespawn(me);
}
@@ -1619,7 +1619,7 @@ class npc_strangulate_vehicle : public CreatureScript
else
{
summoner->CastSpell(summoner, SPELL_HARVEST_SOULS_TELEPORT, true);
- summoner->RemoveAurasDueToSpell(HARVEST_SOUL, 0, 0, AURA_REMOVE_BY_EXPIRE);
+ summoner->RemoveAurasDueToSpell(HARVEST_SOUL, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE);
}
}
}
@@ -1627,7 +1627,7 @@ class npc_strangulate_vehicle : public CreatureScript
_events.ScheduleEvent(EVENT_DESPAWN_SELF, 65000);
break;
case EVENT_MOVE_TO_LICH_KING:
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
{
if (me->GetExactDist(lichKing) > 10.0f)
{
@@ -1637,7 +1637,7 @@ class npc_strangulate_vehicle : public CreatureScript
}
break;
case EVENT_DESPAWN_SELF:
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
lichKing->AI()->SummonedCreatureDespawn(me);
me->DespawnOrUnsummon(1);
break;
@@ -1737,7 +1737,7 @@ class npc_terenas_menethil : public CreatureScript
{
_events.Reset();
_events.SetPhase(PHASE_OUTRO);
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
me->SetFacingToObject(lichKing);
_events.ScheduleEvent(EVENT_OUTRO_TERENAS_TALK_1, 2000, 0, PHASE_OUTRO);
@@ -1771,11 +1771,11 @@ class npc_terenas_menethil : public CreatureScript
case EVENT_OUTRO_TERENAS_TALK_2:
Talk(SAY_TERENAS_OUTRO_2);
DoCastAOE(SPELL_MASS_RESURRECTION);
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
{
lichKing->AI()->DoAction(ACTION_FINISH_OUTRO);
lichKing->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
- if (Creature* tirion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING)))
+ if (Creature* tirion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING)))
tirion->AI()->AttackStart(lichKing);
}
break;
@@ -1787,7 +1787,7 @@ class npc_terenas_menethil : public CreatureScript
_events.ScheduleEvent(EVENT_TELEPORT_BACK, 1000);
break;
case EVENT_TELEPORT_BACK:
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
lichKing->AI()->DoAction(ACTION_TELEPORT_BACK);
break;
default:
@@ -1832,7 +1832,7 @@ class npc_spirit_warden : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* terenas = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TERENAS_MENETHIL)))
+ if (Creature* terenas = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_TERENAS_MENETHIL)))
terenas->AI()->DoAction(ACTION_TELEPORT_BACK);
}
@@ -2267,7 +2267,7 @@ class spell_the_lich_king_quake : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& targets)
{
- if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetData64(DATA_ARTHAS_PLATFORM)))
+ if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetGuidData(DATA_ARTHAS_PLATFORM)))
targets.remove_if(Trinity::HeightDifferenceCheck(platform, 5.0f, false));
}
@@ -2783,7 +2783,7 @@ class spell_the_lich_king_harvest_soul : public SpellScriptLoader
{
// m_originalCaster to allow stacking from different casters, meh
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
- GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetData64(DATA_THE_LICH_KING));
+ GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING));
}
void Register() override
@@ -2881,7 +2881,7 @@ class spell_the_lich_king_restore_soul : public SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/)
{
- if (Creature* lichKing = ObjectAccessor::GetCreature(*GetCaster(), _instance->GetData64(DATA_THE_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*GetCaster(), _instance->GetGuidData(DATA_THE_LICH_KING)))
lichKing->AI()->DoAction(ACTION_TELEPORT_BACK);
if (Creature* spawner = GetCaster()->FindNearestCreature(NPC_WORLD_TRIGGER_INFINITE_AOI, 50.0f))
spawner->RemoveAllAuras();
@@ -2970,7 +2970,7 @@ class spell_the_lich_king_in_frostmourne_room : public SpellScriptLoader
{
// m_originalCaster to allow stacking from different casters, meh
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
- GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetData64(DATA_THE_LICH_KING));
+ GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING));
}
void Register() override
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
index 6d297252dcb..ec7a937e725 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
@@ -175,7 +175,7 @@ struct ManaVoidSelector : public std::unary_function<Unit*, bool>
class DelayedCastEvent : public BasicEvent
{
public:
- DelayedCastEvent(Creature* trigger, uint32 spellId, uint64 originalCaster, uint32 despawnTime) : _trigger(trigger), _originalCaster(originalCaster), _spellId(spellId), _despawnTime(despawnTime)
+ DelayedCastEvent(Creature* trigger, uint32 spellId, ObjectGuid originalCaster, uint32 despawnTime) : _trigger(trigger), _originalCaster(originalCaster), _spellId(spellId), _despawnTime(despawnTime)
{
}
@@ -189,7 +189,7 @@ class DelayedCastEvent : public BasicEvent
private:
Creature* _trigger;
- uint64 _originalCaster;
+ ObjectGuid _originalCaster;
uint32 _spellId;
uint32 _despawnTime;
};
@@ -353,7 +353,7 @@ class boss_valithria_dreamwalker : public CreatureScript
DoCast(me, SPELL_ACHIEVEMENT_CHECK);
DoCastAOE(SPELL_DREAMWALKERS_RAGE);
_events.ScheduleEvent(EVENT_DREAM_SLIP, 3500);
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_LICH_KING)))
lichKing->AI()->EnterEvadeMode();
}
else if (!_over75PercentTalkDone && me->HealthAbovePctHealed(75, heal))
@@ -384,7 +384,7 @@ class boss_valithria_dreamwalker : public CreatureScript
_justDied = true;
Talk(SAY_VALITHRIA_DEATH);
_instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
- if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER)))
+ if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_TRIGGER)))
trigger->AI()->DoAction(ACTION_DEATH);
}
}
@@ -401,10 +401,10 @@ class boss_valithria_dreamwalker : public CreatureScript
me->SetDisplayId(11686);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->DespawnOrUnsummon(4000);
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_LICH_KING)))
lichKing->CastSpell(lichKing, SPELL_SPAWN_CHEST, false);
- if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER)))
+ if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_TRIGGER)))
me->Kill(trigger);
}
}
@@ -522,7 +522,7 @@ class npc_green_dragon_combat_trigger : public CreatureScript
me->setActive(true);
DoZoneInCombat();
instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, IN_PROGRESS);
- if (Creature* valithria = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VALITHRIA_DREAMWALKER)))
+ if (Creature* valithria = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)))
valithria->AI()->DoAction(ACTION_ENTER_COMBAT);
}
@@ -721,10 +721,10 @@ class npc_risen_archmage : public CreatureScript
for (std::list<Creature*>::iterator itr = archmages.begin(); itr != archmages.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_ENTER_COMBAT);
- if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_LICH_KING)))
+ if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_LICH_KING)))
lichKing->AI()->DoZoneInCombat();
- if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER)))
+ if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_TRIGGER)))
trigger->AI()->DoZoneInCombat();
}
}
@@ -742,7 +742,7 @@ class npc_risen_archmage : public CreatureScript
void JustSummoned(Creature* summon) override
{
if (summon->GetEntry() == NPC_COLUMN_OF_FROST)
- summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_COLUMN_OF_FROST_DAMAGE, 0, 8000), summon->m_Events.CalculateTime(2000));
+ summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_COLUMN_OF_FROST_DAMAGE, ObjectGuid::Empty, 8000), summon->m_Events.CalculateTime(2000));
else if (summon->GetEntry() == NPC_MANA_VOID)
summon->DespawnOrUnsummon(36000);
}
@@ -880,7 +880,7 @@ class npc_suppresser : public CreatureScript
void IsSummonedBy(Unit* /*summoner*/) override
{
- if (Creature* valithria = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER)))
+ if (Creature* valithria = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)))
AttackStart(valithria);
}
@@ -1099,7 +1099,7 @@ class npc_dream_cloud : public CreatureScript
case EVENT_EXPLODE:
me->GetMotionMaster()->MoveIdle();
// must use originalCaster the same for all clouds to allow stacking
- me->CastSpell(me, EMERALD_VIGOR, false, NULL, NULL, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER));
+ me->CastSpell(me, EMERALD_VIGOR, false, NULL, NULL, _instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER));
me->DespawnOrUnsummon(100);
break;
default:
@@ -1220,7 +1220,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader
if (!GetHitUnit())
return;
- GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING));
+ GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING));
}
void Register() override
@@ -1299,7 +1299,7 @@ class spell_dreamwalker_summon_suppresser_effect : public SpellScriptLoader
if (!GetHitUnit())
return;
- GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING));
+ GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING));
}
void Register() override
@@ -1428,7 +1428,7 @@ class spell_dreamwalker_twisted_nightmares : public SpellScriptLoader
// return;
if (InstanceScript* instance = GetHitUnit()->GetInstanceScript())
- GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetData64(DATA_VALITHRIA_DREAMWALKER));
+ GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER));
}
void Register() override
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
index 23569ba77c2..c2007730cdc 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
@@ -390,9 +390,9 @@ class npc_highlord_tirion_fordring_lh : public CreatureScript
void Initialize()
{
- _theLichKing = 0;
- _bolvarFordragon = 0;
- _factionNPC = 0;
+ _theLichKing.Clear();
+ _bolvarFordragon.Clear();
+ _factionNPC.Clear();
_damnedKills = 0;
}
@@ -581,9 +581,9 @@ class npc_highlord_tirion_fordring_lh : public CreatureScript
private:
EventMap _events;
InstanceScript* const _instance;
- uint64 _theLichKing;
- uint64 _bolvarFordragon;
- uint64 _factionNPC;
+ ObjectGuid _theLichKing;
+ ObjectGuid _bolvarFordragon;
+ ObjectGuid _factionNPC;
uint16 _damnedKills;
};
@@ -760,7 +760,7 @@ class boss_sister_svalna : public CreatureScript
uint64 delay = 1;
for (uint32 i = 0; i < 4; ++i)
{
- if (Creature* crusader = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CAPTAIN_ARNATH + i)))
+ if (Creature* crusader = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CAPTAIN_ARNATH + i)))
{
if (crusader->IsAlive() && crusader->GetEntry() == crusader->GetCreatureData()->id)
{
@@ -774,7 +774,7 @@ class boss_sister_svalna : public CreatureScript
void EnterCombat(Unit* /*attacker*/) override
{
_EnterCombat();
- if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE)))
+ if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CROK_SCOURGEBANE)))
crok->AI()->Talk(SAY_CROK_COMBAT_SVALNA);
events.ScheduleEvent(EVENT_SVALNA_COMBAT, 9000);
events.ScheduleEvent(EVENT_IMPALING_SPEAR, urand(40000, 50000));
@@ -979,7 +979,7 @@ class npc_crok_scourgebane : public CreatureScript
_isEventDone = true;
// Load Grid with Sister Svalna
me->GetMap()->LoadGrid(4356.71f, 2484.33f);
- if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA)))
+ if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA)))
svalna->AI()->DoAction(ACTION_START_GAUNTLET);
Talk(SAY_CROK_INTRO_1);
_events.ScheduleEvent(EVENT_ARNATH_INTRO_2, 7000);
@@ -987,7 +987,7 @@ class npc_crok_scourgebane : public CreatureScript
_events.ScheduleEvent(EVENT_START_PATHING, 37000);
me->setActive(true);
for (uint32 i = 0; i < 4; ++i)
- if (Creature* crusader = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_CAPTAIN_ARNATH + i)))
+ if (Creature* crusader = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_CAPTAIN_ARNATH + i)))
crusader->AI()->DoAction(ACTION_START_GAUNTLET);
}
else if (action == ACTION_RESET_EVENT)
@@ -1000,7 +1000,7 @@ class npc_crok_scourgebane : public CreatureScript
}
}
- void SetGUID(uint64 guid, int32 type/* = 0*/) override
+ void SetGUID(ObjectGuid guid, int32 type/* = 0*/) override
{
if (type == ACTION_VRYKUL_DEATH)
{
@@ -1013,7 +1013,7 @@ class npc_crok_scourgebane : public CreatureScript
_isEventActive = false;
me->setActive(false);
Talk(SAY_CROK_FINAL_WP);
- if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA)))
+ if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA)))
svalna->AI()->DoAction(ACTION_RESURRECT_CAPTAINS);
}
}
@@ -1041,7 +1041,7 @@ class npc_crok_scourgebane : public CreatureScript
_isEventActive = false;
me->setActive(false);
Talk(SAY_CROK_FINAL_WP);
- if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA)))
+ if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA)))
svalna->AI()->DoAction(ACTION_RESURRECT_CAPTAINS);
}
break;
@@ -1067,7 +1067,7 @@ class npc_crok_scourgebane : public CreatureScript
minY -= 50.0f;
maxY -= 50.0f;
// at waypoints 1 and 2 she kills one captain
- if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA)))
+ if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA)))
svalna->AI()->DoAction(ACTION_KILL_CAPTAIN);
}
else if (waypointId == 4)
@@ -1090,7 +1090,7 @@ class npc_crok_scourgebane : public CreatureScript
}
// at waypoints 1 and 2 she kills one captain
case 2:
- if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA)))
+ if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA)))
svalna->AI()->DoAction(ACTION_KILL_CAPTAIN);
break;
default:
@@ -1160,7 +1160,7 @@ class npc_crok_scourgebane : public CreatureScript
switch (eventId)
{
case EVENT_ARNATH_INTRO_2:
- if (Creature* arnath = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_CAPTAIN_ARNATH)))
+ if (Creature* arnath = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_CAPTAIN_ARNATH)))
arnath->AI()->Talk(SAY_ARNATH_INTRO_2);
break;
case EVENT_CROK_INTRO_3:
@@ -1206,7 +1206,7 @@ class npc_crok_scourgebane : public CreatureScript
private:
EventMap _events;
- std::set<uint64> _aliveTrash;
+ GuidSet _aliveTrash;
InstanceScript* _instance;
uint32 _currentWPid;
uint32 _wipeCheckTimer;
@@ -1254,7 +1254,7 @@ struct npc_argent_captainAI : public ScriptedAI
{
if (action == ACTION_START_GAUNTLET)
{
- if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE)))
+ if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CROK_SCOURGEBANE)))
{
me->SetReactState(REACT_DEFENSIVE);
FollowAngle = me->GetAngle(crok) + me->GetOrientation();
@@ -1298,7 +1298,7 @@ struct npc_argent_captainAI : public ScriptedAI
if (!me->GetVehicle())
{
me->GetMotionMaster()->Clear(false);
- if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE)))
+ if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CROK_SCOURGEBANE)))
me->GetMotionMaster()->MoveFollow(crok, FollowDist, FollowAngle, MOTION_SLOT_IDLE);
}
@@ -2148,7 +2148,7 @@ class at_icc_start_frostwing_gauntlet : public AreaTriggerScript
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
{
if (InstanceScript* instance = player->GetInstanceScript())
- if (Creature* crok = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_CROK_SCOURGEBANE)))
+ if (Creature* crok = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_CROK_SCOURGEBANE)))
crok->AI()->DoAction(ACTION_START_GAUNTLET);
return true;
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
index 9c26f93fd54..4d86293665a 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
@@ -120,52 +120,6 @@ class instance_icecrown_citadel : public InstanceMapScript
LoadDoorData(doorData);
TeamInInstance = 0;
HeroicAttempts = MaxHeroicAttempts;
- LadyDeathwisperElevatorGUID = 0;
- GunshipGUID = 0;
- EnemyGunshipGUID = 0;
- GunshipArmoryGUID = 0;
- DeathbringerSaurfangGUID = 0;
- DeathbringerSaurfangDoorGUID = 0;
- DeathbringerSaurfangEventGUID = 0;
- DeathbringersCacheGUID = 0;
- TeleporterLichKingGUID = 0;
- TeleporterUpperSpireGUID = 0;
- TeleporterLightsHammerGUID = 0;
- TeleporterRampartsGUID = 0;
- TeleporterDeathBringerGUID = 0;
- TeleporterOratoryGUID = 0;
- TeleporterSindragosaGUID = 0;
- PlagueSigilGUID = 0;
- BloodwingSigilGUID = 0;
- FrostwingSigilGUID = 0;
- memset(PutricidePipeGUIDs, 0, 2 * sizeof(uint64));
- memset(PutricideGateGUIDs, 0, 2 * sizeof(uint64));
- PutricideCollisionGUID = 0;
- FestergutGUID = 0;
- RotfaceGUID = 0;
- ProfessorPutricideGUID = 0;
- PutricideTableGUID = 0;
- memset(BloodCouncilGUIDs, 0, 3 * sizeof(uint64));
- BloodCouncilControllerGUID = 0;
- BloodQueenLanaThelGUID = 0;
- CrokScourgebaneGUID = 0;
- memset(CrokCaptainGUIDs, 0, 4 * sizeof(uint64));
- SisterSvalnaGUID = 0;
- ValithriaDreamwalkerGUID = 0;
- ValithriaLichKingGUID = 0;
- ValithriaTriggerGUID = 0;
- SindragosaGUID = 0;
- SpinestalkerGUID = 0;
- RimefangGUID = 0;
- TheLichKingTeleportGUID = 0;
- TheLichKingGUID = 0;
- HighlordTirionFordringGUID = 0;
- TerenasMenethilGUID = 0;
- ArthasPlatformGUID = 0;
- ArthasPrecipiceGUID = 0;
- FrozenThroneEdgeGUID = 0;
- FrozenThroneWindGUID = 0;
- FrozenThroneWarningGUID = 0;
IsBonedEligible = true;
IsOozeDanceEligible = true;
IsNauseaEligible = true;
@@ -174,9 +128,6 @@ class instance_icecrown_citadel : public InstanceMapScript
UpperSpireTeleporterActiveState = NOT_STARTED;
BloodQuickeningState = NOT_STARTED;
BloodQuickeningMinutes = 0;
- FrozenBolvarGUID = 0;
- PillarsChainedGUID = 0;
- PillarsUnchainedGUID = 0;
}
// A function to help reduce the number of lines for teleporter management.
@@ -362,7 +313,7 @@ class instance_icecrown_citadel : public InstanceMapScript
void OnCreatureRemove(Creature* creature) override
{
if (creature->GetEntry() == NPC_SINDRAGOSA)
- SindragosaGUID = 0;
+ SindragosaGUID.Clear();
}
// Weekly quest spawn prevention
@@ -721,7 +672,7 @@ class instance_icecrown_citadel : public InstanceMapScript
break;
case GO_THE_SKYBREAKER_A:
case GO_ORGRIMS_HAMMER_H:
- GunshipGUID = 0;
+ GunshipGUID.Clear();
break;
default:
break;
@@ -755,7 +706,7 @@ class instance_icecrown_citadel : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -820,7 +771,7 @@ class instance_icecrown_citadel : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
bool SetBossState(uint32 type, EncounterState state) override
@@ -1164,7 +1115,7 @@ class instance_icecrown_citadel : public InstanceMapScript
return false;
}
- bool CheckRequiredBosses(uint32 bossId, Player const* player = NULL) const override
+ bool CheckRequiredBosses(uint32 bossId, Player const* player = nullptr) const override
{
if (player && player->GetSession()->HasPermission(rbac::RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES))
return true;
@@ -1472,55 +1423,55 @@ class instance_icecrown_citadel : public InstanceMapScript
protected:
EventMap Events;
- uint64 LadyDeathwisperElevatorGUID;
- uint64 GunshipGUID;
- uint64 EnemyGunshipGUID;
- uint64 GunshipArmoryGUID;
- uint64 DeathbringerSaurfangGUID;
- uint64 DeathbringerSaurfangDoorGUID;
- uint64 DeathbringerSaurfangEventGUID; // Muradin Bronzebeard or High Overlord Saurfang
- uint64 DeathbringersCacheGUID;
- uint64 TeleporterLichKingGUID;
- uint64 TeleporterUpperSpireGUID;
- uint64 TeleporterLightsHammerGUID;
- uint64 TeleporterRampartsGUID;
- uint64 TeleporterDeathBringerGUID;
- uint64 TeleporterOratoryGUID;
- uint64 TeleporterSindragosaGUID;
- uint64 PlagueSigilGUID;
- uint64 BloodwingSigilGUID;
- uint64 FrostwingSigilGUID;
- uint64 PutricidePipeGUIDs[2];
- uint64 PutricideGateGUIDs[2];
- uint64 PutricideCollisionGUID;
- uint64 FestergutGUID;
- uint64 RotfaceGUID;
- uint64 ProfessorPutricideGUID;
- uint64 PutricideTableGUID;
- uint64 BloodCouncilGUIDs[3];
- uint64 BloodCouncilControllerGUID;
- uint64 BloodQueenLanaThelGUID;
- uint64 CrokScourgebaneGUID;
- uint64 CrokCaptainGUIDs[4];
- uint64 SisterSvalnaGUID;
- uint64 ValithriaDreamwalkerGUID;
- uint64 ValithriaLichKingGUID;
- uint64 ValithriaTriggerGUID;
- uint64 SindragosaGUID;
- uint64 SpinestalkerGUID;
- uint64 RimefangGUID;
- uint64 TheLichKingTeleportGUID;
- uint64 TheLichKingGUID;
- uint64 HighlordTirionFordringGUID;
- uint64 TerenasMenethilGUID;
- uint64 ArthasPlatformGUID;
- uint64 ArthasPrecipiceGUID;
- uint64 FrozenThroneEdgeGUID;
- uint64 FrozenThroneWindGUID;
- uint64 FrozenThroneWarningGUID;
- uint64 FrozenBolvarGUID;
- uint64 PillarsChainedGUID;
- uint64 PillarsUnchainedGUID;
+ ObjectGuid LadyDeathwisperElevatorGUID;
+ ObjectGuid GunshipGUID;
+ ObjectGuid EnemyGunshipGUID;
+ ObjectGuid GunshipArmoryGUID;
+ ObjectGuid DeathbringerSaurfangGUID;
+ ObjectGuid DeathbringerSaurfangDoorGUID;
+ ObjectGuid DeathbringerSaurfangEventGUID; // Muradin Bronzebeard or High Overlord Saurfang
+ ObjectGuid DeathbringersCacheGUID;
+ ObjectGuid TeleporterLichKingGUID;
+ ObjectGuid TeleporterUpperSpireGUID;
+ ObjectGuid TeleporterLightsHammerGUID;
+ ObjectGuid TeleporterRampartsGUID;
+ ObjectGuid TeleporterDeathBringerGUID;
+ ObjectGuid TeleporterOratoryGUID;
+ ObjectGuid TeleporterSindragosaGUID;
+ ObjectGuid PlagueSigilGUID;
+ ObjectGuid BloodwingSigilGUID;
+ ObjectGuid FrostwingSigilGUID;
+ ObjectGuid PutricidePipeGUIDs[2];
+ ObjectGuid PutricideGateGUIDs[2];
+ ObjectGuid PutricideCollisionGUID;
+ ObjectGuid FestergutGUID;
+ ObjectGuid RotfaceGUID;
+ ObjectGuid ProfessorPutricideGUID;
+ ObjectGuid PutricideTableGUID;
+ ObjectGuid BloodCouncilGUIDs[3];
+ ObjectGuid BloodCouncilControllerGUID;
+ ObjectGuid BloodQueenLanaThelGUID;
+ ObjectGuid CrokScourgebaneGUID;
+ ObjectGuid CrokCaptainGUIDs[4];
+ ObjectGuid SisterSvalnaGUID;
+ ObjectGuid ValithriaDreamwalkerGUID;
+ ObjectGuid ValithriaLichKingGUID;
+ ObjectGuid ValithriaTriggerGUID;
+ ObjectGuid SindragosaGUID;
+ ObjectGuid SpinestalkerGUID;
+ ObjectGuid RimefangGUID;
+ ObjectGuid TheLichKingTeleportGUID;
+ ObjectGuid TheLichKingGUID;
+ ObjectGuid HighlordTirionFordringGUID;
+ ObjectGuid TerenasMenethilGUID;
+ ObjectGuid ArthasPlatformGUID;
+ ObjectGuid ArthasPrecipiceGUID;
+ ObjectGuid FrozenThroneEdgeGUID;
+ ObjectGuid FrozenThroneWindGUID;
+ ObjectGuid FrozenThroneWarningGUID;
+ ObjectGuid FrozenBolvarGUID;
+ ObjectGuid PillarsChainedGUID;
+ ObjectGuid PillarsUnchainedGUID;
uint32 TeamInInstance;
uint32 ColdflameJetsState;
uint32 UpperSpireTeleporterActiveState;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
index ec273d5f6e8..dcb004cc3a0 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
@@ -201,7 +201,7 @@ class npc_faerlina_add : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
if (_instance && GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
- if (Creature* faerlina = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FAERLINA)))
+ if (Creature* faerlina = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_FAERLINA)))
DoCast(faerlina, SPELL_WIDOWS_EMBRACE);
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
index a8de1418cc4..c715bd8aad7 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
@@ -106,7 +106,7 @@ public:
void Initialize()
{
- uiEventStarterGUID = 0;
+ uiEventStarterGUID.Clear();
nextWP = 0;
punishTimer = 2000;
nextMovementStarted = false;
@@ -118,7 +118,7 @@ public:
}
Horsemen id;
- uint64 uiEventStarterGUID;
+ ObjectGuid uiEventStarterGUID;
uint8 nextWP;
uint32 punishTimer;
bool caster;
@@ -143,10 +143,10 @@ public:
bool DoEncounteraction(Unit* who, bool attack, bool reset, bool checkAllDead)
{
- Creature* Thane = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THANE));
- Creature* Lady = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LADY));
- Creature* Baron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BARON));
- Creature* Sir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SIR));
+ Creature* Thane = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THANE));
+ Creature* Lady = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LADY));
+ Creature* Baron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BARON));
+ Creature* Sir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SIR));
if (Thane && Lady && Baron && Sir)
{
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index de9d85db70b..39381f38d67 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -182,8 +182,8 @@ class boss_gothik : public CreatureScript
bool phaseTwo;
bool thirtyPercentReached;
- std::vector<uint64> LiveTriggerGUID;
- std::vector<uint64> DeadTriggerGUID;
+ GuidVector LiveTriggerGUID;
+ GuidVector DeadTriggerGUID;
void Reset() override
{
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
index 2d0e8a6d2b2..aac59761626 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
@@ -135,7 +135,7 @@ public:
me->NearTeleportTo(x, y, z, o - (float(M_PI) / 2));
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
DoCastAOE(SPELL_PLAGUE_CLOUD);
events.ScheduleEvent(EVENT_PHASE, 45000);
events.ScheduleEvent(EVENT_ERUPT, 8000);
@@ -204,7 +204,7 @@ class spell_heigan_eruption : public SpellScriptLoader
if (GetHitDamage() >= int32(GetHitPlayer()->GetHealth()))
if (InstanceScript* instance = caster->GetInstanceScript())
- if (Creature* Heigan = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_HEIGAN)))
+ if (Creature* Heigan = ObjectAccessor::GetCreature(*caster, instance->GetGuidData(DATA_HEIGAN)))
Heigan->AI()->SetData(DATA_SAFETY_DANCE, 0);
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
index 80bf7e39ad3..87466b6bf41 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
@@ -285,13 +285,13 @@ public:
uint8 nAbomination;
uint8 nWeaver;
- std::map<uint64, float> chained;
+ std::map<ObjectGuid, float> chained;
SummonList spawns; // adds spawn by the trigger. kept in separated list (i.e. not in summons)
void ResetPlayerScale()
{
- std::map<uint64, float>::const_iterator itr;
+ std::map<ObjectGuid, float>::const_iterator itr;
for (itr = chained.begin(); itr != chained.end(); ++itr)
{
if (Player* charmed = ObjectAccessor::GetPlayer(*me, itr->first))
@@ -313,7 +313,7 @@ public:
instance->SetData(DATA_ABOMINATION_KILLED, 0);
- if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_TRIGGER)))
+ if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_TRIGGER)))
{
trigger->ResetDoorOrButton();
trigger->SetLootState(GO_READY);
@@ -321,7 +321,7 @@ public:
for (uint8 i = 0; i <= 3; ++i)
{
- if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_PORTAL01 + i)))
+ if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_PORTAL01 + i)))
if (!((portal->getLootState() == GO_READY) || (portal->getLootState() == GO_NOT_READY)))
portal->ResetDoorOrButton();
}
@@ -349,7 +349,7 @@ public:
_EnterCombat();
for (uint8 i = 0; i <= 3; ++i)
{
- if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_PORTAL01 + i)))
+ if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_PORTAL01 + i)))
portal->ResetDoorOrButton();
}
DoCast(me, SPELL_KELTHUZAD_CHANNEL, false);
@@ -399,7 +399,7 @@ public:
}
break;
case EVENT_TRIGGER:
- if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_TRIGGER)))
+ if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_TRIGGER)))
trigger->SetLootState(GO_JUST_DEACTIVATED);
break;
case EVENT_PHASE:
@@ -439,7 +439,7 @@ public:
for (uint8 i = 0; i <= 3; ++i)
{
- if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_PORTAL01 + i)))
+ if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_PORTAL01 + i)))
if (portal->getLootState() == GO_READY)
portal->UseDoorOrButton();
}
@@ -495,7 +495,7 @@ public:
}
case EVENT_CHAINED_SPELL:
{
- std::map<uint64, float>::iterator itr;
+ std::map<ObjectGuid, float>::iterator itr;
for (itr = chained.begin(); itr != chained.end();)
{
if (Unit* player = ObjectAccessor::GetPlayer(*me, itr->first))
@@ -503,7 +503,7 @@ public:
if (!player->IsCharmed())
{
player->SetObjectScale(itr->second);
- std::map<uint64, float>::iterator next = itr;
+ std::map<ObjectGuid, float>::iterator next = itr;
++next;
chained.erase(itr);
itr = next;
@@ -639,7 +639,7 @@ public:
if (!instance || instance->IsEncounterInProgress() || instance->GetBossState(BOSS_KELTHUZAD) == DONE)
return false;
- Creature* pKelthuzad = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_KELTHUZAD));
+ Creature* pKelthuzad = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_KELTHUZAD));
if (!pKelthuzad)
return false;
@@ -648,7 +648,7 @@ public:
return false;
pKelthuzadAI->AttackStart(player);
- if (GameObject* trigger = ObjectAccessor::GetGameObject(*player, instance->GetData64(DATA_KELTHUZAD_TRIGGER)))
+ if (GameObject* trigger = ObjectAccessor::GetGameObject(*player, instance->GetGuidData(DATA_KELTHUZAD_TRIGGER)))
{
if (trigger->getLootState() == GO_READY)
trigger->UseDoorOrButton();
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
index 209e689e615..aa284f1aaee 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
@@ -165,11 +165,11 @@ public:
struct npc_webwrapAI : public NullCreatureAI
{
- npc_webwrapAI(Creature* creature) : NullCreatureAI(creature), victimGUID(0) { }
+ npc_webwrapAI(Creature* creature) : NullCreatureAI(creature) { }
- uint64 victimGUID;
+ ObjectGuid victimGUID;
- void SetGUID(uint64 guid, int32 /*param*/) override
+ void SetGUID(ObjectGuid guid, int32 /*param*/) override
{
victimGUID = guid;
if (me->m_spells[0] && victimGUID)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
index ce5010c972f..97c7d7c4052 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
@@ -80,7 +80,7 @@ enum Misc
MAX_FROST_RESISTANCE = 100
};
-typedef std::map<uint64, uint64> IceBlockMap;
+typedef std::map<ObjectGuid, ObjectGuid> IceBlockMap;
class boss_sapphiron : public CreatureScript
{
@@ -320,7 +320,7 @@ class boss_sapphiron : public CreatureScript
{
std::vector<Unit*>::const_iterator itr = targets.begin();
advance(itr, rand32() % targets.size());
- _iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0));
+ _iceblocks.insert(std::make_pair((*itr)->GetGUID(), ObjectGuid::Empty));
DoCast(*itr, SPELL_ICEBOLT);
--_iceboltCount;
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
index 8ae3b5790db..650777a8815 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
@@ -120,11 +120,11 @@ public:
// Moreover, the adds may not yet be spawn. So just track down the status if mob is spawn
// and each mob will send its status at reset (meaning that it is alive)
checkFeugenAlive = false;
- if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN)))
+ if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FEUGEN)))
checkFeugenAlive = pFeugen->IsAlive();
checkStalaggAlive = false;
- if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STALAGG)))
+ if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STALAGG)))
checkStalaggAlive = pStalagg->IsAlive();
if (!checkFeugenAlive && !checkStalaggAlive)
@@ -230,12 +230,12 @@ public:
{
if (!checkStalaggAlive)
{
- if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STALAGG)))
+ if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STALAGG)))
pStalagg->Respawn();
}
else
{
- if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN)))
+ if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FEUGEN)))
pFeugen->Respawn();
}
}
@@ -307,7 +307,7 @@ public:
void Reset() override
{
- if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
+ if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THADDIUS)))
if (pThaddius->AI())
pThaddius->AI()->DoAction(ACTION_STALAGG_RESET);
Initialize();
@@ -328,7 +328,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_STAL_DEATH);
- if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
+ if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THADDIUS)))
if (pThaddius->AI())
pThaddius->AI()->DoAction(ACTION_STALAGG_DIED);
}
@@ -340,7 +340,7 @@ public:
if (magneticPullTimer <= uiDiff)
{
- if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN)))
+ if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FEUGEN)))
{
Unit* pStalaggVictim = me->GetVictim();
Unit* pFeugenVictim = pFeugen->GetVictim();
@@ -403,7 +403,7 @@ public:
void Reset() override
{
- if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
+ if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THADDIUS)))
if (pThaddius->AI())
pThaddius->AI()->DoAction(ACTION_FEUGEN_RESET);
Initialize();
@@ -424,7 +424,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_FEUG_DEATH);
- if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
+ if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THADDIUS)))
if (pThaddius->AI())
pThaddius->AI()->DoAction(ACTION_FEUGEN_DIED);
}
diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
index 2fc49be0903..4151c4a85a7 100644
--- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
@@ -112,27 +112,11 @@ class instance_naxxramas : public InstanceMapScript
LoadDoorData(doorData);
LoadMinionData(minionData);
- GothikGateGUID = 0;
- HorsemenChestGUID = 0;
- FaerlinaGUID = 0;
- ThaneGUID = 0;
- LadyGUID = 0;
- BaronGUID = 0;
- SirGUID = 0;
- ThaddiusGUID = 0;
- HeiganGUID = 0;
- FeugenGUID = 0;
- StalaggGUID = 0;
- SapphironGUID = 0;
- KelthuzadGUID = 0;
- KelthuzadTriggerGUID = 0;
minHorsemenDiedTime = 0;
maxHorsemenDiedTime = 0;
AbominationCount = 0;
playerDied = 0;
-
- memset(PortalsGUID, 0, sizeof(PortalsGUID));
}
void OnCreatureCreate(Creature* creature) override
@@ -309,7 +293,7 @@ class instance_naxxramas : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 id) const override
+ ObjectGuid GetGuidData(uint32 id) const override
{
switch (id)
{
@@ -345,7 +329,7 @@ class instance_naxxramas : public InstanceMapScript
return KelthuzadTriggerGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
bool SetBossState(uint32 id, EncounterState state) override
@@ -372,7 +356,7 @@ class instance_naxxramas : public InstanceMapScript
if (i == section)
continue;
- for (uint64 guid : HeiganEruptionGUID[i])
+ for (ObjectGuid guid : HeiganEruptionGUID[i])
{
if (GameObject* heiganEruption = instance->GetGameObject(guid))
{
@@ -434,38 +418,38 @@ class instance_naxxramas : public InstanceMapScript
protected:
/* The Arachnid Quarter */
// Grand Widow Faerlina
- uint64 FaerlinaGUID;
+ ObjectGuid FaerlinaGUID;
/* The Plague Quarter */
// Heigan the Unclean
- std::set<uint64> HeiganEruptionGUID[4];
- uint64 HeiganGUID;
+ GuidSet HeiganEruptionGUID[4];
+ ObjectGuid HeiganGUID;
/* The Military Quarter */
// Gothik the Harvester
- uint64 GothikGateGUID;
+ ObjectGuid GothikGateGUID;
// The Four Horsemen
- uint64 ThaneGUID;
- uint64 LadyGUID;
- uint64 BaronGUID;
- uint64 SirGUID;
- uint64 HorsemenChestGUID;
+ ObjectGuid ThaneGUID;
+ ObjectGuid LadyGUID;
+ ObjectGuid BaronGUID;
+ ObjectGuid SirGUID;
+ ObjectGuid HorsemenChestGUID;
time_t minHorsemenDiedTime;
time_t maxHorsemenDiedTime;
/* The Construct Quarter */
// Thaddius
- uint64 ThaddiusGUID;
- uint64 FeugenGUID;
- uint64 StalaggGUID;
+ ObjectGuid ThaddiusGUID;
+ ObjectGuid FeugenGUID;
+ ObjectGuid StalaggGUID;
/* Frostwyrm Lair */
// Sapphiron
- uint64 SapphironGUID;
+ ObjectGuid SapphironGUID;
// Kel'Thuzad
- uint64 KelthuzadGUID;
- uint64 KelthuzadTriggerGUID;
- uint64 PortalsGUID[4];
+ ObjectGuid KelthuzadGUID;
+ ObjectGuid KelthuzadTriggerGUID;
+ ObjectGuid PortalsGUID[4];
uint8 AbominationCount;
/* The Immortal / The Undying */
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
index 8b694bb6a3e..b1db173804b 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -330,7 +330,7 @@ enum MiscData
class VehicleCheckPredicate
{
public:
- bool operator()(uint64 guid) { return IS_VEHICLE_GUID(guid); }
+ bool operator()(ObjectGuid guid) { return guid.IsVehicle(); }
};
class boss_malygos : public CreatureScript
@@ -351,9 +351,10 @@ public:
{
_summonDeaths = 0;
_preparingPulsesChecker = 0;
- _arcaneOverloadGUID = 0;
- _lastHitByArcaneBarrageGUID = 0;
- memset(_surgeTargetGUID, 0, sizeof(_surgeTargetGUID));
+ _arcaneOverloadGUID.Clear();
+ _lastHitByArcaneBarrageGUID.Clear();
+ for (ObjectGuid& guid : _surgeTargetGUID)
+ guid.Clear();
_killSpamFilter = false;
_canAttack = false;
@@ -423,17 +424,17 @@ public:
}
}
- uint64 GetGUID(int32 type) const override
+ ObjectGuid GetGUID(int32 type) const override
{
if (type >= DATA_FIRST_SURGE_TARGET_GUID && type < DATA_FIRST_SURGE_TARGET_GUID + NUM_MAX_SURGE_TARGETS)
return _surgeTargetGUID[type - DATA_FIRST_SURGE_TARGET_GUID];
else if (type == DATA_LAST_TARGET_BARRAGE_GUID)
return _lastHitByArcaneBarrageGUID;
- return 0;
+ return ObjectGuid::Empty;
}
- void SetGUID(uint64 guid, int32 type) override
+ void SetGUID(ObjectGuid guid, int32 type) override
{
switch (type)
{
@@ -447,6 +448,7 @@ public:
break;
case DATA_LAST_TARGET_BARRAGE_GUID:
_lastHitByArcaneBarrageGUID = guid;
+ break;
}
}
@@ -456,7 +458,7 @@ public:
{
case ACTION_LAND_ENCOUNTER_START:
events.CancelEventGroup(1);
- if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALEXSTRASZA_BUNNY_GUID)))
+ if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID)))
{
Position pos;
pos.m_positionZ = alexstraszaBunny->GetPositionZ();
@@ -670,7 +672,7 @@ public:
Talk(SAY_BUFF_SPARK);
}
else if (spell->Id == SPELL_MALYGOS_BERSERK)
- TalkToMap(EMOTE_HIT_BERSERKER_TIMER);
+ Talk(EMOTE_HIT_BERSERKER_TIMER);
}
void MoveInLineOfSight(Unit* who) override
@@ -720,7 +722,7 @@ public:
{
_firstCyclicMovementStarted = true;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALEXSTRASZA_BUNNY_GUID)))
+ if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID)))
me->SetFacingToObject(alexstraszaBunny);
events.ScheduleEvent(EVENT_SUMMON_ARCANE_BOMB, 1*IN_MILLISECONDS, 0, PHASE_TWO);
}
@@ -730,7 +732,7 @@ public:
break;
case POINT_PHASE_ONE_TO_TWO_TRANSITION:
me->SetDisableGravity(true);
- if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALEXSTRASZA_BUNNY_GUID)))
+ if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID)))
me->SetFacingToObject(alexstraszaBunny);
me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_ARCANE_RUNES, 5 * IN_MILLISECONDS);
events.ScheduleEvent(EVENT_FLY_OUT_OF_PLATFORM, 18 * IN_MILLISECONDS, 0, PHASE_TWO);
@@ -789,7 +791,7 @@ public:
me->CastCustomSpell(SPELL_RANDOM_PORTAL, SPELLVALUE_MAX_TARGETS, 1);
break;
case EVENT_LAND_START_ENCOUNTER:
- if (GameObject* iris = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_FOCUSING_IRIS_GUID)))
+ if (GameObject* iris = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_FOCUSING_IRIS_GUID)))
{
me->SetFacingToObject(iris);
iris->Delete(); // this is not the best way.
@@ -846,7 +848,7 @@ public:
case EVENT_FLY_OUT_OF_PLATFORM:
if (!_performingDestroyPlatform)
{
- if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALEXSTRASZA_BUNNY_GUID)))
+ if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID)))
{
Position randomPosOnRadius;
// Hardcodded retail value, reason is Z getters can fail... (TO DO: Change to getter when height calculation works on 100%!)
@@ -1002,7 +1004,7 @@ public:
{
_JustDied();
Talk(SAY_DEATH);
- if (Creature* alexstraszaGiftBoxBunny = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GIFT_BOX_BUNNY_GUID)))
+ if (Creature* alexstraszaGiftBoxBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GIFT_BOX_BUNNY_GUID)))
{
if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
alexstraszaGiftBoxBunny->SummonGameObject(GO_HEART_OF_MAGIC_10, HeartOfMagicSpawnPos.GetPositionX(), HeartOfMagicSpawnPos.GetPositionY(),
@@ -1036,9 +1038,9 @@ public:
uint8 _phase; // Counter for phases used with a getter.
uint8 _summonDeaths; // Keeps count of arcane trash.
uint8 _preparingPulsesChecker; // In retail they use 2 preparing pulses with 7 sec CD, after they pass 2 seconds.
- uint64 _arcaneOverloadGUID; // Last Arcane Overload summoned to know to which should visual be cast to (the purple ball, not bubble).
- uint64 _lastHitByArcaneBarrageGUID; // Last hit player by Arcane Barrage, will be removed if targets > 1.
- uint64 _surgeTargetGUID[3]; // All these three are used to keep current tagets to which warning should be sent.
+ ObjectGuid _arcaneOverloadGUID; // Last Arcane Overload summoned to know to which should visual be cast to (the purple ball, not bubble).
+ ObjectGuid _lastHitByArcaneBarrageGUID; // Last hit player by Arcane Barrage, will be removed if targets > 1.
+ ObjectGuid _surgeTargetGUID[3]; // All these three are used to keep current tagets to which warning should be sent.
bool _killSpamFilter; // Prevent text spamming on killed player by helping implement a CD.
bool _canAttack; // Used to control attacking (Move Chase not being applied after Stop Attack, only few times should act like this).
@@ -1075,7 +1077,7 @@ public:
{
if (spell->Id == SPELL_PORTAL_OPENED)
{
- if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS)))
+ if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS)))
{
if (malygos->AI()->GetData(DATA_PHASE) == PHASE_ONE)
DoCast(me, SPELL_SUMMON_POWER_PARK, true);
@@ -1089,7 +1091,7 @@ public:
if (!me->HasAura(SPELL_PORTAL_VISUAL_CLOSED) && !me->HasAura(SPELL_PORTAL_OPENED))
DoCast(me, SPELL_PORTAL_VISUAL_CLOSED, true);
- if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS)))
+ if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS)))
{
if (malygos->AI()->GetData(DATA_PHASE) != PHASE_ONE && me->HasAura(SPELL_PORTAL_OPENED))
{
@@ -1119,7 +1121,7 @@ public:
npc_power_sparkAI(Creature* creature) : ScriptedAI(creature)
{
_instance = creature->GetInstanceScript();
- TalkToMap(EMOTE_POWER_SPARK_SUMMONED);
+ Talk(EMOTE_POWER_SPARK_SUMMONED);
MoveToMalygos();
}
@@ -1127,7 +1129,7 @@ public:
{
me->GetMotionMaster()->MoveIdle();
- if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS)))
+ if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS)))
me->GetMotionMaster()->MoveFollow(malygos, 0.0f, 0.0f);
}
@@ -1136,7 +1138,7 @@ public:
if (!_instance)
return;
- if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS)))
+ if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS)))
{
if (malygos->AI()->GetData(DATA_PHASE) != PHASE_ONE || _instance->GetBossState(DATA_MALYGOS_EVENT) == FAIL)
{
@@ -1421,7 +1423,7 @@ class npc_nexus_lord : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS)))
+ if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS)))
malygos->AI()->SetData(DATA_SUMMON_DEATHS, malygos->AI()->GetData(DATA_SUMMON_DEATHS) + 1);
}
@@ -1488,7 +1490,7 @@ class npc_scion_of_eternity : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS)))
+ if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS)))
malygos->AI()->SetData(DATA_SUMMON_DEATHS, malygos->AI()->GetData(DATA_SUMMON_DEATHS) + 1);
}
@@ -1528,7 +1530,7 @@ public:
void DoAction(int32 /*action*/) override
{
- if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MALYGOS)))
+ if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS)))
{
if (malygos->AI()->GetData(DATA_PHASE) == PHASE_TWO)
me->DespawnOrUnsummon(6*IN_MILLISECONDS);
@@ -1886,7 +1888,7 @@ class spell_malygos_vortex_visual : public SpellScriptLoader
if (InstanceScript* instance = caster->GetInstanceScript())
{
// Teleport spell - I'm not sure but might be it must be cast by each vehicle when it's passenger leaves it.
- if (Creature* trigger = caster->GetMap()->GetCreature(instance->GetData64(DATA_TRIGGER)))
+ if (Creature* trigger = caster->GetMap()->GetCreature(instance->GetGuidData(DATA_TRIGGER)))
trigger->CastSpell(targetPlayer, SPELL_VORTEX_6, true);
}
}
@@ -2032,7 +2034,7 @@ class spell_scion_of_eternity_arcane_barrage : public SpellScriptLoader
Creature* caster = GetCaster()->ToCreature();
InstanceScript* instance = caster->GetInstanceScript();
- Creature* malygos = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_MALYGOS));
+ Creature* malygos = ObjectAccessor::GetCreature(*caster, instance->GetGuidData(DATA_MALYGOS));
// If max possible targets are more than 1 then Scions wouldn't select previosly selected target,
// in longer terms this means if spell picks target X then 2nd cast of this spell will pick smth else
@@ -2121,7 +2123,7 @@ class spell_malygos_destroy_platform_channel : public SpellScriptLoader
{
if (Creature* target = GetTarget()->ToCreature())
if (InstanceScript* instance = target->GetInstanceScript())
- if (Creature* platformTrigger = target->GetMap()->GetCreature(instance->GetData64(DATA_ALEXSTRASZA_BUNNY_GUID)))
+ if (Creature* platformTrigger = target->GetMap()->GetCreature(instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID)))
platformTrigger->CastSpell(platformTrigger, SPELL_DESTROY_PLATFORM_BOOM_VISUAL);
}
@@ -2195,7 +2197,7 @@ class spell_alexstrasza_bunny_destroy_platform_event : public SpellScriptLoader
{
Creature* caster = GetCaster()->ToCreature();
if (InstanceScript* instance = caster->GetInstanceScript())
- if (GameObject* platform = caster->GetMap()->GetGameObject(instance->GetData64(DATA_PLATFORM)))
+ if (GameObject* platform = caster->GetMap()->GetGameObject(instance->GetGuidData(DATA_PLATFORM)))
platform->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED);
}
@@ -2478,7 +2480,7 @@ class spell_alexstrasza_gift_beam_visual : public SpellScriptLoader
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
_alexstraszaGift->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- if (GameObject* heartMagic = target->GetMap()->GetGameObject(instance->GetData64(DATA_HEART_OF_MAGIC_GUID)))
+ if (GameObject* heartMagic = target->GetMap()->GetGameObject(instance->GetGuidData(DATA_HEART_OF_MAGIC_GUID)))
{
heartMagic->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
// TO DO: This is hack, core doesn't have support for these flags,
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
index 45439ced242..d8612e1f5dd 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
@@ -37,19 +37,7 @@ public:
{
SetHeaders(DataHeader);
SetBossNumber(MAX_ENCOUNTER);
-
- vortexTriggers.clear();
- portalTriggers.clear();
-
- malygosGUID = 0;
- irisGUID = 0;
- lastPortalGUID = 0;
- platformGUID = 0;
- exitPortalGUID = 0;
- alexstraszaBunnyGUID = 0;
- heartOfMagicGUID = 0;
- giftBoxBunnyGUID = 0;
- };
+ }
bool SetBossState(uint32 type, EncounterState state) override
{
@@ -60,7 +48,7 @@ public:
{
if (state == FAIL)
{
- for (std::list<uint64>::const_iterator itr_trigger = portalTriggers.begin(); itr_trigger != portalTriggers.end(); ++itr_trigger)
+ for (GuidList::const_iterator itr_trigger = portalTriggers.begin(); itr_trigger != portalTriggers.end(); ++itr_trigger)
{
if (Creature* trigger = instance->GetCreature(*itr_trigger))
{
@@ -190,7 +178,7 @@ public:
if (Creature* malygos = instance->GetCreature(malygosGUID))
{
std::list<HostileReference*> m_threatlist = malygos->getThreatManager().getThreatList();
- for (std::list<uint64>::const_iterator itr_vortex = vortexTriggers.begin(); itr_vortex != vortexTriggers.end(); ++itr_vortex)
+ for (GuidList::const_iterator itr_vortex = vortexTriggers.begin(); itr_vortex != vortexTriggers.end(); ++itr_vortex)
{
if (m_threatlist.empty())
return;
@@ -224,7 +212,7 @@ public:
{
bool next = (lastPortalGUID == portalTriggers.back() || !lastPortalGUID ? true : false);
- for (std::list<uint64>::const_iterator itr_trigger = portalTriggers.begin(); itr_trigger != portalTriggers.end(); ++itr_trigger)
+ for (GuidList::const_iterator itr_trigger = portalTriggers.begin(); itr_trigger != portalTriggers.end(); ++itr_trigger)
{
if (next)
{
@@ -257,7 +245,7 @@ public:
}
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -277,20 +265,20 @@ public:
return giftBoxBunnyGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
private:
- std::list<uint64> vortexTriggers;
- std::list<uint64> portalTriggers;
- uint64 malygosGUID;
- uint64 irisGUID;
- uint64 lastPortalGUID;
- uint64 platformGUID;
- uint64 exitPortalGUID;
- uint64 heartOfMagicGUID;
- uint64 alexstraszaBunnyGUID;
- uint64 giftBoxBunnyGUID;
+ GuidList vortexTriggers;
+ GuidList portalTriggers;
+ ObjectGuid malygosGUID;
+ ObjectGuid irisGUID;
+ ObjectGuid lastPortalGUID;
+ ObjectGuid platformGUID;
+ ObjectGuid exitPortalGUID;
+ ObjectGuid heartOfMagicGUID;
+ ObjectGuid alexstraszaBunnyGUID;
+ ObjectGuid giftBoxBunnyGUID;
Position focusingIrisPosition;
Position exitPortalPosition;
};
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
index 399f2eb8ac2..ed08296acd8 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
@@ -85,7 +85,7 @@ class boss_anomalus : public CreatureScript
{
Phase = 0;
uiSparkTimer = 5000;
- uiChaoticRiftGUID = 0;
+ uiChaoticRiftGUID.Clear();
chaosTheory = true;
}
@@ -93,7 +93,7 @@ class boss_anomalus : public CreatureScript
uint8 Phase;
uint32 uiSparkTimer;
- uint64 uiChaoticRiftGUID;
+ ObjectGuid uiChaoticRiftGUID;
bool chaosTheory;
void Reset() override
@@ -151,13 +151,13 @@ class boss_anomalus : public CreatureScript
if (Rift && Rift->isDead())
{
me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD);
- uiChaoticRiftGUID = 0;
+ uiChaoticRiftGUID.Clear();
}
return;
}
}
else
- uiChaoticRiftGUID = 0;
+ uiChaoticRiftGUID.Clear();
if ((Phase == 0) && HealthBelowPct(50))
{
@@ -232,7 +232,7 @@ class npc_chaotic_rift : public CreatureScript
if (uiChaoticEnergyBurstTimer <= diff)
{
- Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANOMALUS));
+ Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ANOMALUS));
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
@@ -250,7 +250,7 @@ class npc_chaotic_rift : public CreatureScript
if (Creature* Wraith = me->SummonCreature(NPC_CRAZED_MANA_WRAITH, me->GetPositionX() + 1, me->GetPositionY() + 1, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000))
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
Wraith->AI()->AttackStart(target);
- Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANOMALUS));
+ Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ANOMALUS));
if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
uiSummonCrazedManaWraithTimer = 5000;
else
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
index 7bc4174260b..6b3df5ef665 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
@@ -84,8 +84,8 @@ public:
InstanceScript* instance;
- std::list<uint64> intenseColdList;
- uint64 auiContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES];
+ GuidList intenseColdList;
+ ObjectGuid auiContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES];
uint32 uiCrystalfireBreathTimer;
uint32 uiCrystalChainsCrystalizeTimer;
uint32 uiTailSweepTimer;
@@ -127,9 +127,9 @@ public:
bool CheckContainmentSpheres(bool remove_prison = false)
{
- auiContainmentSphereGUIDs[0] = instance->GetData64(ANOMALUS_CONTAINMET_SPHERE);
- auiContainmentSphereGUIDs[1] = instance->GetData64(ORMOROKS_CONTAINMET_SPHERE);
- auiContainmentSphereGUIDs[2] = instance->GetData64(TELESTRAS_CONTAINMET_SPHERE);
+ auiContainmentSphereGUIDs[0] = instance->GetGuidData(ANOMALUS_CONTAINMET_SPHERE);
+ auiContainmentSphereGUIDs[1] = instance->GetGuidData(ORMOROKS_CONTAINMET_SPHERE);
+ auiContainmentSphereGUIDs[2] = instance->GetGuidData(TELESTRAS_CONTAINMET_SPHERE);
GameObject* ContainmentSpheres[DATA_CONTAINMENT_SPHERES];
@@ -163,7 +163,7 @@ public:
}
}
- void SetGUID(uint64 guid, int32 id/* = 0 */) override
+ void SetGUID(ObjectGuid guid, int32 id/* = 0 */) override
{
if (id == DATA_INTENSE_COLD)
intenseColdList.push_back(guid);
@@ -219,7 +219,7 @@ public:
{
InstanceScript* instance = go->GetInstanceScript();
- Creature* pKeristrasza = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_KERISTRASZA));
+ Creature* pKeristrasza = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_KERISTRASZA));
if (pKeristrasza && pKeristrasza->IsAlive())
{
// maybe these are hacks :(
@@ -277,9 +277,9 @@ class achievement_intense_cold : public AchievementCriteriaScript
if (!target)
return false;
- std::list<uint64> intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->intenseColdList;
+ GuidList intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->intenseColdList;
if (!intenseColdList.empty())
- for (std::list<uint64>::iterator itr = intenseColdList.begin(); itr != intenseColdList.end(); ++itr)
+ for (GuidList::iterator itr = intenseColdList.begin(); itr != intenseColdList.end(); ++itr)
if (player->GetGUID() == *itr)
return false;
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
index c08fd97a76f..8c58a65cdbe 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
@@ -89,9 +89,9 @@ public:
uiGravityWellTimer = 15 * IN_MILLISECONDS;
uiCooldown = 0;
- uiFireMagusGUID = 0;
- uiFrostMagusGUID = 0;
- uiArcaneMagusGUID = 0;
+ uiFireMagusGUID.Clear();
+ uiFrostMagusGUID.Clear();
+ uiArcaneMagusGUID.Clear();
for (uint8 n = 0; n < 3; ++n)
time[n] = 0;
@@ -102,9 +102,9 @@ public:
InstanceScript* instance;
- uint64 uiFireMagusGUID;
- uint64 uiFrostMagusGUID;
- uint64 uiArcaneMagusGUID;
+ ObjectGuid uiFireMagusGUID;
+ ObjectGuid uiFrostMagusGUID;
+ ObjectGuid uiArcaneMagusGUID;
bool bFireMagusDead;
bool bFrostMagusDead;
@@ -173,7 +173,7 @@ public:
return 0;
}
- uint64 SplitPersonality(uint32 entry)
+ ObjectGuid SplitPersonality(uint32 entry)
{
if (Creature* Summoned = me->SummonCreature(entry, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS))
{
@@ -199,7 +199,7 @@ public:
Summoned->AI()->AttackStart(target);
return Summoned->GetGUID();
}
- return 0;
+ return ObjectGuid::Empty;
}
void SummonedCreatureDespawn(Creature* summon) override
@@ -256,9 +256,9 @@ public:
Phase = 2;
if (Phase == 3)
Phase = 4;
- uiFireMagusGUID = 0;
- uiFrostMagusGUID = 0;
- uiArcaneMagusGUID = 0;
+ uiFireMagusGUID.Clear();
+ uiFrostMagusGUID.Clear();
+ uiArcaneMagusGUID.Clear();
bIsWaitingToAppear = true;
uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS;
Talk(SAY_MERGE);
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
index 663f4bca6ac..91a40d43f12 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
@@ -44,12 +44,12 @@ public:
uint32 m_auiEncounter[NUMBER_OF_ENCOUNTERS];
- uint64 Anomalus;
- uint64 Keristrasza;
+ ObjectGuid Anomalus;
+ ObjectGuid Keristrasza;
- uint64 AnomalusContainmentSphere;
- uint64 OrmoroksContainmentSphere;
- uint64 TelestrasContainmentSphere;
+ ObjectGuid AnomalusContainmentSphere;
+ ObjectGuid OrmoroksContainmentSphere;
+ ObjectGuid TelestrasContainmentSphere;
std::string strInstData;
@@ -57,12 +57,6 @@ public:
{
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
-
- Anomalus = 0;
- Keristrasza = 0;
- AnomalusContainmentSphere = 0;
- OrmoroksContainmentSphere = 0;
- TelestrasContainmentSphere = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -222,7 +216,7 @@ public:
}
}
- uint64 GetData64(uint32 uiIdentifier) const override
+ ObjectGuid GetGuidData(uint32 uiIdentifier) const override
{
switch (uiIdentifier)
{
@@ -232,7 +226,7 @@ public:
case ORMOROKS_CONTAINMET_SPHERE: return OrmoroksContainmentSphere;
case TELESTRAS_CONTAINMET_SPHERE: return TelestrasContainmentSphere;
}
- return 0;
+ return ObjectGuid::Empty;
}
std::string GetSaveData() override
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
index 17508517f44..0119b81796e 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
@@ -184,7 +184,7 @@ class npc_azure_ring_captain : public CreatureScript
void Initialize()
{
- targetGUID = 0;
+ targetGUID.Clear();
}
void Reset() override
@@ -231,7 +231,7 @@ class npc_azure_ring_captain : public CreatureScript
switch (action)
{
case ACTION_CALL_DRAGON_EVENT:
- if (Creature* varos = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VAROS)))
+ if (Creature* varos = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VAROS)))
{
if (Unit* victim = varos->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0))
{
@@ -246,7 +246,7 @@ class npc_azure_ring_captain : public CreatureScript
}
private:
- uint64 targetGUID;
+ ObjectGuid targetGUID;
InstanceScript* instance;
};
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
index 83093234093..0665bfd240c 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
@@ -44,20 +44,7 @@ class instance_oculus : public InstanceMapScript
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- DrakosGUID = 0;
- VarosGUID = 0;
- UromGUID = 0;
- EregosGUID = 0;
-
CentrifugueConstructCounter = 0;
-
- EregosCacheGUID = 0;
-
- GreaterWhelpList.clear();
-
- BelgaristraszGUID = 0;
- EternosGUID = 0;
- VerdisaGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -240,7 +227,7 @@ class instance_oculus : public InstanceMapScript
return true;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -256,7 +243,7 @@ class instance_oculus : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
void FreeDragons()
@@ -282,26 +269,26 @@ class instance_oculus : public InstanceMapScript
void GreaterWhelps()
{
- for (uint64 guid : GreaterWhelpList)
+ for (ObjectGuid guid : GreaterWhelpList)
if (Creature* gwhelp = instance->GetCreature(guid))
gwhelp->SetPhaseMask(1, true);
}
protected:
- uint64 DrakosGUID;
- uint64 VarosGUID;
- uint64 UromGUID;
- uint64 EregosGUID;
+ ObjectGuid DrakosGUID;
+ ObjectGuid VarosGUID;
+ ObjectGuid UromGUID;
+ ObjectGuid EregosGUID;
- uint64 BelgaristraszGUID;
- uint64 EternosGUID;
- uint64 VerdisaGUID;
+ ObjectGuid BelgaristraszGUID;
+ ObjectGuid EternosGUID;
+ ObjectGuid VerdisaGUID;
uint8 CentrifugueConstructCounter;
- uint64 EregosCacheGUID;
+ ObjectGuid EregosCacheGUID;
- std::list<uint64> GreaterWhelpList;
+ GuidList GreaterWhelpList;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
index 29de693bf3a..b5079d8cf4f 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
@@ -109,7 +109,6 @@ public:
Initialize();
instance = creature->GetInstanceScript();
m_uiStance = STANCE_DEFENSIVE;
- memset(&m_auiStormforgedLieutenantGUID, 0, sizeof(m_auiStormforgedLieutenantGUID));
canBuff = true;
}
@@ -158,7 +157,7 @@ public:
uint32 m_uiMortalStrike_Timer;
uint32 m_uiSlam_Timer;
- uint64 m_auiStormforgedLieutenantGUID[2];
+ ObjectGuid m_auiStormforgedLieutenantGUID[2];
void Reset() override
{
@@ -170,6 +169,7 @@ public:
for (uint8 i = 0; i < 2; ++i)
{
+ // Something isn't right here - m_auiStormforgedLieutenantGUID is never assinged to
if (Creature* pStormforgedLieutenant = ObjectAccessor::GetCreature(*me, m_auiStormforgedLieutenantGUID[i]))
if (!pStormforgedLieutenant->IsAlive())
pStormforgedLieutenant->Respawn();
@@ -421,7 +421,7 @@ public:
void EnterCombat(Unit* who) override
{
- if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BJARNGRIM)))
+ if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BJARNGRIM)))
{
if (pBjarngrim->IsAlive() && !pBjarngrim->GetVictim())
pBjarngrim->AI()->AttackStart(who);
@@ -444,7 +444,7 @@ public:
if (m_uiRenewSteel_Timer <= uiDiff)
{
- if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BJARNGRIM)))
+ if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BJARNGRIM)))
{
if (pBjarngrim->IsAlive())
DoCast(pBjarngrim, SPELL_RENEW_STEEL_N);
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
index ddd88681a05..274fbed0fc9 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
@@ -168,7 +168,7 @@ public:
Position pos = me->GetPosition();
- for (uint64 guid : lSparkList)
+ for (ObjectGuid guid : lSparkList)
{
if (Creature* pSpark = ObjectAccessor::GetCreature(*me, guid))
{
@@ -348,7 +348,7 @@ public:
// Prevent them to follow players through the whole instance
if (uiCheckTimer <= uiDiff)
{
- Creature* ionar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_IONAR));
+ Creature* ionar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_IONAR));
if (ionar && ionar->IsAlive())
{
if (me->GetDistance(ionar) > DATA_MAX_SPARK_DISTANCE)
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
index 4ca94f69c5b..d63d5e87923 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
@@ -100,7 +100,7 @@ public:
InstanceScript* instance;
- std::list<uint64> m_lGolemGUIDList;
+ GuidList m_lGolemGUIDList;
bool m_bHasTemper;
bool m_bIsStriking;
@@ -164,7 +164,7 @@ public:
if (m_lGolemGUIDList.empty())
return;
- for (uint64 guid : m_lGolemGUIDList)
+ for (ObjectGuid guid : m_lGolemGUIDList)
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, guid))
if (temp->IsAlive())
@@ -179,7 +179,7 @@ public:
if (m_lGolemGUIDList.empty())
return;
- for (uint64 guid : m_lGolemGUIDList)
+ for (ObjectGuid guid : m_lGolemGUIDList)
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, guid))
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
index 0f44f935d24..0d39a8921e8 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
@@ -39,13 +39,6 @@ class instance_halls_of_lightning : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
-
- GeneralBjarngrimGUID = 0;
- VolkhanGUID = 0;
- IonarGUID = 0;
- LokenGUID = 0;
-
- LokenGlobeGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -119,7 +112,7 @@ class instance_halls_of_lightning : public InstanceMapScript
return true;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -134,16 +127,16 @@ class instance_halls_of_lightning : public InstanceMapScript
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
protected:
- uint64 GeneralBjarngrimGUID;
- uint64 VolkhanGUID;
- uint64 IonarGUID;
- uint64 LokenGUID;
+ ObjectGuid GeneralBjarngrimGUID;
+ ObjectGuid VolkhanGUID;
+ ObjectGuid IonarGUID;
+ ObjectGuid LokenGUID;
- uint64 LokenGlobeGUID;
+ ObjectGuid LokenGlobeGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
index 63000df133e..ac3df1e49aa 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
@@ -281,7 +281,7 @@ class npc_iron_sludge : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* sjonnir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SJONNIR)))
+ if (Creature* sjonnir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SJONNIR)))
sjonnir->AI()->DoAction(ACTION_OOZE_DEAD);
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
index 11f616e8550..f98a6e40a07 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
@@ -164,16 +164,16 @@ public:
bool bMarnakActivated;
bool bAbedneumActivated;
- std::list<uint64> KaddrakGUIDList;
+ GuidList KaddrakGUIDList;
void Reset() override
{
Initialize();
- instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), false);
- instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), false);
- instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), false);
- instance->HandleGameObject(instance->GetData64(DATA_GO_SKY_FLOOR), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_KADDRAK), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_MARNAK), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_ABEDNEUM), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_SKY_FLOOR), false);
KaddrakGUIDList.clear();
}
@@ -212,7 +212,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (!KaddrakGUIDList.empty())
- for (std::list<uint64>::const_iterator itr = KaddrakGUIDList.begin(); itr != KaddrakGUIDList.end(); ++itr)
+ for (GuidList::const_iterator itr = KaddrakGUIDList.begin(); itr != KaddrakGUIDList.end(); ++itr)
{
if (Creature* pKaddrak = ObjectAccessor::GetCreature(*me, *itr))
{
@@ -306,15 +306,15 @@ public:
bIsBattle = false;
uiStep = 0;
uiPhaseTimer = 0;
- uiControllerGUID = 0;
+ uiControllerGUID.Clear();
brannSparklinNews = true;
}
uint32 uiStep;
uint32 uiPhaseTimer;
- uint64 uiControllerGUID;
- std::list<uint64> lDwarfGUIDList;
+ ObjectGuid uiControllerGUID;
+ GuidList lDwarfGUIDList;
InstanceScript* instance;
@@ -338,9 +338,9 @@ public:
{
if (lDwarfGUIDList.empty())
return;
- for (std::list<uint64>::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr)
+ for (GuidList::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr)
{
- Creature* temp = ObjectAccessor::GetCreature(*me, instance ? (*itr) : 0);
+ Creature* temp = ObjectAccessor::GetCreature(*me, instance ? (*itr) : ObjectGuid::Empty);
if (temp && temp->IsAlive())
temp->DespawnOrUnsummon();
}
@@ -367,7 +367,7 @@ public:
break;
case 17:
Talk(SAY_EVENT_INTRO_2);
- instance->HandleGameObject(instance->GetData64(DATA_GO_TRIBUNAL_CONSOLE), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_TRIBUNAL_CONSOLE), true);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
SetEscortPaused(true);
JumpToNextStep(8500);
@@ -455,7 +455,7 @@ public:
JumpToNextStep(0);
break;
case 5:
- if (Creature* temp = (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))))
+ if (Creature* temp = (ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM))))
temp->AI()->Talk(SAY_EVENT_INTRO_3_ABED);
JumpToNextStep(8500);
break;
@@ -464,13 +464,13 @@ public:
JumpToNextStep(6500);
break;
case 7:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KADDRAK)))
temp->AI()->Talk(SAY_EVENT_A_2_KADD);
JumpToNextStep(12500);
break;
case 8:
Talk(SAY_EVENT_A_3);
- instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_KADDRAK), true);
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID))
ENSURE_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bKaddrakActivated = true;
JumpToNextStep(5000);
@@ -485,14 +485,14 @@ public:
JumpToNextStep(6000);
break;
case 11:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MARNAK)))
temp->AI()->Talk(SAY_EVENT_B_2_MARN);
SpawnDwarf(1);
JumpToNextStep(20000);
break;
case 12:
Talk(SAY_EVENT_B_3);
- instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_MARNAK), true);
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID))
ENSURE_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bMarnakActivated = true;
JumpToNextStep(10000);
@@ -515,14 +515,14 @@ public:
JumpToNextStep(20000);
break;
case 17:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_C_2_ABED);
SpawnDwarf(1);
JumpToNextStep(20000);
break;
case 18:
Talk(SAY_EVENT_C_3);
- instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_ABEDNEUM), true);
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID))
ENSURE_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bAbedneumActivated = true;
JumpToNextStep(5000);
@@ -541,7 +541,7 @@ public:
JumpToNextStep(20000);
break;
case 22:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_D_2_ABED);
SpawnDwarf(1);
JumpToNextStep(5000);
@@ -564,7 +564,7 @@ public:
JumpToNextStep(10000);
break;
case 27:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_D_4_ABED);
SpawnDwarf(1);
JumpToNextStep(10000);
@@ -573,7 +573,7 @@ public:
me->SetReactState(REACT_DEFENSIVE);
Talk(SAY_EVENT_END_01);
me->SetStandState(UNIT_STAND_STATE_STAND);
- instance->HandleGameObject(instance->GetData64(DATA_GO_SKY_FLOOR), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_SKY_FLOOR), true);
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID))
temp->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
bIsBattle = true;
@@ -587,7 +587,7 @@ public:
JumpToNextStep(5500);
break;
case 30:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_END_03_ABED);
JumpToNextStep(8500);
break;
@@ -596,7 +596,7 @@ public:
JumpToNextStep(11500);
break;
case 32:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_END_05_ABED);
JumpToNextStep(11500);
break;
@@ -605,7 +605,7 @@ public:
JumpToNextStep(4500);
break;
case 34:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_END_07_ABED);
JumpToNextStep(22500);
break;
@@ -614,7 +614,7 @@ public:
JumpToNextStep(7500);
break;
case 36:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KADDRAK)))
temp->AI()->Talk(SAY_EVENT_END_09_KADD);
JumpToNextStep(18500);
break;
@@ -623,7 +623,7 @@ public:
JumpToNextStep(5500);
break;
case 38:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KADDRAK)))
temp->AI()->Talk(SAY_EVENT_END_11_KADD);
JumpToNextStep(20500);
break;
@@ -632,7 +632,7 @@ public:
JumpToNextStep(2500);
break;
case 40:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KADDRAK)))
temp->AI()->Talk(SAY_EVENT_END_13_KADD);
JumpToNextStep(19500);
break;
@@ -641,7 +641,7 @@ public:
JumpToNextStep(10500);
break;
case 42:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MARNAK)))
temp->AI()->Talk(SAY_EVENT_END_15_MARN);
JumpToNextStep(6500);
break;
@@ -650,7 +650,7 @@ public:
JumpToNextStep(6500);
break;
case 44:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MARNAK)))
temp->AI()->Talk(SAY_EVENT_END_17_MARN);
JumpToNextStep(25500);
break;
@@ -659,7 +659,7 @@ public:
JumpToNextStep(23500);
break;
case 46:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MARNAK)))
temp->AI()->Talk(SAY_EVENT_END_19_MARN);
JumpToNextStep(3500);
break;
@@ -668,16 +668,16 @@ public:
JumpToNextStep(8500);
break;
case 48:
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ABEDNEUM)))
temp->AI()->Talk(SAY_EVENT_END_21_ABED);
JumpToNextStep(5500);
break;
case 49:
{
- instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), false);
- instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), false);
- instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), false);
- instance->HandleGameObject(instance->GetData64(DATA_GO_SKY_FLOOR), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_KADDRAK), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_MARNAK), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_ABEDNEUM), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_GO_SKY_FLOOR), false);
Player* player = GetPlayerForEscort();
if (player)
player->GroupEventHappens(QUEST_HALLS_OF_STONE, me);
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
index b7aa606aeeb..d6c7b18eabd 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
@@ -39,22 +39,6 @@ class instance_halls_of_stone : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
-
- KrystallusGUID = 0;
- MaidenOfGriefGUID = 0;
- SjonnirGUID = 0;
-
- KaddrakGUID = 0;
- AbedneumGUID = 0;
- MarnakGUID = 0;
- BrannGUID = 0;
-
- TribunalConsoleGUID = 0;
- TribunalChestGUID = 0;
- TribunalSkyFloorGUID = 0;
- KaddrakGoGUID = 0;
- AbedneumGoGUID = 0;
- MarnakGoGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -132,7 +116,7 @@ class instance_halls_of_stone : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -162,7 +146,7 @@ class instance_halls_of_stone : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
bool SetBossState(uint32 type, EncounterState state) override
@@ -186,7 +170,7 @@ class instance_halls_of_stone : public InstanceMapScript
return true;
}
- bool CheckRequiredBosses(uint32 bossId, Player const* player /*= NULL*/) const override
+ bool CheckRequiredBosses(uint32 bossId, Player const* player = nullptr) const override
{
if (player && player->GetSession()->HasPermission(rbac::RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES))
return true;
@@ -205,21 +189,21 @@ class instance_halls_of_stone : public InstanceMapScript
}
protected:
- uint64 KrystallusGUID;
- uint64 MaidenOfGriefGUID;
- uint64 SjonnirGUID;
-
- uint64 KaddrakGUID;
- uint64 AbedneumGUID;
- uint64 MarnakGUID;
- uint64 BrannGUID;
-
- uint64 TribunalConsoleGUID;
- uint64 TribunalChestGUID;
- uint64 TribunalSkyFloorGUID;
- uint64 KaddrakGoGUID;
- uint64 AbedneumGoGUID;
- uint64 MarnakGoGUID;
+ ObjectGuid KrystallusGUID;
+ ObjectGuid MaidenOfGriefGUID;
+ ObjectGuid SjonnirGUID;
+
+ ObjectGuid KaddrakGUID;
+ ObjectGuid AbedneumGUID;
+ ObjectGuid MarnakGUID;
+ ObjectGuid BrannGUID;
+
+ ObjectGuid TribunalConsoleGUID;
+ ObjectGuid TribunalChestGUID;
+ ObjectGuid TribunalSkyFloorGUID;
+ ObjectGuid KaddrakGoGUID;
+ ObjectGuid AbedneumGoGUID;
+ ObjectGuid MarnakGoGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
index 3c073578d49..bd5b61e227f 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
@@ -403,7 +403,7 @@ class boss_algalon_the_observer : public CreatureScript
{
_firstPull = false;
Talk(SAY_ALGALON_START_TIMER);
- if (Creature* brann = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRANN_BRONZEBEARD_ALG)))
+ if (Creature* brann = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRANN_BRONZEBEARD_ALG)))
brann->AI()->DoAction(ACTION_FINISH_INTRO);
me->setActive(true);
@@ -1008,10 +1008,10 @@ class go_celestial_planetarium_access : public GameObjectScript
if (InstanceScript* instance = go->GetInstanceScript())
{
instance->SetData(DATA_ALGALON_SUMMON_STATE, 1);
- if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_01)))
+ if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetGuidData(DATA_SIGILDOOR_01)))
sigil->SetGoState(GO_STATE_ACTIVE);
- if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_02)))
+ if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetGuidData(DATA_SIGILDOOR_02)))
sigil->SetGoState(GO_STATE_ACTIVE);
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp
index 80b3882593c..bb7a8592e04 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp
@@ -210,11 +210,11 @@ class boss_steelbreaker : public CreatureScript
Talk(SAY_STEELBREAKER_DEATH);
//DoCastAOE(SPELL_SUPERCHARGE, true);
- if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRUNDIR)))
+ if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRUNDIR)))
if (Brundir->IsAlive())
Brundir->AI()->DoAction(ACTION_SUPERCHARGE);
- if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOLGEIM)))
+ if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MOLGEIM)))
if (Molgeim->IsAlive())
Molgeim->AI()->DoAction(ACTION_SUPERCHARGE);
}
@@ -355,11 +355,11 @@ class boss_runemaster_molgeim : public CreatureScript
Talk(SAY_MOLGEIM_DEATH);
//DoCastAOE(SPELL_SUPERCHARGE, true);
- if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRUNDIR)))
+ if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRUNDIR)))
if (Brundir->IsAlive())
Brundir->AI()->DoAction(ACTION_SUPERCHARGE);
- if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER)))
+ if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STEELBREAKER)))
if (Steelbreaker->IsAlive())
Steelbreaker->AI()->DoAction(ACTION_SUPERCHARGE);
}
@@ -396,12 +396,12 @@ class boss_runemaster_molgeim : public CreatureScript
switch (urand(0, 2))
{
case 1:
- if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER)))
+ if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STEELBREAKER)))
if (Steelbreaker->IsAlive())
target = Steelbreaker;
break;
case 2:
- if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER)))
+ if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STEELBREAKER)))
if (Brundir->IsAlive())
target = Brundir;
break;
@@ -528,11 +528,11 @@ class boss_stormcaller_brundir : public CreatureScript
Talk(SAY_BRUNDIR_DEATH);
//DoCastAOE(SPELL_SUPERCHARGE, true);
- if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOLGEIM)))
+ if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MOLGEIM)))
if (Molgeim->IsAlive())
Molgeim->AI()->DoAction(ACTION_SUPERCHARGE);
- if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER)))
+ if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STEELBREAKER)))
if (Steelbreaker->IsAlive())
Steelbreaker->AI()->DoAction(ACTION_SUPERCHARGE);
}
@@ -689,7 +689,7 @@ class spell_assembly_meltdown : public SpellScriptLoader
void HandleInstaKill(SpellEffIndex /*effIndex*/)
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_STEELBREAKER)))
+ if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_STEELBREAKER)))
Steelbreaker->AI()->DoAction(ACTION_ADD_CHARGE);
}
@@ -724,7 +724,7 @@ class spell_assembly_rune_of_summoning : public SpellScriptLoader
void HandlePeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
- GetTarget()->CastSpell(GetTarget(), SPELL_RUNE_OF_SUMMONING_SUMMON, true, NULL, aurEff, GetTarget()->IsSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : 0);
+ GetTarget()->CastSpell(GetTarget(), SPELL_RUNE_OF_SUMMONING_SUMMON, true, NULL, aurEff, GetTarget()->IsSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : ObjectGuid::Empty);
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
index 8dd72e5d1a6..a00c715fef4 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
@@ -112,7 +112,7 @@ class boss_auriaya : public CreatureScript
void Initialize()
{
- DefenderGUID = 0;
+ DefenderGUID.Clear();
defenderLives = 8;
crazyCatLady = true;
nineLives = false;
@@ -279,7 +279,7 @@ class boss_auriaya : public CreatureScript
}
private:
- uint64 DefenderGUID;
+ ObjectGuid DefenderGUID;
uint8 defenderLives;
bool crazyCatLady;
bool nineLives;
@@ -385,7 +385,7 @@ class npc_sanctum_sentry : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Auriaya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_AURIAYA)))
+ if (Creature* Auriaya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_AURIAYA)))
Auriaya->AI()->DoAction(ACTION_CRAZY_CAT_LADY);
}
@@ -461,7 +461,7 @@ class npc_feral_defender : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
DoCast(me, SPELL_SUMMON_ESSENCE);
- if (Creature* Auriaya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_AURIAYA)))
+ if (Creature* Auriaya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_AURIAYA)))
Auriaya->AI()->DoAction(ACTION_RESPAWN_DEFENDER);
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
index 5f65d0ea89e..ec42ba82f36 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
@@ -227,7 +227,6 @@ class boss_flame_leviathan : public CreatureScript
boss_flame_leviathanAI(Creature* creature) : BossAI(creature, BOSS_LEVIATHAN), vehicle(creature->GetVehicleKit())
{
Initialize();
- _pursueTarget = 0;
}
void Initialize()
@@ -273,7 +272,7 @@ class boss_flame_leviathan : public CreatureScript
_Reset();
//resets shutdown counter to 0. 2 or 4 depending on raid mode
Shutdown = 0;
- _pursueTarget = 0;
+ _pursueTarget.Clear();
me->SetReactState(REACT_DEFENSIVE);
}
@@ -557,7 +556,7 @@ class boss_flame_leviathan : public CreatureScript
}
}
- uint64 _pursueTarget;
+ ObjectGuid _pursueTarget;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -1003,7 +1002,7 @@ public:
npc_escortAI::UpdateAI(diff);
if (!HasEscortState(STATE_ESCORT_ESCORTING))
- Start(false, true, 0, NULL, false, true);
+ Start(false, true, ObjectGuid::Empty, NULL, false, true);
else
{
if (infernoTimer <= diff)
@@ -1208,7 +1207,7 @@ class npc_lorekeeper : public CreatureScript
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
- if (Creature* leviathan = instance->instance->GetCreature(instance->GetData64(BOSS_LEVIATHAN)))
+ if (Creature* leviathan = instance->instance->GetCreature(instance->GetGuidData(BOSS_LEVIATHAN)))
{
leviathan->AI()->DoAction(ACTION_START_HARD_MODE);
creature->SetVisible(false);
@@ -1670,7 +1669,7 @@ class FlameLeviathanPursuedTargetSelector
//! Vehicle must be in use by player
bool playerFound = false;
for (SeatMap::const_iterator itr = vehicle->Seats.begin(); itr != vehicle->Seats.end() && !playerFound; ++itr)
- if (IS_PLAYER_GUID(itr->second.Passenger.Guid))
+ if (itr->second.Passenger.Guid.IsPlayer())
playerFound = true;
return !playerFound;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
index ecebeb8d4e5..93fee8d1964 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
@@ -226,7 +226,6 @@ class npc_iron_roots : public CreatureScript
me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); // Death Grip
me->setFaction(14);
me->SetReactState(REACT_PASSIVE);
- summonerGUID = 0;
}
void IsSummonedBy(Unit* summoner) override
@@ -251,7 +250,7 @@ class npc_iron_roots : public CreatureScript
}
private:
- uint64 summonerGUID;
+ ObjectGuid summonerGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -284,7 +283,7 @@ class boss_freya : public CreatureScript
for (uint8 i = 0; i < 3; ++i)
for (uint8 n = 0; n < 2; ++n)
- ElementalGUID[i][n] = 0;
+ ElementalGUID[i][n].Clear();
for (uint8 i = 0; i < 6; ++i)
for (uint8 n = 0; n < 2; ++n)
deforestation[i][n] = 0;
@@ -297,7 +296,7 @@ class boss_freya : public CreatureScript
random[n] = false;
}
- uint64 ElementalGUID[3][2];
+ ObjectGuid ElementalGUID[3][2];
uint32 deforestation[6][2];
uint32 elementalTimer[2];
@@ -340,7 +339,7 @@ class boss_freya : public CreatureScript
Creature* Elder[3];
for (uint8 n = 0; n < 3; ++n)
{
- Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF + n));
+ Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_BRIGHTLEAF + n));
if (Elder[n] && Elder[n]->IsAlive())
{
me->AddAura(SPELL_DRAINED_OF_POWER, Elder[n]);
@@ -615,7 +614,7 @@ class boss_freya : public CreatureScript
Creature* Elder[3];
for (uint8 n = 0; n < 3; ++n)
{
- Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF + n));
+ Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_BRIGHTLEAF + n));
if (Elder[n] && Elder[n]->IsAlive())
{
Elder[n]->RemoveAllAuras();
@@ -715,10 +714,10 @@ class boss_elder_brightleaf : public CreatureScript
if (killer->GetTypeId() == TYPEID_PLAYER)
{
- if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_IRONBRANCH)))
+ if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_IRONBRANCH)))
Ironbranch->AI()->DoAction(ACTION_ELDER_DEATH);
- if (Creature* Stonebark = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_STONEBARK)))
+ if (Creature* Stonebark = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_STONEBARK)))
Stonebark->AI()->DoAction(ACTION_ELDER_DEATH);
}
}
@@ -822,10 +821,10 @@ class boss_elder_stonebark : public CreatureScript
if (killer->GetTypeId() == TYPEID_PLAYER)
{
- if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_IRONBRANCH)))
+ if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_IRONBRANCH)))
Ironbranch->AI()->DoAction(ACTION_ELDER_DEATH);
- if (Creature* Brightleaf = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF)))
+ if (Creature* Brightleaf = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_BRIGHTLEAF)))
Brightleaf->AI()->DoAction(ACTION_ELDER_DEATH);
}
}
@@ -935,10 +934,10 @@ class boss_elder_ironbranch : public CreatureScript
if (killer->GetTypeId() == TYPEID_PLAYER)
{
- if (Creature* Brightleaf = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF)))
+ if (Creature* Brightleaf = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_BRIGHTLEAF)))
Brightleaf->AI()->DoAction(ACTION_ELDER_DEATH);
- if (Creature* Stonebark = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_STONEBARK)))
+ if (Creature* Stonebark = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_STONEBARK)))
Stonebark->AI()->DoAction(ACTION_ELDER_DEATH);
}
}
@@ -1076,7 +1075,7 @@ class npc_ancient_water_spirit : public CreatureScript
{
Initialize();
instance = me->GetInstanceScript();
- if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA)))
+ if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA)))
waveCount = ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount;
else
waveCount = 0;
@@ -1114,7 +1113,7 @@ class npc_ancient_water_spirit : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA)))
+ if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA)))
{
ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false;
ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(1);
@@ -1144,7 +1143,7 @@ class npc_storm_lasher : public CreatureScript
{
Initialize();
instance = me->GetInstanceScript();
- if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA)))
+ if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA)))
waveCount = ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount;
else
waveCount = 0;
@@ -1188,7 +1187,7 @@ class npc_storm_lasher : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA)))
+ if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA)))
{
ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false;
ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(2);
@@ -1218,7 +1217,7 @@ class npc_snaplasher : public CreatureScript
npc_snaplasherAI(Creature* creature) : ScriptedAI(creature)
{
instance = me->GetInstanceScript();
- if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA)))
+ if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA)))
waveCount = ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount;
else
waveCount = 0;
@@ -1237,7 +1236,7 @@ class npc_snaplasher : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_FREYA)))
+ if (Creature* Freya = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_FREYA)))
{
ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->checkElementalAlive[waveCount] = false;
ENSURE_AI(boss_freya::boss_freyaAI, Freya->AI())->LasherDead(4);
@@ -1543,17 +1542,17 @@ class spell_freya_attuned_to_nature_dose_reduction : public SpellScriptLoader
case SPELL_ATTUNED_TO_NATURE_2_DOSE_REDUCTION:
if (target->HasAura(GetEffectValue()))
for (uint8 n = 0; n < 2; ++n)
- target->RemoveAuraFromStack(GetEffectValue(), 0, AURA_REMOVE_BY_DEFAULT);
+ target->RemoveAuraFromStack(GetEffectValue());
break;
case SPELL_ATTUNED_TO_NATURE_10_DOSE_REDUCTION:
if (target->HasAura(GetEffectValue()))
for (uint8 n = 0; n < 10; ++n)
- target->RemoveAuraFromStack(GetEffectValue(), 0, AURA_REMOVE_BY_DEFAULT);
+ target->RemoveAuraFromStack(GetEffectValue());
break;
case SPELL_ATTUNED_TO_NATURE_25_DOSE_REDUCTION:
if (target->HasAura(GetEffectValue()))
for (uint8 n = 0; n < 25; ++n)
- target->RemoveAuraFromStack(GetEffectValue(), 0, AURA_REMOVE_BY_DEFAULT);
+ target->RemoveAuraFromStack(GetEffectValue());
break;
default:
break;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
index 5d4ddf1865c..9cb5e71b471 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
@@ -338,7 +338,7 @@ class boss_saronite_animus : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_VEZAX)))
+ if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_VEZAX)))
Vezax->AI()->DoAction(ACTION_ANIMUS_DIE);
}
@@ -433,7 +433,7 @@ class npc_saronite_vapors : public CreatureScript
DoCast(me, SPELL_SARONITE_VAPORS);
me->DespawnOrUnsummon(30000);
- if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_VEZAX)))
+ if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_VEZAX)))
Vezax->AI()->DoAction(ACTION_VAPORS_DIE);
}
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
index 42c0323a714..f1cfea0e58f 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
@@ -189,13 +189,13 @@ class npc_flash_freeze : public CreatureScript
void Initialize()
{
- targetGUID = 0;
+ targetGUID.Clear();
checkDespawnTimer = 1000;
}
InstanceScript* instance;
- uint64 targetGUID;
+ ObjectGuid targetGUID;
uint32 checkDespawnTimer;
void Reset() override
@@ -236,7 +236,7 @@ class npc_flash_freeze : public CreatureScript
// Prevents to have Ice Block on other place than target is
me->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation());
if (target->GetTypeId() == TYPEID_PLAYER)
- if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR)))
+ if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR)))
Hodir->AI()->DoAction(ACTION_CHEESE_THE_FREEZE);
}
}
@@ -260,12 +260,11 @@ class npc_ice_block : public CreatureScript
instance = me->GetInstanceScript();
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED);
- targetGUID = 0;
}
InstanceScript* instance;
- uint64 targetGUID;
+ ObjectGuid targetGUID;
void IsSummonedBy(Unit* summoner) override
{
@@ -288,7 +287,7 @@ class npc_ice_block : public CreatureScript
{
Helper->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED);
- if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR)))
+ if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR)))
{
if (!Hodir->IsInCombat())
{
@@ -691,7 +690,7 @@ class npc_hodir_priest : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR)))
+ if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR)))
Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS);
}
@@ -753,7 +752,7 @@ class npc_hodir_shaman : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR)))
+ if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR)))
Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS);
}
@@ -814,7 +813,7 @@ class npc_hodir_druid : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR)))
+ if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR)))
Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS);
}
@@ -894,7 +893,7 @@ class npc_hodir_mage : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_HODIR)))
+ if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_HODIR)))
Hodir->AI()->DoAction(ACTION_I_HAVE_THE_COOLEST_FRIENDS);
}
@@ -990,7 +989,7 @@ class spell_biting_cold : public SpellScriptLoader
}
private:
- typedef std::list< std::pair<uint64, uint8> > TargetList;
+ typedef std::list<std::pair<ObjectGuid, uint8>> TargetList;
TargetList listOfTargets;
};
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
index f0f918f7e39..d4fbf959c53 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
@@ -124,7 +124,7 @@ class boss_ignis : public CreatureScript
void Initialize()
{
- _slagPotGUID = 0;
+ _slagPotGUID.Clear();
_shattered = false;
_firstConstructKill = 0;
}
@@ -251,7 +251,7 @@ class boss_ignis : public CreatureScript
{
slagPotTarget->ExitVehicle();
slagPotTarget = NULL;
- _slagPotGUID = 0;
+ _slagPotGUID.Clear();
events.CancelEvent(EVENT_END_POT);
}
break;
@@ -282,7 +282,7 @@ class boss_ignis : public CreatureScript
}
private:
- uint64 _slagPotGUID;
+ ObjectGuid _slagPotGUID;
Vehicle* _vehicle;
time_t _firstConstructKill;
bool _shattered;
@@ -323,7 +323,7 @@ class npc_iron_construct : public CreatureScript
if (me->HasAura(SPELL_BRITTLE) && damage >= 5000)
{
DoCast(SPELL_SHATTER);
- if (Creature* ignis = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_IGNIS)))
+ if (Creature* ignis = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_IGNIS)))
if (ignis->AI())
ignis->AI()->DoAction(ACTION_REMOVE_BUFF);
@@ -385,7 +385,7 @@ class npc_scorch_ground : public CreatureScript
void Initialize()
{
_heat = false;
- _constructGUID = 0;
+ _constructGUID.Clear();
_heatTimer = 0;
}
@@ -429,7 +429,7 @@ class npc_scorch_ground : public CreatureScript
}
private:
- uint64 _constructGUID;
+ ObjectGuid _constructGUID;
uint32 _heatTimer;
bool _heat;
};
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
index 71a89c0e508..9486d95639f 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
@@ -115,7 +115,7 @@ class boss_kologarn : public CreatureScript
Vehicle* vehicle;
bool left, right;
- uint64 eyebeamTarget;
+ ObjectGuid eyebeamTarget;
void EnterCombat(Unit* /*who*/) override
{
@@ -139,7 +139,7 @@ class boss_kologarn : public CreatureScript
{
_Reset();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- eyebeamTarget = 0;
+ eyebeamTarget.Clear();
}
void JustDied(Unit* /*killer*/) override
@@ -339,7 +339,7 @@ class spell_ulduar_rubble_summon : public SpellScriptLoader
if (!caster)
return;
- uint64 originalCaster = caster->GetInstanceScript() ? caster->GetInstanceScript()->GetData64(BOSS_KOLOGARN) : 0;
+ ObjectGuid originalCaster = caster->GetInstanceScript() ? caster->GetInstanceScript()->GetGuidData(BOSS_KOLOGARN) : ObjectGuid::Empty;
uint32 spellId = GetEffectValue();
for (uint8 i = 0; i < 5; ++i)
caster->CastSpell(caster, spellId, true, NULL, NULL, originalCaster);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
index 3a137a8658e..880eeba206b 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
@@ -347,9 +347,9 @@ static bool IsEncounterFinished(Unit* who)
{
InstanceScript* instance = who->GetInstanceScript();
- Creature* mkii = ObjectAccessor::GetCreature(*who, instance->GetData64(DATA_LEVIATHAN_MK_II));
- Creature* vx001 = ObjectAccessor::GetCreature(*who, instance->GetData64(DATA_VX_001));
- Creature* aerial = ObjectAccessor::GetCreature(*who, instance->GetData64(DATA_AERIAL_COMMAND_UNIT));
+ Creature* mkii = ObjectAccessor::GetCreature(*who, instance->GetGuidData(DATA_LEVIATHAN_MK_II));
+ Creature* vx001 = ObjectAccessor::GetCreature(*who, instance->GetGuidData(DATA_VX_001));
+ Creature* aerial = ObjectAccessor::GetCreature(*who, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT));
if (!mkii || !vx001 || !aerial)
return false;
@@ -363,7 +363,7 @@ static bool IsEncounterFinished(Unit* who)
mkii->DespawnOrUnsummon(120000);
vx001->DespawnOrUnsummon(120000);
aerial->DespawnOrUnsummon(120000);
- if (Creature* mimiron = ObjectAccessor::GetCreature(*who, instance->GetData64(BOSS_MIMIRON)))
+ if (Creature* mimiron = ObjectAccessor::GetCreature(*who, instance->GetGuidData(BOSS_MIMIRON)))
mimiron->AI()->JustDied(who);
return true;
}
@@ -395,7 +395,7 @@ class boss_mimiron : public CreatureScript
break;
case DO_ACTIVATE_V0L7R0N_1:
Talk(SAY_AERIAL_DEATH);
- if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LEVIATHAN_MK_II)))
+ if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LEVIATHAN_MK_II)))
mkii->GetMotionMaster()->MovePoint(WP_MKII_P4_POS_1, VehicleRelocation[WP_MKII_P4_POS_1]);
break;
case DO_ACTIVATE_V0L7R0N_2:
@@ -420,7 +420,7 @@ class boss_mimiron : public CreatureScript
me->RemoveAurasDueToSpell(SPELL_WELD);
DoCast(me->GetVehicleBase(), SPELL_SEAT_6);
- if (GameObject* button = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MIMIRON_BUTTON)))
+ if (GameObject* button = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MIMIRON_BUTTON)))
button->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
if (_fireFighter)
@@ -450,14 +450,14 @@ class boss_mimiron : public CreatureScript
_Reset();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MIMIRON_ELEVATOR)))
+ if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MIMIRON_ELEVATOR)))
elevator->SetGoState(GO_STATE_ACTIVE);
if (_fireFighter)
- if (Creature* computer = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_COMPUTER)))
+ if (Creature* computer = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_COMPUTER)))
computer->AI()->DoAction(DO_DEACTIVATE_COMPUTER);
- if (GameObject* button = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MIMIRON_BUTTON)))
+ if (GameObject* button = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MIMIRON_BUTTON)))
{
button->SetGoState(GO_STATE_READY);
button->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
@@ -466,7 +466,7 @@ class boss_mimiron : public CreatureScript
_fireFighter = false;
DoCast(me, SPELL_WELD);
- if (Unit* mkii = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LEVIATHAN_MK_II)))
+ if (Unit* mkii = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEVIATHAN_MK_II)))
DoCast(mkii, SPELL_SEAT_3);
}
@@ -485,7 +485,7 @@ class boss_mimiron : public CreatureScript
switch (eventId)
{
case EVENT_SUMMON_FLAMES:
- if (Unit* worldtrigger = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MIMIRON_WORLD_TRIGGER)))
+ if (Unit* worldtrigger = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_MIMIRON_WORLD_TRIGGER)))
worldtrigger->CastCustomSpell(SPELL_SCRIPT_EFFECT_SUMMON_FLAMES_INITIAL, SPELLVALUE_MAX_TARGETS, 3, NULL, true, NULL, NULL, me->GetGUID());
events.RescheduleEvent(EVENT_SUMMON_FLAMES, 28000);
break;
@@ -521,21 +521,21 @@ class boss_mimiron : public CreatureScript
events.ScheduleEvent(EVENT_VX001_ACTIVATION_4, 5000);
break;
case EVENT_VX001_ACTIVATION_4:
- if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MIMIRON_ELEVATOR)))
+ if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MIMIRON_ELEVATOR)))
elevator->SetGoState(GO_STATE_READY);
- if (Unit* worldtrigger = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MIMIRON_WORLD_TRIGGER)))
+ if (Unit* worldtrigger = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_MIMIRON_WORLD_TRIGGER)))
worldtrigger->CastSpell(worldtrigger, SPELL_ELEVATOR_KNOCKBACK);
events.ScheduleEvent(EVENT_VX001_ACTIVATION_5, 6000);
break;
case EVENT_VX001_ACTIVATION_5:
- if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MIMIRON_ELEVATOR)))
+ if (GameObject* elevator = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_MIMIRON_ELEVATOR)))
elevator->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
if (Creature* vx001 = me->SummonCreature(NPC_VX_001, VX001SummonPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000))
vx001->CastSpell(vx001, SPELL_FREEZE_ANIM);
events.ScheduleEvent(EVENT_VX001_ACTIVATION_6, 19000);
break;
case EVENT_VX001_ACTIVATION_6:
- if (Unit* vx001 = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_VX_001)))
+ if (Unit* vx001 = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_VX_001)))
DoCast(vx001, SPELL_SEAT_1);
events.ScheduleEvent(EVENT_VX001_ACTIVATION_7, 3500);
break;
@@ -566,7 +566,7 @@ class boss_mimiron : public CreatureScript
events.ScheduleEvent(EVENT_AERIAL_ACTIVATION_4, 5000);
break;
case EVENT_AERIAL_ACTIVATION_4:
- if (Unit* aerial = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_AERIAL_COMMAND_UNIT)))
+ if (Unit* aerial = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT)))
me->CastSpell(aerial, SPELL_SEAT_1);
events.ScheduleEvent(EVENT_AERIAL_ACTIVATION_5, 2000);
break;
@@ -579,14 +579,14 @@ class boss_mimiron : public CreatureScript
acu->AI()->DoAction(_fireFighter? DO_HARDMODE_AERIAL : DO_START_AERIAL);
break;
case EVENT_VOL7RON_ACTIVATION_1:
- if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LEVIATHAN_MK_II)))
+ if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LEVIATHAN_MK_II)))
mkii->SetFacingTo(float(M_PI));
events.ScheduleEvent(EVENT_VOL7RON_ACTIVATION_2, 1000);
break;
case EVENT_VOL7RON_ACTIVATION_2:
- if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LEVIATHAN_MK_II)))
+ if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LEVIATHAN_MK_II)))
{
- if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VX_001)))
+ if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VX_001)))
{
vx001->RemoveAurasDueToSpell(SPELL_TORSO_DISABLED);
vx001->CastSpell(mkii, SPELL_MOUNT_MKII);
@@ -595,14 +595,14 @@ class boss_mimiron : public CreatureScript
events.ScheduleEvent(EVENT_VOL7RON_ACTIVATION_3, 4500);
break;
case EVENT_VOL7RON_ACTIVATION_3:
- if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LEVIATHAN_MK_II)))
+ if (Creature* mkii = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LEVIATHAN_MK_II)))
mkii->GetMotionMaster()->MovePoint(WP_MKII_P4_POS_4, VehicleRelocation[WP_MKII_P4_POS_4]);
events.ScheduleEvent(EVENT_VOL7RON_ACTIVATION_4, 5000);
break;
case EVENT_VOL7RON_ACTIVATION_4:
- if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VX_001)))
+ if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VX_001)))
{
- if (Creature* aerial = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AERIAL_COMMAND_UNIT)))
+ if (Creature* aerial = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT)))
{
aerial->GetMotionMaster()->MoveLand(0, (aerial->GetPositionX(), aerial->GetPositionY(), aerial->GetPositionZMinusOffset()));
aerial->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
@@ -617,13 +617,13 @@ class boss_mimiron : public CreatureScript
events.ScheduleEvent(EVENT_VOL7RON_ACTIVATION_6, 3000);
break;
case EVENT_VOL7RON_ACTIVATION_6:
- if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VX_001)))
+ if (Creature* vx001 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VX_001)))
DoCast(vx001, SPELL_SEAT_2);
events.ScheduleEvent(EVENT_VOL7RON_ACTIVATION_7, 5000);
break;
case EVENT_VOL7RON_ACTIVATION_7:
for (uint8 data = DATA_LEVIATHAN_MK_II; data <= DATA_AERIAL_COMMAND_UNIT; ++data)
- if (Creature* mimironVehicle = ObjectAccessor::GetCreature(*me, instance->GetData64(data)))
+ if (Creature* mimironVehicle = ObjectAccessor::GetCreature(*me, instance->GetGuidData(data)))
mimironVehicle->AI()->DoAction(DO_ASSEMBLED_COMBAT);
break;
case EVENT_OUTTRO_1:
@@ -636,7 +636,7 @@ class boss_mimiron : public CreatureScript
Talk(SAY_V07TRON_DEATH);
if (_fireFighter)
{
- if (Creature* computer = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_COMPUTER)))
+ if (Creature* computer = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_COMPUTER)))
computer->AI()->DoAction(DO_DEACTIVATE_COMPUTER);
me->SummonGameObject(RAID_MODE(GO_CACHE_OF_INNOVATION_FIREFIGHTER, GO_CACHE_OF_INNOVATION_FIREFIGHTER_HERO), 2744.040f, 2569.352f, 364.3135f, 3.124123f, 0.f, 0.f, 0.9999619f, 0.008734641f, 604800);
}
@@ -772,7 +772,7 @@ class boss_leviathan_mk_ii : public CreatureScript
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
- if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON)))
+ if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON)))
mimiron->AI()->Talk(events.IsInPhase(PHASE_LEVIATHAN_MK_II) ? SAY_MKII_SLAY : SAY_V07TRON_SLAY);
}
@@ -787,7 +787,7 @@ class boss_leviathan_mk_ii : public CreatureScript
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_HALF_HEAL);
- if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON)))
+ if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON)))
mimiron->AI()->DoAction(DO_ACTIVATE_VX001);
break;
case WP_MKII_P4_POS_1:
@@ -797,7 +797,7 @@ class boss_leviathan_mk_ii : public CreatureScript
events.ScheduleEvent(EVENT_MOVE_POINT_3, 1);
break;
case WP_MKII_P4_POS_3:
- if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON)))
+ if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON)))
mimiron->AI()->DoAction(DO_ACTIVATE_V0L7R0N_2);
break;
case WP_MKII_P4_POS_4:
@@ -937,7 +937,7 @@ class boss_vx_001 : public CreatureScript
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // | UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_HALF_HEAL); // has no effect, wat
DoCast(me, SPELL_TORSO_DISABLED);
- if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON)))
+ if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON)))
mimiron->AI()->DoAction(DO_ACTIVATE_AERIAL);
}
else if (events.IsInPhase(PHASE_VOL7RON))
@@ -1008,7 +1008,7 @@ class boss_vx_001 : public CreatureScript
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
- if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON)))
+ if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON)))
mimiron->AI()->Talk(events.IsInPhase(PHASE_VX_001) ? SAY_VX001_SLAY : SAY_V07TRON_SLAY);
}
@@ -1028,7 +1028,7 @@ class boss_vx_001 : public CreatureScript
// Handle rotation during SPELL_SPINNING_UP, SPELL_P3WX2_LASER_BARRAGE, SPELL_RAPID_BURST, and SPELL_HAND_PULSE_LEFT/RIGHT
if (me->HasUnitState(UNIT_STATE_CASTING))
{
- if (Creature* channelTarget = ObjectAccessor::GetCreature(*me, me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)))
+ if (Creature* channelTarget = ObjectAccessor::GetCreature(*me, me->GetChannelObjectGuid()))
me->SetFacingToObject(channelTarget);
return;
}
@@ -1183,7 +1183,7 @@ class boss_aerial_command_unit : public CreatureScript
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
- if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON)))
+ if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON)))
mimiron->AI()->Talk(events.IsInPhase(PHASE_AERIAL_COMMAND_UNIT) ? SAY_AERIAL_SLAY : SAY_V07TRON_SLAY);
}
@@ -1193,7 +1193,7 @@ class boss_aerial_command_unit : public CreatureScript
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON)))
+ if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON)))
mimiron->AI()->DoAction(DO_ACTIVATE_V0L7R0N_1);
}
}
@@ -1414,7 +1414,7 @@ class npc_mimiron_computer : public CreatureScript
{
case EVENT_SELF_DESTRUCT_10:
Talk(SAY_SELF_DESTRUCT_10);
- if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON)))
+ if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON)))
mimiron->AI()->DoAction(DO_ACTIVATE_HARD_MODE);
events.ScheduleEvent(EVENT_SELF_DESTRUCT_9, 60000);
break;
@@ -1456,7 +1456,7 @@ class npc_mimiron_computer : public CreatureScript
break;
case EVENT_SELF_DESTRUCT_FINALIZED:
Talk(SAY_SELF_DESTRUCT_FINALIZED);
- if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MIMIRON)))
+ if (Creature* mimiron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_MIMIRON)))
mimiron->AI()->DoAction(DO_ACTIVATE_SELF_DESTRUCT);
DoCast(me, SPELL_SELF_DESTRUCTION_AURA);
DoCast(me, SPELL_SELF_DESTRUCTION_VISUAL);
@@ -1634,7 +1634,7 @@ class go_mimiron_hardmode_button : public GameObjectScript
if (!instance)
return false;
- if (Creature* computer = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_COMPUTER)))
+ if (Creature* computer = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_COMPUTER)))
computer->AI()->DoAction(DO_ACTIVATE_COMPUTER);
go->SetGoState(GO_STATE_ACTIVE);
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
@@ -1656,7 +1656,7 @@ class spell_mimiron_bomb_bot : public SpellScriptLoader
{
if (GetHitPlayer())
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (Creature* mkii = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_LEVIATHAN_MK_II)))
+ if (Creature* mkii = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_LEVIATHAN_MK_II)))
mkii->AI()->SetData(DATA_SETUP_BOMB, 0);
}
@@ -1953,7 +1953,7 @@ class spell_mimiron_p3wx2_laser_barrage : public SpellScriptLoader
void OnHit(SpellEffIndex /*effIndex*/)
{
- GetCaster()->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, GetHitUnit()->GetGUID());
+ GetCaster()->SetChannelObjectGuid(GetHitUnit()->GetGUID());
}
void Register() override
@@ -2022,7 +2022,7 @@ class spell_mimiron_proximity_explosion : public SpellScriptLoader
{
if (GetHitPlayer())
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (Creature* mkII = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_LEVIATHAN_MK_II)))
+ if (Creature* mkII = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_LEVIATHAN_MK_II)))
mkII->AI()->SetData(DATA_SETUP_MINE, 0);
}
@@ -2239,7 +2239,7 @@ class spell_mimiron_rocket_strike_damage : public SpellScriptLoader
{
if (GetHitPlayer())
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (Creature* mkii = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_LEVIATHAN_MK_II)))
+ if (Creature* mkii = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_LEVIATHAN_MK_II)))
mkii->AI()->SetData(DATA_SETUP_ROCKET, 0);
}
@@ -2298,7 +2298,7 @@ class spell_mimiron_rocket_strike_target_select : public SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_ROCKET_STRIKE, true, NULL, NULL, instance->GetData64(DATA_VX_001));
+ GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_ROCKET_STRIKE, true, NULL, NULL, instance->GetGuidData(DATA_VX_001));
GetCaster()->SetDisplayId(11686);
}
@@ -2357,7 +2357,7 @@ class spell_mimiron_spinning_up : public SpellScriptLoader
void OnHit(SpellEffIndex /*effIndex*/)
{
if (GetHitUnit() != GetCaster())
- GetCaster()->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, GetHitUnit()->GetGUID());
+ GetCaster()->SetChannelObjectGuid(GetHitUnit()->GetGUID());
}
void Register() override
@@ -2394,7 +2394,7 @@ class spell_mimiron_summon_assault_bot : public SpellScriptLoader
if (Unit* caster = GetCaster())
if (InstanceScript* instance = caster->GetInstanceScript())
if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS)
- caster->CastSpell(caster, SPELL_SUMMON_ASSAULT_BOT, false, NULL, aurEff, instance->GetData64(DATA_AERIAL_COMMAND_UNIT));
+ caster->CastSpell(caster, SPELL_SUMMON_ASSAULT_BOT, false, NULL, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT));
}
void Register() override
@@ -2466,7 +2466,7 @@ class spell_mimiron_summon_fire_bot : public SpellScriptLoader
if (Unit* caster = GetCaster())
if (InstanceScript* instance = caster->GetInstanceScript())
if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS)
- caster->CastSpell(caster, SPELL_SUMMON_FIRE_BOT, false, NULL, aurEff, instance->GetData64(DATA_AERIAL_COMMAND_UNIT));
+ caster->CastSpell(caster, SPELL_SUMMON_FIRE_BOT, false, NULL, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT));
}
void Register() override
@@ -2662,7 +2662,7 @@ class spell_mimiron_summon_junk_bot : public SpellScriptLoader
if (Unit* caster = GetCaster())
if (InstanceScript* instance = caster->GetInstanceScript())
if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS)
- caster->CastSpell(caster, SPELL_SUMMON_JUNK_BOT, false, NULL, aurEff, instance->GetData64(DATA_AERIAL_COMMAND_UNIT));
+ caster->CastSpell(caster, SPELL_SUMMON_JUNK_BOT, false, NULL, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT));
}
void Register() override
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
index d53ac6d91d6..cad6b045120 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
@@ -203,13 +203,13 @@ class boss_razorscale_controller : public CreatureScript
switch (spell->Id)
{
case SPELL_FLAMED:
- if (GameObject* Harpoon1 = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_RAZOR_HARPOON_1)))
+ if (GameObject* Harpoon1 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_RAZOR_HARPOON_1)))
Harpoon1->RemoveFromWorld();
- if (GameObject* Harpoon2 = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_RAZOR_HARPOON_2)))
+ if (GameObject* Harpoon2 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_RAZOR_HARPOON_2)))
Harpoon2->RemoveFromWorld();
- if (GameObject* Harpoon3 = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_RAZOR_HARPOON_3)))
+ if (GameObject* Harpoon3 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_RAZOR_HARPOON_3)))
Harpoon3->RemoveFromWorld();
- if (GameObject* Harpoon4 = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_RAZOR_HARPOON_4)))
+ if (GameObject* Harpoon4 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_RAZOR_HARPOON_4)))
Harpoon4->RemoveFromWorld();
DoAction(ACTION_HARPOON_BUILD);
DoAction(ACTION_PLACE_BROKEN_HARPOON);
@@ -312,7 +312,7 @@ class go_razorscale_harpoon : public GameObjectScript
bool OnGossipHello(Player* /*player*/, GameObject* go) override
{
InstanceScript* instance = go->GetInstanceScript();
- if (ObjectAccessor::GetCreature(*go, instance->GetData64(BOSS_RAZORSCALE)))
+ if (ObjectAccessor::GetCreature(*go, instance->GetGuidData(BOSS_RAZORSCALE)))
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
return false;
}
@@ -357,14 +357,14 @@ class boss_razorscale : public CreatureScript
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_PASSIVE);
Initialize();
- if (Creature* commander = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EXPEDITION_COMMANDER)))
+ if (Creature* commander = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EXPEDITION_COMMANDER)))
commander->AI()->DoAction(ACTION_COMMANDER_RESET);
}
void EnterCombat(Unit* /*who*/) override
{
_EnterCombat();
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RAZORSCALE_CONTROL)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_RAZORSCALE_CONTROL)))
controller->AI()->DoAction(ACTION_HARPOON_BUILD);
me->SetSpeed(MOVE_FLIGHT, 3.0f, true);
me->SetReactState(REACT_PASSIVE);
@@ -379,7 +379,7 @@ class boss_razorscale : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
_JustDied();
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RAZORSCALE_CONTROL)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_RAZORSCALE_CONTROL)))
controller->AI()->Reset();
}
@@ -455,7 +455,7 @@ class boss_razorscale : public CreatureScript
me->SetCanFly(false);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED);
- if (Creature* commander = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EXPEDITION_COMMANDER)))
+ if (Creature* commander = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EXPEDITION_COMMANDER)))
commander->AI()->DoAction(ACTION_GROUND_PHASE);
events.ScheduleEvent(EVENT_BREATH, 30000, 0, PHASE_GROUND);
events.ScheduleEvent(EVENT_BUFFET, 33000, 0, PHASE_GROUND);
@@ -471,7 +471,7 @@ class boss_razorscale : public CreatureScript
return;
case EVENT_BUFFET:
DoCastAOE(SPELL_WINGBUFFET);
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RAZORSCALE_CONTROL)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_RAZORSCALE_CONTROL)))
controller->CastSpell(controller, SPELL_FLAMED, true);
events.CancelEvent(EVENT_BUFFET);
return;
@@ -602,12 +602,10 @@ class npc_expedition_commander : public CreatureScript
struct npc_expedition_commanderAI : public ScriptedAI
{
- npc_expedition_commanderAI(Creature* creature) : ScriptedAI(creature)
+ npc_expedition_commanderAI(Creature* creature) : ScriptedAI(creature), summons(creature)
{
Initialize();
instance = me->GetInstanceScript();
- memset(Engineer, 0, sizeof(Engineer));
- memset(Defender, 0, sizeof(Defender));
}
void Initialize()
@@ -618,18 +616,18 @@ class npc_expedition_commander : public CreatureScript
}
InstanceScript* instance;
- std::list<uint64> summons;
+ SummonList summons;
bool Greet;
uint32 AttackStartTimer;
uint8 Phase;
- uint64 Engineer[4];
- uint64 Defender[4];
+ ObjectGuid Engineer[4];
+ ObjectGuid Defender[4];
void Reset() override
{
Initialize();
- summons.clear();
+ summons.DespawnAll();
}
void MoveInLineOfSight(Unit* who) override
@@ -644,7 +642,7 @@ class npc_expedition_commander : public CreatureScript
void JustSummoned(Creature* summoned) override
{
- summons.push_back(summoned->GetGUID());
+ summons.Summon(summoned);
}
void DoAction(int32 action) override
@@ -655,7 +653,7 @@ class npc_expedition_commander : public CreatureScript
Talk(SAY_GROUND_PHASE);
break;
case ACTION_COMMANDER_RESET:
- summons.clear();
+ summons.DespawnAll();
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
break;
}
@@ -669,7 +667,7 @@ class npc_expedition_commander : public CreatureScript
{
case 1:
instance->SetBossState(BOSS_RAZORSCALE, IN_PROGRESS);
- summons.clear();
+ summons.DespawnAll();
AttackStartTimer = 1000;
Phase = 2;
break;
@@ -715,7 +713,7 @@ class npc_expedition_commander : public CreatureScript
Phase = 5;
break;
case 5:
- if (Creature* Razorscale = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_RAZORSCALE)))
+ if (Creature* Razorscale = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_RAZORSCALE)))
{
Razorscale->AI()->DoAction(ACTION_EVENT_START);
me->SetInCombatWith(Razorscale);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
index 18b9a3040fe..2032c7b861d 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
@@ -460,7 +460,7 @@ class npc_xt002_heart : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- Creature* xt002 = _instance ? ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)) : NULL;
+ Creature* xt002 = _instance ? ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_XT002)) : NULL;
if (!xt002 || !xt002->AI())
return;
@@ -512,7 +512,7 @@ class npc_scrapbot : public CreatureScript
Initialize();
- if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)))
+ if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_XT002)))
me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f);
}
@@ -520,7 +520,7 @@ class npc_scrapbot : public CreatureScript
{
if (_rangeCheckTimer <= diff)
{
- if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)))
+ if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_XT002)))
{
if (me->IsWithinMeleeRange(xt002))
{
@@ -575,7 +575,7 @@ class npc_pummeller : public CreatureScript
{
Initialize();
- if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)))
+ if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_XT002)))
{
Position pos = xt002->GetPosition();
me->GetMotionMaster()->MovePoint(0, pos);
@@ -689,7 +689,7 @@ class npc_boombot : public CreatureScript
me->SetFloatValue(UNIT_FIELD_MAXDAMAGE, 18000.0f);
/// @todo proper waypoints?
- if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)))
+ if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_XT002)))
me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f);
}
@@ -939,7 +939,7 @@ class spell_xt002_heart_overload_periodic : public SpellScriptLoader
{
if (InstanceScript* instance = caster->GetInstanceScript())
{
- if (Unit* toyPile = ObjectAccessor::GetUnit(*caster, instance->GetData64(DATA_TOY_PILE_0 + urand(0, 3))))
+ if (Unit* toyPile = ObjectAccessor::GetUnit(*caster, instance->GetGuidData(DATA_TOY_PILE_0 + urand(0, 3))))
{
caster->CastSpell(toyPile, SPELL_ENERGY_ORB, true);
@@ -952,7 +952,7 @@ class spell_xt002_heart_overload_periodic : public SpellScriptLoader
{
uint8 a = urand(0, 4);
uint32 spellId = spells[a];
- toyPile->CastSpell(toyPile, spellId, true, NULL, NULL, instance->GetData64(BOSS_XT002));
+ toyPile->CastSpell(toyPile, spellId, true, NULL, NULL, instance->GetGuidData(BOSS_XT002));
}
}
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
index d3012dc99ba..391aebf9229 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
@@ -451,7 +451,7 @@ class boss_voice_of_yogg_saron : public CreatureScript
BossAI::EnterEvadeMode();
for (uint8 i = DATA_SARA; i <= DATA_MIMIRON_YS; ++i)
- if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(i)))
+ if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetGuidData(i)))
creature->AI()->EnterEvadeMode();
// not sure, spoken by Sara (sound), regarding to wowwiki Voice whispers it
@@ -490,11 +490,11 @@ class boss_voice_of_yogg_saron : public CreatureScript
void EnterCombat(Unit* /*who*/) override
{
- if (Creature* sara = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SARA)))
+ if (Creature* sara = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARA)))
sara->SetInCombatWith(me);
for (uint8 i = DATA_FREYA_YS; i <= DATA_MIMIRON_YS; ++i)
- if (Creature* keeper = ObjectAccessor::GetCreature(*me, instance->GetData64(i)))
+ if (Creature* keeper = ObjectAccessor::GetCreature(*me, instance->GetGuidData(i)))
keeper->SetInCombatWith(me);
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
@@ -510,7 +510,7 @@ class boss_voice_of_yogg_saron : public CreatureScript
void JustDied(Unit* killer) override
{
// don't despawn Yogg-Saron's corpse, remove him from SummonList!
- if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_YOGG_SARON)))
+ if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_YOGG_SARON)))
summons.Despawn(yogg);
BossAI::JustDied(killer);
@@ -535,7 +535,7 @@ class boss_voice_of_yogg_saron : public CreatureScript
instance->SetBossState(BOSS_YOGG_SARON, IN_PROGRESS);
break;
case EVENT_EXTINGUISH_ALL_LIFE:
- if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_YOGG_SARON)))
+ if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_YOGG_SARON)))
{
yogg->AI()->Talk(EMOTE_YOGG_SARON_EXTINGUISH_ALL_LIFE, me);
yogg->CastSpell((Unit*)NULL, SPELL_EXTINGUISH_ALL_LIFE, true);
@@ -563,7 +563,7 @@ class boss_voice_of_yogg_saron : public CreatureScript
break;
case EVENT_ILLUSION:
{
- if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_YOGG_SARON)))
+ if (Creature* yogg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_YOGG_SARON)))
{
yogg->AI()->Talk(EMOTE_YOGG_SARON_MADNESS);
yogg->AI()->Talk(SAY_YOGG_SARON_MADNESS);
@@ -576,7 +576,7 @@ class boss_voice_of_yogg_saron : public CreatureScript
uint8 illusion = urand(CHAMBER_ILLUSION, STORMWIND_ILLUSION);
instance->SetData(DATA_ILLUSION, illusion);
- if (Creature* brain = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRAIN_OF_YOGG_SARON)))
+ if (Creature* brain = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRAIN_OF_YOGG_SARON)))
brain->AI()->DoAction(ACTION_INDUCE_MADNESS);
events.ScheduleEvent(EVENT_ILLUSION, 80000, 0, PHASE_TWO); // wowwiki says 80 secs, wowhead says something about 90 secs
break;
@@ -602,7 +602,7 @@ class boss_voice_of_yogg_saron : public CreatureScript
case ACTION_PHASE_TWO:
events.SetPhase(PHASE_TWO);
me->SummonCreature(NPC_YOGG_SARON, YoggSaronSpawnPos);
- if (Creature* brain = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRAIN_OF_YOGG_SARON)))
+ if (Creature* brain = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRAIN_OF_YOGG_SARON)))
brain->SetInCombatWithZone();
events.ScheduleEvent(EVENT_SUMMON_CORRUPTOR_TENTACLE, 1, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO);
events.ScheduleEvent(EVENT_SUMMON_CONSTRICTOR_TENTACLE, 1, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO);
@@ -672,23 +672,23 @@ class boss_sara : public CreatureScript
{
boss_saraAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
- uint64 GetLinkedPlayerGUID(uint64 guid) const
+ ObjectGuid GetLinkedPlayerGUID(ObjectGuid guid) const
{
- std::map<uint64, uint64>::const_iterator itr = _linkData.find(guid);
+ std::map<ObjectGuid, ObjectGuid>::const_iterator itr = _linkData.find(guid);
if (itr != _linkData.end())
return itr->second;
- return 0;
+ return ObjectGuid::Empty;
}
- void SetLinkBetween(uint64 player1, uint64 player2)
+ void SetLinkBetween(ObjectGuid player1, ObjectGuid player2)
{
_linkData[player1] = player2;
_linkData[player2] = player1;
}
// called once for each target on aura remove
- void RemoveLinkFrom(uint64 player1)
+ void RemoveLinkFrom(ObjectGuid player1)
{
_linkData.erase(player1);
}
@@ -699,7 +699,7 @@ class boss_sara : public CreatureScript
{
damage = 0;
- if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON)))
+ if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON)))
voice->AI()->DoAction(ACTION_PHASE_TRANSFORM);
Talk(SAY_SARA_TRANSFORM_1);
@@ -794,14 +794,14 @@ class boss_sara : public CreatureScript
Talk(SAY_SARA_TRANSFORM_4);
DoCast(me, SPELL_FULL_HEAL);
me->setFaction(16);
- if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON)))
+ if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON)))
voice->AI()->DoAction(ACTION_PHASE_TWO);
- if (Creature* mimiron = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MIMIRON_YS)))
+ if (Creature* mimiron = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MIMIRON_YS)))
mimiron->AI()->DoAction(ACTION_PHASE_TWO);
break;
case EVENT_TRANSFORM_4:
DoCast(me, SPELL_PHASE_2_TRANSFORM);
- if (Creature* yogg = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_YOGG_SARON)))
+ if (Creature* yogg = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_YOGG_SARON)))
DoCast(yogg, SPELL_RIDE_YOGG_SARON_VEHICLE);
DoCast(me, SPELL_SHADOWY_BARRIER_SARA);
_events.SetPhase(PHASE_TWO);
@@ -857,7 +857,7 @@ class boss_sara : public CreatureScript
break;
}
- if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON)))
+ if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON)))
voice->AI()->JustSummoned(summon);
}
@@ -876,7 +876,7 @@ class boss_sara : public CreatureScript
private:
EventMap _events;
InstanceScript* _instance;
- std::map<uint64, uint64> _linkData;
+ std::map<ObjectGuid, ObjectGuid> _linkData;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -926,15 +926,15 @@ class boss_yogg_saron : public CreatureScript
{
Talk(SAY_YOGG_SARON_DEATH);
- if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON)))
+ if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON)))
me->Kill(creature);
for (uint8 i = DATA_SARA; i <= DATA_BRAIN_OF_YOGG_SARON; ++i)
- if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetData64(i)))
+ if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(i)))
creature->DisappearAndDie();
for (uint8 i = DATA_FREYA_YS; i <= DATA_MIMIRON_YS; ++i)
- if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetData64(i)))
+ if (Creature* creature = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(i)))
creature->AI()->EnterEvadeMode();
Map::PlayerList const& players = me->GetMap()->GetPlayers();
@@ -1043,15 +1043,15 @@ class boss_brain_of_yogg_saron : public CreatureScript
DoCast(me, SPELL_BRAIN_HURT_VISUAL, true);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
- if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON)))
+ if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON)))
voice->AI()->DoAction(ACTION_PHASE_THREE);
- if (Creature* sara = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SARA)))
+ if (Creature* sara = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SARA)))
sara->AI()->DoAction(ACTION_PHASE_THREE);
- if (Creature* yogg = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_YOGG_SARON)))
+ if (Creature* yogg = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_YOGG_SARON)))
yogg->AI()->DoAction(ACTION_PHASE_THREE);
for (uint8 i = DATA_THORIM_YS; i <= DATA_MIMIRON_YS; ++i)
- if (Creature* keeper = ObjectAccessor::GetCreature(*me, _instance->GetData64(i)))
+ if (Creature* keeper = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(i)))
keeper->AI()->DoAction(ACTION_PHASE_THREE);
}
}
@@ -1070,7 +1070,7 @@ class boss_brain_of_yogg_saron : public CreatureScript
// make sure doors won't be opened
for (uint32 i = GO_BRAIN_ROOM_DOOR_1; i <= GO_BRAIN_ROOM_DOOR_3; ++i)
- _instance->HandleGameObject(_instance->GetData64(i), false);
+ _instance->HandleGameObject(_instance->GetGuidData(i), false);
DoCastAOE(SPELL_INDUCE_MADNESS);
break;
@@ -1083,9 +1083,9 @@ class boss_brain_of_yogg_saron : public CreatureScript
sCreatureTextMgr->SendChat(me, EMOTE_BRAIN_ILLUSION_SHATTERED, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_AREA);
_summons.DespawnAll();
DoCastAOE(SPELL_SHATTERED_ILLUSION, true);
- _instance->HandleGameObject(_instance->GetData64(GO_BRAIN_ROOM_DOOR_1 + illusion), true);
+ _instance->HandleGameObject(_instance->GetGuidData(GO_BRAIN_ROOM_DOOR_1 + illusion), true);
- if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON)))
+ if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON)))
voice->AI()->DoAction(ACTION_TOGGLE_SHATTERED_ILLUSION);
}
break;
@@ -1211,7 +1211,7 @@ class npc_guardian_of_yogg_saron : public CreatureScript
return;
// Guardian can be summoned both by Voice of Yogg-Saron and by Ominous Cloud
- if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON)))
+ if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON)))
voice->AI()->JustSummoned(me);
}
@@ -1314,7 +1314,7 @@ class npc_constrictor_tentacle : public CreatureScript
void IsSummonedBy(Unit* /*summoner*/) override
{
- if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VOICE_OF_YOGG_SARON)))
+ if (Creature* voice = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON)))
voice->AI()->JustSummoned(me);
}
@@ -1405,7 +1405,7 @@ class npc_influence_tentacle : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* brain = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_BRAIN_OF_YOGG_SARON)))
+ if (Creature* brain = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_BRAIN_OF_YOGG_SARON)))
brain->AI()->DoAction(ACTION_TENTACLE_KILLED);
}
@@ -2791,7 +2791,7 @@ class spell_yogg_saron_induce_madness : public SpellScriptLoader // 64059
if (Unit* target = GetHitUnit())
{
target->CastSpell(target, SPELL_TELEPORT_BACK_TO_MAIN_ROOM);
- target->RemoveAurasDueToSpell(SPELL_SANITY, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL);
+ target->RemoveAurasDueToSpell(SPELL_SANITY, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL);
target->RemoveAurasDueToSpell(uint32(GetEffectValue()));
}
}
@@ -2801,7 +2801,7 @@ class spell_yogg_saron_induce_madness : public SpellScriptLoader // 64059
GetCaster()->CastSpell((Unit*)NULL, SPELL_SHATTERED_ILLUSION_REMOVE);
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (Creature* voice = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_VOICE_OF_YOGG_SARON)))
+ if (Creature* voice = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_VOICE_OF_YOGG_SARON)))
voice->AI()->DoAction(ACTION_TOGGLE_SHATTERED_ILLUSION);
}
@@ -3081,7 +3081,7 @@ class spell_yogg_saron_in_the_maws_of_the_old_god : public SpellScriptLoader
SpellCastResult CheckRequirement()
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (Creature* yogg = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(BOSS_YOGG_SARON)))
+ if (Creature* yogg = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(BOSS_YOGG_SARON)))
if (yogg->FindCurrentSpellBySpellId(SPELL_DEAFENING_ROAR))
{
if (GetCaster()->GetDistance(yogg) > 20.0f)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index 56f5c19c574..016c0bff1e5 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -63,50 +63,50 @@ class instance_ulduar : public InstanceMapScript
instance_ulduar_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { }
// Creatures
- uint64 LeviathanGUID;
- uint64 IgnisGUID;
- uint64 RazorscaleGUID;
- uint64 RazorscaleController;
- uint64 ExpeditionCommanderGUID;
- uint64 XT002GUID;
- uint64 XTToyPileGUIDs[4];
- uint64 AssemblyGUIDs[3];
- uint64 KologarnGUID;
- uint64 AuriayaGUID;
- uint64 HodirGUID;
- uint64 ThorimGUID;
- uint64 FreyaGUID;
- uint64 ElderGUIDs[3];
- uint64 MimironGUID;
- uint64 MimironVehicleGUIDs[3];
- uint64 MimironComputerGUID;
- uint64 MimironWorldTriggerGUID;
- uint64 VezaxGUID;
- uint64 YoggSaronGUID;
- uint64 VoiceOfYoggSaronGUID;
- uint64 SaraGUID;
- uint64 BrainOfYoggSaronGUID;
- uint64 KeeperGUIDs[4];
- uint64 AlgalonGUID;
- uint64 BrannBronzebeardAlgGUID;
+ ObjectGuid LeviathanGUID;
+ ObjectGuid IgnisGUID;
+ ObjectGuid RazorscaleGUID;
+ ObjectGuid RazorscaleController;
+ ObjectGuid ExpeditionCommanderGUID;
+ ObjectGuid XT002GUID;
+ ObjectGuid XTToyPileGUIDs[4];
+ ObjectGuid AssemblyGUIDs[3];
+ ObjectGuid KologarnGUID;
+ ObjectGuid AuriayaGUID;
+ ObjectGuid HodirGUID;
+ ObjectGuid ThorimGUID;
+ ObjectGuid FreyaGUID;
+ ObjectGuid ElderGUIDs[3];
+ ObjectGuid MimironGUID;
+ ObjectGuid MimironVehicleGUIDs[3];
+ ObjectGuid MimironComputerGUID;
+ ObjectGuid MimironWorldTriggerGUID;
+ ObjectGuid VezaxGUID;
+ ObjectGuid YoggSaronGUID;
+ ObjectGuid VoiceOfYoggSaronGUID;
+ ObjectGuid SaraGUID;
+ ObjectGuid BrainOfYoggSaronGUID;
+ ObjectGuid KeeperGUIDs[4];
+ ObjectGuid AlgalonGUID;
+ ObjectGuid BrannBronzebeardAlgGUID;
// GameObjects
- uint64 LeviathanGateGUID;
- uint64 RazorHarpoonGUIDs[4];
- uint64 KologarnChestGUID;
- uint64 KologarnBridgeGUID;
- uint64 ThorimChestGUID;
- uint64 HodirRareCacheGUID;
- uint64 HodirChestGUID;
- uint64 MimironTramGUID;
- uint64 MimironElevatorGUID;
- uint64 MimironButtonGUID;
- uint64 BrainRoomDoorGUIDs[3];
- uint64 AlgalonSigilDoorGUID[3];
- uint64 AlgalonFloorGUID[2];
- uint64 AlgalonUniverseGUID;
- uint64 AlgalonTrapdoorGUID;
- uint64 GiftOfTheObserverGUID;
+ ObjectGuid LeviathanGateGUID;
+ ObjectGuid RazorHarpoonGUIDs[4];
+ ObjectGuid KologarnChestGUID;
+ ObjectGuid KologarnBridgeGUID;
+ ObjectGuid ThorimChestGUID;
+ ObjectGuid HodirRareCacheGUID;
+ ObjectGuid HodirChestGUID;
+ ObjectGuid MimironTramGUID;
+ ObjectGuid MimironElevatorGUID;
+ ObjectGuid MimironButtonGUID;
+ ObjectGuid BrainRoomDoorGUIDs[3];
+ ObjectGuid AlgalonSigilDoorGUID[3];
+ ObjectGuid AlgalonFloorGUID[2];
+ ObjectGuid AlgalonUniverseGUID;
+ ObjectGuid AlgalonTrapdoorGUID;
+ ObjectGuid GiftOfTheObserverGUID;
// Miscellaneous
uint32 TeamInInstance;
@@ -119,47 +119,12 @@ class instance_ulduar : public InstanceMapScript
bool Unbroken;
bool IsDriveMeCrazyEligible;
- std::set<uint64> mRubbleSpawns;
-
void Initialize() override
{
SetHeaders(DataHeader);
SetBossNumber(MAX_ENCOUNTER);
LoadDoorData(doorData);
LoadMinionData(minionData);
- LeviathanGUID = 0;
- IgnisGUID = 0;
- RazorscaleGUID = 0;
- RazorscaleController = 0;
- ExpeditionCommanderGUID = 0;
- XT002GUID = 0;
- KologarnGUID = 0;
- AuriayaGUID = 0;
- MimironGUID = 0;
- MimironComputerGUID = 0;
- MimironWorldTriggerGUID = 0;
- HodirGUID = 0;
- ThorimGUID = 0;
- FreyaGUID = 0;
- VezaxGUID = 0;
- YoggSaronGUID = 0;
- VoiceOfYoggSaronGUID = 0;
- SaraGUID = 0;
- BrainOfYoggSaronGUID = 0;
- AlgalonGUID = 0;
- KologarnChestGUID = 0;
- KologarnBridgeGUID = 0;
- ThorimChestGUID = 0;
- HodirRareCacheGUID = 0;
- HodirChestGUID = 0;
- MimironTramGUID = 0;
- MimironElevatorGUID = 0;
- MimironButtonGUID = 0;
- LeviathanGateGUID = 0;
- AlgalonUniverseGUID = 0;
- AlgalonTrapdoorGUID = 0;
- BrannBronzebeardAlgGUID = 0;
- GiftOfTheObserverGUID = 0;
_algalonTimer = 61;
_maxArmorItemLevel = 0;
_maxWeaponItemLevel = 0;
@@ -175,17 +140,8 @@ class instance_ulduar : public InstanceMapScript
_algalonSummoned = false;
_summonAlgalon = false;
- memset(AlgalonSigilDoorGUID, 0, sizeof(AlgalonSigilDoorGUID));
- memset(AlgalonFloorGUID, 0, sizeof(AlgalonFloorGUID));
- memset(XTToyPileGUIDs, 0, sizeof(XTToyPileGUIDs));
- memset(AssemblyGUIDs, 0, sizeof(AssemblyGUIDs));
- memset(RazorHarpoonGUIDs, 0, sizeof(RazorHarpoonGUIDs));
- memset(ElderGUIDs, 0, sizeof(ElderGUIDs));
- memset(MimironVehicleGUIDs, 0, sizeof(MimironVehicleGUIDs));
- memset(BrainRoomDoorGUIDs, 0, sizeof(BrainRoomDoorGUIDs));
- memset(KeeperGUIDs, 0, sizeof(KeeperGUIDs));
- memset(_summonObservationRingKeeper, false, sizeof(_summonObservationRingKeeper));
- memset(_summonYSKeeper, false, sizeof(_summonYSKeeper));
+ memset(_summonObservationRingKeeper, 0, sizeof(_summonObservationRingKeeper));
+ memset(_summonYSKeeper, 0, sizeof(_summonYSKeeper));
}
void FillInitialWorldStates(WorldPacket& packet) override
@@ -460,7 +416,7 @@ class instance_ulduar : public InstanceMapScript
for (uint8 i = 0; i < 4; ++i)
if (XTToyPileGUIDs[i] == creature->GetGUID())
{
- XTToyPileGUIDs[i] = 0;
+ XTToyPileGUIDs[i].Clear();
break;
}
break;
@@ -471,7 +427,7 @@ class instance_ulduar : public InstanceMapScript
break;
case NPC_BRANN_BRONZBEARD_ALG:
if (BrannBronzebeardAlgGUID == creature->GetGUID())
- BrannBronzebeardAlgGUID = 0;
+ BrannBronzebeardAlgGUID.Clear();
break;
default:
break;
@@ -489,7 +445,7 @@ class instance_ulduar : public InstanceMapScript
case GO_KOLOGARN_BRIDGE:
KologarnBridgeGUID = gameObject->GetGUID();
if (GetBossState(BOSS_KOLOGARN) == DONE)
- HandleGameObject(0, false, gameObject);
+ HandleGameObject(ObjectGuid::Empty, false, gameObject);
break;
case GO_THORIM_CHEST_HERO:
case GO_THORIM_CHEST:
@@ -844,11 +800,11 @@ class instance_ulduar : public InstanceMapScript
}
}
- void SetData64(uint32 /*type*/, uint64 /*data*/) override
+ void SetGuidData(uint32 /*type*/, ObjectGuid /*data*/) override
{
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -975,7 +931,7 @@ class instance_ulduar : public InstanceMapScript
return BrannBronzebeardAlgGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
uint32 GetData(uint32 type) const override
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
index ee52df58c80..c08e1934552 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
@@ -287,7 +287,7 @@ class npc_annhylde_the_caller : public CreatureScript
{
case 1:
Talk(YELL_RESURRECT);
- if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR)))
+ if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_INGVAR)))
{
ingvar->RemoveAura(SPELL_SUMMON_BANSHEE);
ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_DUMMY, true);
@@ -316,7 +316,7 @@ class npc_annhylde_the_caller : public CreatureScript
switch (eventId)
{
case EVENT_RESURRECT_1:
- if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR)))
+ if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_INGVAR)))
{
ingvar->RemoveAura(SPELL_INGVAR_FEIGN_DEATH);
ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_HEAL, false);
@@ -324,7 +324,7 @@ class npc_annhylde_the_caller : public CreatureScript
_events.ScheduleEvent(EVENT_RESURRECT_2, 3000);
break;
case EVENT_RESURRECT_2:
- if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR)))
+ if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_INGVAR)))
{
ingvar->RemoveAurasDueToSpell(SPELL_SCOURG_RESURRECTION_DUMMY);
ingvar->AI()->DoAction(ACTION_START_PHASE_2);
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
index ecc6de96daa..adb544cb25e 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
@@ -94,7 +94,7 @@ class npc_frost_tomb : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* keleseth = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_KELESETH)))
+ if (Creature* keleseth = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_PRINCE_KELESETH)))
keleseth->AI()->SetData(DATA_ON_THE_ROCKS, false);
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
index c6a91e3ff33..bf11e3cca7b 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
@@ -116,7 +116,7 @@ struct generic_boss_controllerAI : public BossAI
void JustDied(Unit* /*killer*/) override
{
- if (Creature* otherBoss = ObjectAccessor::GetCreature(*me, instance->GetData64(OtherBossData)))
+ if (Creature* otherBoss = ObjectAccessor::GetCreature(*me, instance->GetGuidData(OtherBossData)))
{
if (otherBoss->IsAlive())
{
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
index 78df568d144..360befc02af 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
@@ -45,11 +45,6 @@ class instance_utgarde_keep : public InstanceMapScript
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
LoadMinionData(minionData);
-
- PrinceKelesethGUID = 0;
- SkarvaldGUID = 0;
- DalronnGUID = 0;
- IngvarGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -94,39 +89,39 @@ class instance_utgarde_keep : public InstanceMapScript
{
case GO_BELLOW_1:
Forges[0].BellowGUID = go->GetGUID();
- HandleGameObject(0, Forges[0].Event != NOT_STARTED, go);
+ HandleGameObject(ObjectGuid::Empty, Forges[0].Event != NOT_STARTED, go);
break;
case GO_BELLOW_2:
Forges[1].BellowGUID = go->GetGUID();
- HandleGameObject(0, Forges[1].Event != NOT_STARTED, go);
+ HandleGameObject(ObjectGuid::Empty, Forges[1].Event != NOT_STARTED, go);
break;
case GO_BELLOW_3:
Forges[2].BellowGUID = go->GetGUID();
- HandleGameObject(0, Forges[2].Event != NOT_STARTED, go);
+ HandleGameObject(ObjectGuid::Empty, Forges[2].Event != NOT_STARTED, go);
break;
case GO_FORGEFIRE_1:
Forges[0].FireGUID = go->GetGUID();
- HandleGameObject(0, Forges[0].Event != NOT_STARTED, go);
+ HandleGameObject(ObjectGuid::Empty, Forges[0].Event != NOT_STARTED, go);
break;
case GO_FORGEFIRE_2:
Forges[1].FireGUID = go->GetGUID();
- HandleGameObject(0, Forges[1].Event != NOT_STARTED, go);
+ HandleGameObject(ObjectGuid::Empty, Forges[1].Event != NOT_STARTED, go);
break;
case GO_FORGEFIRE_3:
Forges[2].FireGUID = go->GetGUID();
- HandleGameObject(0, Forges[2].Event != NOT_STARTED, go);
+ HandleGameObject(ObjectGuid::Empty, Forges[2].Event != NOT_STARTED, go);
break;
case GO_GLOWING_ANVIL_1:
Forges[0].AnvilGUID = go->GetGUID();
- HandleGameObject(0, Forges[0].Event != NOT_STARTED, go);
+ HandleGameObject(ObjectGuid::Empty, Forges[0].Event != NOT_STARTED, go);
break;
case GO_GLOWING_ANVIL_2:
Forges[1].AnvilGUID = go->GetGUID();
- HandleGameObject(0, Forges[1].Event != NOT_STARTED, go);
+ HandleGameObject(ObjectGuid::Empty, Forges[1].Event != NOT_STARTED, go);
break;
case GO_GLOWING_ANVIL_3:
Forges[2].AnvilGUID = go->GetGUID();
- HandleGameObject(0, Forges[2].Event != NOT_STARTED, go);
+ HandleGameObject(ObjectGuid::Empty, Forges[2].Event != NOT_STARTED, go);
break;
case GO_GIANT_PORTCULLIS_1:
case GO_GIANT_PORTCULLIS_2:
@@ -150,7 +145,7 @@ class instance_utgarde_keep : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -166,7 +161,7 @@ class instance_utgarde_keep : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
void SetData(uint32 type, uint32 data) override
@@ -207,10 +202,10 @@ class instance_utgarde_keep : public InstanceMapScript
protected:
ForgeInfo Forges[3];
- uint64 PrinceKelesethGUID;
- uint64 SkarvaldGUID;
- uint64 DalronnGUID;
- uint64 IngvarGUID;
+ ObjectGuid PrinceKelesethGUID;
+ ObjectGuid SkarvaldGUID;
+ ObjectGuid DalronnGUID;
+ ObjectGuid IngvarGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h
index 751239755cf..5b52072b07f 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h
@@ -76,11 +76,11 @@ enum GameObjectIds
struct ForgeInfo
{
- ForgeInfo() : AnvilGUID(0), BellowGUID(0), FireGUID(0), Event(NOT_STARTED) { };
+ ForgeInfo() : Event(NOT_STARTED) { };
- uint64 AnvilGUID;
- uint64 BellowGUID;
- uint64 FireGUID;
+ ObjectGuid AnvilGUID;
+ ObjectGuid BellowGUID;
+ ObjectGuid FireGUID;
uint32 Event;
};
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
index b3285bd492e..061499f2025 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
@@ -129,11 +129,11 @@ public:
me->GetMotionMaster()->MoveTargetedHome();
for (uint8 i = DATA_FRENZIED_WORGEN; i <= DATA_FEROCIOUS_RHINO; ++i)
- if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(i)))
+ if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(i)))
if (!temp->IsAlive())
temp->Respawn();
- if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF_SPHERE)))
{
go->SetGoState(GO_STATE_READY);
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
@@ -224,7 +224,7 @@ public:
move = Sequence[AddCount++];
// send orb to summon spot
- if (Creature* orb = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_ORB)))
+ if (Creature* orb = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_ORB)))
if (orb->IsAlive())
orb->GetMotionMaster()->MovePoint(move, moveLocs[move]);
@@ -293,7 +293,7 @@ public:
if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS)
{
- Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF));
+ Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF));
if (palehoof && palehoof->IsAlive())
palehoof->AI()->Reset();
}
@@ -345,7 +345,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)))
+ if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF)))
palehoof->AI()->DoAction(ACTION_NEXT_PHASE);
}
@@ -407,7 +407,7 @@ public:
if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS)
{
- Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF));
+ Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF));
if (palehoof && palehoof->IsAlive())
palehoof->AI()->Reset();
}
@@ -460,7 +460,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)))
+ if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF)))
palehoof->AI()->DoAction(ACTION_NEXT_PHASE);
}
@@ -523,7 +523,7 @@ public:
if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS)
{
- Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF));
+ Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF));
if (palehoof && palehoof->IsAlive())
palehoof->AI()->Reset();
}
@@ -576,7 +576,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)))
+ if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF)))
palehoof->AI()->DoAction(ACTION_NEXT_PHASE);
}
@@ -644,7 +644,7 @@ public:
if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS)
{
- Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF));
+ Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF));
if (palehoof && palehoof->IsAlive())
palehoof->AI()->Reset();
}
@@ -698,7 +698,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)))
+ if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GORTOK_PALEHOOF)))
palehoof->AI()->DoAction(ACTION_NEXT_PHASE);
}
@@ -778,7 +778,7 @@ public:
return;
}
- if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetData64(nextBossId)))
+ if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetGuidData(nextBossId)))
{
nextBoss->RemoveAurasDueToSpell(SPELL_FREEZE);
nextBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC);
@@ -822,7 +822,7 @@ public:
return;
}
- if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetData64(nextBossId)))
+ if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetGuidData(nextBossId)))
DoCast(nextBoss, SPELL_ORB_CHANNEL, false);
currentPhase = Phase(id);
@@ -843,7 +843,7 @@ class go_palehoof_sphere : public GameObjectScript
if (!instance)
return false;
- Creature* palehoof = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_GORTOK_PALEHOOF));
+ Creature* palehoof = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_GORTOK_PALEHOOF));
if (palehoof && palehoof->IsAlive())
{
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
index af5dc4a4e03..5d6a2416d73 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
@@ -171,7 +171,6 @@ public:
{
Initialize();
instance = creature->GetInstanceScript();
- m_uiGraufGUID = 0;
m_uiMovementTimer = 0;
m_uiSummonTimer = 0;
}
@@ -191,8 +190,7 @@ public:
InstanceScript* instance;
SummonList Summons;
- uint64 m_uiGraufGUID;
- std::vector<uint64> triggersGUID;
+ ObjectGuid m_uiGraufGUID;
uint32 m_uiCrushTimer;
uint32 m_uiPoisonedSpearTimer;
@@ -208,8 +206,6 @@ public:
void Reset() override
{
- triggersGUID.clear();
-
Initialize();
Summons.DespawnAll();
@@ -274,7 +270,7 @@ public:
void SummonedCreatureDespawn(Creature* summoned) override
{
if (summoned->GetEntry() == NPC_GRAUF)
- m_uiGraufGUID = 0;
+ m_uiGraufGUID.Clear();
Summons.Despawn(summoned);
}
@@ -477,7 +473,7 @@ public:
if (!instance)
return false;
- if (Creature* pSkadi = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_SKADI_THE_RUTHLESS)))
+ if (Creature* pSkadi = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_SKADI_THE_RUTHLESS)))
player->CastSpell(pSkadi, SPELL_RAPID_FIRE, true);
return false;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
index a31aff259d1..bf9d9eaa43b 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
@@ -143,7 +143,7 @@ class boss_svala : public CreatureScript
void Initialize()
{
- _arthasGUID = 0;
+ _arthasGUID.Clear();
_sacrificed = false;
}
@@ -162,7 +162,7 @@ class boss_svala : public CreatureScript
Initialize();
- instance->SetData64(DATA_SACRIFICED_PLAYER, 0);
+ instance->SetGuidData(DATA_SACRIFICED_PLAYER, ObjectGuid::Empty);
}
void EnterCombat(Unit* /*who*/) override
@@ -188,7 +188,7 @@ class boss_svala : public CreatureScript
events.SetPhase(INTRO);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, DATA_UTGARDE_MIRROR))
+ if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_UTGARDE_MIRROR)))
mirror->SetGoState(GO_STATE_READY);
if (Creature* arthas = me->SummonCreature(NPC_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN))
@@ -331,12 +331,12 @@ class boss_svala : public CreatureScript
break;
}
case EVENT_INTRO_DESPAWN_ARTHAS:
- if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, DATA_UTGARDE_MIRROR))
+ if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_UTGARDE_MIRROR)))
mirror->SetGoState(GO_STATE_ACTIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if (Creature* arthas = ObjectAccessor::GetCreature(*me, _arthasGUID))
arthas->DespawnOrUnsummon();
- _arthasGUID = 0;
+ _arthasGUID.Clear();
events.SetPhase(NORMAL);
_introCompleted = true;
events.ScheduleEvent(EVENT_SINISTER_STRIKE, 7 * IN_MILLISECONDS, 0, NORMAL);
@@ -354,7 +354,7 @@ class boss_svala : public CreatureScript
case EVENT_RITUAL_PREPARATION:
if (Unit* sacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true))
{
- instance->SetData64(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID());
+ instance->SetGuidData(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID());
Talk(SAY_SACRIFICE_PLAYER);
DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION);
SetCombatMovement(false);
@@ -385,7 +385,7 @@ class boss_svala : public CreatureScript
}
private:
- uint64 _arthasGUID;
+ ObjectGuid _arthasGUID;
bool _sacrificed;
bool _introCompleted;
};
@@ -434,7 +434,7 @@ class npc_ritual_channeler : public CreatureScript
if (paralyzeTimer <= diff)
{
- if (Unit* victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SACRIFICED_PLAYER)))
+ if (Unit* victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_SACRIFICED_PLAYER)))
DoCast(victim, SPELL_PARALYZE, false);
paralyzeTimer = 200;
@@ -487,7 +487,7 @@ class RitualTargetCheck
bool operator() (WorldObject* obj) const
{
if (InstanceScript* instance = obj->GetInstanceScript())
- if (instance->GetData64(DATA_SACRIFICED_PLAYER) == obj->GetGUID())
+ if (instance->GetGuidData(DATA_SACRIFICED_PLAYER) == obj->GetGUID())
return false;
return true;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
index 1d3fcba09de..c4312e08704 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
@@ -124,8 +124,8 @@ public:
ActivedNumber = 0;
HealthAmountModifier = 1;
HealthAmountMultipler = DUNGEON_MODE(20, 25);
- ActiveAncestorGUID = 0;
- SpiritFountGUID = 0;
+ ActiveAncestorGUID.Clear();
+ SpiritFountGUID.Clear();
}
void Reset() override
@@ -283,14 +283,14 @@ public:
Talk(SAY_SLAY);
}
- void DespawnBoatGhosts(uint64& CreatureGUID)
+ void DespawnBoatGhosts(ObjectGuid& CreatureGUID)
{
// @todo: fire visual after ancestor despawns.
if (CreatureGUID)
if (Creature* temp = ObjectAccessor::GetCreature(*me, CreatureGUID))
temp->DisappearAndDie();
- CreatureGUID = 0;
+ CreatureGUID.Clear();
}
private:
@@ -299,8 +299,8 @@ public:
uint8 ActivedNumber;
uint32 HealthAmountModifier;
uint32 HealthAmountMultipler;
- uint64 ActiveAncestorGUID;
- uint64 SpiritFountGUID;
+ ObjectGuid ActiveAncestorGUID;
+ ObjectGuid SpiritFountGUID;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp
index 1bc3f20c3fe..519cc3b7202 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp
@@ -38,23 +38,6 @@ class instance_utgarde_pinnacle : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
-
- SvalaSorrowgraveGUID = 0;
- GortokPalehoofGUID = 0;
- SkadiTheRuthlessGUID = 0;
- KingYmironGUID = 0;
-
- UtgardeMirrorGUID = 0;
- GortokPalehoofSphereGUID = 0;
-
- FrenziedWorgenGUID = 0;
- RavenousFurbolgGUID = 0;
- FerociousRhinoGUID = 0;
- MassiveJormungarGUID = 0;
- PalehoofOrbGUID = 0;
-
- SvalaGUID = 0;
- SacrificedPlayerGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -107,7 +90,7 @@ class instance_utgarde_pinnacle : public InstanceMapScript
GortokPalehoofSphereGUID = go->GetGUID();
if (GetBossState(DATA_GORTOK_PALEHOOF) == DONE)
{
- HandleGameObject(0, true, go);
+ HandleGameObject(ObjectGuid::Empty, true, go);
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
break;
@@ -133,7 +116,7 @@ class instance_utgarde_pinnacle : public InstanceMapScript
}
}
- void SetData64(uint32 type, uint64 data) override
+ void SetGuidData(uint32 type, ObjectGuid data) override
{
switch (type)
{
@@ -145,7 +128,7 @@ class instance_utgarde_pinnacle : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -179,27 +162,27 @@ class instance_utgarde_pinnacle : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
protected:
- uint64 SvalaSorrowgraveGUID;
- uint64 GortokPalehoofGUID;
- uint64 SkadiTheRuthlessGUID;
- uint64 KingYmironGUID;
+ ObjectGuid SvalaSorrowgraveGUID;
+ ObjectGuid GortokPalehoofGUID;
+ ObjectGuid SkadiTheRuthlessGUID;
+ ObjectGuid KingYmironGUID;
- uint64 UtgardeMirrorGUID;
- uint64 GortokPalehoofSphereGUID;
+ ObjectGuid UtgardeMirrorGUID;
+ ObjectGuid GortokPalehoofSphereGUID;
- uint64 FrenziedWorgenGUID;
- uint64 RavenousFurbolgGUID;
- uint64 FerociousRhinoGUID;
- uint64 MassiveJormungarGUID;
+ ObjectGuid FrenziedWorgenGUID;
+ ObjectGuid RavenousFurbolgGUID;
+ ObjectGuid FerociousRhinoGUID;
+ ObjectGuid MassiveJormungarGUID;
- uint64 PalehoofOrbGUID;
+ ObjectGuid PalehoofOrbGUID;
- uint64 SvalaGUID;
- uint64 SacrificedPlayerGUID;
+ ObjectGuid SvalaGUID;
+ ObjectGuid SacrificedPlayerGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
index 8a88abb9d06..bacb63b73bc 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
@@ -101,7 +101,7 @@ class boss_emalon : public CreatureScript
{
if (!summons.empty())
{
- for (std::list<uint64>::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
+ for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
{
Creature* minion = ObjectAccessor::GetCreature(*me, *itr);
if (minion && minion->IsAlive() && !minion->GetVictim() && minion->AI())
@@ -201,7 +201,7 @@ class npc_tempest_minion : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (Creature* emalon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EMALON)))
+ if (Creature* emalon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EMALON)))
{
if (emalon->IsAlive())
{
@@ -216,7 +216,7 @@ class npc_tempest_minion : public CreatureScript
DoZoneInCombat();
events.ScheduleEvent(EVENT_SHOCK, 20000);
- if (Creature* pEmalon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EMALON)))
+ if (Creature* pEmalon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EMALON)))
{
if (!pEmalon->GetVictim() && pEmalon->AI())
pEmalon->AI()->AttackStart(who);
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
index 36c952d14a1..a7895b8d506 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
@@ -262,7 +262,7 @@ class npc_frozen_orb_stalker : public CreatureScript
return;
spawned = true;
- Unit* toravon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TORAVON));
+ Unit* toravon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TORAVON));
if (!toravon)
return;
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
index 959c8b7724d..846ecc1226a 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
@@ -38,8 +38,6 @@ class instance_vault_of_archavon : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
- EmalonGUID = 0;
- ToravonGUID = 0;
ArchavonDeath = 0;
EmalonDeath = 0;
KoralonDeath = 0;
@@ -60,7 +58,7 @@ class instance_vault_of_archavon : public InstanceMapScript
}
}
- uint64 GetData64(uint32 identifier) const override
+ ObjectGuid GetGuidData(uint32 identifier) const override
{
switch (identifier)
{
@@ -72,7 +70,7 @@ class instance_vault_of_archavon : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
bool SetBossState(uint32 type, EncounterState state) override
@@ -127,8 +125,8 @@ class instance_vault_of_archavon : public InstanceMapScript
}
private:
- uint64 EmalonGUID;
- uint64 ToravonGUID;
+ ObjectGuid EmalonGUID;
+ ObjectGuid ToravonGUID;
time_t ArchavonDeath;
time_t EmalonDeath;
time_t KoralonDeath;
diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
index 6cc90bcd4ed..bbb8c758bb1 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
@@ -85,12 +85,12 @@ public:
else if (instance->GetData(DATA_WAVE_COUNT) == 12)
instance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED);
- if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1)))
+ if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_1)))
{
if (!pGuard1->IsAlive())
pGuard1->Respawn();
}
- if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2)))
+ if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_2)))
{
if (!pGuard2->IsAlive())
pGuard2->Respawn();
@@ -109,13 +109,13 @@ public:
who->SetInCombatWith(me);
DoStartMovement(who);
- if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1)))
+ if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_1)))
{
pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE);
if (!pGuard1->GetVictim() && pGuard1->AI())
pGuard1->AI()->AttackStart(who);
}
- if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2)))
+ if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_2)))
{
pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE);
if (!pGuard2->GetVictim() && pGuard2->AI())
@@ -129,7 +129,7 @@ public:
Talk(SAY_AGGRO);
DoCast(me, SPELL_EARTH_SHIELD);
- if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_EREKEM_CELL)))
+ if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_EREKEM_CELL)))
if (pDoor->GetGoState() == GO_STATE_READY)
{
EnterEvadeMode();
@@ -154,9 +154,9 @@ public:
//spam stormstrike in hc mode if spawns are dead
if (IsHeroic())
{
- if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1)))
+ if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_1)))
{
- if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2)))
+ if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_2)))
{
if (!pGuard1->IsAlive() && !pGuard2->IsAlive())
DoCastVictim(SPELL_STORMSTRIKE);
@@ -172,14 +172,14 @@ public:
if (uiChainHealTimer <= diff)
{
- if (uint64 TargetGUID = GetChainHealTargetGUID())
+ if (ObjectGuid TargetGUID = GetChainHealTargetGUID())
{
if (Creature* target = ObjectAccessor::GetCreature(*me, TargetGUID))
DoCast(target, SPELL_CHAIN_HEAL);
//If one of the adds is dead spawn heals faster
- Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1));
- Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2));
+ Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_1));
+ Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_2));
uiChainHealTimer = ((pGuard1 && !pGuard1->IsAlive()) || (pGuard2 && !pGuard2->IsAlive()) ? 3000 : 8000) + rand32() % 3000;
}
} else uiChainHealTimer -= diff;
@@ -230,20 +230,20 @@ public:
Talk(SAY_SLAY);
}
- uint64 GetChainHealTargetGUID()
+ ObjectGuid GetChainHealTargetGUID()
{
if (HealthBelowPct(85))
return me->GetGUID();
- Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1));
+ Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_1));
if (pGuard1 && pGuard1->IsAlive() && !pGuard1->HealthAbovePct(75))
return pGuard1->GetGUID();
- Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2));
+ Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_2));
if (pGuard2 && pGuard2->IsAlive() && !pGuard2->HealthAbovePct(75))
return pGuard2->GetGUID();
- return 0;
+ return ObjectGuid::Empty;
}
};
diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
index ba72f6f52ca..50a65920876 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
@@ -128,7 +128,7 @@ public:
DoCast(me, SPELL_PROTECTIVE_BUBBLE);
- if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_ICHORON_CELL)))
+ if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_ICHORON_CELL)))
if (pDoor->GetGoState() == GO_STATE_READY)
{
EnterEvadeMode();
@@ -227,7 +227,7 @@ public:
{
if (!bIsExploded)
{
- if (!me->HasAura(SPELL_PROTECTIVE_BUBBLE, 0))
+ if (!me->HasAura(SPELL_PROTECTIVE_BUBBLE))
{
Talk(SAY_SHATTER);
DoCast(me, SPELL_WATER_BLAST);
@@ -247,7 +247,7 @@ public:
bool bIsWaterElementsAlive = false;
if (!m_waterElements.empty())
{
- for (std::list<uint64>::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr)
+ for (SummonList::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr)
if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr))
if (temp->IsAlive())
{
@@ -308,7 +308,7 @@ public:
summoned->SetSpeed(MOVE_RUN, 0.3f);
summoned->GetMotionMaster()->MoveFollow(me, 0, 0);
m_waterElements.Summon(summoned);
- instance->SetData64(DATA_ADD_TRASH_MOB, summoned->GetGUID());
+ instance->SetGuidData(DATA_ADD_TRASH_MOB, summoned->GetGUID());
}
}
@@ -317,7 +317,7 @@ public:
if (summoned)
{
m_waterElements.Despawn(summoned);
- instance->SetData64(DATA_DEL_TRASH_MOB, summoned->GetGUID());
+ instance->SetGuidData(DATA_DEL_TRASH_MOB, summoned->GetGUID());
}
}
@@ -374,7 +374,7 @@ public:
{
if (uiRangeCheck_Timer < uiDiff)
{
- if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ICHORON)))
+ if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ICHORON)))
{
if (me->IsWithinDist(pIchoron, 2.0f, false))
{
@@ -391,7 +391,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
DoCast(me, SPELL_SPLASH);
- if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ICHORON)))
+ if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ICHORON)))
if (pIchoron->AI())
pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_KILLED);
}
diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
index 3a08a4510ca..5d8756bcffc 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
@@ -68,7 +68,7 @@ public:
void EnterCombat(Unit* /*who*/) override
{
- if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_LAVANTHOR_CELL)))
+ if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_LAVANTHOR_CELL)))
if (pDoor->GetGoState() == GO_STATE_READY)
{
EnterEvadeMode();
diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
index 12ace1b1c38..67d71cad24c 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
@@ -61,7 +61,7 @@ public:
void EnterCombat(Unit* /*who*/) override
{
- if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_MORAGG_CELL)))
+ if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_MORAGG_CELL)))
if (pDoor->GetGoState() == GO_STATE_READY)
{
EnterEvadeMode();
diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
index 734c20000eb..79c535979d7 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
@@ -134,7 +134,7 @@ public:
void EnterCombat(Unit* /*who*/) override
{
Talk(SAY_AGGRO);
- if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_XEVOZZ_CELL)))
+ if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_XEVOZZ_CELL)))
if (pDoor->GetGoState() == GO_STATE_READY)
{
EnterEvadeMode();
@@ -254,7 +254,7 @@ public:
if (uiRangeCheck_Timer < uiDiff)
{
- if (Creature* pXevozz = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_XEVOZZ)))
+ if (Creature* pXevozz = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_XEVOZZ)))
{
float fDistance = me->GetDistance2d(pXevozz);
if (fDistance <= 3)
diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
index 753d4ebea01..d24d005926c 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
@@ -105,7 +105,7 @@ public:
void EnterCombat(Unit* /*who*/) override
{
Talk(SAY_AGGRO);
- if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_ZURAMAT_CELL)))
+ if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetGuidData(DATA_ZURAMAT_CELL)))
if (pDoor->GetGoState() == GO_STATE_READY)
{
EnterEvadeMode();
diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
index 9c81e664fd4..cddf6ce3c25 100644
--- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
@@ -114,35 +114,35 @@ public:
{
instance_violet_hold_InstanceMapScript(Map* map) : InstanceScript(map) { }
- uint64 uiMoragg;
- uint64 uiErekem;
- uint64 uiErekemGuard[2];
- uint64 uiIchoron;
- uint64 uiLavanthor;
- uint64 uiXevozz;
- uint64 uiZuramat;
- uint64 uiCyanigosa;
- uint64 uiSinclari;
-
- uint64 uiMoraggCell;
- uint64 uiErekemCell;
- uint64 uiErekemLeftGuardCell;
- uint64 uiErekemRightGuardCell;
- uint64 uiIchoronCell;
- uint64 uiLavanthorCell;
- uint64 uiXevozzCell;
- uint64 uiZuramatCell;
- uint64 uiMainDoor;
- uint64 uiTeleportationPortal;
- uint64 uiSaboteurPortal;
-
- uint64 uiActivationCrystal[4];
+ ObjectGuid uiMoragg;
+ ObjectGuid uiErekem;
+ ObjectGuid uiErekemGuard[2];
+ ObjectGuid uiIchoron;
+ ObjectGuid uiLavanthor;
+ ObjectGuid uiXevozz;
+ ObjectGuid uiZuramat;
+ ObjectGuid uiCyanigosa;
+ ObjectGuid uiSinclari;
+
+ ObjectGuid uiMoraggCell;
+ ObjectGuid uiErekemCell;
+ ObjectGuid uiErekemLeftGuardCell;
+ ObjectGuid uiErekemRightGuardCell;
+ ObjectGuid uiIchoronCell;
+ ObjectGuid uiLavanthorCell;
+ ObjectGuid uiXevozzCell;
+ ObjectGuid uiZuramatCell;
+ ObjectGuid uiMainDoor;
+ ObjectGuid uiTeleportationPortal;
+ ObjectGuid uiSaboteurPortal;
+
+ ObjectGuid uiActivationCrystal[4];
uint32 uiActivationTimer;
uint32 uiCyanigosaEventTimer;
uint32 uiDoorSpellTimer;
- std::set<uint64> trashMobs; // to kill with crystal
+ GuidSet trashMobs; // to kill with crystal
uint8 uiWaveCount;
uint8 uiLocation;
@@ -171,28 +171,6 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
- uiMoragg = 0;
- uiErekem = 0;
- uiIchoron = 0;
- uiLavanthor = 0;
- uiXevozz = 0;
- uiZuramat = 0;
- uiCyanigosa = 0;
- uiSinclari = 0;
-
- uiMoraggCell = 0;
- uiErekemCell = 0;
- uiErekemGuard[0] = 0;
- uiErekemGuard[1] = 0;
- uiIchoronCell = 0;
- uiLavanthorCell = 0;
- uiXevozzCell = 0;
- uiZuramatCell = 0;
- uiMainDoor = 0;
- uiTeleportationPortal = 0;
- uiSaboteurPortal = 0;
-
- trashMobs.clear();
uiRemoveNpc = 0;
@@ -266,11 +244,14 @@ public:
break;
}
+ /*
+ BEWARE - SHIT.
if (creature->GetGUID() == uiFirstBoss || creature->GetGUID() == uiSecondBoss)
{
creature->AllLootRemovedFromCorpse();
creature->RemoveLootMode(1);
}
+ */
}
void OnGameObjectCreate(GameObject* go) override
@@ -407,7 +388,7 @@ public:
}
}
- void SetData64(uint32 type, uint64 data) override
+ void SetGuidData(uint32 type, ObjectGuid data) override
{
switch (type)
{
@@ -441,7 +422,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 identifier) const override
+ ObjectGuid GetGuidData(uint32 identifier) const override
{
switch (identifier)
{
@@ -468,7 +449,7 @@ public:
case DATA_SABOTEUR_PORTAL: return uiSaboteurPortal;
}
- return 0;
+ return ObjectGuid::Empty;
}
void SpawnPortal()
@@ -813,8 +794,8 @@ public:
// visuals
trigger->CastSpell(trigger, spellInfoLightning, true, 0, 0, trigger->GetGUID());
- // Kill all mobs registered with SetData64(ADD_TRASH_MOB)
- for (std::set<uint64>::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr)
+ // Kill all mobs registered with SetGuidData(ADD_TRASH_MOB)
+ for (GuidSet::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr)
{
Creature* creature = instance->GetCreature(*itr);
if (creature && creature->IsAlive())
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
index 1c106f399de..76a7b701717 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
@@ -526,7 +526,7 @@ public:
{
me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false);
me->DisappearAndDie();
- Creature* pSaboPort = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_SABOTEUR_PORTAL));
+ Creature* pSaboPort = ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_SABOTEUR_PORTAL));
if (pSaboPort)
pSaboPort->DisappearAndDie();
instance->SetData(DATA_START_BOSS_ENCOUNTER, 1);
@@ -653,13 +653,13 @@ public:
void JustSummoned(Creature* summoned) override
{
listOfMobs.Summon(summoned);
- instance->SetData64(DATA_ADD_TRASH_MOB, summoned->GetGUID());
+ instance->SetGuidData(DATA_ADD_TRASH_MOB, summoned->GetGUID());
}
void SummonedCreatureDies(Creature* summoned, Unit* /*killer*/) override
{
listOfMobs.Despawn(summoned);
- instance->SetData64(DATA_DEL_TRASH_MOB, summoned->GetGUID());
+ instance->SetGuidData(DATA_DEL_TRASH_MOB, summoned->GetGUID());
}
};
diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp
index a83f4feb70a..1aad8079e07 100644
--- a/src/server/scripts/Northrend/zone_borean_tundra.cpp
+++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp
@@ -71,13 +71,13 @@ public:
uint32 phaseTimer;
uint8 phase;
- uint64 casterGuid;
+ ObjectGuid casterGuid;
void Reset() override
{
phaseTimer = 500;
phase = 0;
- casterGuid = 0;
+ casterGuid.Clear();
}
void SpellHit(Unit* caster, const SpellInfo* spell) override
@@ -391,7 +391,7 @@ public:
if (uiRand < 25)
{
player->CastSpell(me, SPELL_FREED_WARSONG_PEON, true);
- player->KilledMonsterCredit(NPC_WARSONG_PEON, 0);
+ player->KilledMonsterCredit(NPC_WARSONG_PEON);
}
else if (uiRand < 75)
player->CastSpell(me, nerubarVictims[urand(0, 2)], true);
@@ -449,7 +449,7 @@ public:
{
npc_nesingwary_trapperAI(Creature* creature) : ScriptedAI(creature) { creature->SetVisible(false); }
- uint64 go_caribouGUID;
+ ObjectGuid go_caribouGUID;
uint8 phase;
uint32 phaseTimer;
@@ -458,7 +458,7 @@ public:
me->SetVisible(false);
phaseTimer = 2500;
phase = 1;
- go_caribouGUID = 0;
+ go_caribouGUID.Clear();
}
void EnterCombat(Unit* /*who*/) override { }
@@ -474,7 +474,7 @@ public:
if (summon->IsSummon())
if (Unit* temp = summon->GetSummoner())
if (Player* player = temp->ToPlayer())
- player->KilledMonsterCredit(me->GetEntry(), 0);
+ player->KilledMonsterCredit(me->GetEntry());
if (GameObject* go_caribou = me->GetMap()->GetGameObject(go_caribouGUID))
go_caribou->SetGoState(GO_STATE_READY);
@@ -723,10 +723,9 @@ public:
{
npc_nexus_drake_hatchlingAI(Creature* creature) : FollowerAI(creature)
{
- HarpoonerGUID = 0;
}
- uint64 HarpoonerGUID;
+ ObjectGuid HarpoonerGUID;
bool WithRedDragonBlood;
void Reset() override
@@ -764,10 +763,10 @@ public:
{
if (Player* pHarpooner = ObjectAccessor::GetPlayer(*me, HarpoonerGUID))
{
- pHarpooner->KilledMonsterCredit(26175, 0);
+ pHarpooner->KilledMonsterCredit(26175);
pHarpooner->RemoveAura(SPELL_DRAKE_HATCHLING_SUBDUED);
SetFollowComplete();
- HarpoonerGUID = 0;
+ HarpoonerGUID.Clear();
me->DisappearAndDie();
}
}
@@ -793,7 +792,7 @@ public:
if ((me->getFaction() == 35) && (!me->HasAura(SPELL_SUBDUED)))
{
- HarpoonerGUID = 0;
+ HarpoonerGUID.Clear();
me->DisappearAndDie();
}
@@ -865,10 +864,10 @@ public:
{
npc_thassarianAI(Creature* creature) : npc_escortAI(creature) { }
- uint64 arthasGUID;
- uint64 talbotGUID;
- uint64 leryssaGUID;
- uint64 arlosGUID;
+ ObjectGuid arthasGUID;
+ ObjectGuid talbotGUID;
+ ObjectGuid leryssaGUID;
+ ObjectGuid arlosGUID;
bool arthasInPosition;
bool arlosInPosition;
@@ -883,10 +882,10 @@ public:
me->RestoreFaction();
me->RemoveStandFlags(UNIT_STAND_STATE_SIT);
- arthasGUID = 0;
- talbotGUID = 0;
- leryssaGUID = 0;
- arlosGUID = 0;
+ arthasGUID.Clear();
+ talbotGUID.Clear();
+ leryssaGUID.Clear();
+ arlosGUID.Clear();
arthasInPosition = false;
arlosInPosition = false;
@@ -1242,8 +1241,8 @@ public:
{
npc_counselor_talbotAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 leryssaGUID;
- uint64 arlosGUID;
+ ObjectGuid leryssaGUID;
+ ObjectGuid arlosGUID;
bool bCheck;
@@ -1253,8 +1252,8 @@ public:
void Reset() override
{
- leryssaGUID = 0;
- arlosGUID = 0;
+ leryssaGUID.Clear();
+ arlosGUID.Clear();
bCheck = false;
shadowBoltTimer = urand(5000, 12000);
deflectionTimer = urand(20000, 25000);
@@ -1609,15 +1608,11 @@ public:
void SpellHit(Unit* unit, const SpellInfo* spell) override
{
if (spell->Id == SPELL_NEURAL_NEEDLE && unit->GetTypeId() == TYPEID_PLAYER)
- {
if (Player* player = unit->ToPlayer())
- {
GotStinged(player->GetGUID());
- }
- }
}
- void GotStinged(uint64 casterGUID)
+ void GotStinged(ObjectGuid casterGUID)
{
if (Player* caster = ObjectAccessor::GetPlayer(*me, casterGUID))
{
@@ -1644,7 +1639,7 @@ public:
break;
case 7:
Talk(SAY_IMPRISIONED_BERYL_7);
- caster->KilledMonsterCredit(NPC_IMPRISONED_BERYL_SORCERER, 0);
+ caster->KilledMonsterCredit(NPC_IMPRISONED_BERYL_SORCERER);
break;
}
}
@@ -1980,7 +1975,7 @@ public:
{
Quest const* qInfo = sObjectMgr->GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW);
if (qInfo)
- player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0);
+ player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0]);
}
}
};
@@ -2195,7 +2190,7 @@ public:
uint32 uiEventTimer;
uint8 uiEventPhase;
- uint64 uiPlayerGUID;
+ ObjectGuid uiPlayerGUID;
void Reset() override
{
@@ -2208,7 +2203,7 @@ public:
uiEventTimer = 0;
uiEventPhase = 0;
- uiPlayerGUID = 0;
+ uiPlayerGUID.Clear();
DoCast(SPELL_SHROUD_OF_THE_DEATH_CULTIST);
@@ -2225,7 +2220,7 @@ public:
uiEventPhase = 1;
}
- void SetGUID(uint64 uiGuid, int32 /*iId*/) override
+ void SetGUID(ObjectGuid uiGuid, int32 /*iId*/) override
{
uiPlayerGUID = uiGuid;
}
diff --git a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
index 7d680ecd071..9cad60f8766 100644
--- a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
+++ b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
@@ -56,11 +56,11 @@ public:
SetCombatMovement(false);
}
- uint64 targetGUID;
+ ObjectGuid targetGUID;
void Reset() override
{
- targetGUID = 0;
+ targetGUID.Clear();
}
void UpdateAI(uint32 /*diff*/) override
diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp
index 80e496a6e13..68c0ce3acc4 100644
--- a/src/server/scripts/Northrend/zone_dragonblight.cpp
+++ b/src/server/scripts/Northrend/zone_dragonblight.cpp
@@ -158,8 +158,12 @@ class npc_commander_eligor_dawnbringer : public CreatureScript
void Reset() override
{
talkWing = 0;
- memset(audienceList, 0, sizeof(audienceList));
- memset(imageList, 0, sizeof(imageList));
+ for (ObjectGuid& guid : audienceList)
+ guid.Clear();
+
+ for (ObjectGuid& guid : imageList)
+ guid.Clear();
+
_events.ScheduleEvent(EVENT_GET_TARGETS, 5000);
_events.ScheduleEvent(EVENT_START_RANDOM, 20000);
}
@@ -351,8 +355,8 @@ class npc_commander_eligor_dawnbringer : public CreatureScript
}
private:
EventMap _events;
- uint64 audienceList[10];
- uint64 imageList[5];
+ ObjectGuid audienceList[10];
+ ObjectGuid imageList[5];
uint8 talkWing;
};
@@ -652,13 +656,12 @@ class npc_torturer_lecraft : public CreatureScript
npc_torturer_lecraftAI(Creature* creature) : ScriptedAI(creature)
{
_textCounter = 1;
- _playerGUID = 0;
}
void Reset() override
{
_textCounter = 1;
- _playerGUID = 0;
+ _playerGUID.Clear();
}
void EnterCombat(Unit* who) override
@@ -686,7 +689,7 @@ class npc_torturer_lecraft : public CreatureScript
Talk(_textCounter, player);
if (_textCounter == 5)
- player->KilledMonsterCredit(NPC_TORTURER_LECRAFT, 0);
+ player->KilledMonsterCredit(NPC_TORTURER_LECRAFT);
++_textCounter;
@@ -723,7 +726,7 @@ class npc_torturer_lecraft : public CreatureScript
private:
EventMap _events;
uint8 _textCounter;
- uint64 _playerGUID;
+ ObjectGuid _playerGUID;
};
CreatureAI* GetAI(Creature* creature) const
diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
index 6d41a2e9b21..e06bf32d7d8 100644
--- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
@@ -116,7 +116,7 @@ public:
case 19:
if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID))
{
- if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0))
+ if (Mrfloppy->HasAura(SPELL_MRFLOPPY))
{
if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID))
Mrfloppy->EnterVehicle(RWORG);
@@ -180,13 +180,13 @@ public:
void Reset() override
{
- _mrfloppyGUID = 0;
- _RavenousworgGUID = 0;
+ _mrfloppyGUID.Clear();
+ _RavenousworgGUID.Clear();
}
private:
- uint64 _RavenousworgGUID;
- uint64 _mrfloppyGUID;
+ ObjectGuid _RavenousworgGUID;
+ ObjectGuid _mrfloppyGUID;
};
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override
@@ -542,7 +542,7 @@ public:
void Reset() override
{
- _playerGUID = 0;
+ _playerGUID.Clear();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
me->SetReactState(REACT_AGGRESSIVE);
@@ -604,7 +604,7 @@ public:
private:
EventMap _events;
- uint64 _playerGUID;
+ ObjectGuid _playerGUID;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp
index 96fdcbfe990..53dc2a62f90 100644
--- a/src/server/scripts/Northrend/zone_howling_fjord.cpp
+++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp
@@ -179,7 +179,7 @@ public:
void Reset() override
{
- uint64 summonerGUID = 0;
+ ObjectGuid summonerGUID;
if (me->IsSummon())
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
@@ -321,15 +321,15 @@ public:
npc_daegarnAI(Creature* creature) : ScriptedAI(creature) { }
bool bEventInProgress;
- uint64 uiPlayerGUID;
+ ObjectGuid uiPlayerGUID;
void Reset() override
{
bEventInProgress = false;
- uiPlayerGUID = 0;
+ uiPlayerGUID.Clear();
}
- void StartEvent(uint64 uiGUID)
+ void StartEvent(ObjectGuid uiGUID)
{
if (bEventInProgress)
return;
diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp
index 32b9805470e..a43df0dc3f0 100644
--- a/src/server/scripts/Northrend/zone_icecrown.cpp
+++ b/src/server/scripts/Northrend/zone_icecrown.cpp
@@ -234,7 +234,7 @@ public:
{
if (who->HasAura(SPELL_SUBDUED_LITHE_STALKER))
{
- owner->ToPlayer()->KilledMonsterCredit(NPC_GEIST_RETURN_BUNNY_KC, 0);
+ owner->ToPlayer()->KilledMonsterCredit(NPC_GEIST_RETURN_BUNNY_KC);
who->ToCreature()->DisappearAndDie();
}
@@ -505,7 +505,6 @@ public:
{
HalofSpawned = false;
PhaseCount = 0;
- Summons.DespawnAll();
SetCombatMovement(false);
}
@@ -518,10 +517,10 @@ public:
SummonList Summons;
- uint64 guidDalfors;
- uint64 guidPriest[3];
- uint64 guidMason[3];
- uint64 guidHalof;
+ ObjectGuid guidDalfors;
+ ObjectGuid guidPriest[3];
+ ObjectGuid guidMason[3];
+ ObjectGuid guidHalof;
void Reset() override
{
@@ -912,7 +911,7 @@ class npc_margrave_dhakar : public CreatureScript
struct npc_margrave_dhakarAI : public ScriptedAI
{
- npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , _summons(me), _lichKingGuid(0) { }
+ npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , _summons(me) { }
void Reset() override
{
@@ -1026,7 +1025,7 @@ class npc_margrave_dhakar : public CreatureScript
private:
EventMap _events;
SummonList _summons;
- uint64 _lichKingGuid;
+ ObjectGuid _lichKingGuid;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
index 3f35fc0e172..53fe1500624 100644
--- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
@@ -374,8 +374,8 @@ public:
sayStep = 0;
timer = 0;
phase = 0;
- playerGUID = 0;
- orphanGUID = 0;
+ playerGUID.Clear();
+ orphanGUID.Clear();
}
void MoveInLineOfSight(Unit* who) override
@@ -489,7 +489,7 @@ public:
if (itr->second.CreatureOrGOCount[i] != 0)
continue;
- player->KilledMonsterCredit(me->GetEntry(), 0);
+ player->KilledMonsterCredit(me->GetEntry());
player->Say(SAY_OFFER, LANG_UNIVERSAL);
sayStep = 1;
break;
@@ -501,8 +501,8 @@ public:
uint8 sayStep;
uint32 timer;
int8 phase;
- uint64 playerGUID;
- uint64 orphanGUID;
+ ObjectGuid playerGUID;
+ ObjectGuid orphanGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -783,7 +783,7 @@ public:
apple->CastSpell(apple, SPELL_APPLE_FALL);
wilhelm->AI()->Talk(SAY_WILHELM_HIT);
if (Player* player = shooter->ToPlayer())
- player->KilledMonsterCredit(NPC_APPLE, 0);
+ player->KilledMonsterCredit(NPC_APPLE);
apple->DespawnOrUnsummon();
break;
diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp
index cfee2e0f187..a183d0997d4 100644
--- a/src/server/scripts/Northrend/zone_storm_peaks.cpp
+++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp
@@ -454,17 +454,16 @@ public:
{
npc_brann_bronzebeard_keystoneAI(Creature* creature) : ScriptedAI(creature)
{
- memset(&objectGUID, 0, sizeof(objectGUID));
- playerGUID = 0;
- voiceGUID = 0;
objectCounter = 0;
}
void Reset() override
{
- memset(&objectGUID, 0, sizeof(objectGUID));
- playerGUID = 0;
- voiceGUID = 0;
+ for (ObjectGuid& guid : objectGUID)
+ guid.Clear();
+
+ playerGUID.Clear();
+ voiceGUID.Clear();
objectCounter = 0;
}
@@ -583,9 +582,9 @@ public:
private:
EventMap events;
- uint64 playerGUID;
- uint64 objectGUID[5];
- uint64 voiceGUID;
+ ObjectGuid playerGUID;
+ ObjectGuid objectGUID[5];
+ ObjectGuid voiceGUID;
uint8 objectCounter;
};
@@ -643,13 +642,12 @@ public:
{
npc_king_jokkum_vehicleAI(Creature* creature) : VehicleAI(creature)
{
- playerGUID = 0;
pathEnd = false;
}
void Reset() override
{
- playerGUID = 0;
+ playerGUID.Clear();
pathEnd = false;
}
@@ -715,7 +713,7 @@ public:
private:
EventMap events;
- uint64 playerGUID;
+ ObjectGuid playerGUID;
bool pathEnd;
};
diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp
index fe74997bb39..b0059de7e27 100644
--- a/src/server/scripts/Northrend/zone_wintergrasp.cpp
+++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp
@@ -198,7 +198,7 @@ class npc_wg_spirit_guide : public CreatureScript
GraveyardVect graveyard = wintergrasp->GetGraveyardVector();
for (uint8 i = 0; i < graveyard.size(); i++)
if (graveyard[i]->GetControlTeamId() == player->GetTeamId())
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
@@ -292,7 +292,7 @@ class npc_wg_queue : public CreatureScript
if (wintergrasp->IsWarTime())
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID());
}
else
@@ -301,7 +301,7 @@ class npc_wg_queue : public CreatureScript
player->SendUpdateWorldState(4354, time(NULL) + timer);
if (timer < 15 * MINUTE)
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID());
}
else
diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp
index 2e75b10c0e8..44f559bfa79 100644
--- a/src/server/scripts/Northrend/zone_zuldrak.cpp
+++ b/src/server/scripts/Northrend/zone_zuldrak.cpp
@@ -51,7 +51,7 @@ public:
void Reset() override
{
- _rageclawGUID = 0;
+ _rageclawGUID.Clear();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
float x, y, z;
@@ -104,7 +104,7 @@ public:
}
private:
- uint64 _rageclawGUID;
+ ObjectGuid _rageclawGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -455,13 +455,12 @@ public:
{
npc_alchemist_finklesteinAI(Creature* creature) : ScriptedAI(creature)
{
- _playerGUID = 0;
_getingredienttry = 0;
}
void Reset() override
{
- _playerGUID = 0;
+ _playerGUID.Clear();
_getingredienttry = 0;
_events.ScheduleEvent(EVENT_TURN_TO_POT, urand(15000, 26000));
}
@@ -556,7 +555,7 @@ public:
private:
EventMap _events;
- uint64 _playerGUID;
+ ObjectGuid _playerGUID;
uint8 _getingredienttry;
};
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
index b3492b8334b..252a2cc8e85 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
@@ -255,7 +255,7 @@ void OPvPCapturePointHP::ChangeState()
// complete quest objective
if (m_State == OBJECTIVESTATE_ALLIANCE || m_State == OBJECTIVESTATE_HORDE)
- SendObjectiveComplete(HP_CREDITMARKER[m_TowerType], 0);
+ SendObjectiveComplete(HP_CREDITMARKER[m_TowerType], ObjectGuid::Empty);
}
void OPvPCapturePointHP::FillInitialWorldStates(WorldPacket &data)
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
index 1b4828dec51..b16ced348ec 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
@@ -32,7 +32,7 @@ void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed)
{
if (killed->GetTypeId() == TYPEID_PLAYER && player->GetTeam() != killed->ToPlayer()->GetTeam())
{
- player->KilledMonsterCredit(NA_CREDIT_MARKER, 0); // 0 guid, btw it isn't even used in killedmonster function :S
+ player->KilledMonsterCredit(NA_CREDIT_MARKER); // 0 guid, btw it isn't even used in killedmonster function :S
if (player->GetTeam() == ALLIANCE)
player->CastSpell(player, NA_KILL_TOKEN_ALLIANCE, true);
else
@@ -43,7 +43,7 @@ void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed)
uint32 OPvPCapturePointNA::GetAliveGuardsCount()
{
uint32 cnt = 0;
- for (std::map<uint32, uint64>::iterator itr = m_Creatures.begin(); itr != m_Creatures.end(); ++itr)
+ for (std::map<uint32, ObjectGuid>::iterator itr = m_Creatures.begin(); itr != m_Creatures.end(); ++itr)
{
switch (itr->first)
{
@@ -372,7 +372,7 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player* player, uint32 spellId, GameO
return false;
}
-int32 OPvPCapturePointNA::HandleOpenGo(Player* player, uint64 guid)
+int32 OPvPCapturePointNA::HandleOpenGo(Player* player, ObjectGuid guid)
{
int32 retval = OPvPCapturePoint::HandleOpenGo(player, guid);
if (retval >= 0)
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h
index aa52c8135e7..8d327da4b0f 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h
@@ -269,7 +269,7 @@ class OPvPCapturePointNA : public OPvPCapturePoint
bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
- int32 HandleOpenGo(Player* player, uint64 guid);
+ int32 HandleOpenGo(Player* player, ObjectGuid guid) override;
uint32 GetAliveGuardsCount();
uint32 GetControllingFaction() const;
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index 62108feaeeb..49250c9d638 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -109,7 +109,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
// add 20 cenarion circle repu
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20);
// complete quest
- player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_A, 0);
+ player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_A);
}
return true;
case SI_AREATRIGGER_H:
@@ -135,7 +135,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
// add 20 cenarion circle repu
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20);
// complete quest
- player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_H, 0);
+ player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_H);
}
return true;
}
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
index e089dfdb7d5..476abe012ce 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
@@ -281,7 +281,7 @@ void OPvPCapturePointTF::ChangeState()
m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_ALLIANCE);
- for (PlayerSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr)
+ for (GuidSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->AreaExploredOrEventHappens(TF_ALLY_QUEST);
break;
@@ -296,7 +296,7 @@ void OPvPCapturePointTF::ChangeState()
m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_HORDE);
- for (PlayerSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr)
+ for (GuidSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->AreaExploredOrEventHappens(TF_HORDE_QUEST);
break;
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
index d6ee91ff2a9..89012b56b82 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
@@ -181,7 +181,7 @@ bool OPvPCapturePointZM_GraveYard::Update(uint32 /*diff*/)
return retval;
}
-int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, uint64 guid)
+int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, ObjectGuid guid)
{
int32 retval = OPvPCapturePoint::HandleOpenGo(player, guid);
if (retval >= 0)
@@ -218,7 +218,7 @@ OPvPCapturePointZM_GraveYard::OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp)
{
m_BothControllingFaction = 0;
m_GraveYardState = ZM_GRAVEYARD_N;
- m_FlagCarrierGUID = 0;
+ m_FlagCarrierGUID.Clear();
// add field scouts here
AddCreature(ZM_ALLIANCE_FIELD_SCOUT, ZM_AllianceFieldScout.entry, ZM_AllianceFieldScout.map, ZM_AllianceFieldScout.x, ZM_AllianceFieldScout.y, ZM_AllianceFieldScout.z, ZM_AllianceFieldScout.o);
AddCreature(ZM_HORDE_FIELD_SCOUT, ZM_HordeFieldScout.entry, ZM_HordeFieldScout.map, ZM_HordeFieldScout.x, ZM_HordeFieldScout.y, ZM_HordeFieldScout.z, ZM_HordeFieldScout.o);
@@ -286,7 +286,7 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction)
p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A);
p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H);
}
- m_FlagCarrierGUID = 0;
+ m_FlagCarrierGUID.Clear();
}
}
break;
@@ -297,8 +297,8 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction)
bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& /*gso*/)
{
- uint64 guid = c->GetGUID();
- std::map<uint64, uint32>::iterator itr = m_CreatureTypes.find(guid);
+ ObjectGuid guid = c->GetGUID();
+ std::map<ObjectGuid, uint32>::iterator itr = m_CreatureTypes.find(guid);
if (itr != m_CreatureTypes.end())
{
if (itr->second == ZM_ALLIANCE_FIELD_SCOUT && player->GetTeam() == ALLIANCE && m_BothControllingFaction == ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A)
@@ -309,9 +309,9 @@ bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player* player, Creature* c, Gossip
return false;
}
-bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, uint64 guid, uint32 /*gossipid*/)
+bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, ObjectGuid guid, uint32 /*gossipid*/)
{
- std::map<uint64, uint32>::iterator itr = m_CreatureTypes.find(guid);
+ std::map<ObjectGuid, uint32>::iterator itr = m_CreatureTypes.find(guid);
if (itr != m_CreatureTypes.end())
{
Creature* cr = HashMapHolder<Creature>::Find(guid);
@@ -342,10 +342,10 @@ bool OPvPCapturePointZM_GraveYard::HandleDropFlag(Player* /*player*/, uint32 spe
switch (spellId)
{
case ZM_BATTLE_STANDARD_A:
- m_FlagCarrierGUID = 0;
+ m_FlagCarrierGUID.Clear();
return true;
case ZM_BATTLE_STANDARD_H:
- m_FlagCarrierGUID = 0;
+ m_FlagCarrierGUID.Clear();
return true;
}
return false;
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
index eef1ff9cc3b..5910a88f476 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
@@ -192,11 +192,11 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint
void UpdateTowerState();
- int32 HandleOpenGo(Player* player, uint64 guid);
+ int32 HandleOpenGo(Player* player, ObjectGuid guid) override;
void SetBeaconState(uint32 controlling_team); // not good atm
- bool HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
+ bool HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid);
bool HandleDropFlag(Player* player, uint32 spellId);
@@ -210,7 +210,7 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint
protected:
uint32 m_BothControllingFaction;
- uint64 m_FlagCarrierGUID;
+ ObjectGuid m_FlagCarrierGUID;
};
class OutdoorPvPZM : public OutdoorPvP
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
index 7ba0a452941..1cfd7a23f39 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
@@ -174,7 +174,7 @@ public:
}
uint32 soulmodel;
- uint64 soulholder;
+ ObjectGuid soulholder;
uint8 soulclass;
uint32 Fear_timer;
@@ -187,7 +187,7 @@ public:
void Reset() override
{
soulmodel = 0;
- soulholder = 0;
+ soulholder.Clear();
soulclass = 0;
Fear_timer = 15000 + rand32() % 5000;
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
index 683b253d8a1..9a94096c2de 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
@@ -69,7 +69,7 @@ public:
uint32 Carnivorousbite_Timer;
uint32 FocusFire_Timer;
- uint64 FocusedTargetGUID;
+ ObjectGuid FocusedTargetGUID;
void Reset() override
{
@@ -77,7 +77,7 @@ public:
Attractmagic_Timer = 28000;
Carnivorousbite_Timer = 10000;
FocusFire_Timer = 17000;
- FocusedTargetGUID = 0;
+ FocusedTargetGUID.Clear();
}
void EnterCombat(Unit* /*who*/) override
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
index a48f5245273..6ff92bcdb0b 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
@@ -115,7 +115,7 @@ class boss_ambassador_hellmaw : public CreatureScript
me->RemoveAurasDueToSpell(SPELL_BANISH);
Talk(SAY_INTRO);
- Start(true, false, 0, NULL, false, true);
+ Start(true, false, ObjectGuid::Empty, NULL, false, true);
}
void EnterCombat(Unit* /*who*/) override
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
index 905fe67af97..b3aac6becc4 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
@@ -238,7 +238,7 @@ class npc_voidtraveler : public CreatureScript
{
if (_moveTimer <= diff)
{
- Creature* Vorpil = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_GRANDMASTER_VORPIL));
+ Creature* Vorpil = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_GRANDMASTER_VORPIL));
if (!Vorpil)
return;
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
index 9bd985130a9..6fea892abea 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
@@ -40,8 +40,6 @@ class instance_shadow_labyrinth : public InstanceMapScript
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- AmbassadorHellmawGUID = 0;
- GrandmasterVorpilGUID = 0;
FelOverseerCount = 0;
}
@@ -123,7 +121,7 @@ class instance_shadow_labyrinth : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -132,12 +130,12 @@ class instance_shadow_labyrinth : public InstanceMapScript
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
protected:
- uint64 AmbassadorHellmawGUID;
- uint64 GrandmasterVorpilGUID;
+ ObjectGuid AmbassadorHellmawGUID;
+ ObjectGuid GrandmasterVorpilGUID;
uint32 FelOverseerCount;
};
diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
index 3a33561e998..5302aa34a29 100644
--- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
@@ -156,11 +156,11 @@ public:
}
case EVENT_SET_CHANNELERS:
{
- for (uint64 guid : _bloodmageList)
+ for (ObjectGuid guid : _bloodmageList)
if (Creature* bloodmage = ObjectAccessor::GetCreature(*me, guid))
bloodmage->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL);
- for (uint64 guid : _deathshaperList)
+ for (ObjectGuid guid : _deathshaperList)
if (Creature* deathshaper = ObjectAccessor::GetCreature(*me, guid))
deathshaper->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL);
@@ -202,8 +202,8 @@ public:
private:
InstanceScript* _instance;
EventMap _events;
- std::list<uint64> _bloodmageList;
- std::list<uint64> _deathshaperList;
+ GuidList _bloodmageList;
+ GuidList _deathshaperList;
bool _enteredCombat;
};
diff --git a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp
index f03caa37cb2..b41e7e77452 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp
@@ -73,7 +73,7 @@ public:
InstanceScript* instance;
- uint64 TargetGUID;
+ ObjectGuid TargetGUID;
float TargetThreat;
@@ -94,7 +94,7 @@ public:
{
instance->SetBossState(DATA_GURTOGG_BLOODBOIL, NOT_STARTED);
- TargetGUID = 0;
+ TargetGUID.Clear();
TargetThreat = 0;
@@ -134,7 +134,7 @@ public:
Talk(SAY_DEATH);
}
- void RevertThreatOnTarget(uint64 guid)
+ void RevertThreatOnTarget(ObjectGuid guid)
{
if (Unit* unit = ObjectAccessor::GetUnit(*me, guid))
{
@@ -258,7 +258,7 @@ public:
{
if (TargetGUID)
RevertThreatOnTarget(TargetGUID);
- TargetGUID = 0;
+ TargetGUID.Clear();
Phase1 = true;
BloodboilTimer = 10000;
BloodboilCount = 0;
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index 22cd886d99b..4ec6aed9655 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -381,7 +381,7 @@ public:
{
FlameBlastTimer = 15000;
CheckTimer = 5000;
- GlaiveGUID = 0;
+ GlaiveGUID.Clear();
}
void EnterCombat(Unit* /*who*/) override
@@ -424,7 +424,7 @@ public:
}
}
- void SetGlaiveGUID(uint64 guid)
+ void SetGlaiveGUID(ObjectGuid guid)
{
GlaiveGUID = guid;
}
@@ -455,7 +455,7 @@ public:
private:
uint32 FlameBlastTimer;
uint32 CheckTimer;
- uint64 GlaiveGUID;
+ ObjectGuid GlaiveGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -476,7 +476,6 @@ public:
{
instance = creature->GetInstanceScript();
DoCast(me, SPELL_DUAL_WIELD, true);
- AkamaGUID = 0;
}
void Reset() override;
@@ -489,7 +488,7 @@ public:
{
for (uint8 i = 0; i < 2; ++i)
if (summon->GetGUID() == FlameGUID[i])
- FlameGUID[i] = 0;
+ FlameGUID[i].Clear();
if (!FlameGUID[0] && !FlameGUID[1] && Phase != PHASE_ILLIDAN_NULL)
{
@@ -542,7 +541,7 @@ public:
instance->SetBossState(DATA_ILLIDAN_STORMRAGE, DONE);
for (uint8 i = DATA_GO_ILLIDAN_DOOR_R; i < DATA_GO_ILLIDAN_DOOR_L + 1; ++i)
- instance->HandleGameObject(instance->GetData64(i), true);
+ instance->HandleGameObject(instance->GetGuidData(i), true);
}
void KilledUnit(Unit* victim) override
@@ -573,7 +572,7 @@ public:
}
}
- void DeleteFromThreatList(uint64 TargetGUID)
+ void DeleteFromThreatList(ObjectGuid TargetGUID)
{
ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
@@ -849,7 +848,7 @@ public:
if (Creature* glaive = ObjectAccessor::GetCreature(*me, GlaiveGUID[i]))
glaive->DespawnOrUnsummon();
- GlaiveGUID[i] = 0;
+ GlaiveGUID[i].Clear();
}
}
Timer[EVENT_FLIGHT_SEQUENCE] = 2000;
@@ -1102,7 +1101,7 @@ public:
}
public:
- uint64 AkamaGUID;
+ ObjectGuid AkamaGUID;
uint32 Timer[EVENT_ENRAGE + 1];
PhaseIllidan Phase;
private:
@@ -1112,9 +1111,9 @@ public:
uint32 TransformCount;
uint32 FlightCount;
uint32 HoverPoint;
- uint64 MaievGUID;
- uint64 FlameGUID[2];
- uint64 GlaiveGUID[2];
+ ObjectGuid MaievGUID;
+ ObjectGuid FlameGUID[2];
+ ObjectGuid GlaiveGUID[2];
SummonList Summons;
};
@@ -1140,7 +1139,7 @@ public:
{
MaxTimer = 0;
Phase = PHASE_NORMAL_MAIEV;
- IllidanGUID = 0;
+ IllidanGUID.Clear();
Timer[EVENT_MAIEV_STEALTH] = 0;
Timer[EVENT_MAIEV_TAUNT] = urand(22, 43) * 1000;
Timer[EVENT_MAIEV_SHADOW_STRIKE] = 30000;
@@ -1153,7 +1152,7 @@ public:
void EnterEvadeMode() override { }
- void GetIllidanGUID(uint64 guid)
+ void GetIllidanGUID(ObjectGuid guid)
{
IllidanGUID = guid;
}
@@ -1333,7 +1332,7 @@ public:
}
private:
- uint64 IllidanGUID;
+ ObjectGuid IllidanGUID;
PhaseIllidan Phase;
EventMaiev Event;
uint32 Timer[5];
@@ -1364,10 +1363,10 @@ public:
WalkCount = 0;
instance->SetBossState(DATA_ILLIDAN_STORMRAGE, NOT_STARTED);
- IllidanGUID = instance->GetData64(DATA_ILLIDAN_STORMRAGE);
- GateGUID = instance->GetData64(DATA_GO_ILLIDAN_GATE);
- DoorGUID[0] = instance->GetData64(DATA_GO_ILLIDAN_DOOR_R);
- DoorGUID[1] = instance->GetData64(DATA_GO_ILLIDAN_DOOR_L);
+ IllidanGUID = instance->GetGuidData(DATA_ILLIDAN_STORMRAGE);
+ GateGUID = instance->GetGuidData(DATA_GO_ILLIDAN_GATE);
+ DoorGUID[0] = instance->GetGuidData(DATA_GO_ILLIDAN_DOOR_R);
+ DoorGUID[1] = instance->GetGuidData(DATA_GO_ILLIDAN_DOOR_L);
if (JustCreated) // close all doors at create
{
@@ -1385,9 +1384,9 @@ public:
instance->HandleGameObject(DoorGUID[i], true);
}
- ChannelGUID = 0;
- SpiritGUID[0] = 0;
- SpiritGUID[1] = 0;
+ ChannelGUID.Clear();
+ SpiritGUID[0].Clear();
+ SpiritGUID[1].Clear();
Phase = PHASE_AKAMA_NULL;
Timer = 0;
@@ -1758,11 +1757,11 @@ public:
PhaseAkama Phase;
bool Event;
uint32 Timer;
- uint64 IllidanGUID;
- uint64 ChannelGUID;
- uint64 SpiritGUID[2];
- uint64 GateGUID;
- uint64 DoorGUID[2];
+ ObjectGuid IllidanGUID;
+ ObjectGuid ChannelGUID;
+ ObjectGuid SpiritGUID[2];
+ ObjectGuid GateGUID;
+ ObjectGuid DoorGUID[2];
uint32 ChannelCount;
uint32 WalkCount;
uint32 TalkCount;
@@ -1787,11 +1786,11 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::Reset()
akama->AI()->EnterEvadeMode();
}
- MaievGUID = 0;
+ MaievGUID.Clear();
for (uint8 i = 0; i < 2; ++i)
{
- FlameGUID[i] = 0;
- GlaiveGUID[i] = 0;
+ FlameGUID[i].Clear();
+ GlaiveGUID[i].Clear();
}
Phase = PHASE_ILLIDAN_NULL;
@@ -1956,7 +1955,7 @@ public:
void Reset() override
{
- IllidanGUID = 0;
+ IllidanGUID.Clear();
Active = false;
SummonedBeams = false;
@@ -1985,7 +1984,7 @@ public:
DespawnTimer = 5000;
if (who->HasAura(SPELL_ENRAGE))
who->RemoveAurasDueToSpell(SPELL_ENRAGE); // Dispel his enrage
- // if (GameObject* CageTrap = instance->instance->GetGameObject(instance->GetData64(CageTrapGUID)))
+ // if (GameObject* CageTrap = instance->instance->GetGameObject(instance->GetGuidData(CageTrapGUID)))
// CageTrap->SetLootState(GO_JUST_DEACTIVATED);
}
@@ -2014,7 +2013,7 @@ public:
public:
bool Active;
private:
- uint64 IllidanGUID;
+ ObjectGuid IllidanGUID;
uint32 DespawnTimer;
bool SummonedBeams;
};
@@ -2059,7 +2058,7 @@ public:
void Reset() override
{
- TargetGUID = 0;
+ TargetGUID.Clear();
DoCast(me, SPELL_SHADOW_DEMON_PASSIVE, true);
}
@@ -2090,7 +2089,7 @@ public:
}
private:
- uint64 TargetGUID;
+ ObjectGuid TargetGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -2136,7 +2135,7 @@ public:
void Reset() override
{
- IllidanGUID = instance->GetData64(DATA_ILLIDAN_STORMRAGE);
+ IllidanGUID = instance->GetGuidData(DATA_ILLIDAN_STORMRAGE);
CheckTimer = 5000;
DoCast(me, SPELL_SHADOWFIEND_PASSIVE, true);
@@ -2195,7 +2194,7 @@ public:
private:
InstanceScript* instance;
- uint64 IllidanGUID;
+ ObjectGuid IllidanGUID;
uint32 CheckTimer;
};
diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
index 60162188f7e..39aac706acc 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
@@ -112,8 +112,8 @@ public:
void Initialize()
{
- for (uint8 i = 0; i<3; ++i)
- TargetGUID[i] = 0;
+ for (uint8 i = 0; i < 3; ++i)
+ TargetGUID[i].Clear();
BeamCount = 0;
CurrentBeam = SINISTER_BEAM; // 0 - Sinister, 1 - Vile, 2 - Wicked, 3 - Sinful
@@ -236,7 +236,7 @@ public:
{
if (Unit* unit = ObjectAccessor::GetUnit(*me, TargetGUID[i]))
unit->CastSpell(unit, SPELL_ATTRACTION, true);
- TargetGUID[i] = 0;
+ TargetGUID[i].Clear();
}
}
++ExplosionCount;
@@ -267,7 +267,7 @@ public:
}
private:
- uint64 TargetGUID[3];
+ ObjectGuid TargetGUID[3];
uint32 BeamCount;
uint32 CurrentBeam;
uint32 ExplosionCount;
diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
index f3c8af50328..c5989f4df64 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
@@ -113,9 +113,12 @@ public:
{
npc_enslaved_soulAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 ReliquaryGUID;
+ ObjectGuid ReliquaryGUID;
- void Reset() override { ReliquaryGUID = 0; }
+ void Reset() override
+ {
+ ReliquaryGUID.Clear();
+ }
void EnterCombat(Unit* /*who*/) override
{
@@ -142,12 +145,11 @@ public:
boss_reliquary_of_soulsAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
- EssenceGUID = 0;
}
InstanceScript* instance;
- uint64 EssenceGUID;
+ ObjectGuid EssenceGUID;
uint32 Phase;
uint32 Counter;
@@ -165,7 +167,7 @@ public:
if (Creature* essence = ObjectAccessor::GetCreature(*me, EssenceGUID))
essence->DespawnOrUnsummon();
- EssenceGUID = 0;
+ EssenceGUID.Clear();
}
Phase = 0;
@@ -334,17 +336,15 @@ public:
if (Essence)
{
if (Phase == 1)
- {
Essence->AI()->Talk(SUFF_SAY_AFTER);
- }
else
- {
Essence->AI()->Talk(DESI_SAY_AFTER);
- }
+
Essence->DespawnOrUnsummon();
}
+
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
- EssenceGUID = 0;
+ EssenceGUID.Clear();
SoulCount = 0;
SoulDeathCount = 0;
Timer = 3000;
@@ -624,7 +624,7 @@ public:
{
boss_essence_of_angerAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 AggroTargetGUID;
+ ObjectGuid AggroTargetGUID;
uint32 CheckTankTimer;
uint32 SoulScreamTimer;
@@ -636,7 +636,7 @@ public:
void Reset() override
{
- AggroTargetGUID = 0;
+ AggroTargetGUID.Clear();
CheckTankTimer = 5000;
SoulScreamTimer = 10000;
diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
index f1e170c0705..6b337e42087 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
@@ -175,11 +175,11 @@ public:
{
if (!HasKilledAkamaAndReseting)
{
- for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
+ for (GuidList::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
if (Creature* Channeler = ObjectAccessor::GetCreature(*me, *itr))
Channeler->DespawnOrUnsummon();
- for (std::list<uint64>::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr)
+ for (GuidList::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr)
if (Creature* Spawner = ObjectAccessor::GetCreature(*me, *itr))
Spawner->AI()->SetData(SETDATA_DATA, SETDATA_DESPAWN_ALL_SPAWNS);
@@ -207,7 +207,7 @@ public:
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
{
- if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE)))
+ if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE)))
if (Akama->IsAlive())
ScriptedAI::AttackStart(Akama);
}
@@ -231,7 +231,7 @@ public:
events.ScheduleEvent(EVENT_START_ATTACK_AKAMA, 500);
events.ScheduleEvent(EVENT_SET_CHANNELERS_SPAWNERS, 1000);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
- if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE)))
+ if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE)))
me->AddThreat(Akama, 10000000.0f);
}
else if (spell->Id == SPELL_SHADE_SOUL_CHANNEL_2)
@@ -267,7 +267,7 @@ public:
switch (eventId)
{
case EVENT_RESET_ENCOUNTER:
- if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE)))
+ if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE)))
if (!Akama->IsAlive())
Akama->Respawn();
break;
@@ -307,17 +307,13 @@ public:
{
case EVENT_SET_CHANNELERS_SPAWNERS:
{
- for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
- {
+ for (GuidList::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
if (Creature* Channeler = ObjectAccessor::GetCreature(*me, *itr))
Channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- }
- for (std::list<uint64>::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr)
- {
+ for (GuidList::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr)
if (Creature* Spawner = ObjectAccessor::GetCreature(*me, *itr))
Spawner->AI()->SetData(SETDATA_DATA, SETDATA_START_SPAWNING);
- }
break;
}
case EVENT_START_ATTACK_AKAMA:
@@ -347,14 +343,14 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
combatStarted = false;
- if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE)))
+ if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE)))
Akama->DespawnOrUnsummon();
- for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
+ for (GuidList::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
if (Creature* Channeler = ObjectAccessor::GetCreature(*me, *itr))
Channeler->DespawnOrUnsummon();
- for (std::list<uint64>::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr)
+ for (GuidList::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr)
if (Creature* Spawner = ObjectAccessor::GetCreature(*me, *itr))
Spawner->AI()->SetData(SETDATA_DATA, SETDATA_DESPAWN_ALL_SPAWNS);
@@ -365,7 +361,7 @@ public:
if (!akamaReached)
{
- if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE)))
+ if (Creature* Akama = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE)))
{
if (me->IsWithinDist(Akama, 2.0f, false))
{
@@ -379,7 +375,7 @@ public:
events.CancelEvent(EVENT_START_ATTACK_AKAMA);
events.ScheduleEvent(EVENT_ADD_THREAT, 100);
- for (std::list<uint64>::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr)
+ for (GuidList::const_iterator itr = Spawners.begin(); itr != Spawners.end(); ++itr)
if (Creature* Spawner = ObjectAccessor::GetCreature(*me, *itr))
Spawner->AI()->SetData(SETDATA_DATA, SETDATA_STOP_SPAWNING);
}
@@ -395,8 +391,8 @@ public:
private:
InstanceScript* instance;
EventMap events;
- std::list<uint64> Channelers;
- std::list<uint64> Spawners;
+ GuidList Channelers;
+ GuidList Spawners;
bool akamaReached;
bool combatStarted;
bool HasKilledAkamaAndReseting;
@@ -437,7 +433,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA)))
+ if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA)))
if (Shade->IsAlive())
ENSURE_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->HasKilledAkama = true;
me->GetMotionMaster()->Clear(true);
@@ -451,7 +447,7 @@ public:
me->ClearUnitState(UNIT_STATE_ROOT);
me->RemoveAura(SPELL_AKAMA_SOUL_CHANNEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
- if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA)))
+ if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA)))
Shade->RemoveAura(SPELL_AKAMA_SOUL_CHANNEL);
StartCombat = true;
}
@@ -577,7 +573,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA)))
+ if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA)))
Shade->AI()->SetData(SETDATA_DATA, SETDATA_CHANNELER_DIED);
}
@@ -593,7 +589,7 @@ public:
switch (eventId)
{
case EVENT_CHANNEL:
- if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA)))
+ if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA)))
{
if (Shade->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
DoCast(me, SPELL_SHADE_SOUL_CHANNEL);
@@ -751,26 +747,26 @@ public:
{
if (!startedBanishing)
{
- if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA)))
+ if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA)))
{
if (Shade->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
me->GetMotionMaster()->MovePoint(0, Shade->GetPositionX(), Shade->GetPositionY(), Shade->GetPositionZ(), false);
else
{
- if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE)))
+ if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE)))
AttackStart(target);
}
}
}
- summonerGuid = 0;
+ summonerGuid.Clear();
startedBanishing = false;
switchToCombat = false;
}
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA)))
+ if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA)))
Shade->AI()->SetData(SETDATA_DATA, SETDATA_CHANNELER_DIED);
me->DespawnOrUnsummon(5000);
}
@@ -799,7 +795,7 @@ public:
switch (eventId)
{
case EVENT_SORCERER_CHANNEL:
- if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA)))
+ if (Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA)))
{
if (Shade->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
{
@@ -812,7 +808,7 @@ public:
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
Shade->AI()->SetData(SETDATA_DATA, SETDATA_CHANNELER_DIED);
switchToCombat = true;
- if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE)))
+ if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE)))
AttackStart(target);
}
}
@@ -824,7 +820,7 @@ public:
if (!startedBanishing)
{
- Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADE_OF_AKAMA));
+ Creature* Shade = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADE_OF_AKAMA));
if (me->IsWithinDist(Shade, 20.0f, false))
{
me->StopMoving();
@@ -841,7 +837,7 @@ public:
private:
InstanceScript* instance;
EventMap events;
- uint64 summonerGuid;
+ ObjectGuid summonerGuid;
bool startedBanishing;
bool switchToCombat;
};
@@ -870,9 +866,9 @@ public:
void Reset() override
{
- summonerGuid = 0;
+ summonerGuid.Clear();
- if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE)))
+ if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE)))
AttackStart(target);
}
@@ -933,7 +929,7 @@ public:
private:
InstanceScript* instance;
EventMap events;
- uint64 summonerGuid;
+ ObjectGuid summonerGuid;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -960,9 +956,9 @@ public:
void Reset() override
{
- summonerGuid = 0;
+ summonerGuid.Clear();
- if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE)))
+ if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE)))
AttackStart(target);
}
@@ -1013,7 +1009,7 @@ public:
private:
InstanceScript* instance;
EventMap events;
- uint64 summonerGuid;
+ ObjectGuid summonerGuid;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -1040,9 +1036,9 @@ public:
void Reset() override
{
- summonerGuid = 0;
+ summonerGuid.Clear();
- if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE)))
+ if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE)))
AttackStart(target);
}
@@ -1093,7 +1089,7 @@ public:
private:
InstanceScript* instance;
EventMap events;
- uint64 summonerGuid;
+ ObjectGuid summonerGuid;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -1122,9 +1118,9 @@ public:
{
spiritMend = false;
chainHeal = false;
- summonerGuid = 0;
+ summonerGuid.Clear();
- if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_AKAMA_SHADE)))
+ if (Unit* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AKAMA_SHADE)))
AttackStart(target);
}
@@ -1188,7 +1184,7 @@ public:
private:
InstanceScript* instance;
EventMap events;
- uint64 summonerGuid;
+ ObjectGuid summonerGuid;
bool spiritMend;
bool chainHeal;
};
diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
index 0bbf2cb2a96..081dbc079a7 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
@@ -67,13 +67,13 @@ public:
uint32 CheckTeronTimer;
uint32 ShadowBoltTimer;
- uint64 TeronGUID;
+ ObjectGuid TeronGUID;
void Reset() override
{
CheckTeronTimer = 5000;
ShadowBoltTimer = 12000;
- TeronGUID = 0;
+ TeronGUID.Clear();
}
void EnterCombat(Unit* /*who*/) override { }
@@ -113,7 +113,7 @@ public:
return;
}
- void SetTeronGUID(uint64 guid)
+ void SetTeronGUID(ObjectGuid guid)
{
TeronGUID = guid;
}
@@ -134,16 +134,16 @@ public:
{
npc_shadowy_constructAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 GhostGUID;
- uint64 TeronGUID;
+ ObjectGuid GhostGUID;
+ ObjectGuid TeronGUID;
uint32 CheckPlayerTimer;
uint32 CheckTeronTimer;
void Reset() override
{
- GhostGUID = 0;
- TeronGUID = 0;
+ GhostGUID.Clear();
+ TeronGUID.Clear();
CheckPlayerTimer = 2000;
CheckTeronTimer = 5000;
@@ -238,8 +238,8 @@ public:
uint32 RandomYellTimer;
uint32 AggroTimer;
- uint64 AggroTargetGUID;
- uint64 GhostGUID; // Player that gets killed by Shadow of Death and gets turned into a ghost
+ ObjectGuid AggroTargetGUID;
+ ObjectGuid GhostGUID; // Player that gets killed by Shadow of Death and gets turned into a ghost
bool Intro;
bool Done;
@@ -260,7 +260,7 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
AggroTimer = 20000;
- AggroTargetGUID = 0;
+ AggroTargetGUID.Clear();
Intro = false;
Done = false;
}
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index c998bfed2dc..0f80e541261 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -1,145 +1,144 @@
-/*
- * Copyright (C) 2008-2014 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 "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "black_temple.h"
-#include "Player.h"
-#include "SpellInfo.h"
-
-enum Texts
-{
- SAY_AGGRO = 0,
- SAY_NEEDLE = 1,
- SAY_SLAY = 2,
- SAY_SPECIAL = 3,
- SAY_ENRAGE = 4,
- SAY_DEATH = 5
-};
-
-enum Spells
-{
- SPELL_NEEDLE_SPINE = 39992,
- SPELL_TIDAL_BURST = 39878,
- SPELL_TIDAL_SHIELD = 39872,
- SPELL_IMPALING_SPINE = 39837,
- SPELL_CREATE_NAJENTUS_SPINE = 39956,
- SPELL_HURL_SPINE = 39948,
- SPELL_BERSERK = 26662
-
-};
-
-enum Events
-{
- EVENT_BERSERK = 1,
- EVENT_YELL = 2,
- EVENT_NEEDLE = 3,
- EVENT_SPINE = 4,
- EVENT_SHIELD = 5
-};
-
-enum EventGroups
-{
- GCD_CAST = 1,
- GCD_YELL = 2
-};
-
-class boss_najentus : public CreatureScript
-{
-public:
- boss_najentus() : CreatureScript("boss_najentus") { }
-
- struct boss_najentusAI : public BossAI
- {
- boss_najentusAI(Creature* creature) : BossAI(creature, DATA_HIGH_WARLORD_NAJENTUS)
- {
- SpineTargetGUID = 0;
- }
-
- void Reset() override
- {
- _Reset();
- SpineTargetGUID = 0;
- }
-
- void KilledUnit(Unit* /*victim*/) override
- {
- Talk(SAY_SLAY);
- events.DelayEvents(5000, GCD_YELL);
- }
-
- void JustDied(Unit* /*killer*/) override
- {
- _JustDied();
- Talk(SAY_DEATH);
- }
-
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
- {
- if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
- {
- me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD);
- DoCast(me, SPELL_TIDAL_BURST, true);
- ResetTimer();
- }
- }
-
- void EnterCombat(Unit* /*who*/) override
- {
- _EnterCombat();
- Talk(SAY_AGGRO);
- events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST);
- events.ScheduleEvent(EVENT_YELL, 45000 + (rand32() % 76) * 1000, GCD_YELL);
- ResetTimer();
- }
-
- bool RemoveImpalingSpine()
- {
- if (!SpineTargetGUID)
- return false;
-
- Unit* target = ObjectAccessor::GetUnit(*me, SpineTargetGUID);
- if (target && target->HasAura(SPELL_IMPALING_SPINE))
- target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE);
- SpineTargetGUID=0;
- return true;
- }
-
- void ResetTimer(uint32 inc = 0)
- {
- events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST);
- events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST);
- events.RescheduleEvent(EVENT_SHIELD, 60000 + inc);
- }
-
- void ExecuteEvent(uint32 eventId) override
- {
- switch (eventId)
- {
- case EVENT_SHIELD:
- DoCast(me, SPELL_TIDAL_SHIELD, true);
- ResetTimer(45000);
- break;
- case EVENT_BERSERK:
- Talk(SAY_ENRAGE);
- DoCast(me, SPELL_BERSERK, true);
- events.DelayEvents(15000, GCD_YELL);
- break;
- case EVENT_SPINE:
+/*
+ * Copyright (C) 2008-2014 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 "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "black_temple.h"
+#include "Player.h"
+#include "SpellInfo.h"
+
+enum Texts
+{
+ SAY_AGGRO = 0,
+ SAY_NEEDLE = 1,
+ SAY_SLAY = 2,
+ SAY_SPECIAL = 3,
+ SAY_ENRAGE = 4,
+ SAY_DEATH = 5
+};
+
+enum Spells
+{
+ SPELL_NEEDLE_SPINE = 39992,
+ SPELL_TIDAL_BURST = 39878,
+ SPELL_TIDAL_SHIELD = 39872,
+ SPELL_IMPALING_SPINE = 39837,
+ SPELL_CREATE_NAJENTUS_SPINE = 39956,
+ SPELL_HURL_SPINE = 39948,
+ SPELL_BERSERK = 26662
+
+};
+
+enum Events
+{
+ EVENT_BERSERK = 1,
+ EVENT_YELL = 2,
+ EVENT_NEEDLE = 3,
+ EVENT_SPINE = 4,
+ EVENT_SHIELD = 5
+};
+
+enum EventGroups
+{
+ GCD_CAST = 1,
+ GCD_YELL = 2
+};
+
+class boss_najentus : public CreatureScript
+{
+public:
+ boss_najentus() : CreatureScript("boss_najentus") { }
+
+ struct boss_najentusAI : public BossAI
+ {
+ boss_najentusAI(Creature* creature) : BossAI(creature, DATA_HIGH_WARLORD_NAJENTUS)
+ {
+ }
+
+ void Reset() override
+ {
+ _Reset();
+ SpineTargetGUID.Clear();
+ }
+
+ void KilledUnit(Unit* /*victim*/) override
+ {
+ Talk(SAY_SLAY);
+ events.DelayEvents(5000, GCD_YELL);
+ }
+
+ void JustDied(Unit* /*killer*/) override
+ {
+ _JustDied();
+ Talk(SAY_DEATH);
+ }
+
+ void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ {
+ if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
+ {
+ me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD);
+ DoCast(me, SPELL_TIDAL_BURST, true);
+ ResetTimer();
+ }
+ }
+
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _EnterCombat();
+ Talk(SAY_AGGRO);
+ events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST);
+ events.ScheduleEvent(EVENT_YELL, 45000 + (rand32() % 76) * 1000, GCD_YELL);
+ ResetTimer();
+ }
+
+ bool RemoveImpalingSpine()
+ {
+ if (!SpineTargetGUID)
+ return false;
+
+ Unit* target = ObjectAccessor::GetUnit(*me, SpineTargetGUID);
+ if (target && target->HasAura(SPELL_IMPALING_SPINE))
+ target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE);
+ SpineTargetGUID.Clear();
+ return true;
+ }
+
+ void ResetTimer(uint32 inc = 0)
+ {
+ events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST);
+ events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST);
+ events.RescheduleEvent(EVENT_SHIELD, 60000 + inc);
+ }
+
+ void ExecuteEvent(uint32 eventId) override
+ {
+ switch (eventId)
+ {
+ case EVENT_SHIELD:
+ DoCast(me, SPELL_TIDAL_SHIELD, true);
+ ResetTimer(45000);
+ break;
+ case EVENT_BERSERK:
+ Talk(SAY_ENRAGE);
+ DoCast(me, SPELL_BERSERK, true);
+ events.DelayEvents(15000, GCD_YELL);
+ break;
+ case EVENT_SPINE:
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
@@ -158,59 +157,59 @@ public:
}
events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST);
return;
- }
- case EVENT_NEEDLE:
- {
- //DoCast(me, SPELL_NEEDLE_SPINE, true);
- std::list<Unit*> targets;
- SelectTargetList(targets, 3, SELECT_TARGET_RANDOM, 80, true);
- for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
- DoCast(*i, 39835, true);
- events.ScheduleEvent(EVENT_NEEDLE, urand(15000, 25000), GCD_CAST);
- events.DelayEvents(1500, GCD_CAST);
- return;
- }
- case EVENT_YELL:
- Talk(SAY_SPECIAL);
- events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL);
- events.DelayEvents(15000, GCD_YELL);
- break;
- default:
- break;
- }
- }
-
- private:
- uint64 SpineTargetGUID;
- };
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetBlackTempleAI<boss_najentusAI>(creature);
- }
-};
-
-class go_najentus_spine : public GameObjectScript
-{
-public:
- go_najentus_spine() : GameObjectScript("go_najentus_spine") { }
-
- bool OnGossipHello(Player* player, GameObject* go) override
- {
- if (InstanceScript* instance = go->GetInstanceScript())
- if (Creature* Najentus = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_HIGH_WARLORD_NAJENTUS)))
- if (ENSURE_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine())
- {
- player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
- go->Delete();
- }
- return true;
- }
-
-};
-
-void AddSC_boss_najentus()
-{
- new boss_najentus();
- new go_najentus_spine();
-}
+ }
+ case EVENT_NEEDLE:
+ {
+ //DoCast(me, SPELL_NEEDLE_SPINE, true);
+ std::list<Unit*> targets;
+ SelectTargetList(targets, 3, SELECT_TARGET_RANDOM, 80, true);
+ for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
+ DoCast(*i, 39835, true);
+ events.ScheduleEvent(EVENT_NEEDLE, urand(15000, 25000), GCD_CAST);
+ events.DelayEvents(1500, GCD_CAST);
+ return;
+ }
+ case EVENT_YELL:
+ Talk(SAY_SPECIAL);
+ events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL);
+ events.DelayEvents(15000, GCD_YELL);
+ break;
+ default:
+ break;
+ }
+ }
+
+ private:
+ ObjectGuid SpineTargetGUID;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetBlackTempleAI<boss_najentusAI>(creature);
+ }
+};
+
+class go_najentus_spine : public GameObjectScript
+{
+public:
+ go_najentus_spine() : GameObjectScript("go_najentus_spine") { }
+
+ bool OnGossipHello(Player* player, GameObject* go) override
+ {
+ if (InstanceScript* instance = go->GetInstanceScript())
+ if (Creature* Najentus = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_HIGH_WARLORD_NAJENTUS)))
+ if (ENSURE_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine())
+ {
+ player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
+ go->Delete();
+ }
+ return true;
+ }
+
+};
+
+void AddSC_boss_najentus()
+{
+ new boss_najentus();
+ new go_najentus_spine();
+}
diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
index 2c6bac4c9d9..a14a4c576cb 100644
--- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
+++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
@@ -129,11 +129,9 @@ public:
{
npc_blood_elf_council_voice_triggerAI(Creature* creature) : ScriptedAI(creature)
{
- for (uint8 i = 0; i < 4; ++i)
- Council[i] = 0;
}
- uint64 Council[4];
+ ObjectGuid Council[4];
uint32 EnrageTimer;
uint32 AggroYellTimer;
@@ -157,10 +155,10 @@ public:
{
if (InstanceScript* instance = me->GetInstanceScript())
{
- Council[0] = instance->GetData64(DATA_GATHIOS_THE_SHATTERER);
- Council[1] = instance->GetData64(DATA_VERAS_DARKSHADOW);
- Council[2] = instance->GetData64(DATA_LADY_MALANDE);
- Council[3] = instance->GetData64(DATA_HIGH_NETHERMANCER_ZEREVOR);
+ Council[0] = instance->GetGuidData(DATA_GATHIOS_THE_SHATTERER);
+ Council[1] = instance->GetGuidData(DATA_VERAS_DARKSHADOW);
+ Council[2] = instance->GetGuidData(DATA_LADY_MALANDE);
+ Council[3] = instance->GetGuidData(DATA_HIGH_NETHERMANCER_ZEREVOR);
} else TC_LOG_ERROR("scripts", ERROR_INST_DATA);
}
@@ -226,13 +224,11 @@ public:
npc_illidari_councilAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
- for (uint8 i = 0; i < 4; ++i)
- Council[i] = 0;
}
InstanceScript* instance;
- uint64 Council[4];
+ ObjectGuid Council[4];
uint32 CheckTimer;
uint32 EndEventTimer;
@@ -264,7 +260,7 @@ public:
}
instance->SetBossState(DATA_ILLIDARI_COUNCIL, NOT_STARTED);
- if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))
+ if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_ELF_COUNCIL_VOICE)))
VoiceTrigger->AI()->EnterEvadeMode();
EventBegun = false;
@@ -283,13 +279,13 @@ public:
{
if (target && target->IsAlive())
{
- Council[0] = instance->GetData64(DATA_GATHIOS_THE_SHATTERER);
- Council[1] = instance->GetData64(DATA_HIGH_NETHERMANCER_ZEREVOR);
- Council[2] = instance->GetData64(DATA_LADY_MALANDE);
- Council[3] = instance->GetData64(DATA_VERAS_DARKSHADOW);
+ Council[0] = instance->GetGuidData(DATA_GATHIOS_THE_SHATTERER);
+ Council[1] = instance->GetGuidData(DATA_HIGH_NETHERMANCER_ZEREVOR);
+ Council[2] = instance->GetGuidData(DATA_LADY_MALANDE);
+ Council[3] = instance->GetGuidData(DATA_VERAS_DARKSHADOW);
// Start the event for the Voice Trigger
- if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))
+ if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_ELF_COUNCIL_VOICE)))
{
ENSURE_AI(npc_blood_elf_council_voice_trigger::npc_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->LoadCouncilGUIDs();
ENSURE_AI(npc_blood_elf_council_voice_trigger::npc_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->EventStarted = true;
@@ -322,7 +318,7 @@ public:
{
if (DeathCount > 3)
{
- if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))
+ if (Creature* VoiceTrigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_ELF_COUNCIL_VOICE)))
VoiceTrigger->DealDamage(VoiceTrigger, VoiceTrigger->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
instance->SetBossState(DATA_ILLIDARI_COUNCIL, DONE);
//me->SummonCreature(AKAMAID, 746.466980f, 304.394989f, 311.90208f, 6.272870f, TEMPSUMMON_DEAD_DESPAWN, 0);
@@ -379,12 +375,10 @@ struct boss_illidari_councilAI : public ScriptedAI
boss_illidari_councilAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
- for (uint8 i = 0; i < 4; ++i)
- Council[i] = 0;
LoadedGUIDs = false;
}
- uint64 Council[4];
+ ObjectGuid Council[4];
InstanceScript* instance;
@@ -392,7 +386,7 @@ struct boss_illidari_councilAI : public ScriptedAI
void EnterCombat(Unit* who) override
{
- if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ILLIDARI_COUNCIL)))
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ILLIDARI_COUNCIL)))
ENSURE_AI(npc_illidari_council::npc_illidari_councilAI, controller->AI())->StartEvent(who);
DoZoneInCombat();
// Load GUIDs on first aggro because the Creature guids are only set as the creatures are created in world-
@@ -436,10 +430,10 @@ struct boss_illidari_councilAI : public ScriptedAI
void LoadGUIDs()
{
- Council[0] = instance->GetData64(DATA_LADY_MALANDE);
- Council[1] = instance->GetData64(DATA_HIGH_NETHERMANCER_ZEREVOR);
- Council[2] = instance->GetData64(DATA_GATHIOS_THE_SHATTERER);
- Council[3] = instance->GetData64(DATA_VERAS_DARKSHADOW);
+ Council[0] = instance->GetGuidData(DATA_LADY_MALANDE);
+ Council[1] = instance->GetGuidData(DATA_HIGH_NETHERMANCER_ZEREVOR);
+ Council[2] = instance->GetGuidData(DATA_GATHIOS_THE_SHATTERER);
+ Council[3] = instance->GetGuidData(DATA_VERAS_DARKSHADOW);
LoadedGUIDs = true;
}
diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
index 55ad45597ea..7067ca659d3 100644
--- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
@@ -47,23 +47,6 @@ class instance_black_temple : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
-
- NajentusGUID = 0;
- SupremusGUID = 0;
- ShadeOfAkamaGUID = 0;
- AkamaShadeGUID = 0;
- AkamaGUID = 0;
- GathiosTheShattererGUID = 0;
- HighNethermancerZerevorGUID = 0;
- LadyMalandeGUID = 0;
- VerasDarkshadowGUID = 0;
- IllidariCouncilGUID = 0;
- BloodElfCouncilVoiceGUID = 0;
- IllidanStormrageGUID = 0;
-
- IllidanGateGUID = 0;
-
- memset(IllidanDoorGUIDs, 0, 2 * sizeof(uint64));
}
void OnCreatureCreate(Creature* creature) override
@@ -162,7 +145,7 @@ class instance_black_temple : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -200,28 +183,28 @@ class instance_black_temple : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
protected:
- uint64 NajentusGUID;
- uint64 SupremusGUID;
- uint64 ShadeOfAkamaGUID;
- uint64 AkamaShadeGUID;
- uint64 AkamaGUID;
+ ObjectGuid NajentusGUID;
+ ObjectGuid SupremusGUID;
+ ObjectGuid ShadeOfAkamaGUID;
+ ObjectGuid AkamaShadeGUID;
+ ObjectGuid AkamaGUID;
- uint64 GathiosTheShattererGUID;
- uint64 HighNethermancerZerevorGUID;
- uint64 LadyMalandeGUID;
- uint64 VerasDarkshadowGUID;
+ ObjectGuid GathiosTheShattererGUID;
+ ObjectGuid HighNethermancerZerevorGUID;
+ ObjectGuid LadyMalandeGUID;
+ ObjectGuid VerasDarkshadowGUID;
- uint64 IllidariCouncilGUID;
- uint64 BloodElfCouncilVoiceGUID;
+ ObjectGuid IllidariCouncilGUID;
+ ObjectGuid BloodElfCouncilVoiceGUID;
- uint64 IllidanStormrageGUID;
+ ObjectGuid IllidanStormrageGUID;
- uint64 IllidanGateGUID;
- uint64 IllidanDoorGUIDs[2];
+ ObjectGuid IllidanGateGUID;
+ ObjectGuid IllidanDoorGUIDs[2];
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
index 683efcdbcf0..05db2c12b90 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
@@ -112,9 +112,6 @@ public:
boss_fathomlord_karathressAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
- Advisors[0] = 0;
- Advisors[1] = 0;
- Advisors[2] = 0;
}
InstanceScript* instance;
@@ -125,7 +122,7 @@ public:
bool BlessingOfTides;
- uint64 Advisors[MAX_ADVISORS];
+ ObjectGuid Advisors[MAX_ADVISORS];
void Reset() override
{
@@ -135,10 +132,10 @@ public:
BlessingOfTides = false;
- uint64 RAdvisors[MAX_ADVISORS];
- RAdvisors[0] = instance->GetData64(DATA_SHARKKIS);
- RAdvisors[1] = instance->GetData64(DATA_TIDALVESS);
- RAdvisors[2] = instance->GetData64(DATA_CARIBDIS);
+ ObjectGuid RAdvisors[MAX_ADVISORS];
+ RAdvisors[0] = instance->GetGuidData(DATA_SHARKKIS);
+ RAdvisors[1] = instance->GetGuidData(DATA_TIDALVESS);
+ RAdvisors[2] = instance->GetGuidData(DATA_CARIBDIS);
// Respawn of the 3 Advisors
for (uint8 i = 0; i < MAX_ADVISORS; ++i)
if (RAdvisors[i])
@@ -175,9 +172,9 @@ public:
void GetAdvisors()
{
- Advisors[0] = instance->GetData64(DATA_SHARKKIS);
- Advisors[1] = instance->GetData64(DATA_TIDALVESS);
- Advisors[2] = instance->GetData64(DATA_CARIBDIS);
+ Advisors[0] = instance->GetGuidData(DATA_SHARKKIS);
+ Advisors[1] = instance->GetGuidData(DATA_TIDALVESS);
+ Advisors[2] = instance->GetGuidData(DATA_CARIBDIS);
}
void StartEvent(Unit* who)
@@ -187,7 +184,7 @@ public:
Talk(SAY_AGGRO);
DoZoneInCombat();
- instance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID());
+ instance->SetGuidData(DATA_KARATHRESSEVENT_STARTER, who->GetGUID());
instance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS);
}
@@ -216,7 +213,7 @@ public:
//Only if not incombat check if the event is started
if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT))
{
- if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_KARATHRESSEVENT_STARTER)))
{
AttackStart(target);
GetAdvisors();
@@ -308,7 +305,6 @@ public:
boss_fathomguard_sharkkisAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
- SummonedPet = 0;
}
InstanceScript* instance;
@@ -320,7 +316,7 @@ public:
bool pet;
- uint64 SummonedPet;
+ ObjectGuid SummonedPet;
void Reset() override
{
@@ -335,20 +331,20 @@ public:
if (Pet && Pet->IsAlive())
Pet->DealDamage(Pet, Pet->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- SummonedPet = 0;
+ SummonedPet.Clear();
instance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED);
}
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KARATHRESS)))
+ if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KARATHRESS)))
ENSURE_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath();
}
void EnterCombat(Unit* who) override
{
- instance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID());
+ instance->SetGuidData(DATA_KARATHRESSEVENT_STARTER, who->GetGUID());
instance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS);
}
@@ -357,7 +353,7 @@ public:
//Only if not incombat check if the event is started
if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT))
{
- if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_KARATHRESSEVENT_STARTER)))
AttackStart(target);
}
@@ -468,13 +464,13 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KARATHRESS)))
+ if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KARATHRESS)))
ENSURE_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventTidalvessDeath();
}
void EnterCombat(Unit* who) override
{
- instance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID());
+ instance->SetGuidData(DATA_KARATHRESSEVENT_STARTER, who->GetGUID());
instance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS);
DoCast(me, SPELL_WINDFURY_WEAPON);
}
@@ -484,7 +480,7 @@ public:
//Only if not incombat check if the event is started
if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT))
{
- if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_KARATHRESSEVENT_STARTER)))
AttackStart(target);
}
@@ -515,7 +511,7 @@ public:
if (Spitfire_Timer <= diff)
{
DoCast(me, SPELL_SPITFIRE_TOTEM);
- if (Unit* SpitfireTotem = ObjectAccessor::GetUnit(*me, CREATURE_SPITFIRE_TOTEM))
+ if (Unit* SpitfireTotem = me->FindNearestCreature(CREATURE_SPITFIRE_TOTEM, 100.0f))
SpitfireTotem->ToCreature()->AI()->AttackStart(me->GetVictim());
Spitfire_Timer = 60000;
@@ -584,13 +580,13 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KARATHRESS)))
+ if (Creature* Karathress = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KARATHRESS)))
ENSURE_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventCaribdisDeath();
}
void EnterCombat(Unit* who) override
{
- instance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID());
+ instance->SetGuidData(DATA_KARATHRESSEVENT_STARTER, who->GetGUID());
instance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS);
}
@@ -599,7 +595,7 @@ public:
//Only if not incombat check if the event is started
if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT))
{
- if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
+ if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_KARATHRESSEVENT_STARTER)))
AttackStart(target);
}
@@ -675,13 +671,13 @@ public:
switch (rand32() % 4)
{
case 0:
- unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESS));
+ unit = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_KARATHRESS));
break;
case 1:
- unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SHARKKIS));
+ unit = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_SHARKKIS));
break;
case 2:
- unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_TIDALVESS));
+ unit = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_TIDALVESS));
break;
case 3:
unit = me;
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp
index bcde75584fb..cea6a1854a1 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp
@@ -94,13 +94,11 @@ public:
boss_hydross_the_unstableAI(Creature* creature) : ScriptedAI(creature), Summons(me)
{
instance = creature->GetInstanceScript();
- beams[0] = 0;
- beams[1] = 0;
}
InstanceScript* instance;
- uint64 beams[2];
+ ObjectGuid beams[2];
uint32 PosCheck_Timer;
uint32 MarkOfHydross_Timer;
uint32 MarkOfCorruption_Timer;
@@ -116,8 +114,8 @@ public:
void Reset() override
{
DeSummonBeams();
- beams[0] = 0;
- beams[1] = 0;
+ beams[0].Clear();
+ beams[1].Clear();
PosCheck_Timer = 2500;
MarkOfHydross_Timer = 15000;
MarkOfCorruption_Timer = 15000;
@@ -147,7 +145,7 @@ public:
beamer->CastSpell(me, SPELL_BLUE_BEAM, true);
beamer->SetDisplayId(11686); //invisible
beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- beams[0]=beamer->GetGUID();
+ beams[0] = beamer->GetGUID();
}
beamer = me->SummonCreature(ENTRY_BEAM_DUMMY, -219.918f, -371.308f, 22.0042f, 2.73072f, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (beamer)
@@ -155,7 +153,7 @@ public:
beamer->CastSpell(me, SPELL_BLUE_BEAM, true);
beamer->SetDisplayId(11686); //invisible
beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- beams[1]=beamer->GetGUID();
+ beams[1] = beamer->GetGUID();
}
}
void DeSummonBeams()
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
index a241f2bea37..4630620c585 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
@@ -151,13 +151,11 @@ public:
Intro = false;
JustCreated = true;
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // set it only once on Creature create (no need do intro if wiped)
- for (uint8 i = 0; i < 4; ++i)
- ShieldGeneratorChannel[i] = 0;
}
InstanceScript* instance;
- uint64 ShieldGeneratorChannel[4];
+ ObjectGuid ShieldGeneratorChannel[4];
uint32 AggroTimer;
uint32 ShockBlastTimer;
@@ -210,7 +208,7 @@ public:
if (Unit* remo = ObjectAccessor::GetUnit(*me, ShieldGeneratorChannel[i]))
{
remo->setDeathState(JUST_DIED);
- ShieldGeneratorChannel[i] = 0;
+ ShieldGeneratorChannel[i].Clear();
}
}
}
@@ -565,7 +563,7 @@ public:
uint32 Phase;
float X, Y, Z;
- uint64 VashjGUID;
+ ObjectGuid VashjGUID;
void Reset() override
{
@@ -589,7 +587,7 @@ public:
}
}
- VashjGUID = instance->GetData64(DATA_LADYVASHJ);
+ VashjGUID = instance->GetGuidData(DATA_LADYVASHJ);
}
void EnterCombat(Unit* /*who*/) override { }
@@ -662,7 +660,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* vashj = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_LADYVASHJ)))
+ if (Creature* vashj = ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_LADYVASHJ)))
ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->EventTaintedElementalDeath();
}
@@ -778,7 +776,7 @@ public:
if (CheckTimer <= diff)
{
// check if vashj is death
- Unit* Vashj = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ));
+ Unit* Vashj = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LADYVASHJ));
if (!Vashj || !Vashj->IsAlive() || ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->ToCreature()->AI())->Phase != 3)
{
// remove
@@ -833,7 +831,7 @@ public:
{
if (CheckTimer <= diff)
{
- Unit* vashj = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ));
+ Unit* vashj = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LADYVASHJ));
if (vashj && vashj->IsAlive())
{
@@ -865,7 +863,7 @@ public:
return true;
}
- Creature* vashj = ObjectAccessor::GetCreature((*player), instance->GetData64(DATA_LADYVASHJ));
+ Creature* vashj = ObjectAccessor::GetCreature((*player), instance->GetGuidData(DATA_LADYVASHJ));
if (vashj && (ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase == 2))
{
if (GameObject* gObj = targets.GetGOTarget())
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
index fb5b4579942..9f51155b334 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
@@ -83,13 +83,12 @@ public:
{
npc_inner_demonAI(Creature* creature) : ScriptedAI(creature)
{
- victimGUID = 0;
}
uint32 ShadowBolt_Timer;
uint32 Link_Timer;
- uint64 victimGUID;
+ ObjectGuid victimGUID;
void Reset() override
{
@@ -97,17 +96,17 @@ public:
Link_Timer = 1000;
}
- void SetGUID(uint64 guid, int32 id/* = 0 */) override
+ void SetGUID(ObjectGuid guid, int32 id/* = 0 */) override
{
if (id == INNER_DEMON_VICTIM)
victimGUID = guid;
}
- uint64 GetGUID(int32 id/* = 0 */) const override
+ ObjectGuid GetGUID(int32 id/* = 0 */) const override
{
if (id == INNER_DEMON_VICTIM)
return victimGUID;
- return 0;
+ return ObjectGuid::Empty;
}
void JustDied(Unit* /*killer*/) override
@@ -190,10 +189,6 @@ public:
{
creature->GetPosition(x, y, z);
instance = creature->GetInstanceScript();
- Demon = 0;
-
- for (uint8 i = 0; i < 3; ++i)//clear guids
- SpellBinderGUID[i] = 0;
}
InstanceScript* instance;
@@ -213,10 +208,10 @@ public:
bool EnrageUsed;
float x, y, z;
- uint64 InnderDemon[5];
+ ObjectGuid InnderDemon[5];
uint32 InnerDemon_Count;
- uint64 Demon;
- uint64 SpellBinderGUID[3];
+ ObjectGuid Demon;
+ ObjectGuid SpellBinderGUID[3];
void Reset() override
{
@@ -317,10 +312,10 @@ public:
// and reseting equipment
me->LoadEquipment();
- if (instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER))
+ if (instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER))
{
Unit* victim = NULL;
- victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER));
+ victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER));
if (victim)
me->getThreatManager().addThreat(victim, 1);
StartEvent();
@@ -349,13 +344,12 @@ public:
{
if (InnderDemon[i])
{
- //delete creature
- Creature* creature = ObjectAccessor::GetCreature((*me), InnderDemon[i]);
- if (creature && creature->IsAlive())
- {
- creature->DespawnOrUnsummon();
- }
- InnderDemon[i] = 0;
+ //delete creature
+ Creature* creature = ObjectAccessor::GetCreature((*me), InnderDemon[i]);
+ if (creature && creature->IsAlive())
+ creature->DespawnOrUnsummon();
+
+ InnderDemon[i].Clear();
}
}
@@ -364,9 +358,9 @@ public:
void CastConsumingMadness() //remove this once SPELL_INSIDIOUS_WHISPER is supported by core
{
- for (uint8 i=0; i<5; ++i)
+ for (uint8 i = 0; i < 5; ++i)
{
- if (InnderDemon[i] > 0)
+ if (InnderDemon[i])
{
Creature* unit = ObjectAccessor::GetCreature((*me), InnderDemon[i]);
if (unit && unit->IsAlive())
@@ -481,7 +475,7 @@ public:
if (SwitchToDemon_Timer <= diff)
{
//switch to demon form
- me->RemoveAurasDueToSpell(SPELL_WHIRLWIND, 0);
+ me->RemoveAurasDueToSpell(SPELL_WHIRLWIND);
me->SetDisplayId(MODEL_DEMON);
Talk(SAY_SWITCH_TO_DEMON);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID , 0);
@@ -576,8 +570,8 @@ public:
Creature* Copy = NULL;
Copy = DoSpawnCreature(DEMON_FORM, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 6000);
if (Copy)
- {
- Demon = Copy->GetGUID();
+ {
+ Demon = Copy->GetGUID();
if (me->GetVictim())
Copy->AI()->AttackStart(me->GetVictim());
}
@@ -682,13 +676,12 @@ public:
npc_greyheart_spellbinderAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
- leotherasGUID = 0;
AddedBanish = false;
}
InstanceScript* instance;
- uint64 leotherasGUID;
+ ObjectGuid leotherasGUID;
uint32 Mindblast_Timer;
uint32 Earthshock_Timer;
@@ -700,7 +693,7 @@ public:
Mindblast_Timer = urand(3000, 8000);
Earthshock_Timer = urand(5000, 10000);
- instance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0);
+ instance->SetGuidData(DATA_LEOTHERAS_EVENT_STARTER, ObjectGuid::Empty);
Creature* leotheras = ObjectAccessor::GetCreature(*me, leotherasGUID);
if (leotheras && leotheras->IsAlive())
ENSURE_AI(boss_leotheras_the_blind::boss_leotheras_the_blindAI, leotheras->AI())->CheckChannelers(/*false*/);
@@ -709,7 +702,7 @@ public:
void EnterCombat(Unit* who) override
{
me->InterruptNonMeleeSpells(false);
- instance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, who->GetGUID());
+ instance->SetGuidData(DATA_LEOTHERAS_EVENT_STARTER, who->GetGUID());
}
void JustRespawned() override
@@ -734,12 +727,12 @@ public:
void UpdateAI(uint32 diff) override
{
if (!leotherasGUID)
- leotherasGUID = instance->GetData64(DATA_LEOTHERAS);
+ leotherasGUID = instance->GetGuidData(DATA_LEOTHERAS);
- if (!me->IsInCombat() && instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER))
+ if (!me->IsInCombat() && instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER))
{
Unit* victim = NULL;
- victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER));
+ victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER));
if (victim)
AttackStart(victim);
}
@@ -750,7 +743,7 @@ public:
return;
}
- if (!instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER))
+ if (!instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER))
{
EnterEvadeMode();
return;
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
index d501b919614..0a538ac0c39 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
@@ -215,8 +215,8 @@ public:
{
//Teleport 4 players under the waterfalls
Unit* target;
- std::set<uint64> list;
- std::set<uint64>::const_iterator itr;
+ GuidSet targets;
+ GuidSet::const_iterator itr;
for (uint8 i = 0; i < 4; ++i)
{
counter = 0;
@@ -226,13 +226,13 @@ public:
if (counter < Playercount)
break;
if (target)
- itr = list.find(target->GetGUID());
+ itr = targets.find(target->GetGUID());
++counter;
- } while (itr != list.end());
+ } while (itr != targets.end());
if (target)
{
- list.insert(target->GetGUID());
+ targets.insert(target->GetGUID());
ApplyWateryGrave(target, i);
}
}
@@ -253,8 +253,8 @@ public:
if (WateryGlobules_Timer <= diff)
{
Unit* pGlobuleTarget;
- std::set<uint64> globulelist;
- std::set<uint64>::const_iterator itr;
+ GuidSet globules;
+ GuidSet::const_iterator itr;
for (uint8 g = 0; g < 4; g++) //one unit can't cast more than one spell per update, so some players have to cast for us XD
{
counter = 0;
@@ -262,14 +262,14 @@ public:
{
pGlobuleTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true);
if (pGlobuleTarget)
- itr = globulelist.find(pGlobuleTarget->GetGUID());
+ itr = globules.find(pGlobuleTarget->GetGUID());
if (counter > Playercount)
break;
++counter;
- } while (itr != globulelist.end());
+ } while (itr != globules.end());
if (pGlobuleTarget)
{
- globulelist.insert(pGlobuleTarget->GetGUID());
+ globules.insert(pGlobuleTarget->GetGUID());
pGlobuleTarget->CastSpell(pGlobuleTarget, globulespell[g], true);
}
}
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 a3577f40d68..3fb090ab94c 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
@@ -94,20 +94,6 @@ class instance_serpent_shrine : public InstanceMapScript
{
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
- LurkerBelow = 0;
- Sharkkis = 0;
- Tidalvess = 0;
- Caribdis = 0;
- LadyVashj = 0;
- Karathress = 0;
- KarathressEvent_Starter = 0;
- LeotherasTheBlind = 0;
- LeotherasEventStarter = 0;
-
- ControlConsole = 0;
- BridgePart[0] = 0;
- BridgePart[1] = 0;
- BridgePart[2] = 0;
StrangePool = 0;
Water = WATERSTATE_FRENZY;
@@ -247,7 +233,7 @@ class instance_serpent_shrine : public InstanceMapScript
}
}
- void SetData64(uint32 type, uint64 data) override
+ void SetGuidData(uint32 type, ObjectGuid data) override
{
if (type == DATA_KARATHRESSEVENT_STARTER)
KarathressEvent_Starter = data;
@@ -255,7 +241,7 @@ class instance_serpent_shrine : public InstanceMapScript
LeotherasEventStarter = data;
}
- uint64 GetData64(uint32 identifier) const override
+ ObjectGuid GetGuidData(uint32 identifier) const override
{
switch (identifier)
{
@@ -280,7 +266,7 @@ class instance_serpent_shrine : public InstanceMapScript
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
void SetData(uint32 type, uint32 data) override
@@ -297,7 +283,6 @@ class instance_serpent_shrine : public InstanceMapScript
HandleGameObject(BridgePart[0], true);
HandleGameObject(BridgePart[0], true);
}
- ControlConsole = data;
break;
case DATA_TRASH:
if (data == 1 && TrashCount < MIN_KILLS)
@@ -424,18 +409,18 @@ class instance_serpent_shrine : public InstanceMapScript
}
private:
- uint64 LurkerBelow;
- uint64 Sharkkis;
- uint64 Tidalvess;
- uint64 Caribdis;
- uint64 LadyVashj;
- uint64 Karathress;
- uint64 KarathressEvent_Starter;
- uint64 LeotherasTheBlind;
- uint64 LeotherasEventStarter;
-
- uint64 ControlConsole;
- uint64 BridgePart[3];
+ ObjectGuid LurkerBelow;
+ ObjectGuid Sharkkis;
+ ObjectGuid Tidalvess;
+ ObjectGuid Caribdis;
+ ObjectGuid LadyVashj;
+ ObjectGuid Karathress;
+ ObjectGuid KarathressEvent_Starter;
+ ObjectGuid LeotherasTheBlind;
+ ObjectGuid LeotherasEventStarter;
+
+ ObjectGuid ControlConsole;
+ ObjectGuid BridgePart[3];
uint32 StrangePool;
uint32 FishingTimer;
uint32 WaterCheckTimer;
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
index 78a14539e25..3207727b5d1 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
@@ -226,7 +226,7 @@ public:
{
if (instance->GetBossState(DATA_MEKGINEER_STEAMRIGGER) == IN_PROGRESS)
{
- if (Creature* mekgineer = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MEKGINEER_STEAMRIGGER)))
+ if (Creature* mekgineer = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MEKGINEER_STEAMRIGGER)))
{
if (me->IsWithinDistInMap(mekgineer, MAX_REPAIR_RANGE))
{
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 40bc8dd69d7..f0884e83baa 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
@@ -58,11 +58,6 @@ class instance_steam_vault : public InstanceMapScript
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
- ThespiaGUID = 0;
- MekgineerGUID = 0;
- KalithreshGUID = 0;
-
- MainChambersDoorGUID = 0;
DistillerState = 0;
}
@@ -96,7 +91,7 @@ class instance_steam_vault : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -109,7 +104,7 @@ class instance_steam_vault : public InstanceMapScript
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
void SetData(uint32 type, uint32 data) override
@@ -158,11 +153,11 @@ class instance_steam_vault : public InstanceMapScript
}
protected:
- uint64 ThespiaGUID;
- uint64 MekgineerGUID;
- uint64 KalithreshGUID;
+ ObjectGuid ThespiaGUID;
+ ObjectGuid MekgineerGUID;
+ ObjectGuid KalithreshGUID;
- uint64 MainChambersDoorGUID;
+ ObjectGuid MainChambersDoorGUID;
uint8 DistillerState;
};
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
index 7090a693876..d3b11d481fb 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
@@ -54,7 +54,7 @@ public:
struct boss_the_black_stalkerAI : public ScriptedAI
{
- boss_the_black_stalkerAI(Creature* creature) : ScriptedAI(creature)
+ boss_the_black_stalkerAI(Creature* creature) : ScriptedAI(creature), Striders(creature)
{
}
@@ -62,11 +62,11 @@ public:
uint32 Levitate_Timer;
uint32 ChainLightning_Timer;
uint32 StaticCharge_Timer;
- uint64 LevitatedTarget;
+ ObjectGuid LevitatedTarget;
uint32 LevitatedTarget_Timer;
bool InAir;
uint32 check_Timer;
- std::list<uint64> Striders;
+ SummonList Striders;
void Reset() override
{
@@ -75,9 +75,9 @@ public:
StaticCharge_Timer = 10000;
SporeStriders_Timer = 10000 + rand32() % 5000;
check_Timer = 5000;
- LevitatedTarget = 0;
+ LevitatedTarget.Clear();
LevitatedTarget_Timer = 0;
- Striders.clear();
+ Striders.DespawnAll();
}
void EnterCombat(Unit* /*who*/) override { }
@@ -86,7 +86,7 @@ public:
{
if (summon && summon->GetEntry() == ENTRY_SPORE_STRIDER)
{
- Striders.push_back(summon->GetGUID());
+ Striders.Summon(summon);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
summon->AI()->AttackStart(target);
else
@@ -97,9 +97,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- for (std::list<uint64>::const_iterator i = Striders.begin(); i != Striders.end(); ++i)
- if (Creature* strider = ObjectAccessor::GetCreature(*me, *i))
- strider->DisappearAndDie();
+ Striders.DespawnAll();
}
void UpdateAI(uint32 diff) override
@@ -136,13 +134,13 @@ public:
{
if (!target->HasAura(SPELL_LEVITATE))
{
- LevitatedTarget = 0;
+ LevitatedTarget.Clear();
return;
}
if (InAir)
{
target->AddAura(SPELL_SUSPENSION, target);
- LevitatedTarget = 0;
+ LevitatedTarget.Clear();
}
else
{
@@ -152,7 +150,7 @@ public:
}
}
else
- LevitatedTarget = 0;
+ LevitatedTarget.Clear();
} else LevitatedTarget_Timer -= diff;
}
if (Levitate_Timer <= diff)
diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
index 3b7bb0c4312..0fcc7310d07 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
@@ -250,7 +250,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR)))
+ if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MAULGAR)))
maulgar->AI()->DoAction(ACTION_ADD_DEATH);
instance->SetBossState(DATA_MAULGAR, DONE);
@@ -333,7 +333,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR)))
+ if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MAULGAR)))
maulgar->AI()->DoAction(ACTION_ADD_DEATH);
instance->SetBossState(DATA_MAULGAR, DONE);
@@ -419,7 +419,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR)))
+ if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MAULGAR)))
maulgar->AI()->DoAction(ACTION_ADD_DEATH);
instance->SetBossState(DATA_MAULGAR, DONE);
@@ -496,7 +496,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR)))
+ if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MAULGAR)))
maulgar->AI()->DoAction(ACTION_ADD_DEATH);
instance->SetBossState(DATA_MAULGAR, DONE);
diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
index 3337ce47fd6..5f8bafc736b 100644
--- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
+++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
@@ -48,8 +48,6 @@ class instance_gruuls_lair : public InstanceMapScript
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
LoadMinionData(minionData);
-
- MaulgarGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -112,7 +110,7 @@ class instance_gruuls_lair : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -121,11 +119,11 @@ class instance_gruuls_lair : public InstanceMapScript
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
protected:
- uint64 MaulgarGUID;
+ ObjectGuid MaulgarGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
index 15c660b4ad7..a0673d4aced 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
@@ -133,7 +133,7 @@ class go_broggok_lever : public GameObjectScript
if (instance->GetBossState(DATA_BROGGOK) != DONE && instance->GetBossState(DATA_BROGGOK) != IN_PROGRESS)
{
instance->SetBossState(DATA_BROGGOK, IN_PROGRESS);
- if (Creature* broggok = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_BROGGOK)))
+ if (Creature* broggok = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_BROGGOK)))
broggok->AI()->DoAction(ACTION_PREPARE_BROGGOK);
}
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
index b2f199008d0..da7074b131f 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
@@ -65,8 +65,6 @@ class boss_kelidan_the_breaker : public CreatureScript
{
boss_kelidan_the_breakerAI(Creature* creature) : BossAI(creature, DATA_KELIDAN_THE_BREAKER)
{
- for (uint8 i = 0; i < 5; ++i)
- Channelers[i] = 0;
}
uint32 ShadowVolley_Timer;
@@ -76,7 +74,7 @@ class boss_kelidan_the_breaker : public CreatureScript
uint32 check_Timer;
bool Firenova;
bool addYell;
- uint64 Channelers[5];
+ ObjectGuid Channelers[5];
void Reset() override
{
@@ -116,7 +114,7 @@ class boss_kelidan_the_breaker : public CreatureScript
addYell = true;
Talk(SAY_ADD_AGGRO);
}
- for (uint8 i=0; i<5; ++i)
+ for (uint8 i = 0; i<5; ++i)
{
Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]);
if (who && channeler && !channeler->IsInCombat())
@@ -126,7 +124,7 @@ class boss_kelidan_the_breaker : public CreatureScript
void ChannelerDied(Unit* killer)
{
- for (uint8 i=0; i<5; ++i)
+ for (uint8 i = 0; i < 5; ++i)
{
Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]);
if (channeler && channeler->IsAlive())
@@ -138,25 +136,25 @@ class boss_kelidan_the_breaker : public CreatureScript
AttackStart(killer);
}
- uint64 GetChanneled(Creature* channeler1)
+ ObjectGuid GetChanneled(Creature* channeler1)
{
SummonChannelers();
if (!channeler1)
- return 0;
+ return ObjectGuid::Empty;
uint8 i;
- for (i=0; i<5; ++i)
+ for (i = 0; i < 5; ++i)
{
Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]);
if (channeler && channeler->GetGUID() == channeler1->GetGUID())
break;
}
- return Channelers[(i+2)%5];
+ return Channelers[(i + 2) % 5];
}
void SummonChannelers()
{
- for (uint8 i=0; i<5; ++i)
+ for (uint8 i = 0; i < 5; ++i)
{
Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]);
if (!channeler || channeler->isDead())
@@ -164,7 +162,7 @@ class boss_kelidan_the_breaker : public CreatureScript
if (channeler)
Channelers[i] = channeler->GetGUID();
else
- Channelers[i] = 0;
+ Channelers[i].Clear();
}
}
@@ -310,16 +308,19 @@ class npc_shadowmoon_channeler : public CreatureScript
if (check_Timer <= diff)
{
if (!me->IsNonMeleeSpellCast(false))
+ {
if (Creature* Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
{
- uint64 channeler = ENSURE_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->GetChanneled(me);
+ ObjectGuid channeler = ENSURE_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->GetChanneled(me);
if (Unit* channeled = ObjectAccessor::GetUnit(*me, channeler))
DoCast(channeled, SPELL_CHANNELING);
}
+ }
check_Timer = 5000;
}
else
check_Timer -= diff;
+
return;
}
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
index d88594d9c1e..8e9018a99c9 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
@@ -44,20 +44,6 @@ class instance_blood_furnace : public InstanceMapScript
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- TheMakerGUID = 0;
- BroggokGUID = 0;
- KelidanTheBreakerGUID = 0;
-
- BroggokLeverGUID = 0;
- PrisonDoor4GUID = 0;
-
- memset(PrisonCellGUIDs, 0, 8 * sizeof(uint64));
-
- PrisonersCell5.clear();
- PrisonersCell6.clear();
- PrisonersCell7.clear();
- PrisonersCell8.clear();
-
PrisonerCounter5 = 0;
PrisonerCounter6 = 0;
PrisonerCounter7 = 0;
@@ -154,7 +140,7 @@ class instance_blood_furnace : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -168,7 +154,7 @@ class instance_blood_furnace : public InstanceMapScript
return BroggokLeverGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
bool SetBossState(uint32 type, EncounterState state) override
@@ -219,9 +205,9 @@ class instance_blood_furnace : public InstanceMapScript
HandleGameObject(PrisonCellGUIDs[DATA_PRISON_CELL8 - DATA_PRISON_CELL1], false);
}
- void ResetPrisoners(const std::set<uint64>& prisoners)
+ void ResetPrisoners(GuidSet const& prisoners)
{
- for (std::set<uint64>::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i)
+ for (GuidSet::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i)
if (Creature* prisoner = instance->GetCreature(*i))
ResetPrisoner(prisoner);
}
@@ -273,7 +259,7 @@ class instance_blood_furnace : public InstanceMapScript
ResetPrisoner(creature);
}
- void PrisonerDied(uint64 guid)
+ void PrisonerDied(ObjectGuid guid)
{
if (PrisonersCell5.find(guid) != PrisonersCell5.end() && --PrisonerCounter5 <= 0)
ActivateCell(DATA_PRISON_CELL6);
@@ -313,9 +299,9 @@ class instance_blood_furnace : public InstanceMapScript
}
}
- void ActivatePrisoners(std::set<uint64> const& prisoners)
+ void ActivatePrisoners(GuidSet const& prisoners)
{
- for (std::set<uint64>::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i)
+ for (GuidSet::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i)
if (Creature* prisoner = instance->GetCreature(*i))
{
prisoner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
@@ -324,19 +310,19 @@ class instance_blood_furnace : public InstanceMapScript
}
protected:
- uint64 TheMakerGUID;
- uint64 BroggokGUID;
- uint64 KelidanTheBreakerGUID;
+ ObjectGuid TheMakerGUID;
+ ObjectGuid BroggokGUID;
+ ObjectGuid KelidanTheBreakerGUID;
- uint64 BroggokLeverGUID;
- uint64 PrisonDoor4GUID;
+ ObjectGuid BroggokLeverGUID;
+ ObjectGuid PrisonDoor4GUID;
- uint64 PrisonCellGUIDs[8];
+ ObjectGuid PrisonCellGUIDs[8];
- std::set<uint64>PrisonersCell5;
- std::set<uint64>PrisonersCell6;
- std::set<uint64>PrisonersCell7;
- std::set<uint64>PrisonersCell8;
+ GuidSet PrisonersCell5;
+ GuidSet PrisonersCell6;
+ GuidSet PrisonersCell7;
+ GuidSet PrisonersCell8;
uint8 PrisonerCounter5;
uint8 PrisonerCounter6;
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
index 237aa506589..061d6a6a9a8 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
@@ -74,7 +74,7 @@ class boss_omor_the_unscarred : public CreatureScript
Shadowbolt_Timer = 2000;
Summon_Timer = 10000;
SummonedCount = 0;
- PlayerGUID = 0;
+ PlayerGUID.Clear();
CanPullBack = false;
_Reset();
@@ -141,7 +141,7 @@ class boss_omor_the_unscarred : public CreatureScript
DoCast(temp, SPELL_SHADOW_WHIP);
}
}
- PlayerGUID = 0;
+ PlayerGUID.Clear();
ShadowWhip_Timer = 2000;
CanPullBack = false;
}
@@ -218,7 +218,7 @@ class boss_omor_the_unscarred : public CreatureScript
uint32 Shadowbolt_Timer;
uint32 Summon_Timer;
uint32 SummonedCount;
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
bool CanPullBack;
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
index d2a93caf7a3..44c93dc77c9 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
@@ -70,7 +70,6 @@ class boss_nazan : public CreatureScript
{
boss_nazanAI(Creature* creature) : BossAI(creature, DATA_NAZAN)
{
- VazrudenGUID = 0;
flight = true;
}
@@ -183,7 +182,7 @@ class boss_nazan : public CreatureScript
uint32 Fly_Timer;
uint32 Turn_Timer;
bool flight;
- uint64 VazrudenGUID;
+ ObjectGuid VazrudenGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -282,8 +281,6 @@ class boss_vazruden_the_herald : public CreatureScript
summoned = false;
sentryDown = false;
lootSpawned = false;
- NazanGUID = 0;
- VazrudenGUID = 0;
}
void Reset() override
@@ -304,7 +301,7 @@ class boss_vazruden_the_herald : public CreatureScript
if (Nazan)
{
Nazan->DisappearAndDie();
- NazanGUID = 0;
+ NazanGUID.Clear();
}
Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID);
@@ -313,7 +310,7 @@ class boss_vazruden_the_herald : public CreatureScript
if (Vazruden)
{
Vazruden->DisappearAndDie();
- VazrudenGUID = 0;
+ VazrudenGUID.Clear();
}
summoned = false;
me->ClearUnitState(UNIT_STATE_ROOT);
@@ -435,8 +432,8 @@ class boss_vazruden_the_herald : public CreatureScript
uint32 waypoint;
uint32 check;
bool sentryDown;
- uint64 NazanGUID;
- uint64 VazrudenGUID;
+ ObjectGuid NazanGUID;
+ ObjectGuid VazrudenGUID;
bool summoned;
bool lootSpawned;
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
index c8ffc7d495a..1c3eb6d8c34 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
@@ -40,7 +40,6 @@ class instance_ramparts : public InstanceMapScript
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
- felIronChestGUID = 0;
}
void OnGameObjectCreate(GameObject* go) override
@@ -74,7 +73,7 @@ class instance_ramparts : public InstanceMapScript
}
protected:
- uint64 felIronChestGUID;
+ ObjectGuid felIronChestGUID;
bool spawned;
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
index 8a5d6e41780..50cdcfe121b 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
@@ -85,7 +85,7 @@ enum Spells
//count of clickers needed to interrupt blast nova
#define CLICKERS_COUNT 5
-typedef std::map<uint64, uint64> CubeMap;
+typedef std::map<ObjectGuid, ObjectGuid> CubeMap;
class npc_abyssal : public CreatureScript
{
@@ -253,10 +253,10 @@ class boss_magtheridon : public CreatureScript
instance->SetData(DATA_COLLAPSE, false);
}
- void SetClicker(uint64 cubeGUID, uint64 clickerGUID)
+ void SetClicker(ObjectGuid cubeGUID, ObjectGuid clickerGUID)
{
// to avoid multiclicks from 1 cube
- if (uint64 guid = Cube[cubeGUID])
+ if (ObjectGuid guid = Cube[cubeGUID])
DebuffClicker(ObjectAccessor::GetUnit(*me, guid));
Cube[cubeGUID] = clickerGUID;
NeedCheckCube = true;
@@ -284,7 +284,7 @@ class boss_magtheridon : public CreatureScript
if (!clicker || !clicker->HasAura(SPELL_SHADOW_GRASP))
{
DebuffClicker(clicker);
- (*i).second = 0;
+ (*i).second.Clear();
}
else
++ClickerNum;
@@ -588,7 +588,7 @@ public:
if (instance->GetData(DATA_MAGTHERIDON_EVENT) != IN_PROGRESS)
return true;
- Creature* Magtheridon =ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_MAGTHERIDON));
+ Creature* Magtheridon =ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_MAGTHERIDON));
if (!Magtheridon || !Magtheridon->IsAlive())
return true;
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
index 45262f9109c..db0159d1a2d 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
@@ -58,10 +58,10 @@ class instance_magtheridons_lair : public InstanceMapScript
uint32 m_auiEncounter[MAX_ENCOUNTER];
- uint64 MagtheridonGUID;
- std::set<uint64> ChannelerGUID;
- uint64 DoorGUID;
- std::set<uint64> ColumnGUID;
+ ObjectGuid MagtheridonGUID;
+ GuidSet ChannelerGUID;
+ ObjectGuid DoorGUID;
+ GuidSet ColumnGUID;
uint32 CageTimer;
uint32 RespawnTimer;
@@ -71,11 +71,6 @@ class instance_magtheridons_lair : public InstanceMapScript
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
- MagtheridonGUID = 0;
- ChannelerGUID.clear();
- DoorGUID = 0;
- ColumnGUID.clear();
-
CageTimer = 0;
RespawnTimer = 0;
}
@@ -124,14 +119,14 @@ class instance_magtheridons_lair : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
case DATA_MAGTHERIDON:
return MagtheridonGUID;
}
- return 0;
+ return ObjectGuid::Empty;
}
void SetData(uint32 type, uint32 data) override
@@ -152,7 +147,7 @@ class instance_magtheridons_lair : public InstanceMapScript
if (m_auiEncounter[1] != NOT_STARTED)
{
m_auiEncounter[1] = NOT_STARTED;
- for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
+ for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
if (Creature* Channeler = instance->GetCreature(*i))
{
@@ -171,7 +166,7 @@ class instance_magtheridons_lair : public InstanceMapScript
{
m_auiEncounter[1] = IN_PROGRESS;
// Let all five channelers aggro.
- for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
+ for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
Creature* Channeler = instance->GetCreature(*i);
if (Channeler && Channeler->IsAlive())
@@ -188,7 +183,7 @@ class instance_magtheridons_lair : public InstanceMapScript
}
break;
case DONE: // Add buff and check if all channelers are dead.
- for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
+ for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
Creature* Channeler = instance->GetCreature(*i);
if (Channeler && Channeler->IsAlive())
@@ -204,7 +199,7 @@ class instance_magtheridons_lair : public InstanceMapScript
break;
case DATA_COLLAPSE:
// true - collapse / false - reset
- for (std::set<uint64>::const_iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i)
+ for (GuidSet::const_iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i)
DoUseDoorOrButton(*i);
break;
default:
@@ -239,7 +234,7 @@ class instance_magtheridons_lair : public InstanceMapScript
{
if (RespawnTimer <= diff)
{
- for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
+ for (GuidSet::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
if (Creature* Channeler = instance->GetCreature(*i))
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
index 9a8f83fa1c2..741d5b78285 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
@@ -323,7 +323,7 @@ class npc_fel_orc_convert : public CreatureScript
{
events.ScheduleEvent(EVENT_HEMORRHAGE, 3000);
- if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE)))
+ if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_GRAND_WARLOCK_NETHEKURSE)))
if (me->IsWithinDist(Kurse, 45.0f))
Kurse->AI()->SetData(SETDATA_DATA, SETDATA_PEON_AGGRO);
}
@@ -333,7 +333,7 @@ class npc_fel_orc_convert : public CreatureScript
if (instance->GetBossState(DATA_NETHEKURSE) != IN_PROGRESS)
return;
- if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE)))
+ if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_GRAND_WARLOCK_NETHEKURSE)))
Kurse->AI()->SetData(SETDATA_DATA, SETDATA_PEON_DEATH);
}
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
index d61c40f8e3b..f60c65b0b7a 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
@@ -136,8 +136,6 @@ class boss_warbringer_omrogg : public CreatureScript
{
boss_warbringer_omroggAI(Creature* creature) : BossAI(creature, DATA_OMROGG)
{
- LeftHeadGUID = 0;
- RightHeadGUID = 0;
}
void Reset() override
@@ -145,13 +143,13 @@ class boss_warbringer_omrogg : public CreatureScript
if (Unit* LeftHead = ObjectAccessor::GetUnit(*me, LeftHeadGUID))
{
LeftHead->setDeathState(JUST_DIED);
- LeftHeadGUID = 0;
+ LeftHeadGUID.Clear();
}
if (Unit* RightHead = ObjectAccessor::GetUnit(*me, RightHeadGUID))
{
RightHead->setDeathState(JUST_DIED);
- RightHeadGUID = 0;
+ RightHeadGUID.Clear();
}
AggroYell = false;
@@ -363,8 +361,8 @@ class boss_warbringer_omrogg : public CreatureScript
}
private:
- uint64 LeftHeadGUID;
- uint64 RightHeadGUID;
+ ObjectGuid LeftHeadGUID;
+ ObjectGuid RightHeadGUID;
int iaggro;
int ithreat;
int ikilling;
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
index f1dfcc2b391..7145ebfd7aa 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
@@ -143,7 +143,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript
void removeAdds()
{
- for (std::vector<uint64>::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr)
+ for (GuidVector::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr)
{
Creature* creature = ObjectAccessor::GetCreature(*me, *itr);
if (creature && creature->IsAlive())
@@ -155,7 +155,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript
}
adds.clear();
- for (std::vector<uint64>::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr)
+ for (GuidVector::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr)
{
Creature* creature = ObjectAccessor::GetCreature(*me, *itr);
if (creature && creature->IsAlive())
@@ -295,8 +295,8 @@ class boss_warchief_kargath_bladefist : public CreatureScript
}
private:
- std::vector<uint64> adds;
- std::vector<uint64> assassins;
+ GuidVector adds;
+ GuidVector assassins;
uint32 Charge_timer;
uint32 Blade_Dance_Timer;
uint32 Summon_Assistant_Timer;
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
index 8ee63ff03a2..838297aa21f 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
@@ -45,9 +45,6 @@ class instance_shattered_halls : public InstanceMapScript
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
- nethekurseGUID = 0;
- nethekurseDoor1GUID = 0;
- nethekurseDoor2GUID = 0;
}
void OnGameObjectCreate(GameObject* go) override
@@ -98,7 +95,7 @@ class instance_shattered_halls : public InstanceMapScript
return true;
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -112,13 +109,13 @@ class instance_shattered_halls : public InstanceMapScript
return nethekurseDoor2GUID;
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
protected:
- uint64 nethekurseGUID;
- uint64 nethekurseDoor1GUID;
- uint64 nethekurseDoor2GUID;
+ ObjectGuid nethekurseGUID;
+ ObjectGuid nethekurseDoor1GUID;
+ ObjectGuid nethekurseDoor2GUID;
};
};
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
index 09cb72f1a47..8dd1aad5d4d 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
@@ -178,7 +178,7 @@ class boss_alar : public CreatureScript
me->RemoveAllAuras();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->AttackStop();
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
me->SetSpeed(MOVE_RUN, 5.0f);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(0, waypoint[5][0], waypoint[5][1], waypoint[5][2]);
@@ -494,7 +494,7 @@ class npc_ember_of_alar : public CreatureScript
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if (instance->GetData(DATA_ALAREVENT) == 2)
{
- if (Unit* Alar = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ALAR)))
+ if (Unit* Alar = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ALAR)))
{
int32 AlarHealth = int32(Alar->GetHealth()) - int32(Alar->CountPctFromMaxHealth(3));
if (AlarHealth > 0)
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
index 63c01540af2..0a9e5665ec8 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
@@ -464,7 +464,7 @@ class npc_solarium_priest : public CreatureScript
switch (urand(0, 1))
{
case 0:
- target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ASTROMANCER));
+ target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ASTROMANCER));
break;
case 1:
target = me;
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
index 64deebce8b8..8b23ee172af 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -163,7 +163,7 @@ struct advisorbase_ai : public ScriptedAI
bool FakeDeath;
bool m_bDoubled_Health;
uint32 DelayRes_Timer;
- uint64 DelayRes_Target;
+ ObjectGuid DelayRes_Target;
void Reset() override
{
@@ -175,7 +175,7 @@ struct advisorbase_ai : public ScriptedAI
FakeDeath = false;
DelayRes_Timer = 0;
- DelayRes_Target = 0;
+ DelayRes_Target.Clear();
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -183,7 +183,7 @@ struct advisorbase_ai : public ScriptedAI
//reset encounter
if (instance->GetData(DATA_KAELTHASEVENT) == 1 || instance->GetData(DATA_KAELTHASEVENT) == 3)
- if (Creature* Kaelthas = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KAELTHAS)))
+ if (Creature* Kaelthas = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KAELTHAS)))
Kaelthas->AI()->EnterEvadeMode();
}
@@ -245,7 +245,7 @@ struct advisorbase_ai : public ScriptedAI
me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->ClearAllReactives();
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
me->SetStandState(UNIT_STAND_STATE_DEAD);
@@ -290,7 +290,6 @@ class boss_kaelthas : public CreatureScript
boss_kaelthasAI(Creature* creature) : ScriptedAI(creature), summons(me)
{
instance = creature->GetInstanceScript();
- memset(&m_auiAdvisorGuid, 0, sizeof(m_auiAdvisorGuid));
}
InstanceScript* instance;
@@ -316,7 +315,7 @@ class boss_kaelthas : public CreatureScript
SummonList summons;
- uint64 m_auiAdvisorGuid[MAX_ADVISORS];
+ ObjectGuid m_auiAdvisorGuid[MAX_ADVISORS];
void Reset() override
{
@@ -363,10 +362,10 @@ class boss_kaelthas : public CreatureScript
void StartEvent()
{
- m_auiAdvisorGuid[0] = instance->GetData64(DATA_THALADREDTHEDARKENER);
- m_auiAdvisorGuid[1] = instance->GetData64(DATA_LORDSANGUINAR);
- m_auiAdvisorGuid[2] = instance->GetData64(DATA_GRANDASTROMANCERCAPERNIAN);
- m_auiAdvisorGuid[3] = instance->GetData64(DATA_MASTERENGINEERTELONICUS);
+ m_auiAdvisorGuid[0] = instance->GetGuidData(DATA_THALADREDTHEDARKENER);
+ m_auiAdvisorGuid[1] = instance->GetGuidData(DATA_LORDSANGUINAR);
+ m_auiAdvisorGuid[2] = instance->GetGuidData(DATA_GRANDASTROMANCERCAPERNIAN);
+ m_auiAdvisorGuid[3] = instance->GetGuidData(DATA_MASTERENGINEERTELONICUS);
if (!m_auiAdvisorGuid[0] || !m_auiAdvisorGuid[1] || !m_auiAdvisorGuid[2] || !m_auiAdvisorGuid[3])
{
@@ -927,7 +926,7 @@ class boss_kaelthas : public CreatureScript
//Using packet workaround
WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12);
- data.append(unit->GetPackGUID());
+ data << unit->GetPackGUID();
data << uint32(0);
unit->SendMessageToSet(&data, true);
}
@@ -953,7 +952,7 @@ class boss_kaelthas : public CreatureScript
{
//Using packet workaround
WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12);
- data.append(unit->GetPackGUID());
+ data << unit->GetPackGUID();
data << uint32(0);
unit->SendMessageToSet(&data, true);
}
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
index 6b78706b437..b518eb1cb8b 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
@@ -137,7 +137,7 @@ class boss_void_reaver : public CreatureScript
target = me->GetVictim();
if (target)
- me->CastSpell(target, SPELL_ARCANE_ORB, false, NULL, NULL, 0);
+ me->CastSpell(target, SPELL_ARCANE_ORB, false, NULL, NULL);
ArcaneOrb_Timer = 3000;
}
else
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
index 07cbd68f741..2234547c76a 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
@@ -48,13 +48,13 @@ class instance_the_eye : public InstanceMapScript
{
instance_the_eye_InstanceMapScript(Map* map) : InstanceScript(map) { }
- uint64 ThaladredTheDarkener;
- uint64 LordSanguinar;
- uint64 GrandAstromancerCapernian;
- uint64 MasterEngineerTelonicus;
- uint64 Kaelthas;
- uint64 Astromancer;
- uint64 Alar;
+ ObjectGuid ThaladredTheDarkener;
+ ObjectGuid LordSanguinar;
+ ObjectGuid GrandAstromancerCapernian;
+ ObjectGuid MasterEngineerTelonicus;
+ ObjectGuid Kaelthas;
+ ObjectGuid Astromancer;
+ ObjectGuid Alar;
uint8 KaelthasEventPhase;
uint8 AlarEventPhase;
@@ -65,14 +65,6 @@ class instance_the_eye : public InstanceMapScript
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
- ThaladredTheDarkener = 0;
- LordSanguinar = 0;
- GrandAstromancerCapernian = 0;
- MasterEngineerTelonicus = 0;
- Kaelthas = 0;
- Astromancer = 0;
- Alar = 0;
-
KaelthasEventPhase = 0;
AlarEventPhase = 0;
}
@@ -114,7 +106,7 @@ class instance_the_eye : public InstanceMapScript
}
}
- uint64 GetData64(uint32 identifier) const override
+ ObjectGuid GetGuidData(uint32 identifier) const override
{
switch (identifier)
{
@@ -126,7 +118,7 @@ class instance_the_eye : public InstanceMapScript
case DATA_ASTROMANCER: return Astromancer;
case DATA_ALAR: return Alar;
}
- return 0;
+ return ObjectGuid::Empty;
}
void SetData(uint32 type, uint32 data) override
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
index 3befc3742ff..1a8658c8fbc 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
@@ -322,7 +322,7 @@ class npc_warden_mellichar : public CreatureScript
DoCast(me, SPELL_BUBBLE_VISUAL);
instance->SetBossState(DATA_HARBINGER_SKYRISS, IN_PROGRESS);
- instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), false);
IsRunning = true;
}
@@ -356,7 +356,7 @@ class npc_warden_mellichar : public CreatureScript
case 2:
DoCast(me, SPELL_TARGET_ALPHA);
instance->SetData(DATA_WARDEN_1, IN_PROGRESS);
- instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), false);
break;
case 3:
DoCast(me, SPELL_TARGET_BETA);
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp
index 41bc93cfdfe..71e23a65d66 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp
@@ -77,7 +77,7 @@ class boss_dalliah_the_doomsayer : public CreatureScript
_JustDied();
Talk(SAY_DEATH);
- if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SOCCOTHRATES)))
+ if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SOCCOTHRATES)))
if (soccothrates->IsAlive() && !soccothrates->IsInCombat())
soccothrates->AI()->SetData(1, 1);
}
@@ -163,7 +163,7 @@ class boss_dalliah_the_doomsayer : public CreatureScript
events.ScheduleEvent(EVENT_SHADOW_WAVE, urand(11000, 16000));
break;
case EVENT_ME_FIRST:
- if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SOCCOTHRATES)))
+ if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SOCCOTHRATES)))
if (soccothrates->IsAlive() && !soccothrates->IsInCombat())
soccothrates->AI()->Talk(SAY_AGGRO_DALLIAH_FIRST);
break;
@@ -174,7 +174,7 @@ class boss_dalliah_the_doomsayer : public CreatureScript
if (HealthBelowPct(25) && !soccothratesTaunt)
{
- if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SOCCOTHRATES)))
+ if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SOCCOTHRATES)))
soccothrates->AI()->Talk(SAY_DALLIAH_25_PERCENT);
soccothratesTaunt = true;
}
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
index 7563ecb40db..ec22baf2d4e 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
@@ -158,18 +158,18 @@ class boss_harbinger_skyriss : public CreatureScript
{
case 1:
Talk(SAY_INTRO);
- instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), true);
+ instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), true);
++Intro_Phase;
Intro_Timer = 25000;
break;
case 2:
Talk(SAY_AGGRO);
- if (Unit* mellic = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MELLICHAR)))
+ if (Unit* mellic = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_MELLICHAR)))
{
//should have a better way to do this. possibly spell exist.
mellic->setDeathState(JUST_DIED);
mellic->SetHealth(0);
- instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), false);
+ instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), false);
}
++Intro_Phase;
Intro_Timer = 3000;
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp
index a519ec7207c..27de2786243 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp
@@ -103,7 +103,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript
_JustDied();
Talk(SAY_DEATH);
- if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH)))
+ if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH)))
if (dalliah->IsAlive() && !dalliah->IsInCombat())
dalliah->AI()->SetData(1, 1);
}
@@ -161,7 +161,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript
switch (eventId)
{
case EVENT_PREFIGHT_1:
- if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH)))
+ if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH)))
dalliah->AI()->Talk(SAY_DALLIAH_CONVO_1);
events.ScheduleEvent(EVENT_PREFIGHT_2, 3000);
break;
@@ -170,7 +170,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript
events.ScheduleEvent(EVENT_PREFIGHT_3, 3000);
break;
case EVENT_PREFIGHT_3:
- if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH)))
+ if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH)))
dalliah->AI()->Talk(SAY_DALLIAH_CONVO_2);
events.ScheduleEvent(EVENT_PREFIGHT_4, 6000);
break;
@@ -179,7 +179,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript
events.ScheduleEvent(EVENT_PREFIGHT_5, 2000);
break;
case EVENT_PREFIGHT_5:
- if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH)))
+ if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH)))
dalliah->AI()->Talk(SAY_DALLIAH_CONVO_3);
events.ScheduleEvent(EVENT_PREFIGHT_6, 3000);
break;
@@ -188,7 +188,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript
events.ScheduleEvent(EVENT_PREFIGHT_7, 2000);
break;
case EVENT_PREFIGHT_7:
- if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH)))
+ if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH)))
dalliah->GetMotionMaster()->MovePoint(0, 118.6048f, 96.84852f, 22.44115f);
events.ScheduleEvent(EVENT_PREFIGHT_8, 4000);
break;
@@ -197,7 +197,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript
events.ScheduleEvent(EVENT_PREFIGHT_9, 4000);
break;
case EVENT_PREFIGHT_9:
- if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH)))
+ if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH)))
{
dalliah->SetFacingToObject(me);
me->SetFacingToObject(dalliah);
@@ -251,7 +251,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript
events.ScheduleEvent(EVENT_KNOCK_AWAY, urand(11000, 12000));
break;
case EVENT_ME_FIRST:
- if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH)))
+ if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH)))
if (dalliah->IsAlive() && !dalliah->IsInCombat())
dalliah->AI()->Talk(SAY_AGGRO_SOCCOTHRATES_FIRST);
break;
@@ -262,7 +262,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript
if (HealthBelowPct(25) && !dalliahTaunt)
{
- if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH)))
+ if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH)))
dalliah->AI()->Talk(SAY_SOCCOTHRATES_25_PERCENT);
dalliahTaunt = true;
}
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
index b092243637b..984af86e645 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
@@ -39,14 +39,8 @@ class instance_arcatraz : public InstanceMapScript
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- DalliahGUID = 0;
- SoccothratesGUID = 0;
- MellicharGUID = 0;
- WardensShieldGUID = 0;
-
ConversationState = NOT_STARTED;
- memset(StasisPodGUIDs, 0, 5 * sizeof(uint64));
memset(StasisPodStates, NOT_STARTED, 5 * sizeof(uint8));
}
@@ -151,7 +145,7 @@ class instance_arcatraz : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 data) const override
+ ObjectGuid GetGuidData(uint32 data) const override
{
switch (data)
{
@@ -166,7 +160,7 @@ class instance_arcatraz : public InstanceMapScript
default:
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
bool SetBossState(uint32 type, EncounterState state) override
@@ -193,11 +187,11 @@ class instance_arcatraz : public InstanceMapScript
}
protected:
- uint64 DalliahGUID;
- uint64 SoccothratesGUID;
- uint64 StasisPodGUIDs[5];
- uint64 MellicharGUID;
- uint64 WardensShieldGUID;
+ ObjectGuid DalliahGUID;
+ ObjectGuid SoccothratesGUID;
+ ObjectGuid StasisPodGUIDs[5];
+ ObjectGuid MellicharGUID;
+ ObjectGuid WardensShieldGUID;
uint8 ConversationState;
uint8 StasisPodStates[5];
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
index 0c322877808..c0591f7b874 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
@@ -66,8 +66,6 @@ class boss_high_botanist_freywinn : public CreatureScript
{
boss_high_botanist_freywinnAI(Creature* creature) : BossAI(creature, DATA_HIGH_BOTANIST_FREYWINN) { }
- std::list<uint64> Adds_List;
-
uint32 SummonSeedling_Timer;
uint32 TreeForm_Timer;
uint32 MoveCheck_Timer;
@@ -76,7 +74,7 @@ class boss_high_botanist_freywinn : public CreatureScript
void Reset() override
{
- Adds_List.clear();
+ summons.DespawnAll();
SummonSeedling_Timer = 6000;
TreeForm_Timer = 30000;
@@ -93,7 +91,12 @@ class boss_high_botanist_freywinn : public CreatureScript
void JustSummoned(Creature* summoned) override
{
if (summoned->GetEntry() == NPC_FRAYER)
- Adds_List.push_back(summoned->GetGUID());
+ summons.Summon(summoned);
+ }
+
+ void SummonedCreatureDespawn(Creature* summon) override
+ {
+ summons.Despawn(summon);
}
void DoSummonSeedling()
@@ -147,18 +150,15 @@ class boss_high_botanist_freywinn : public CreatureScript
{
if (MoveCheck_Timer <= diff)
{
- if (!Adds_List.empty())
+ for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr)
{
- for (std::list<uint64>::iterator itr = Adds_List.begin(); itr != Adds_List.end(); ++itr)
+ if (Unit* temp = ObjectAccessor::GetUnit(*me, *itr))
{
- if (Unit* temp = ObjectAccessor::GetUnit(*me, *itr))
+ if (!temp->IsAlive())
{
- if (!temp->IsAlive())
- {
- Adds_List.erase(itr);
- ++DeadAddsCount;
- break;
- }
+ summons.erase(itr);
+ ++DeadAddsCount;
+ break;
}
}
}
@@ -168,7 +168,7 @@ class boss_high_botanist_freywinn : public CreatureScript
if (DeadAddsCount >= 3)
{
- Adds_List.clear();
+ summons.DespawnAll();
DeadAddsCount = 0;
me->InterruptNonMeleeSpells(true);
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
index 8bc9d0982e3..56c62bbf50f 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
@@ -74,10 +74,9 @@ class npc_warp_splinter_treant : public CreatureScript
{
npc_warp_splinter_treantAI(Creature* creature) : ScriptedAI(creature)
{
- WarpGuid = 0;
}
- uint64 WarpGuid;
+ ObjectGuid WarpGuid;
uint32 check_Timer;
void Reset() override
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp
index eb46211fa59..19453bd3925 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp
@@ -29,11 +29,6 @@ class instance_the_botanica : public InstanceMapScript
instance_the_botanica_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
- CommanderSarannisGUID = 0;
- HighBotanistFreywinnGUID = 0;
- ThorngrinTheTenderGUID = 0;
- LajGUID = 0;
- WarpSplinterGUID = 0;
}
void OnCreatureCreate(Creature* creature) override
@@ -60,7 +55,7 @@ class instance_the_botanica : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type) const override
+ ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
{
@@ -78,7 +73,7 @@ class instance_the_botanica : public InstanceMapScript
break;
}
- return 0;
+ return ObjectGuid::Empty;
}
bool SetBossState(uint32 type, EncounterState state) override
@@ -102,11 +97,11 @@ class instance_the_botanica : public InstanceMapScript
}
protected:
- uint64 CommanderSarannisGUID;
- uint64 HighBotanistFreywinnGUID;
- uint64 ThorngrinTheTenderGUID;
- uint64 LajGUID;
- uint64 WarpSplinterGUID;
+ ObjectGuid CommanderSarannisGUID;
+ ObjectGuid HighBotanistFreywinnGUID;
+ ObjectGuid ThorngrinTheTenderGUID;
+ ObjectGuid LajGUID;
+ ObjectGuid WarpSplinterGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp
index a193e8ff880..7b72da0b02e 100644
--- a/src/server/scripts/Outland/boss_doomwalker.cpp
+++ b/src/server/scripts/Outland/boss_doomwalker.cpp
@@ -94,7 +94,7 @@ class boss_doomwalker : public CreatureScript
{
if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who))
- if (who->HasAura(SPELL_MARK_DEATH, 0))
+ if (who->HasAura(SPELL_MARK_DEATH))
who->CastSpell(who, SPELL_AURA_DEATH, 1);
}
diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
index 03b8e7e69c8..b5e54fe85f0 100644
--- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
+++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
@@ -115,13 +115,12 @@ public:
{
npc_bloodmaul_bruteAI(Creature* creature) : ScriptedAI(creature)
{
- PlayerGUID = 0;
hp30 = false;
}
void Reset() override
{
- PlayerGUID = 0;
+ PlayerGUID.Clear();
hp30 = false;
}
@@ -207,7 +206,7 @@ public:
private:
EventMap events;
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
bool hp30;
};
@@ -617,7 +616,7 @@ class npc_simon_bunny : public CreatureScript
uint8 gameLevel;
uint8 fails;
uint8 gameTicks;
- uint64 playerGUID;
+ ObjectGuid playerGUID;
uint32 clusterIds[SIMON_MAX_COLORS];
float zCoordCorrection;
float searchDistance;
@@ -727,7 +726,7 @@ class npc_simon_bunny : public CreatureScript
}
// Used for getting involved player guid. Parameter id is used for defining if is a large(Monument) or small(Relic) node
- void SetGUID(uint64 guid, int32 id) override
+ void SetGUID(ObjectGuid guid, int32 id) override
{
me->SetCanFly(true);
@@ -1131,7 +1130,6 @@ public:
{
npc_oscillating_frequency_scanner_master_bunnyAI(Creature* creature) : ScriptedAI(creature)
{
- playerGuid = 0;
timer = 500;
}
@@ -1170,7 +1168,7 @@ public:
}
private:
- uint64 playerGuid;
+ ObjectGuid playerGuid;
uint32 timer;
};
diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
index 0da70207a04..01ad2ce334f 100644
--- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
@@ -310,7 +310,7 @@ public:
void Reset() override
{
checkTimer = 5000; //check for creature every 5 sec
- helboarGUID = 0;
+ helboarGUID.Clear();
}
void MovementInform(uint32 type, uint32 id) override
@@ -352,7 +352,7 @@ public:
private:
uint32 checkTimer;
- uint64 helboarGUID;
+ ObjectGuid helboarGUID;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp
index a8a99d757e7..b8dd1393600 100644
--- a/src/server/scripts/Outland/zone_nagrand.cpp
+++ b/src/server/scripts/Outland/zone_nagrand.cpp
@@ -299,7 +299,7 @@ public:
{
corki->GetMotionMaster()->MovePoint(1, go->GetPositionX()+5, go->GetPositionY(), go->GetPositionZ());
if (player)
- player->KilledMonsterCredit(NPC_CORKI_CREDIT_1, 0);
+ player->KilledMonsterCredit(NPC_CORKI_CREDIT_1);
}
}
@@ -309,7 +309,7 @@ public:
{
corki->GetMotionMaster()->MovePoint(1, go->GetPositionX()-5, go->GetPositionY(), go->GetPositionZ());
if (player)
- player->KilledMonsterCredit(NPC_CORKI_2, 0);
+ player->KilledMonsterCredit(NPC_CORKI_2);
}
}
@@ -319,7 +319,7 @@ public:
{
corki->GetMotionMaster()->MovePoint(1, go->GetPositionX()+4, go->GetPositionY(), go->GetPositionZ());
if (player)
- player->KilledMonsterCredit(NPC_CORKI_CREDIT_3, 0);
+ player->KilledMonsterCredit(NPC_CORKI_CREDIT_3);
}
}
return true;
@@ -594,7 +594,7 @@ class go_warmaul_prison : public GameObjectScript
if (Creature* prisoner = go->FindNearestCreature(NPC_MAGHAR_PRISONER, 5.0f))
{
- player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0);
+ player->KilledMonsterCredit(NPC_MAGHAR_PRISONER);
prisoner->AI()->Talk(SAY_FREE, player);
prisoner->DespawnOrUnsummon(6000);
diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp
index f82c1f5fb58..eb2fae03202 100644
--- a/src/server/scripts/Outland/zone_netherstorm.cpp
+++ b/src/server/scripts/Outland/zone_netherstorm.cpp
@@ -83,9 +83,9 @@ public:
{
npc_commander_dawnforgeAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 PlayerGUID;
- uint64 ardonisGUID;
- uint64 pathaleonGUID;
+ ObjectGuid PlayerGUID;
+ ObjectGuid ardonisGUID;
+ ObjectGuid pathaleonGUID;
uint32 Phase;
uint32 PhaseSubphase;
@@ -94,9 +94,9 @@ public:
void Reset() override
{
- PlayerGUID = 0;
- ardonisGUID = 0;
- pathaleonGUID = 0;
+ PlayerGUID.Clear();
+ ardonisGUID.Clear();
+ pathaleonGUID.Clear();
Phase = 1;
PhaseSubphase = 0;
@@ -415,7 +415,6 @@ public:
Materialize = false;
Drained = false;
WeakPercent = 25;
- PlayerGUID = 0;
ManaBurnTimer = 5000;
}
@@ -424,7 +423,7 @@ public:
bool Drained;
uint8 WeakPercent;
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
uint32 ManaBurnTimer;
@@ -435,7 +434,7 @@ public:
Drained = false;
WeakPercent = 25 + (rand32() % 16); // 25-40
- PlayerGUID = 0;
+ PlayerGUID.Clear();
ManaBurnTimer = 5000 + (rand32() % 3 * 1000); // 5-8 sec cd
@@ -725,7 +724,7 @@ class go_captain_tyralius_prison : public GameObjectScript
go->UseDoorOrButton();
if (Creature* tyralius = go->FindNearestCreature(NPC_CAPTAIN_TYRALIUS, 1.0f))
{
- player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS, 0);
+ player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS);
tyralius->AI()->Talk(SAY_FREE);
tyralius->DespawnOrUnsummon(8000);
}
diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
index db34665e641..54a7455d3f8 100644
--- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
@@ -80,7 +80,7 @@ public:
{
npc_mature_netherwing_drakeAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 uiPlayerGUID;
+ ObjectGuid uiPlayerGUID;
bool bCanEat;
bool bIsEating;
@@ -90,7 +90,7 @@ public:
void Reset() override
{
- uiPlayerGUID = 0;
+ uiPlayerGUID.Clear();
bCanEat = false;
bIsEating = false;
@@ -154,7 +154,7 @@ public:
if (Player* player = ObjectAccessor::GetPlayer(*me, uiPlayerGUID))
{
- player->KilledMonsterCredit(NPC_EVENT_PINGER, 0);
+ player->KilledMonsterCredit(NPC_EVENT_PINGER);
if (GameObject* go = player->FindNearestGameObject(GO_CARCASS, 10))
go->Delete();
@@ -218,12 +218,11 @@ public:
{
npc_enslaved_netherwing_drakeAI(Creature* creature) : ScriptedAI(creature)
{
- PlayerGUID = 0;
Tapped = false;
Reset();
}
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
uint32 FlyTimer;
bool Tapped;
@@ -276,7 +275,7 @@ public:
if (player)
DoCast(player, SPELL_FORCE_OF_NELTHARAKU, true);
- PlayerGUID = 0;
+ PlayerGUID.Clear();
}
me->SetVisible(false);
me->SetDisableGravity(false);
@@ -349,13 +348,13 @@ public:
{
npc_dragonmaw_peonAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
bool Tapped;
uint32 PoisonTimer;
void Reset() override
{
- PlayerGUID = 0;
+ PlayerGUID.Clear();
Tapped = false;
PoisonTimer = 0;
}
@@ -400,7 +399,7 @@ public:
{
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
if (player && player->GetQuestStatus(11020) == QUEST_STATUS_INCOMPLETE)
- player->KilledMonsterCredit(23209, 0);
+ player->KilledMonsterCredit(23209);
}
PoisonTimer = 0;
me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
@@ -460,7 +459,7 @@ public:
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30658, 1, NULL);
if (msg == EQUIP_ERR_OK)
{
- player->StoreNewItem(dest, 30658, 1, true);
+ player->StoreNewItem(dest, 30658, true);
player->PlayerTalkClass->ClearMenus();
}
}
@@ -470,7 +469,7 @@ public:
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30659, 1, NULL);
if (msg == EQUIP_ERR_OK)
{
- player->StoreNewItem(dest, 30659, 1, true);
+ player->StoreNewItem(dest, 30659, true);
player->PlayerTalkClass->ClearMenus();
}
}
@@ -583,8 +582,8 @@ public:
{
npc_overlord_morghorAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 PlayerGUID;
- uint64 IllidanGUID;
+ ObjectGuid PlayerGUID;
+ ObjectGuid IllidanGUID;
uint32 ConversationTimer;
uint32 Step;
@@ -593,8 +592,8 @@ public:
void Reset() override
{
- PlayerGUID = 0;
- IllidanGUID = 0;
+ PlayerGUID.Clear();
+ IllidanGUID.Clear();
ConversationTimer = 0;
Step = 0;
@@ -798,7 +797,7 @@ public:
case 30:
{
if (Creature* Yarzill = me->FindNearestCreature(C_YARZILL, 50.0f))
- Yarzill->SetTarget(0);
+ Yarzill->SetTarget(ObjectGuid::Empty);
return 5000;
}
break;
@@ -814,7 +813,7 @@ public:
return 5000;
break;
case 33:
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
Reset();
return 100;
break;
@@ -1123,8 +1122,8 @@ public:
uint8 AnimationCount;
- uint64 LordIllidanGUID;
- uint64 AggroTargetGUID;
+ ObjectGuid LordIllidanGUID;
+ ObjectGuid AggroTargetGUID;
bool Timers;
@@ -1132,13 +1131,13 @@ public:
{
AnimationTimer = 4000;
AnimationCount = 0;
- LordIllidanGUID = 0;
- AggroTargetGUID = 0;
+ LordIllidanGUID.Clear();
+ AggroTargetGUID.Clear();
Timers = false;
me->AddUnitState(UNIT_STATE_ROOT);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- me->SetTarget(0);
+ me->SetTarget(ObjectGuid::Empty);
}
void EnterCombat(Unit* /*who*/) override { }
@@ -1274,7 +1273,7 @@ public:
{
npc_lord_illidan_stormrageAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
uint32 WaveTimer;
uint32 AnnounceTimer;
@@ -1288,7 +1287,7 @@ public:
void Reset() override
{
- PlayerGUID = 0;
+ PlayerGUID.Clear();
WaveTimer = 10000;
AnnounceTimer = 7000;
@@ -1416,13 +1415,13 @@ public:
{
npc_illidari_spawnAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 LordIllidanGUID;
+ ObjectGuid LordIllidanGUID;
uint32 SpellTimer1, SpellTimer2, SpellTimer3;
bool Timers;
void Reset() override
{
- LordIllidanGUID = 0;
+ LordIllidanGUID.Clear();
Timers = false;
}
@@ -1727,7 +1726,7 @@ public:
if (Unit* owner = totemOspirits->GetOwner())
if (Player* player = owner->ToPlayer())
- player->KilledMonsterCredit(credit, 0);
+ player->KilledMonsterCredit(credit);
DoCast(totemOspirits, SPELL_SOUL_CAPTURED);
}
}
diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp
index da7ae03a8ee..223a144e33b 100644
--- a/src/server/scripts/Outland/zone_terokkar_forest.cpp
+++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp
@@ -323,7 +323,7 @@ public:
if (rand32() % 100 < 25)
{
me->SummonCreature(QUEST_TARGET, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
- player->KilledMonsterCredit(QUEST_TARGET, 0);
+ player->KilledMonsterCredit(QUEST_TARGET);
}
else
me->SummonCreature(netherwebVictims[rand32() % 6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp
index b24336cb33c..edbec51f4b1 100644
--- a/src/server/scripts/Pet/pet_dk.cpp
+++ b/src/server/scripts/Pet/pet_dk.cpp
@@ -59,7 +59,7 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
Initialize();
CasterAI::InitializeAI();
- uint64 ownerGuid = me->GetOwnerGUID();
+ ObjectGuid ownerGuid = me->GetOwnerGUID();
if (!ownerGuid)
return;
@@ -69,7 +69,7 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check);
me->VisitNearbyObject(30.0f, searcher);
for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
- if ((*iter)->GetAura(SPELL_DK_SUMMON_GARGOYLE_1, ownerGuid))
+ if ((*iter)->HasAura(SPELL_DK_SUMMON_GARGOYLE_1, ownerGuid))
{
me->Attack((*iter), false);
break;
diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp
index d0e950dec32..538dca8e4b9 100644
--- a/src/server/scripts/Pet/pet_generic.cpp
+++ b/src/server/scripts/Pet/pet_generic.cpp
@@ -41,17 +41,11 @@ class npc_pet_gen_mojo : public CreatureScript
{
npc_pet_gen_mojoAI(Creature* creature) : ScriptedAI(creature)
{
- Initialize();
- }
-
- void Initialize()
- {
- _victimGUID = 0;
}
void Reset() override
{
- Initialize();
+ _victimGUID.Clear();
if (Unit* owner = me->GetOwner())
me->GetMotionMaster()->MoveFollow(owner, 0.0f, 0.0f);
@@ -84,7 +78,7 @@ class npc_pet_gen_mojo : public CreatureScript
}
private:
- uint64 _victimGUID;
+ ObjectGuid _victimGUID;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 94d2a95f618..db8a9a5ace2 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -278,7 +278,7 @@ class spell_gen_animal_blood : public SpellScriptLoader
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
// Remove all auras with spell id 46221, except the one currently being applied
- while (Aura* aur = GetUnitOwner()->GetOwnedAura(SPELL_ANIMAL_BLOOD, 0, 0, 0, GetAura()))
+ while (Aura* aur = GetUnitOwner()->GetOwnedAura(SPELL_ANIMAL_BLOOD, ObjectGuid::Empty, ObjectGuid::Empty, 0, GetAura()))
GetUnitOwner()->RemoveOwnedAura(aur);
}
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index f72f6435b0c..d72c6d5c775 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -670,7 +670,7 @@ class spell_mage_glyph_of_icy_veins : public SpellScriptLoader
{
PreventDefaultAction();
- GetTarget()->RemoveAurasByType(SPELL_AURA_HASTE_SPELLS, 0, 0, true, false);
+ GetTarget()->RemoveAurasByType(SPELL_AURA_HASTE_SPELLS, ObjectGuid::Empty, 0, true, false);
GetTarget()->RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
}
@@ -708,7 +708,7 @@ class spell_mage_glyph_of_polymorph : public SpellScriptLoader
PreventDefaultAction();
Unit* target = eventInfo.GetProcTarget();
- target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(SPELL_PRIEST_SHADOW_WORD_DEATH)); // SW:D shall not be removed.
+ target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(SPELL_PRIEST_SHADOW_WORD_DEATH)); // SW:D shall not be removed.
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
}
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index 3bd61ddf465..0f78790bcee 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -710,7 +710,7 @@ class spell_pri_mind_sear : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& unitList)
{
- unitList.remove_if(Trinity::ObjectGUIDCheck(GetCaster()->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)));
+ unitList.remove_if(Trinity::ObjectGUIDCheck(GetCaster()->GetChannelObjectGuid()));
}
void Register() override
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index 92eeef5e8a8..9c65567fe7f 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -754,7 +754,7 @@ class spell_q12937_relief_for_the_fallen : public SpellScriptLoader
if (Creature* target = GetHitCreature())
{
caster->CastSpell(caster, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, NULL);
- caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER, 0);
+ caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER);
target->DespawnOrUnsummon();
}
}
@@ -885,7 +885,7 @@ class spell_q12659_ahunaes_knife : public SpellScriptLoader
if (Creature* target = GetHitCreature())
{
target->DespawnOrUnsummon();
- caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY, 0);
+ caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY);
}
}
@@ -929,7 +929,7 @@ class spell_q9874_liquid_fire : public SpellScriptLoader
if (Creature* target = GetHitCreature())
if (target && !target->HasAura(SPELL_FLAMES))
{
- caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT, 0);
+ caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT);
target->CastSpell(target, SPELL_FLAMES, true);
target->DespawnOrUnsummon(60000);
}
@@ -973,7 +973,7 @@ class spell_q12805_lifeblood_dummy : public SpellScriptLoader
Player* caster = GetCaster()->ToPlayer();
if (Creature* target = GetHitCreature())
{
- caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT, 0);
+ caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT);
target->CastSpell(target, uint32(GetEffectValue()), true);
target->DespawnOrUnsummon(2000);
}
@@ -1016,7 +1016,7 @@ class spell_q13280_13283_plant_battle_standard: public SpellScriptLoader
Unit* caster = GetCaster();
if (caster->IsVehicle())
if (Unit* player = caster->GetVehicleKit()->GetPassenger(0))
- player->ToPlayer()->KilledMonsterCredit(NPC_KING_OF_THE_MOUNTAINT_KC, 0);
+ player->ToPlayer()->KilledMonsterCredit(NPC_KING_OF_THE_MOUNTAINT_KC);
}
void Register() override
@@ -1356,7 +1356,7 @@ class spell_q12372_destabilize_azure_dragonshrine_dummy : public SpellScriptLoad
if (Vehicle* vehicle = caster->GetVehicleKit())
if (Unit* passenger = vehicle->GetPassenger(0))
if (Player* player = passenger->ToPlayer())
- player->KilledMonsterCredit(NPC_WYRMREST_TEMPLE_CREDIT, 0);
+ player->KilledMonsterCredit(NPC_WYRMREST_TEMPLE_CREDIT);
}
void Register() override
@@ -2348,6 +2348,52 @@ class spell_q14100_q14111_make_player_destroy_totems : public SpellScriptLoader
}
};
+enum Fumping
+{
+ SPELL_SUMMON_SAND_GNOME = 39240,
+ SPELL_SUMMON_BONE_SLICER = 39241
+};
+
+// 39238 - Fumping
+class spell_q10929_fumping : SpellScriptLoader
+{
+ public:
+ spell_q10929_fumping() : SpellScriptLoader("spell_q10929_fumping") { }
+
+ class spell_q10929_fumpingAuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_q10929_fumpingAuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SAND_GNOME))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_BONE_SLICER))
+ return false;
+ return true;
+ }
+
+ void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
+ return;
+
+ if (Unit* caster = GetCaster())
+ caster->CastSpell(caster, urand(SPELL_SUMMON_SAND_GNOME, SPELL_SUMMON_BONE_SLICER), true);
+ }
+
+ void Register() override
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_q10929_fumpingAuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const override
+ {
+ return new spell_q10929_fumpingAuraScript();
+ }
+};
+
void AddSC_quest_spell_scripts()
{
new spell_q55_sacred_cleansing();
@@ -2405,4 +2451,5 @@ void AddSC_quest_spell_scripts()
new spell_q12919_gymers_throw();
new spell_q13400_illidan_kill_master();
new spell_q14100_q14111_make_player_destroy_totems();
+ new spell_q10929_fumping();
}
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index e8546c4214e..175a3c4f361 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -400,7 +400,7 @@ class spell_rog_killing_spree : public SpellScriptLoader
{
while (!_targets.empty())
{
- uint64 guid = Trinity::Containers::SelectRandomContainerElement(_targets);
+ ObjectGuid guid = Trinity::Containers::SelectRandomContainerElement(_targets);
if (Unit* target = ObjectAccessor::GetUnit(*GetTarget(), guid))
{
GetTarget()->CastSpell(target, SPELL_ROGUE_KILLING_SPREE_TELEPORT, true);
@@ -431,7 +431,7 @@ class spell_rog_killing_spree : public SpellScriptLoader
}
private:
- std::list<uint64> _targets;
+ GuidList _targets;
};
AuraScript* GetAuraScript() const override
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 4c6e2b942da..42acb474169 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -1001,7 +1001,7 @@ class spell_warl_seduction : public SpellScriptLoader
{
if (caster->GetOwner() && caster->GetOwner()->HasAura(SPELL_WARLOCK_GLYPH_OF_SUCCUBUS))
{
- target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(SPELL_PRIEST_SHADOW_WORD_DEATH)); // SW:D shall not be removed.
+ target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(SPELL_PRIEST_SHADOW_WORD_DEATH)); // SW:D shall not be removed.
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
}
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index ecbc6ca1bdc..4bf57d116fe 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -245,13 +245,13 @@ class spell_warr_deep_wounds : public SpellScriptLoader
ApplyPct(damage, 16 * GetSpellInfo()->GetRank());
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC);
- uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude;
+ uint32 ticks = uint32(spellInfo->GetDuration()) / spellInfo->Effects[EFFECT_0].Amplitude;
// Add remaining ticks to damage done
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC, EFFECT_0, caster->GetGUID()))
- damage += aurEff->GetDamage() * (ticks - aurEff->GetTickNumber());
+ damage += aurEff->GetDamage() * int32(ticks - aurEff->GetTickNumber());
- damage /= ticks;
+ damage /= int32(ticks);
caster->CastCustomSpell(target, SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC, &damage, NULL, NULL, true);
}
diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp
index 057f3d6ee36..2977f4e974a 100644
--- a/src/server/scripts/World/action_ip_logger.cpp
+++ b/src/server/scripts/World/action_ip_logger.cpp
@@ -252,24 +252,24 @@ public:
CharacterDeleteActionIpLogger() : PlayerScript("CharacterDeleteActionIpLogger") { }
// CHARACTER_DELETE = 10
- void OnDelete(uint64 guid, uint32 accountId) override
+ void OnDelete(ObjectGuid guid, uint32 accountId) override
{
DeleteIPLogAction(guid, accountId, CHARACTER_DELETE);
}
// CHARACTER_FAILED_DELETE = 11
- void OnFailedDelete(uint64 guid, uint32 accountId) override
+ void OnFailedDelete(ObjectGuid guid, uint32 accountId) override
{
DeleteIPLogAction(guid, accountId, CHARACTER_FAILED_DELETE);
}
- void DeleteIPLogAction(uint64 guid, uint32 playerGuid, IPLoggingTypes aType)
+ void DeleteIPLogAction(ObjectGuid guid, uint32 playerGuid, IPLoggingTypes aType)
{
// Action IP Logger is only intialized if config is set up
// Else, this script isn't loaded in the first place: We require no config check.
// We declare all the required variables
- uint32 characterGuid = GUID_LOPART(guid); // We have no access to any member function of Player* or WorldSession*. So use old-fashioned way.
+ uint32 characterGuid = guid.GetCounter(); // We have no access to any member function of Player* or WorldSession*. So use old-fashioned way.
// Query playerGuid/accountId, as we only have characterGuid
std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it later.
diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp
index dcba4cf9573..a1e328ebaf0 100644
--- a/src/server/scripts/World/areatrigger_scripts.cpp
+++ b/src/server/scripts/World/areatrigger_scripts.cpp
@@ -431,8 +431,8 @@ class AreaTrigger_at_frostgrips_hollow : public AreaTriggerScript
public:
AreaTrigger_at_frostgrips_hollow() : AreaTriggerScript("at_frostgrips_hollow")
{
- stormforgedMonitorGUID = 0;
- stormforgedEradictorGUID = 0;
+ stormforgedMonitorGUID.Clear();
+ stormforgedEradictorGUID.Clear();
}
bool OnTrigger(Player* player, AreaTriggerEntry const* /* trigger */) override
@@ -469,8 +469,8 @@ public:
}
private:
- uint64 stormforgedMonitorGUID;
- uint64 stormforgedEradictorGUID;
+ ObjectGuid stormforgedMonitorGUID;
+ ObjectGuid stormforgedEradictorGUID;
};
void AddSC_areatrigger_scripts()
diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp
index a00c9465a05..01d36783d20 100644
--- a/src/server/scripts/World/boss_emerald_dragons.cpp
+++ b/src/server/scripts/World/boss_emerald_dragons.cpp
@@ -418,7 +418,7 @@ class npc_spirit_shade : public CreatureScript
struct npc_spirit_shadeAI : public PassiveAI
{
- npc_spirit_shadeAI(Creature* creature) : PassiveAI(creature), _summonerGuid(0)
+ npc_spirit_shadeAI(Creature* creature) : PassiveAI(creature), _summonerGuid()
{
}
@@ -430,7 +430,7 @@ class npc_spirit_shade : public CreatureScript
void MovementInform(uint32 moveType, uint32 data) override
{
- if (moveType == FOLLOW_MOTION_TYPE && data == _summonerGuid)
+ if (moveType == FOLLOW_MOTION_TYPE && data == _summonerGuid.GetCounter())
{
me->CastSpell((Unit*)NULL, SPELL_DARK_OFFERING, false);
me->DespawnOrUnsummon(1000);
@@ -438,7 +438,7 @@ class npc_spirit_shade : public CreatureScript
}
private:
- uint64 _summonerGuid;
+ ObjectGuid _summonerGuid;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp
index 1fdd314a9ed..65cb2c2abce 100644
--- a/src/server/scripts/World/go_scripts.cpp
+++ b/src/server/scripts/World/go_scripts.cpp
@@ -770,7 +770,7 @@ public:
return false;
pPrisoner->DisappearAndDie();
- player->KilledMonsterCredit(NPC_EBON_BLADE_PRISONER_HUMAN, 0);
+ player->KilledMonsterCredit(NPC_EBON_BLADE_PRISONER_HUMAN);
switch (pPrisoner->GetEntry())
{
case NPC_EBON_BLADE_PRISONER_HUMAN:
@@ -917,7 +917,7 @@ public:
if (qInfo)
{
/// @todo prisoner should help player for a short period of time
- player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0);
+ player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0]);
pPrisoner->DisappearAndDie();
}
return true;
@@ -949,7 +949,7 @@ public:
if (pTadpole)
{
pTadpole->DisappearAndDie();
- player->KilledMonsterCredit(NPC_WINTERFIN_TADPOLE, 0);
+ player->KilledMonsterCredit(NPC_WINTERFIN_TADPOLE);
//FIX: Summon minion tadpole
}
}
@@ -1083,7 +1083,7 @@ class go_gjalerbron_cage : public GameObjectScript
{
if (Creature* prisoner = go->FindNearestCreature(NPC_GJALERBRON_PRISONER, 5.0f))
{
- player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, 0);
+ player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER);
prisoner->AI()->Talk(SAY_FREE);
prisoner->DespawnOrUnsummon(6000);
diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp
index bd953a285ab..13d811f3ff1 100644
--- a/src/server/scripts/World/guards.cpp
+++ b/src/server/scripts/World/guards.cpp
@@ -280,7 +280,7 @@ public:
{
banishTimer = 5000;
exileTimer = 8500;
- playerGUID = 0;
+ playerGUID.Clear();
canTeleport = false;
}
@@ -303,7 +303,7 @@ public:
temp->CastSpell(temp, SPELL_EXILE, true);
temp->CastSpell(temp, SPELL_BANISH_TELEPORT, true);
}
- playerGUID = 0;
+ playerGUID.Clear();
exileTimer = 8500;
canTeleport = false;
} else exileTimer -= diff;
@@ -327,7 +327,7 @@ public:
private:
uint32 exileTimer;
uint32 banishTimer;
- uint64 playerGUID;
+ ObjectGuid playerGUID;
bool canTeleport;
};
@@ -353,7 +353,7 @@ public:
{
banishTimer = 5000;
exileTimer = 8500;
- playerGUID = 0;
+ playerGUID.Clear();
canTeleport = false;
}
@@ -376,7 +376,7 @@ public:
temp->CastSpell(temp, SPELL_EXILE, true);
temp->CastSpell(temp, SPELL_BANISH_TELEPORT, true);
}
- playerGUID = 0;
+ playerGUID.Clear();
exileTimer = 8500;
canTeleport = false;
} else exileTimer -= diff;
@@ -399,7 +399,7 @@ public:
private:
uint32 exileTimer;
uint32 banishTimer;
- uint64 playerGUID;
+ ObjectGuid playerGUID;
bool canTeleport;
};
diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp
index 45886fd4361..f9cd44ca88c 100644
--- a/src/server/scripts/World/item_scripts.cpp
+++ b/src/server/scripts/World/item_scripts.cpp
@@ -349,7 +349,7 @@ public:
{
pMammoth->AI()->DoAction(1);
pTrap->SetGoState(GO_STATE_READY);
- player->KilledMonsterCredit(NPC_TRAPPED_MAMMOTH_CALF, 0);
+ player->KilledMonsterCredit(NPC_TRAPPED_MAMMOTH_CALF);
return true;
}
}
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index d04b25147c7..e733f5581f9 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -124,7 +124,7 @@ public:
npc_air_force_botsAI(Creature* creature) : ScriptedAI(creature)
{
SpawnAssoc = NULL;
- SpawnedGUID = 0;
+ SpawnedGUID.Clear();
// find the correct spawnhandling
static uint32 entryCount = sizeof(spawnAssociations) / sizeof(SpawnAssociation);
@@ -154,7 +154,7 @@ public:
}
SpawnAssociation* SpawnAssoc;
- uint64 SpawnedGUID;
+ ObjectGuid SpawnedGUID;
void Reset() override { }
@@ -196,11 +196,11 @@ public:
if (!playerTarget)
return;
- Creature* lastSpawnedGuard = SpawnedGUID == 0 ? NULL : GetSummonedGuard();
+ Creature* lastSpawnedGuard = SpawnedGUID.IsEmpty() ? NULL : GetSummonedGuard();
// prevent calling Unit::GetUnit at next MoveInLineOfSight call - speedup
if (!lastSpawnedGuard)
- SpawnedGUID = 0;
+ SpawnedGUID.Clear();
switch (SpawnAssoc->spawnType)
{
@@ -591,7 +591,7 @@ public:
void Initialize()
{
- PlayerGUID = 0;
+ PlayerGUID.Clear();
SummonPatientTimer = 10000;
SummonPatientCount = 0;
@@ -604,7 +604,7 @@ public:
Event = false;
}
- uint64 PlayerGUID;
+ ObjectGuid PlayerGUID;
uint32 SummonPatientTimer;
uint32 SummonPatientCount;
@@ -613,7 +613,7 @@ public:
bool Event;
- std::list<uint64> Patients;
+ GuidList Patients;
std::vector<Location*> Coordinates;
void Reset() override
@@ -684,10 +684,9 @@ public:
{
if (!Patients.empty())
{
- std::list<uint64>::const_iterator itr;
- for (itr = Patients.begin(); itr != Patients.end(); ++itr)
+ for (GuidList::const_iterator itr = Patients.begin(); itr != Patients.end(); ++itr)
{
- if (Creature* patient = ObjectAccessor::GetCreature((*me), *itr))
+ if (Creature* patient = ObjectAccessor::GetCreature(*me, *itr))
patient->setDeathState(JUST_DIED);
}
}
@@ -743,11 +742,11 @@ public:
void Initialize()
{
- DoctorGUID = 0;
+ DoctorGUID.Clear();
Coord = NULL;
}
- uint64 DoctorGUID;
+ ObjectGuid DoctorGUID;
Location* Coord;
void Reset() override
@@ -944,7 +943,7 @@ public:
Reset();
}
- uint64 CasterGUID;
+ ObjectGuid CasterGUID;
bool IsHealed;
bool CanRun;
@@ -953,7 +952,7 @@ public:
void Reset() override
{
- CasterGUID = 0;
+ CasterGUID.Clear();
IsHealed = false;
CanRun = false;
@@ -1101,7 +1100,7 @@ public:
break;
}
- Start(false, true, true);
+ Start(false, true);
}
else
EnterEvadeMode(); //something went wrong
@@ -1473,7 +1472,7 @@ public:
}
EventMap _events;
- std::unordered_map<uint64, time_t> _damageTimes;
+ std::unordered_map<ObjectGuid, time_t> _damageTimes;
void Reset() override
{
@@ -1520,7 +1519,7 @@ public:
case EVENT_TD_CHECK_COMBAT:
{
time_t now = time(NULL);
- for (std::unordered_map<uint64, time_t>::iterator itr = _damageTimes.begin(); itr != _damageTimes.end();)
+ for (std::unordered_map<ObjectGuid, time_t>::iterator itr = _damageTimes.begin(); itr != _damageTimes.end();)
{
// If unit has not dealt damage to training dummy for 5 seconds, remove him from combat
if (itr->second < now - 5)
@@ -2256,7 +2255,7 @@ public:
void Initialize()
{
inLove = false;
- rabbitGUID = 0;
+ rabbitGUID.Clear();
jumpTimer = urand(5000, 10000);
bunnyTimer = urand(10000, 20000);
searchTimer = urand(5000, 10000);
@@ -2266,7 +2265,7 @@ public:
uint32 jumpTimer;
uint32 bunnyTimer;
uint32 searchTimer;
- uint64 rabbitGUID;
+ ObjectGuid rabbitGUID;
void Reset() override
{
@@ -2341,7 +2340,7 @@ public:
{
npc_imp_in_a_ballAI(Creature* creature) : ScriptedAI(creature)
{
- summonerGUID = 0;
+ summonerGUID.Clear();
}
void IsSummonedBy(Unit* summoner) override
@@ -2369,7 +2368,7 @@ public:
private:
EventMap events;
- uint64 summonerGUID;
+ ObjectGuid summonerGUID;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/shared/DataStores/DBCFileLoader.cpp b/src/server/shared/DataStores/DBCFileLoader.cpp
index f8c8693216d..ea9bf23d383 100644
--- a/src/server/shared/DataStores/DBCFileLoader.cpp
+++ b/src/server/shared/DataStores/DBCFileLoader.cpp
@@ -114,11 +114,9 @@ bool DBCFileLoader::Load(const char* filename, const char* fmt)
DBCFileLoader::~DBCFileLoader()
{
- if (data)
- delete [] data;
+ delete[] data;
- if (fieldsOffset)
- delete [] fieldsOffset;
+ delete[] fieldsOffset;
}
DBCFileLoader::Record DBCFileLoader::getRecord(size_t id)
diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h
index 5548e44c925..61385d92437 100644
--- a/src/server/shared/Database/DatabaseWorkerPool.h
+++ b/src/server/shared/Database/DatabaseWorkerPool.h
@@ -76,13 +76,12 @@ class DatabaseWorkerPool
bool Open(const std::string& infoString, uint8 async_threads, uint8 synch_threads)
{
- bool res = true;
_connectionInfo = new MySQLConnectionInfo(infoString);
TC_LOG_INFO("sql.driver", "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
GetDatabaseName(), async_threads, synch_threads);
- res = OpenConnections(IDX_ASYNC, async_threads);
+ bool res = OpenConnections(IDX_ASYNC, async_threads);
if (!res)
return res;
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 073b1fe3f89..061415ae607 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -34,7 +34,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_INS_CHARACTER_BAN, "INSERT INTO character_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?, 1)", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER_BAN, "UPDATE character_banned SET active = 0 WHERE guid = ? AND active != 0", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_CHARACTER_BAN, "DELETE cb FROM character_banned cb INNER JOIN characters c ON c.guid = cb.guid WHERE c.account = ?", CONNECTION_ASYNC);
- PrepareStatement(CHAR_SEL_BANINFO, "SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM character_banned WHERE guid = ? ORDER BY bandate ASC", CONNECTION_SYNCH);
+ PrepareStatement(CHAR_SEL_BANINFO, "SELECT bandate, unbandate-bandate, active, unbandate, banreason, bannedby FROM character_banned WHERE guid = ? ORDER BY bandate ASC", CONNECTION_SYNCH);
PrepareStatement(CHAR_SEL_GUID_BY_NAME_FILTER, "SELECT guid, name FROM characters WHERE name LIKE CONCAT('%%', ?, '%%')", CONNECTION_SYNCH);
PrepareStatement(CHAR_SEL_BANINFO_LIST, "SELECT bandate, unbandate, bannedby, banreason FROM character_banned WHERE guid = ? ORDER BY unbandate", CONNECTION_SYNCH);
PrepareStatement(CHAR_SEL_BANNED_NAME, "SELECT characters.name FROM characters, character_banned WHERE character_banned.guid = ? AND character_banned.guid = characters.guid", CONNECTION_SYNCH);
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp
index 1245187e7c2..ecbd0e9244c 100644
--- a/src/server/shared/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp
@@ -25,7 +25,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PrepareStatement(WORLD_SEL_QUEST_POOLS, "SELECT entry, pool_entry FROM pool_quest", CONNECTION_SYNCH);
PrepareStatement(WORLD_DEL_CRELINKED_RESPAWN, "DELETE FROM linked_respawn WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_REP_CREATURE_LINKED_RESPAWN, "REPLACE INTO linked_respawn (guid, linkedGuid) VALUES (?, ?)", CONNECTION_ASYNC);
- PrepareStatement(WORLD_SEL_CREATURE_TEXT, "SELECT entry, groupid, id, text, type, language, probability, emote, duration, sound, BroadcastTextID FROM creature_text", CONNECTION_SYNCH);
+ PrepareStatement(WORLD_SEL_CREATURE_TEXT, "SELECT entry, groupid, id, text, type, language, probability, emote, duration, sound, BroadcastTextId, TextRange FROM creature_text", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_SMART_SCRIPTS, "SELECT entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o FROM smart_scripts ORDER BY entryorguid, source_type, id, link", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_SMARTAI_WP, "SELECT entry, pointid, position_x, position_y, position_z FROM waypoints ORDER BY entry, pointid", CONNECTION_SYNCH);
PrepareStatement(WORLD_DEL_GAMEOBJECT, "DELETE FROM gameobject WHERE guid = ?", CONNECTION_ASYNC);
diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp
index abdf2a2cc3c..24290009625 100644
--- a/src/server/shared/Database/MySQLConnection.cpp
+++ b/src/server/shared/Database/MySQLConnection.cpp
@@ -57,8 +57,7 @@ m_connectionFlags(CONNECTION_ASYNC)
MySQLConnection::~MySQLConnection()
{
- if (m_worker)
- delete m_worker;
+ delete m_worker;
for (size_t i = 0; i < m_stmts.size(); ++i)
delete m_stmts[i];
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp
index 2eb456ddd02..e9f4f9ca9ac 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.cpp
+++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp
@@ -1043,7 +1043,7 @@ bool logChildren)
offset, bHandled, Name, "", false, false);
// Set Value back to an empty string since the Array object itself has no value, only its elements have
- symbolDetails.top().Value = "";
+ symbolDetails.top().Value.clear();
DWORD elementsCount;
if (SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_COUNT, &elementsCount))
diff --git a/src/server/shared/Define.h b/src/server/shared/Define.h
index d1501b0c149..5d5da7e600e 100644
--- a/src/server/shared/Define.h
+++ b/src/server/shared/Define.h
@@ -88,6 +88,8 @@
#define SI64FMTD "%" PRId64
#define SI64LIT(N) INT64_C(N)
+#define SZFMTD "%" PRIuPTR
+
typedef int64_t int64;
typedef int32_t int32;
typedef int16_t int16;
diff --git a/src/server/shared/Networking/Socket.h b/src/server/shared/Networking/Socket.h
index dfff60a380b..d3e29ceaaea 100644
--- a/src/server/shared/Networking/Socket.h
+++ b/src/server/shared/Networking/Socket.h
@@ -34,6 +34,7 @@
using boost::asio::ip::tcp;
#define READ_BLOCK_SIZE 4096
+#define TC_SOCKET_USE_IOCP BOOST_ASIO_HAS_IOCP
template<class T>
class Socket : public std::enable_shared_from_this<T>
@@ -58,11 +59,15 @@ public:
if (!IsOpen())
return false;
-#ifndef BOOST_ASIO_HAS_IOCP
+#ifndef TC_SOCKET_USE_IOCP
+ std::unique_lock<std::mutex> guard(_writeLock, std::try_to_lock);
+ if (!guard)
+ return true;
+
if (_isWritingAsync || (!_writeBuffer.GetActiveSize() && _writeQueue.empty()))
return true;
- for (; WriteHandler(boost::system::error_code(), 0);)
+ for (; WriteHandler(guard);)
;
#endif
@@ -113,7 +118,7 @@ public:
{
_writeQueue.push(std::move(buffer));
-#ifdef BOOST_ASIO_HAS_IOCP
+#ifdef TC_SOCKET_USE_IOCP
AsyncProcessQueue(guard);
#else
(void)guard;
@@ -145,24 +150,25 @@ protected:
bool AsyncProcessQueue(std::unique_lock<std::mutex>&)
{
if (_isWritingAsync)
- return true;
+ return false;
_isWritingAsync = true;
-#ifdef BOOST_ASIO_HAS_IOCP
+#ifdef TC_SOCKET_USE_IOCP
MessageBuffer& buffer = _writeQueue.front();
_socket.async_write_some(boost::asio::buffer(buffer.GetReadPointer(), buffer.GetActiveSize()), std::bind(&Socket<T>::WriteHandler,
this->shared_from_this(), std::placeholders::_1, std::placeholders::_2));
#else
- _socket.async_write_some(boost::asio::null_buffers(), std::bind(&Socket<T>::WriteHandler, this->shared_from_this(), std::placeholders::_1, std::placeholders::_2));
+ _socket.async_write_some(boost::asio::null_buffers(), std::bind(&Socket<T>::WriteHandlerWrapper,
+ this->shared_from_this(), std::placeholders::_1, std::placeholders::_2));
#endif
- return true;
+ return false;
}
std::mutex _writeLock;
std::queue<MessageBuffer> _writeQueue;
-#ifndef BOOST_ASIO_HAS_IOCP
+#ifndef TC_SOCKET_USE_IOCP
MessageBuffer _writeBuffer;
#endif
@@ -179,7 +185,7 @@ private:
ReadHandler();
}
-#ifdef BOOST_ASIO_HAS_IOCP
+#ifdef TC_SOCKET_USE_IOCP
void WriteHandler(boost::system::error_code error, std::size_t transferedBytes)
{
@@ -203,12 +209,15 @@ private:
#else
- bool WriteHandler(boost::system::error_code /*error*/, std::size_t /*transferedBytes*/)
+ void WriteHandlerWrapper(boost::system::error_code /*error*/, std::size_t /*transferedBytes*/)
{
- std::unique_lock<std::mutex> guard(_writeLock, std::try_to_lock);
- if (!guard)
- return false;
+ std::unique_lock<std::mutex> guard(_writeLock);
+ _isWritingAsync = false;
+ WriteHandler(guard);
+ }
+ bool WriteHandler(std::unique_lock<std::mutex>& guard)
+ {
if (!IsOpen())
return false;
@@ -229,7 +238,7 @@ private:
}
else if (bytesWritten == 0)
return false;
- else if (bytesWritten < bytesToSend) //now n > 0
+ else if (bytesWritten < bytesToSend)
{
_writeBuffer.ReadCompleted(bytesWritten);
_writeBuffer.Normalize();
@@ -245,10 +254,7 @@ private:
bool HandleQueue(std::unique_lock<std::mutex>& guard)
{
if (_writeQueue.empty())
- {
- _isWritingAsync = false;
return false;
- }
MessageBuffer& queuedMessage = _writeQueue.front();
@@ -277,13 +283,7 @@ private:
}
_writeQueue.pop();
- if (_writeQueue.empty())
- {
- _isWritingAsync = false;
- return false;
- }
-
- return true;
+ return !_writeQueue.empty();
}
#endif
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index f90f4814f2a..f7d27697f24 100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -32,6 +32,7 @@
#include <cstring>
#include <time.h>
#include <cmath>
+#include <type_traits>
#include <boost/asio/buffer.hpp>
class MessageBuffer;
@@ -116,6 +117,7 @@ class ByteBuffer
template <typename T> void append(T value)
{
+ static_assert(std::is_fundamental<T>::value, "append(compound)");
FlushBits();
EndianConvert(value);
append((uint8 *)&value, sizeof(value));
@@ -190,6 +192,7 @@ class ByteBuffer
template <typename T> void put(size_t pos, T value)
{
+ static_assert(std::is_fundamental<T>::value, "append(compound)");
EndianConvert(value);
put(pos, (uint8 *)&value, sizeof(value));
}
diff --git a/src/server/shared/Threading/ProcessPriority.h b/src/server/shared/Threading/ProcessPriority.h
index 23238c94ace..6446820e32d 100644
--- a/src/server/shared/Threading/ProcessPriority.h
+++ b/src/server/shared/Threading/ProcessPriority.h
@@ -26,7 +26,7 @@
#define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0
#endif
-void SetProcessPriority(const std::string logChannel)
+void SetProcessPriority(const std::string& logChannel)
{
// Suppresses Mac OS X Warning since logChannel isn't used.
#if PLATFORM_APPLE
diff --git a/src/server/shared/Utilities/ServiceWin32.cpp b/src/server/shared/Utilities/ServiceWin32.cpp
index ecf403423f7..6e5309d70d7 100644
--- a/src/server/shared/Utilities/ServiceWin32.cpp
+++ b/src/server/shared/Utilities/ServiceWin32.cpp
@@ -204,7 +204,8 @@ void WINAPI ServiceMain(DWORD argc, char *argv[])
GetModuleFileName(0, path, sizeof(path)/sizeof(path[0]));
- for (i = 0; i < std::strlen(path); i++)
+ size_t pathLen = std::strlen(path);
+ for (i = 0; i < pathLen; i++)
{
if (path[i] == '\\') last_slash = i;
}
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp
index 0bdc1fb714c..c4049ae6315 100644
--- a/src/server/shared/Utilities/Util.cpp
+++ b/src/server/shared/Utilities/Util.cpp
@@ -294,7 +294,7 @@ size_t utf8length(std::string& utf8str)
}
catch(std::exception)
{
- utf8str = "";
+ utf8str.clear();
return 0;
}
}
@@ -316,7 +316,7 @@ void utf8truncate(std::string& utf8str, size_t len)
}
catch(std::exception)
{
- utf8str = "";
+ utf8str.clear();
}
}
@@ -360,7 +360,7 @@ bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr)
}
catch(std::exception)
{
- wstr = L"";
+ wstr.clear();
return false;
}
@@ -383,14 +383,14 @@ bool WStrToUtf8(wchar_t* wstr, size_t size, std::string& utf8str)
}
catch(std::exception)
{
- utf8str = "";
+ utf8str.clear();
return false;
}
return true;
}
-bool WStrToUtf8(std::wstring wstr, std::string& utf8str)
+bool WStrToUtf8(std::wstring const& wstr, std::string& utf8str)
{
try
{
@@ -406,7 +406,7 @@ bool WStrToUtf8(std::wstring wstr, std::string& utf8str)
}
catch(std::exception)
{
- utf8str = "";
+ utf8str.clear();
return false;
}
@@ -415,7 +415,7 @@ bool WStrToUtf8(std::wstring wstr, std::string& utf8str)
typedef wchar_t const* const* wstrlist;
-std::wstring GetMainPartOfName(std::wstring wname, uint32 declension)
+std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension)
{
// supported only Cyrillic cases
if (wname.size() < 1 || !isCyrillicCharacter(wname[0]) || declension > 5)
@@ -492,7 +492,7 @@ bool consoleToUtf8(const std::string& conStr, std::string& utf8str)
#endif
}
-bool Utf8FitTo(const std::string& str, std::wstring search)
+bool Utf8FitTo(const std::string& str, std::wstring const& search)
{
std::wstring temp;
diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h
index d674acae09f..73ee37eb079 100644
--- a/src/server/shared/Utilities/Util.h
+++ b/src/server/shared/Utilities/Util.h
@@ -147,7 +147,7 @@ inline bool Utf8toWStr(const std::string& utf8str, wchar_t* wstr, size_t& wsize)
return Utf8toWStr(utf8str.c_str(), utf8str.size(), wstr, wsize);
}
-bool WStrToUtf8(std::wstring wstr, std::string& utf8str);
+bool WStrToUtf8(std::wstring const& wstr, std::string& utf8str);
// size==real string size
bool WStrToUtf8(wchar_t* wstr, size_t size, std::string& utf8str);
@@ -331,11 +331,11 @@ inline void wstrToLower(std::wstring& str)
std::transform( str.begin(), str.end(), str.begin(), wcharToLower );
}
-std::wstring GetMainPartOfName(std::wstring wname, uint32 declension);
+std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension);
bool utf8ToConsole(const std::string& utf8str, std::string& conStr);
bool consoleToUtf8(const std::string& conStr, std::string& utf8str);
-bool Utf8FitTo(const std::string& str, std::wstring search);
+bool Utf8FitTo(const std::string& str, std::wstring const& search);
void utf8printf(FILE* out, const char *str, ...);
void vutf8printf(FILE* out, const char *str, va_list* ap);
bool Utf8ToUpperOnlyLatin(std::string& utf8String);
@@ -878,7 +878,6 @@ class EventMap
*/
EventStore _eventMap;
-
/**
* @name _lastEvent
* @brief Stores information on the most recently executed event
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index 191e44b3e93..07101e61eb6 100644
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -268,8 +268,7 @@ extern int main(int argc, char** argv)
delete soapThread;
}
- if (raAcceptor != nullptr)
- delete raAcceptor;
+ delete raAcceptor;
///- Clean database before leaving
ClearOnlineAccounts();
diff --git a/src/server/worldserver/RemoteAccess/RASession.cpp b/src/server/worldserver/RemoteAccess/RASession.cpp
index 18217d4e882..c2b89cc0076 100644
--- a/src/server/worldserver/RemoteAccess/RASession.cpp
+++ b/src/server/worldserver/RemoteAccess/RASession.cpp
@@ -190,9 +190,7 @@ bool RASession::ProcessCommand(std::string& command)
}
// Obtain a new promise per command
- if (_commandExecuting != nullptr)
- delete _commandExecuting;
-
+ delete _commandExecuting;
_commandExecuting = new std::promise<void>();
CliCommandHolder* cmd = new CliCommandHolder(this, command.c_str(), &RASession::CommandPrint, &RASession::CommandFinished);