aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
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/game
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/game')
-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
208 files changed, 4047 insertions, 3977 deletions
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();