aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp18
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.h8
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp132
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h26
-rw-r--r--src/server/game/Achievements/AchievementMgr.cpp2
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp8
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp4
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp8
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp4
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp4
-rw-r--r--src/server/game/Calendar/CalendarMgr.cpp14
-rw-r--r--src/server/game/Chat/Chat.cpp6
-rw-r--r--src/server/game/Chat/Chat.h2
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp4
-rw-r--r--src/server/game/Conditions/ConditionMgr.h2
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp2
-rw-r--r--src/server/game/Entities/AreaTrigger/AreaTrigger.cpp2
-rw-r--r--src/server/game/Entities/AreaTrigger/AreaTrigger.h2
-rw-r--r--src/server/game/Entities/Corpse/Corpse.cpp9
-rw-r--r--src/server/game/Entities/Corpse/Corpse.h6
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp24
-rw-r--r--src/server/game/Entities/Creature/Creature.h15
-rw-r--r--src/server/game/Entities/Creature/CreatureGroups.cpp28
-rw-r--r--src/server/game/Entities/Creature/CreatureGroups.h12
-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.cpp19
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h12
-rw-r--r--src/server/game/Entities/Item/Container/Bag.cpp2
-rw-r--r--src/server/game/Entities/Item/Container/Bag.h2
-rw-r--r--src/server/game/Entities/Item/Item.cpp52
-rw-r--r--src/server/game/Entities/Item/Item.h4
-rw-r--r--src/server/game/Entities/Object/Object.cpp8
-rw-r--r--src/server/game/Entities/Object/Object.h4
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.cpp27
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.h19
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp34
-rw-r--r--src/server/game/Entities/Pet/Pet.h2
-rw-r--r--src/server/game/Entities/Player/Player.cpp135
-rw-r--r--src/server/game/Entities/Player/Player.h11
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp8
-rw-r--r--src/server/game/Entities/Transport/Transport.h8
-rw-r--r--src/server/game/Entities/Vehicle/Vehicle.cpp4
-rw-r--r--src/server/game/Entities/Vehicle/VehicleDefines.h3
-rw-r--r--src/server/game/Events/GameEventMgr.cpp24
-rw-r--r--src/server/game/Events/GameEventMgr.h10
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp284
-rw-r--r--src/server/game/Globals/ObjectMgr.h65
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.h8
-rw-r--r--src/server/game/Grids/ObjectGridLoader.cpp2
-rw-r--r--src/server/game/Groups/Group.cpp24
-rw-r--r--src/server/game/Groups/Group.h1
-rw-r--r--src/server/game/Groups/GroupMgr.cpp8
-rw-r--r--src/server/game/Groups/GroupMgr.h6
-rw-r--r--src/server/game/Guilds/Guild.cpp4
-rw-r--r--src/server/game/Guilds/GuildMgr.cpp20
-rw-r--r--src/server/game/Guilds/GuildMgr.h2
-rw-r--r--src/server/game/Handlers/BattleGroundHandler.cpp4
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp4
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp16
-rw-r--r--src/server/game/Handlers/GuildHandler.cpp4
-rw-r--r--src/server/game/Handlers/MailHandler.cpp12
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp2
-rw-r--r--src/server/game/Handlers/NPCHandler.cpp8
-rw-r--r--src/server/game/Handlers/PetHandler.cpp7
-rw-r--r--src/server/game/Handlers/PetitionsHandler.cpp72
-rw-r--r--src/server/game/Handlers/QuestHandler.cpp2
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp2
-rw-r--r--src/server/game/Handlers/TicketHandler.cpp2
-rw-r--r--src/server/game/Loot/LootMgr.cpp6
-rw-r--r--src/server/game/Loot/LootMgr.h2
-rw-r--r--src/server/game/Mails/Mail.cpp31
-rw-r--r--src/server/game/Mails/Mail.h24
-rw-r--r--src/server/game/Maps/Map.cpp20
-rw-r--r--src/server/game/Maps/Map.h24
-rw-r--r--src/server/game/Maps/TransportMgr.cpp8
-rw-r--r--src/server/game/Maps/TransportMgr.h2
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvP.cpp14
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvP.h4
-rw-r--r--src/server/game/Pools/PoolMgr.cpp70
-rw-r--r--src/server/game/Pools/PoolMgr.h44
-rw-r--r--src/server/game/Scripting/MapScripts.cpp8
-rw-r--r--src/server/game/Spells/SpellEffects.cpp18
-rw-r--r--src/server/game/Tools/PlayerDump.cpp55
-rw-r--r--src/server/scripts/Commands/cs_character.cpp8
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp18
-rw-r--r--src/server/scripts/Commands/cs_go.cpp4
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp19
-rw-r--r--src/server/scripts/Commands/cs_group.cpp2
-rw-r--r--src/server/scripts/Commands/cs_guild.cpp14
-rw-r--r--src/server/scripts/Commands/cs_list.cpp22
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp8
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp46
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp2
-rw-r--r--src/server/scripts/Commands/cs_send.cpp6
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp40
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp4
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp12
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp33
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_dalaran.cpp2
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp4
-rw-r--r--src/server/scripts/World/action_ip_logger.cpp9
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp2
106 files changed, 899 insertions, 985 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 2eca1c961dc..6fea7a7acc2 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -909,7 +909,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
InstanceScript* instance = obj->GetInstanceScript();
if (!instance)
{
- TC_LOG_ERROR("sql.sql", "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
+ TC_LOG_ERROR("sql.sql", "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid " SI64FMTD "", e.GetEventType(), e.entryOrGuid);
break;
}
@@ -930,7 +930,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
InstanceScript* instance = obj->GetInstanceScript();
if (!instance)
{
- TC_LOG_ERROR("sql.sql", "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
+ TC_LOG_ERROR("sql.sql", "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid " SI64FMTD "", e.GetEventType(), e.entryOrGuid);
break;
}
@@ -1614,7 +1614,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (e.GetTargetType() == SMART_TARGET_NONE)
{
- TC_LOG_ERROR("sql.sql", "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartScript: Entry " SI64FMTD " SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@@ -1749,7 +1749,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 id = temp[urand(0, count - 1)];
if (e.GetTargetType() == SMART_TARGET_NONE)
{
- TC_LOG_ERROR("sql.sql", "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartScript: Entry " SI64FMTD " SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@@ -1779,7 +1779,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 id = urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2);
if (e.GetTargetType() == SMART_TARGET_NONE)
{
- TC_LOG_ERROR("sql.sql", "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartScript: Entry " SI64FMTD " SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@@ -2258,7 +2258,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
}
default:
- TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry " SI64FMTD " SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;
}
@@ -2268,7 +2268,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (linked)
ProcessEvent(linked, unit, var0, var1, bvar, spell, gob);
else
- TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Link Event %u not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link);
+ TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry " SI64FMTD " SourceType %u, Event %u, Link Event %u not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link);
}
}
@@ -2289,7 +2289,7 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e)
return;
if (mTemplate)
{
- TC_LOG_ERROR("sql.sql", "SmartScript::InstallTemplate: Entry %d SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType());
+ TC_LOG_ERROR("sql.sql", "SmartScript::InstallTemplate: Entry " SI64FMTD " SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType());
return;
}
mTemplate = (SMARTAI_TEMPLATE)e.action.installTtemplate.id;
@@ -3603,7 +3603,7 @@ void SmartScript::SetScript9(SmartScriptHolder& e, uint32 entry)
// any SmartScriptHolder contained like the "e" parameter passed to this function
if (isProcessingTimedActionList)
{
- TC_LOG_ERROR("scripts.ai", "Entry %d SourceType %u Event %u Action %u is trying to overwrite timed action list from a timed action, this is not allowed!.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
+ TC_LOG_ERROR("scripts.ai", "Entry " SI64FMTD " SourceType %u Event %u Action %u is trying to overwrite timed action list from a timed action, this is not allowed!.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
return;
}
diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h
index 02e91af032b..c98680c4ede 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -118,7 +118,7 @@ class SmartScript
smart = false;
if (!smart)
- TC_LOG_ERROR("sql.sql", "SmartScript: Action target Creature (GUID: %u Entry: %u) is not using SmartAI, action called by Creature (GUID: %u Entry: %u) skipped to prevent crash.", c ? c->GetDBTableGUIDLow() : 0, c ? c->GetEntry() : 0, me ? me->GetDBTableGUIDLow() : 0, me ? me->GetEntry() : 0);
+ TC_LOG_ERROR("sql.sql", "SmartScript: Action target Creature (GUID: " UI64FMTD " Entry: %u) is not using SmartAI, action called by Creature (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(c ? c->GetDBTableGUIDLow() : UI64LIT(0)), c ? c->GetEntry() : 0, uint64(me ? me->GetDBTableGUIDLow() : UI64LIT(0)), me ? me->GetEntry() : 0);
return smart;
}
@@ -132,7 +132,7 @@ class SmartScript
if (!go || go->GetAIName() != "SmartGameObjectAI")
smart = false;
if (!smart)
- TC_LOG_ERROR("sql.sql", "SmartScript: Action target GameObject (GUID: %u Entry: %u) is not using SmartGameObjectAI, action called by GameObject (GUID: %u Entry: %u) skipped to prevent crash.", g ? g->GetDBTableGUIDLow() : 0, g ? g->GetEntry() : 0, go ? go->GetDBTableGUIDLow() : 0, go ? go->GetEntry() : 0);
+ TC_LOG_ERROR("sql.sql", "SmartScript: Action target GameObject (GUID: " UI64FMTD " Entry: %u) is not using SmartGameObjectAI, action called by GameObject (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(g ? g->GetDBTableGUIDLow() : UI64LIT(0)), g ? g->GetEntry() : 0, uint64(go ? go->GetDBTableGUIDLow() : UI64LIT(0)), go ? go->GetEntry() : 0);
return smart;
}
@@ -145,7 +145,7 @@ class SmartScript
return NULL;
}
- GameObject* FindGameObjectNear(WorldObject* searchObject, uint32 guid) const
+ GameObject* FindGameObjectNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
{
GameObject* gameObject = NULL;
@@ -161,7 +161,7 @@ class SmartScript
return gameObject;
}
- Creature* FindCreatureNear(WorldObject* searchObject, uint32 guid) const
+ Creature* FindCreatureNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
{
Creature* creature = NULL;
CellCoord p(Trinity::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY()));
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 0b2fdfc6bee..28a14c7d5b0 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -130,7 +130,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
SmartScriptHolder temp;
- temp.entryOrGuid = fields[0].GetInt32();
+ temp.entryOrGuid = fields[0].GetInt64();
SmartScriptType source_type = (SmartScriptType)fields[1].GetUInt8();
if (source_type >= SMART_SCRIPT_TYPE_MAX)
{
@@ -191,23 +191,23 @@ void SmartAIMgr::LoadSmartAIFromDB()
}
else
{
- CreatureData const* creature = sObjectMgr->GetCreatureData(uint32(std::abs(temp.entryOrGuid)));
+ CreatureData const* creature = sObjectMgr->GetCreatureData(uint64(-temp.entryOrGuid));
if (!creature)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(std::abs(temp.entryOrGuid)));
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature guid (" SI64FMTD ") does not exist, skipped loading.", -temp.entryOrGuid);
continue;
}
CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creature->id);
if (!creatureInfo)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) guid (%u) does not exist, skipped loading.", creature->id, uint32(std::abs(temp.entryOrGuid)));
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) guid (" SI64FMTD ") does not exist, skipped loading.", creature->id, -temp.entryOrGuid);
continue;
}
if (creatureInfo->AIName != "SmartAI")
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) guid (%u) is not using SmartAI, skipped loading.", creature->id, uint32(std::abs(temp.entryOrGuid)));
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) guid (" SI64FMTD ") is not using SmartAI, skipped loading.", creature->id, -temp.entryOrGuid);
continue;
}
}
@@ -273,7 +273,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!FindLinkedEvent(itr->second, e.link))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Entry %d SourceType %u, Event %u, Link Event %u not found or invalid.",
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Entry " SI64FMTD " SourceType %u, Event %u, Link Event %u not found or invalid.",
e.entryOrGuid, e.GetScriptType(), e.event_id, e.link);
}
}
@@ -282,7 +282,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!FindLinkedSourceEvent(itr->second, e.event_id))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Entry %d SourceType %u, Event %u, Link Source Event not found or invalid. Event will never trigger.",
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Entry " SI64FMTD " SourceType %u, Event %u, Link Source Event not found or invalid. Event will never trigger.",
e.entryOrGuid, e.GetScriptType(), e.event_id);
}
}
@@ -311,7 +311,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
return false;
}
break;
@@ -321,7 +321,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
return false;
}
break;
@@ -343,7 +343,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.playerDistance.dist == 0)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
break;
@@ -369,7 +369,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
case SMART_TARGET_STORED:
break;
default:
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled target_type(%u), Entry " SI64FMTD " SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
return true;
@@ -379,38 +379,38 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.event.type >= SMART_EVENT_END)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid " SI64FMTD " using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
return false;
}
// in SMART_SCRIPT_TYPE_TIMED_ACTIONLIST all event types are overriden by core
if (e.GetScriptType() != SMART_SCRIPT_TYPE_TIMED_ACTIONLIST && !(SmartAIEventMask[e.event.type][1] & SmartAITypeMask[e.GetScriptType()][1]))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid " SI64FMTD ", event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());
return false;
}
if (e.action.type <= 0 || e.action.type >= SMART_ACTION_END)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid " SI64FMTD " using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
return false;
}
if (e.event.event_phase_mask > SMART_EVENT_PHASE_ALL)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid " SI64FMTD " using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
return false;
}
if (e.event.event_flags > SMART_EVENT_FLAGS_ALL)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid " SI64FMTD " using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags);
return false;
}
if (e.link && e.link == e.event_id)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d SourceType %u, Event %u, Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid " SI64FMTD " SourceType %u, Event %u, Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
return false;
}
@@ -451,12 +451,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.event.spellHit.spell);
if (!spellInfo)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
return false;
}
if (e.event.spellHit.school && (e.event.spellHit.school & spellInfo->SchoolMask) != spellInfo->SchoolMask)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
return false;
}
}
@@ -471,12 +471,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_RESPAWN:
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);
return false;
}
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_AREA && !GetAreaEntryByAreaID(e.event.respawn.area))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);
return false;
}
break;
@@ -513,7 +513,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_VICTIM_CASTING:
if (e.event.targetCasting.spellId > 0 && !sSpellMgr->GetSpellInfo(e.event.targetCasting.spellId))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
return false;
}
@@ -567,7 +567,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.event.movementInform.type > NULL_MOTION_TYPE)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
return false;
}
break;
@@ -615,7 +615,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.event.doAction.eventId > EVENT_CHARGE)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
return false;
}
break;
@@ -626,7 +626,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (e.event.friendlyHealthPct.maxHpPct > 100 || e.event.friendlyHealthPct.minHpPct > 100)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has pct value above 100, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u has pct value above 100, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
@@ -641,7 +641,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_TARGET_PLAYER_DISTANCE:
break;
default:
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid target_type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses invalid target_type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType());
return false;
}
break;
@@ -731,7 +731,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_ON_SPELLCLICK:
break;
default:
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled event_type(%u), Entry " SI64FMTD " SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
}
@@ -746,7 +746,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SET_FACTION:
if (e.action.faction.factionID && !sFactionTemplateStore.LookupEntry(e.action.faction.factionID))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID);
return false;
}
break;
@@ -756,7 +756,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.morphOrMount.creature > 0 && !sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature);
return false;
}
@@ -764,12 +764,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.morphOrMount.creature)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
else if (!sCreatureDisplayInfoStore.LookupEntry(e.action.morphOrMount.model))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model);
return false;
}
}
@@ -793,7 +793,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!sTaxiPathStore.LookupEntry(e.action.taxi.id))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id);
return false;
}
break;
@@ -828,7 +828,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT) || spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT2))
{
if (spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_CASTER)
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Effect: SPELL_EFFECT_KILL_CREDIT: (SpellId: %u targetA: %u - targetB: %u) has invalid target for this Action",
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u Effect: SPELL_EFFECT_KILL_CREDIT: (SpellId: %u targetA: %u - targetB: %u) has invalid target for this Action",
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.cast.spell, spellInfo->Effects[j].TargetA.GetTarget(), spellInfo->Effects[j].TargetB.GetTarget());
}
}
@@ -845,32 +845,32 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!qid->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
return false;
}
}
else
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
return false;
}
break;
case SMART_ACTION_SET_EVENT_PHASE:
if (e.action.setEventPhase.phase >= SMART_EVENT_PHASE_MAX)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX-1);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX - 1);
return false;
}
break;
case SMART_ACTION_INC_EVENT_PHASE:
if (!e.action.incEventPhase.inc && !e.action.incEventPhase.dec)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
else if (e.action.incEventPhase.inc > SMART_EVENT_PHASE_MAX || e.action.incEventPhase.dec > SMART_EVENT_PHASE_MAX)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
break;
@@ -887,7 +887,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
e.action.randomPhase.phase5 >= SMART_EVENT_PHASE_MAX ||
e.action.randomPhase.phase6 >= SMART_EVENT_PHASE_MAX)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
}
@@ -897,7 +897,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (e.action.randomPhaseRange.phaseMin >= SMART_EVENT_PHASE_MAX ||
e.action.randomPhaseRange.phaseMax >= SMART_EVENT_PHASE_MAX)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
@@ -912,12 +912,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
CacheSpellContainerBounds sBounds = GetSummonCreatureSpellContainerBounds(e.action.summonCreature.creature);
for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr)
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u creature summon: There is a summon spell for creature entry %u (SpellId: %u, effect: %u)",
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u creature summon: There is a summon spell for creature entry %u (SpellId: %u, effect: %u)",
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.creature, itr->second.first, itr->second.second);
if (e.action.summonCreature.type < TEMPSUMMON_TIMED_OR_DEAD_DESPAWN || e.action.summonCreature.type > TEMPSUMMON_MANUAL_DESPAWN)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
return false;
}
break;
@@ -929,12 +929,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
CacheSpellContainerBounds sBounds = GetKillCreditSpellContainerBounds(e.action.killedMonster.creature);
for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr)
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Kill Credit: There is a killcredit spell for creatureEntry %u (SpellId: %u effect: %u)",
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u Kill Credit: There is a killcredit spell for creatureEntry %u (SpellId: %u effect: %u)",
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.killedMonster.creature, itr->second.first, itr->second.second);
if (e.GetTargetType() == SMART_TARGET_POSITION)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TargetType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses incorrect TargetType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType());
return false;
}
break;
@@ -946,7 +946,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SET_SHEATH:
if (e.action.setSheath.sheath && e.action.setSheath.sheath >= MAX_SHEATH_STATE)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath);
return false;
}
break;
@@ -954,7 +954,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.react.state > REACT_AGGRESSIVE)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature " SI64FMTD " Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state);
return false;
}
break;
@@ -966,7 +966,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
CacheSpellContainerBounds sBounds = GetSummonGameObjectSpellContainerBounds(e.action.summonGO.entry);
for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr)
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u gameobject summon: There is a summon spell for gameobject entry %u (SpellId: %u, effect: %u)",
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u gameobject summon: There is a summon spell for gameobject entry %u (SpellId: %u, effect: %u)",
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonGO.entry, itr->second.first, itr->second.second);
break;
}
@@ -987,21 +987,21 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
CacheSpellContainerBounds sBounds = GetCreateItemSpellContainerBounds(e.action.item.entry);
for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr)
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Create Item: There is a create item spell for item %u (SpellId: %u effect: %u)",
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u Create Item: There is a create item spell for item %u (SpellId: %u effect: %u)",
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.item.entry, itr->second.first, itr->second.second);
break;
}
case SMART_ACTION_TELEPORT:
if (!sMapStore.LookupEntry(e.action.teleport.mapID))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID);
return false;
}
break;
case SMART_ACTION_INSTALL_AI_TEMPLATE:
if (e.action.installTtemplate.id >= SMARTAI_TEMPLATE_END)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature " SI64FMTD " Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id);
return false;
}
break;
@@ -1013,14 +1013,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature " SI64FMTD " Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
return false;
}
if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest))
return false;
if (e.action.wpStart.reactState > REACT_AGGRESSIVE)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature " SI64FMTD " Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
return false;
}
break;
@@ -1045,7 +1045,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_REMOVE_POWER:
if (e.action.power.powerType > MAX_POWERS)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType);
return false;
}
break;
@@ -1056,14 +1056,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
if (eventId < 1 || eventId >= events.size())
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
return false;
}
GameEventData const& eventData = events[eventId];
if (!eventData.isValid())
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
return false;
}
break;
@@ -1075,14 +1075,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
if (eventId < 1 || eventId >= events.size())
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
return false;
}
GameEventData const& eventData = events[eventId];
if (!eventData.isValid())
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
return false;
}
break;
@@ -1098,7 +1098,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(e.entryOrGuid, equipId);
if (!einfo)
{
- TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u, skipped.", equipId, e.entryOrGuid);
+ TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature " SI64FMTD ", skipped.", equipId, e.entryOrGuid);
return false;
}
}
@@ -1112,14 +1112,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (apply != 0 && apply != 1)
{
- TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INGAME_PHASE_ID uses invalid apply value %u (Should be 0 or 1) for creature %u, skipped", apply, e.entryOrGuid);
+ TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INGAME_PHASE_ID uses invalid apply value %u (Should be 0 or 1) for creature " SI64FMTD ", skipped", apply, e.entryOrGuid);
return false;
}
PhaseEntry const* phase = sPhaseStore.LookupEntry(phaseId);
if (!phase)
{
- TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INGAME_PHASE_ID uses invalid phaseid %u for creature %u, skipped", phaseId, e.entryOrGuid);
+ TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INGAME_PHASE_ID uses invalid phaseid %u for creature " SI64FMTD ", skipped", phaseId, e.entryOrGuid);
return false;
}
break;
@@ -1131,14 +1131,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (apply != 0 && apply != 1)
{
- TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INGAME_PHASE_GROUP uses invalid apply value %u (Should be 0 or 1) for creature %u, skipped", apply, e.entryOrGuid);
+ TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INGAME_PHASE_GROUP uses invalid apply value %u (Should be 0 or 1) for creature " SI64FMTD ", skipped", apply, e.entryOrGuid);
return false;
}
PhaseGroupEntry const* phase = sPhaseGroupStore.LookupEntry(phaseGroup);
if (!phase)
{
- TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INGAME_PHASE_GROUP uses invalid phase group id %u for creature %u, skipped", phaseGroup, e.entryOrGuid);
+ TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INGAME_PHASE_GROUP uses invalid phase group id %u for creature " SI64FMTD ", skipped", phaseGroup, e.entryOrGuid);
return false;
}
break;
@@ -1212,7 +1212,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SUMMON_CREATURE_GROUP:
break;
default:
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry " SI64FMTD " SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
return false;
}
@@ -1241,11 +1241,11 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
default:
if (e.entryOrGuid < 0)
{
- entry = uint32(std::abs(e.entryOrGuid));
+ uint64 entry = uint64(-e.entryOrGuid);
CreatureData const* data = sObjectMgr->GetCreatureData(entry);
if (!data)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u using non-existent Creature guid " UI64FMTD ", skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
else
@@ -1259,7 +1259,7 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
if (!entry || !sCreatureTextMgr->TextExist(entry, uint8(id)))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), id);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD "SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), id);
return false;
}
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index a567a4be35e..a6409e833a2 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -1337,7 +1337,7 @@ struct SmartScriptHolder
, event_id(0), link(0), event(), action(), target(), timer(0), active(false), runOnce(false)
, enableTimed(false) { }
- int32 entryOrGuid;
+ int64 entryOrGuid;
SmartScriptType source_type;
uint32 event_id;
uint32 link;
@@ -1445,7 +1445,7 @@ class SmartWaypointMgr
typedef std::vector<SmartScriptHolder> SmartAIEventList;
// all events for all entries / guids
-typedef std::unordered_map<int32, SmartAIEventList> SmartAIEventMap;
+typedef std::unordered_map<int64, SmartAIEventList> SmartAIEventMap;
// Helper Stores
typedef std::map<uint32 /*entry*/, std::pair<uint32 /*spellId*/, SpellEffIndex /*effIndex*/> > CacheSpellContainer;
@@ -1514,7 +1514,7 @@ class SmartAIMgr
{
if (max < min)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
return false;
}
return true;
@@ -1534,7 +1534,7 @@ class SmartAIMgr
{
if (!data)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
return true;
@@ -1544,7 +1544,7 @@ class SmartAIMgr
{
if (!sObjectMgr->GetCreatureTemplate(entry))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1554,7 +1554,7 @@ class SmartAIMgr
{
if (!sObjectMgr->GetQuestTemplate(entry))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1564,7 +1564,7 @@ class SmartAIMgr
{
if (!sObjectMgr->GetGameObjectTemplate(entry))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1574,7 +1574,7 @@ class SmartAIMgr
{
if (!sSpellMgr->GetSpellInfo(entry))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1584,7 +1584,7 @@ class SmartAIMgr
{
if (!sItemStore.LookupEntry(entry))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1594,7 +1594,7 @@ class SmartAIMgr
{
if (!sEmotesTextStore.LookupEntry(entry))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1604,7 +1604,7 @@ class SmartAIMgr
{
if (!sEmotesStore.LookupEntry(entry))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1614,7 +1614,7 @@ class SmartAIMgr
{
if (!sAreaTriggerStore.LookupEntry(entry))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1624,7 +1624,7 @@ class SmartAIMgr
{
if (!sSoundEntriesStore.LookupEntry(entry))
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 26ccd9a508a..96de99bc4d9 100644
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -1981,7 +1981,7 @@ void AchievementMgr<Player>::CompletedAchievement(AchievementEntry const* achiev
draft.AddItem(item);
}
- draft.SendMailTo(trans, GetOwner(), MailSender(MAIL_CREATURE, reward->sender));
+ draft.SendMailTo(trans, GetOwner(), MailSender(MAIL_CREATURE, uint64(reward->sender)));
CharacterDatabase.CommitTransaction(trans);
}
}
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 45faad35a15..8a96a571c00 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -132,8 +132,8 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
// set owner to bidder (to prevent delete item with sender char deleting)
// owner in `data` will set at mail receive and item extracting
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER);
- stmt->setUInt32(0, auction->bidder);
- stmt->setUInt32(1, pItem->GetGUID().GetCounter());
+ stmt->setUInt64(0, auction->bidder);
+ stmt->setUInt64(1, pItem->GetGUID().GetCounter());
trans->Append(stmt);
if (bidder)
@@ -291,13 +291,13 @@ void AuctionHouseMgr::LoadAuctionItems()
{
Field* fields = result->Fetch();
- uint32 item_guid = fields[11].GetUInt32();
+ ObjectGuid::LowType item_guid = fields[11].GetUInt64();
uint32 itemEntry = fields[12].GetUInt32();
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
if (!proto)
{
- TC_LOG_ERROR("misc", "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, itemEntry);
+ TC_LOG_ERROR("misc", "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: " UI64FMTD " id: #%u) in auction, skipped.", item_guid, itemEntry);
continue;
}
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index c2e52f159cf..3b95a08fa66 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -770,7 +770,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
}
Creature* creature = new Creature();
- if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, x, y, z, o))
+ if (!creature->Create(sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate(), map, PHASEMASK_NORMAL, entry, x, y, z, o))
{
TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: Can't create creature entry: %u", entry);
delete creature;
@@ -802,7 +802,7 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
// Create gameobject
GameObject* go = new GameObject;
- if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY))
+ if (!go->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY))
{
TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 81192ed7af4..825377cc2b9 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -825,7 +825,7 @@ void Battleground::EndBattleground(uint32 winner)
BattlegroundScoreMap::const_iterator score = PlayerScores.find(player->GetGUID());
stmt->setUInt32(0, battlegroundId);
- stmt->setUInt32(1, player->GetGUID().GetCounter());
+ stmt->setUInt64(1, player->GetGUID().GetCounter());
stmt->setUInt32(2, score->second->GetKillingBlows());
stmt->setUInt32(3, score->second->GetDeaths());
stmt->setUInt32(4, score->second->GetHonorableKills());
@@ -861,7 +861,7 @@ void Battleground::EndBattleground(uint32 winner)
if (!guildAwarded)
{
guildAwarded = true;
- if (uint32 guildId = GetBgMap()->GetOwnerGuildId(player->GetBGTeam()))
+ if (ObjectGuid::LowType guildId = GetBgMap()->GetOwnerGuildId(player->GetBGTeam()))
{
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
guild->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1, 0, 0, NULL, player);
@@ -1420,7 +1420,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
// and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created
// So we must create it specific for this instance
GameObject* go = new GameObject;
- if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, GetBgMap(),
+ if (!go->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), entry, GetBgMap(),
PHASEMASK_NORMAL, x, y, z, o, rotation0, rotation1, rotation2, rotation3, 100, goState))
{
TC_LOG_ERROR("bg.battleground", "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
@@ -1564,7 +1564,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y,
Creature* creature = new Creature();
- if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, x, y, z, o))
+ if (!creature->Create(sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate(), map, PHASEMASK_NORMAL, entry, x, y, z, o))
{
TC_LOG_ERROR("bg.battleground", "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index e2c1c931b18..af25870ff44 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -652,7 +652,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original
bg->SetRandomTypeID(bgTypeId);
bg->SetRated(isRated);
bg->SetRandom(isRandom);
- bg->SetGuid(ObjectGuid(HIGHGUID_BATTLEGROUND, uint32(bgTypeId)));
+ bg->SetGuid(ObjectGuid(HIGHGUID_BATTLEGROUND, uint64(bgTypeId)));
// Set up correct min/max player counts for scoreboards
if (bg->isArena())
@@ -755,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(ObjectGuid(HIGHGUID_BATTLEGROUND, uint32(bgTemplate->Id)));
+ bg->SetGuid(ObjectGuid(HIGHGUID_BATTLEGROUND, uint64(bgTemplate->Id)));
AddBattleground(bg);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index 3b38a7c6c74..05d0fef1fdd 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -351,8 +351,8 @@ bool BattlegroundIC::SetupBattleground()
return false;
}
- gunshipHorde = sTransportMgr->CreateTransport(GO_HORDE_GUNSHIP, 0, GetBgMap());
- gunshipAlliance = sTransportMgr->CreateTransport(GO_ALLIANCE_GUNSHIP, 0, GetBgMap());
+ gunshipHorde = sTransportMgr->CreateTransport(GO_HORDE_GUNSHIP, UI64LIT(0), GetBgMap());
+ gunshipAlliance = sTransportMgr->CreateTransport(GO_ALLIANCE_GUNSHIP, UI64LIT(0), GetBgMap());
if (!gunshipAlliance || !gunshipHorde)
{
diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp
index 0742f10f388..99b9fe0c60b 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();
- ObjectGuid creatorGUID = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
+ ObjectGuid creatorGUID = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt64());
std::string title = fields[2].GetString();
std::string description = fields[3].GetString();
CalendarEventType type = CalendarEventType(fields[4].GetUInt8());
@@ -66,7 +66,7 @@ void CalendarMgr::LoadFromDB()
uint32 eventTime = fields[6].GetUInt32();
uint32 flags = fields[7].GetUInt32();
uint32 timezoneTime = fields[8].GetUInt32();
- uint32 guildId = 0;
+ ObjectGuid::LowType guildId = UI64LIT(0);
if (flags & CALENDAR_FLAG_GUILD_EVENT || flags & CALENDAR_FLAG_WITHOUT_INVITES)
guildId = Player::GetGuildIdFromDB(creatorGUID);
@@ -91,8 +91,8 @@ void CalendarMgr::LoadFromDB()
uint64 inviteId = fields[0].GetUInt64();
uint64 eventId = fields[1].GetUInt64();
- ObjectGuid invitee = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32());
- ObjectGuid senderGUID = ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt32());
+ ObjectGuid invitee = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt64());
+ ObjectGuid senderGUID = ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt64());
CalendarInviteStatus status = CalendarInviteStatus(fields[4].GetUInt8());
uint32 statusTime = fields[5].GetUInt32();
CalendarModerationRank rank = CalendarModerationRank(fields[6].GetUInt8());
@@ -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, calendarEvent->GetCreatorGUID().GetCounter());
+ stmt->setUInt64(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, invite->GetInviteeGUID().GetCounter());
- stmt->setUInt32(3, invite->GetSenderGUID().GetCounter());
+ stmt->setUInt64(2, invite->GetInviteeGUID().GetCounter());
+ stmt->setUInt64(3, invite->GetSenderGUID().GetCounter());
stmt->setUInt8(4, invite->GetStatus());
stmt->setUInt32(5, uint32(invite->GetStatusTime()));
stmt->setUInt8(6, invite->GetRank());
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 5d895d718ba..bdd7e300700 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -943,7 +943,7 @@ GameObject* ChatHandler::GetNearbyGameObject()
return obj;
}
-GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry)
+GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(ObjectGuid::LowType lowguid, uint32 entry)
{
if (!m_session)
return NULL;
@@ -1097,7 +1097,7 @@ ObjectGuid ChatHandler::extractGuidFromLink(char* text)
}
case SPELL_LINK_CREATURE:
{
- uint32 lowguid = (uint32)atol(idS);
+ ObjectGuid::LowType lowguid = strtoull(idS, nullptr, 10);
if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid))
return ObjectGuid(HIGHGUID_UNIT, data->id, lowguid);
@@ -1106,7 +1106,7 @@ ObjectGuid ChatHandler::extractGuidFromLink(char* text)
}
case SPELL_LINK_GAMEOBJECT:
{
- uint32 lowguid = (uint32)atol(idS);
+ ObjectGuid::LowType lowguid = strtoull(idS, nullptr, 10);
if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid))
return ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, lowguid);
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index deae5d6e937..98c3bc3efbb 100644
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -120,7 +120,7 @@ class ChatHandler
std::string GetNameLink(Player* chr) const;
GameObject* GetNearbyGameObject();
- GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry);
+ GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(ObjectGuid::LowType lowguid, uint32 entry);
bool HasSentErrorMessage() const { return sentErrorMessage; }
void SetSentErrorMessage(bool val){ sentErrorMessage = val; }
static bool LoadCommandTable() { return load_command_table; }
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index d6507f6813c..aaf154a9bd7 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -743,7 +743,7 @@ ConditionList ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureId, uint
return cond;
}
-ConditionList ConditionMgr::GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType)
+ConditionList ConditionMgr::GetConditionsForSmartEvent(int64 entryOrGuid, uint32 eventId, uint32 sourceType)
{
ConditionList cond;
SmartEventConditionContainer::const_iterator itr = SmartEventConditionStore.find(std::make_pair(entryOrGuid, sourceType));
@@ -753,7 +753,7 @@ ConditionList ConditionMgr::GetConditionsForSmartEvent(int32 entryOrGuid, uint32
if (i != (*itr).second.end())
{
cond = (*i).second;
- TC_LOG_DEBUG("condition", "GetConditionsForSmartEvent: found conditions for Smart Event entry or guid %d event_id %u", entryOrGuid, eventId);
+ TC_LOG_DEBUG("condition", "GetConditionsForSmartEvent: found conditions for Smart Event entry or guid " SI64FMTD " event_id %u", entryOrGuid, eventId);
}
}
return cond;
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index 686b0945719..568def188c3 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -248,7 +248,7 @@ class ConditionMgr
bool CanHaveSourceIdSet(ConditionSourceType sourceType) const;
ConditionList GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry);
ConditionList GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId);
- ConditionList GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType);
+ ConditionList GetConditionsForSmartEvent(int64 entryOrGuid, uint32 eventId, uint32 sourceType);
ConditionList GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId);
ConditionList const* GetConditionsForPhaseDefinition(uint32 zone, uint32 entry);
ConditionList GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId);
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index d7fe139f507..be4e04b3b66 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -58,7 +58,7 @@ void LFGMgr::_LoadFromDB(Field* fields, ObjectGuid guid)
if (!guid.IsGroup())
return;
- SetLeader(guid, ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()));
+ SetLeader(guid, ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt64()));
uint32 dungeon = fields[17].GetUInt32();
uint8 state = fields[18].GetUInt8();
diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
index 599f486b949..71836fb5210 100644
--- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
+++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
@@ -55,7 +55,7 @@ void AreaTrigger::RemoveFromWorld()
}
}
-bool AreaTrigger::CreateAreaTrigger(uint32 guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos)
+bool AreaTrigger::CreateAreaTrigger(ObjectGuid::LowType guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos)
{
SetMap(caster->GetMap());
Relocate(pos);
diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.h b/src/server/game/Entities/AreaTrigger/AreaTrigger.h
index cbfa4405b0e..0405910fe22 100644
--- a/src/server/game/Entities/AreaTrigger/AreaTrigger.h
+++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.h
@@ -32,7 +32,7 @@ class AreaTrigger : public WorldObject, public GridObject<AreaTrigger>
void AddToWorld();
void RemoveFromWorld();
- bool CreateAreaTrigger(uint32 guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos);
+ bool CreateAreaTrigger(ObjectGuid::LowType guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos);
void Update(uint32 p_time);
void Remove();
uint32 GetSpellId() const { return GetUInt32Value(AREATRIGGER_SPELLID); }
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index 77399c5bbb9..052e91640a2 100644
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -61,14 +61,14 @@ void Corpse::RemoveFromWorld()
Object::RemoveFromWorld();
}
-bool Corpse::Create(uint32 guidlow, Map* map)
+bool Corpse::Create(ObjectGuid::LowType guidlow, Map* map)
{
SetMap(map);
Object::_Create(guidlow, 0, HIGHGUID_CORPSE);
return true;
}
-bool Corpse::Create(uint32 guidlow, Player* owner)
+bool Corpse::Create(ObjectGuid::LowType guidlow, Player* owner)
{
ASSERT(owner);
@@ -157,12 +157,11 @@ void Corpse::DeleteFromDB(SQLTransaction& trans)
trans->Append(stmt);
}
-bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
+bool Corpse::LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields)
{
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0
- uint32 ownerGuid = fields[16].GetUInt32();
float posX = fields[0].GetFloat();
float posY = fields[1].GetFloat();
float posZ = fields[2].GetFloat();
@@ -177,7 +176,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());
- SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid(HIGHGUID_PLAYER, ownerGuid));
+ SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid(HIGHGUID_PLAYER, fields[16].GetUInt64()));
m_time = time_t(fields[11].GetUInt32());
diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h
index 4b2e9321a73..c4296d76f60 100644
--- a/src/server/game/Entities/Corpse/Corpse.h
+++ b/src/server/game/Entities/Corpse/Corpse.h
@@ -55,11 +55,11 @@ class Corpse : public WorldObject, public GridObject<Corpse>
void AddToWorld() override;
void RemoveFromWorld() override;
- bool Create(uint32 guidlow, Map* map);
- bool Create(uint32 guidlow, Player* owner);
+ bool Create(ObjectGuid::LowType guidlow, Map* map);
+ bool Create(ObjectGuid::LowType guidlow, Player* owner);
void SaveToDB();
- bool LoadCorpseFromDB(uint32 guid, Field* fields);
+ bool LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields);
void DeleteBonesFromWorld();
void DeleteFromDB(SQLTransaction& trans);
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 8caa7d02d94..bea37cec080 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -145,7 +145,7 @@ Creature::Creature(bool isWorldObject): Unit(isWorldObject), MapObject(),
m_groupLootTimer(0), m_PlayerDamageReq(0),
_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_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(UI64LIT(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),
m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(NULL), m_creatureData(NULL), m_waypointID(0), m_path_id(0), m_formation(NULL)
{
@@ -221,7 +221,7 @@ void Creature::SearchFormation()
if (IsSummon())
return;
- uint32 lowguid = GetDBTableGUIDLow();
+ ObjectGuid::LowType lowguid = GetDBTableGUIDLow();
if (!lowguid)
return;
@@ -735,7 +735,7 @@ void Creature::Motion_Initialize()
GetMotionMaster()->Initialize();
}
-bool Creature::Create(uint32 guidlow, Map* map, uint32 /*phaseMask*/, uint32 entry, float x, float y, float z, float ang, CreatureData const* data /*= nullptr*/, uint32 vehId /*= 0*/)
+bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 /*phaseMask*/, uint32 entry, float x, float y, float z, float ang, CreatureData const* data /*= nullptr*/, uint32 vehId /*= 0*/)
{
ASSERT(map);
SetMap(map);
@@ -1014,13 +1014,13 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
SQLTransaction trans = WorldDatabase.BeginTransaction();
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
- stmt->setUInt32(0, m_DBTableGuid);
+ stmt->setUInt64(0, m_DBTableGuid);
trans->Append(stmt);
uint8 index = 0;
stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE);
- stmt->setUInt32(index++, m_DBTableGuid);
+ stmt->setUInt64(index++, m_DBTableGuid);
stmt->setUInt32(index++, GetEntry());
stmt->setUInt16(index++, uint16(mapid));
stmt->setUInt8(index++, spawnMask);
@@ -1174,7 +1174,7 @@ float Creature::GetSpellDamageMod(int32 Rank) const
}
}
-bool Creature::CreateFromProto(uint32 guidlow, uint32 entry, CreatureData const* data /*= nullptr*/, uint32 vehId /*= 0*/)
+bool Creature::CreateFromProto(ObjectGuid::LowType guidlow, uint32 entry, CreatureData const* data /*= nullptr*/, uint32 vehId /*= 0*/)
{
SetZoneScript();
if (GetZoneScript() && data)
@@ -1215,7 +1215,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 entry, CreatureData const*
return true;
}
-bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
+bool Creature::LoadCreatureFromDB(ObjectGuid::LowType guid, Map* map, bool addToMap)
{
CreatureData const* data = sObjectMgr->GetCreatureData(guid);
@@ -1232,7 +1232,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
return false;
}
else
- guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT);
+ guid = sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate();
if (!Create(guid, map, data->phaseMask, data->id, data->posX, data->posY, data->posZ, data->orientation, data))
return false;
@@ -1352,19 +1352,19 @@ void Creature::DeleteFromDB()
SQLTransaction trans = WorldDatabase.BeginTransaction();
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
- stmt->setUInt32(0, m_DBTableGuid);
+ stmt->setUInt64(0, m_DBTableGuid);
trans->Append(stmt);
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
- stmt->setUInt32(0, m_DBTableGuid);
+ stmt->setUInt64(0, m_DBTableGuid);
trans->Append(stmt);
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_CREATURE);
- stmt->setUInt32(0, m_DBTableGuid);
+ stmt->setUInt64(0, m_DBTableGuid);
trans->Append(stmt);
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP);
- stmt->setUInt32(0, m_DBTableGuid);
+ stmt->setUInt64(0, m_DBTableGuid);
trans->Append(stmt);
WorldDatabase.CommitTransaction(trans);
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index cca594451dc..3acd386c416 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -332,7 +332,8 @@ struct CreatureAddon
std::vector<uint32> auras;
};
-typedef std::unordered_map<uint32, CreatureAddon> CreatureAddonContainer;
+typedef std::unordered_map<ObjectGuid::LowType, CreatureAddon> CreatureAddonContainer;
+typedef std::unordered_map<uint32, CreatureAddon> CreatureTemplateAddonContainer;
// Vendors
struct VendorItem
@@ -444,12 +445,12 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
void DisappearAndDie();
- bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 entry, float x, float y, float z, float ang, CreatureData const* data = nullptr, uint32 vehId = 0);
+ bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 entry, float x, float y, float z, float ang, CreatureData const* data = nullptr, uint32 vehId = 0);
bool LoadCreaturesAddon(bool reload = false);
void SelectLevel();
void LoadEquipment(int8 id = 1, bool force = false);
- uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
+ ObjectGuid::LowType GetDBTableGUIDLow() const { return m_DBTableGuid; }
void Update(uint32 time) override; // overwrited Unit::Update
void GetRespawnPosition(float &x, float &y, float &z, float* ori = nullptr, float* dist =nullptr) const;
@@ -541,8 +542,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
void setDeathState(DeathState s) override; // override virtual Unit::setDeathState
- bool LoadFromDB(uint32 guid, Map* map) { return LoadCreatureFromDB(guid, map, false); }
- bool LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap = true);
+ bool LoadFromDB(ObjectGuid::LowType guid, Map* map) { return LoadCreatureFromDB(guid, map, false); }
+ bool LoadCreatureFromDB(ObjectGuid::LowType guid, Map* map, bool addToMap = true);
void SaveToDB();
// overriden in Pet
virtual void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
@@ -677,7 +678,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
void ReleaseFocus(Spell const* focusSpell);
protected:
- bool CreateFromProto(uint32 guidlow, uint32 entry, CreatureData const* data = nullptr, uint32 vehId = 0);
+ bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 entry, CreatureData const* data = nullptr, uint32 vehId = 0);
bool InitEntry(uint32 entry, CreatureData const* data = nullptr);
// vendor items
@@ -702,7 +703,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
void RegenerateHealth();
void Regenerate(Powers power);
MovementGeneratorType m_defaultMovementType;
- uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid
+ ObjectGuid::LowType m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid
uint8 m_equipmentId;
int8 m_originalEquipmentId; // can be -1
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index dc7315728a4..218ce30ab1b 100644
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -30,33 +30,33 @@ FormationMgr::~FormationMgr()
delete itr->second;
}
-void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member)
+void FormationMgr::AddCreatureToGroup(ObjectGuid::LowType leaderGuid, Creature* creature)
{
- Map* map = member->FindMap();
+ Map* map = creature->FindMap();
if (!map)
return;
- CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(groupId);
+ CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(leaderGuid);
//Add member to an existing group
if (itr != map->CreatureGroupHolder.end())
{
- TC_LOG_DEBUG("entities.unit", "Group found: %u, inserting %s, Group InstanceID %u", groupId, member->GetGUID().ToString().c_str(), member->GetInstanceId());
- itr->second->AddMember(member);
+ TC_LOG_DEBUG("entities.unit", "Group found: " UI64FMTD ", inserting %s, Group InstanceID %u", leaderGuid, creature->GetGUID().ToString().c_str(), creature->GetInstanceId());
+ itr->second->AddMember(creature);
}
//Create new group
else
{
- TC_LOG_DEBUG("entities.unit", "Group not found: %u. Creating new group.", groupId);
- CreatureGroup* group = new CreatureGroup(groupId);
- map->CreatureGroupHolder[groupId] = group;
- group->AddMember(member);
+ TC_LOG_DEBUG("entities.unit", "Group not found: " UI64FMTD ". Creating new group.", leaderGuid);
+ CreatureGroup* group = new CreatureGroup(leaderGuid);
+ map->CreatureGroupHolder[leaderGuid] = group;
+ group->AddMember(creature);
}
}
void FormationMgr::RemoveCreatureFromGroup(CreatureGroup* group, Creature* member)
{
- TC_LOG_DEBUG("entities.unit", "Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow());
+ TC_LOG_DEBUG("entities.unit", "Deleting member pointer to GUID: " UI64FMTD " from group %u", group->GetId(), member->GetDBTableGUIDLow());
group->RemoveMember(member);
if (group->isEmpty())
@@ -98,8 +98,8 @@ void FormationMgr::LoadCreatureFormations()
//Load group member data
group_member = new FormationInfo();
- group_member->leaderGUID = fields[0].GetUInt32();
- uint32 memberGUID = fields[1].GetUInt32();
+ group_member->leaderGUID = fields[0].GetUInt64();
+ ObjectGuid::LowType memberGUID = fields[1].GetUInt64();
group_member->groupAI = fields[4].GetUInt32();
group_member->point_1 = fields[5].GetUInt16();
group_member->point_2 = fields[6].GetUInt16();
@@ -119,14 +119,14 @@ void FormationMgr::LoadCreatureFormations()
{
if (!sObjectMgr->GetCreatureData(group_member->leaderGUID))
{
- TC_LOG_ERROR("sql.sql", "creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID);
+ TC_LOG_ERROR("sql.sql", "creature_formations table leader guid " UI64FMTD " incorrect (not exist)", group_member->leaderGUID);
delete group_member;
continue;
}
if (!sObjectMgr->GetCreatureData(memberGUID))
{
- TC_LOG_ERROR("sql.sql", "creature_formations table member guid %u incorrect (not exist)", memberGUID);
+ TC_LOG_ERROR("sql.sql", "creature_formations table member guid " UI64FMTD " incorrect (not exist)", memberGUID);
delete group_member;
continue;
}
diff --git a/src/server/game/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h
index f53de0d48f1..052dff8b898 100644
--- a/src/server/game/Entities/Creature/CreatureGroups.h
+++ b/src/server/game/Entities/Creature/CreatureGroups.h
@@ -28,7 +28,7 @@ class CreatureGroup;
struct FormationInfo
{
- uint32 leaderGUID;
+ ObjectGuid::LowType leaderGUID;
float follow_dist;
float follow_angle;
uint8 groupAI;
@@ -36,7 +36,7 @@ struct FormationInfo
uint16 point_2;
};
-typedef std::unordered_map<uint32/*memberDBGUID*/, FormationInfo*> CreatureGroupInfoType;
+typedef std::unordered_map<ObjectGuid::LowType/*memberDBGUID*/, FormationInfo*> CreatureGroupInfoType;
class FormationMgr
{
@@ -51,7 +51,7 @@ class FormationMgr
return &instance;
}
- void AddCreatureToGroup(uint32 group_id, Creature* creature);
+ void AddCreatureToGroup(ObjectGuid::LowType leaderGuid, Creature* creature);
void RemoveCreatureFromGroup(CreatureGroup* group, Creature* creature);
void LoadCreatureFormations();
CreatureGroupInfoType CreatureGroupMap;
@@ -64,16 +64,16 @@ class CreatureGroup
typedef std::map<Creature*, FormationInfo*> CreatureGroupMemberType;
CreatureGroupMemberType m_members;
- uint32 m_groupID;
+ ObjectGuid::LowType m_groupID;
bool m_Formed;
public:
//Group cannot be created empty
- explicit CreatureGroup(uint32 id) : m_leader(NULL), m_groupID(id), m_Formed(false) { }
+ explicit CreatureGroup(ObjectGuid::LowType id) : m_leader(NULL), m_groupID(id), m_Formed(false) { }
~CreatureGroup() { }
Creature* getLeader() const { return m_leader; }
- uint32 GetId() const { return m_groupID; }
+ ObjectGuid::LowType GetId() const { return m_groupID; }
bool isEmpty() const { return m_members.empty(); }
bool isFormed() const { return m_Formed; }
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
index 2a76bee793e..1d3ea42a4df 100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
@@ -80,7 +80,7 @@ void DynamicObject::RemoveFromWorld()
}
}
-bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type)
+bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type)
{
SetMap(caster->GetMap());
Relocate(pos);
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h
index 89d72bfe5a9..5430e626516 100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.h
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.h
@@ -41,7 +41,7 @@ class DynamicObject : public WorldObject, public GridObject<DynamicObject>, publ
void AddToWorld() override;
void RemoveFromWorld() override;
- bool CreateDynamicObject(uint32 guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type);
+ bool CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type);
void Update(uint32 p_time) override;
void Remove();
void SetDuration(int32 newDuration);
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index d179eb19c99..f5facec6ba4 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -54,7 +54,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(),
m_goInfo = NULL;
m_goData = NULL;
- m_DBTableGuid = 0;
+ m_DBTableGuid = UI64LIT(0);
m_rotation = 0;
m_groupLootTimer = 0;
@@ -162,7 +162,7 @@ void GameObject::RemoveFromWorld()
}
}
-bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 /*phaseMask*/, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit)
+bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, uint32 /*phaseMask*/, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit)
{
ASSERT(map);
SetMap(map);
@@ -798,11 +798,11 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
uint8 index = 0;
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT);
- stmt->setUInt32(0, m_DBTableGuid);
+ stmt->setUInt64(0, m_DBTableGuid);
trans->Append(stmt);
stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_GAMEOBJECT);
- stmt->setUInt32(index++, m_DBTableGuid);
+ stmt->setUInt64(index++, m_DBTableGuid);
stmt->setUInt32(index++, GetEntry());
stmt->setUInt16(index++, uint16(mapid));
stmt->setUInt8(index++, spawnMask);
@@ -823,7 +823,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
WorldDatabase.CommitTransaction(trans);
}
-bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
+bool GameObject::LoadGameObjectFromDB(ObjectGuid::LowType guid, Map* map, bool addToMap)
{
GameObjectData const* data = sObjectMgr->GetGOData(guid);
@@ -851,7 +851,8 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
uint32 artKit = data->artKit;
m_DBTableGuid = guid;
- if (map->GetInstanceId() != 0) guid = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
+ if (map->GetInstanceId() != 0)
+ guid = sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate();
if (!Create(guid, entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, artKit))
return false;
@@ -911,13 +912,13 @@ void GameObject::DeleteFromDB()
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT);
- stmt->setUInt32(0, m_DBTableGuid);
+ stmt->setUInt64(0, m_DBTableGuid);
WorldDatabase.Execute(stmt);
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_EVENT_GAMEOBJECT);
- stmt->setUInt32(0, m_DBTableGuid);
+ stmt->setUInt64(0, m_DBTableGuid);
WorldDatabase.Execute(stmt);
}
@@ -1172,7 +1173,7 @@ void GameObject::SetGoArtKit(uint8 kit)
data->artKit = kit;
}
-void GameObject::SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid)
+void GameObject::SetGoArtKit(uint8 artkit, GameObject* go, ObjectGuid::LowType lowguid)
{
const GameObjectData* data = NULL;
if (go)
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index b14d4049cb5..07df49485fc 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -655,7 +655,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
void RemoveFromWorld() override;
void CleanupsBeforeDelete(bool finalCleanup = true) override;
- bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit = 0);
+ bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit = 0);
void Update(uint32 p_time) override;
GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
GameObjectData const* GetGOData() const { return m_goData; }
@@ -665,7 +665,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
bool IsDynTransport() const;
bool IsDestructibleBuilding() const;
- uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
+ ObjectGuid::LowType GetDBTableGUIDLow() const { return m_DBTableGuid; }
void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f);
@@ -674,8 +674,8 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
void SaveToDB();
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
- bool LoadFromDB(uint32 guid, Map* map) { return LoadGameObjectFromDB(guid, map, false); }
- bool LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap = true);
+ bool LoadFromDB(ObjectGuid::LowType guid, Map* map) { return LoadGameObjectFromDB(guid, map, false); }
+ bool LoadGameObjectFromDB(ObjectGuid::LowType guid, Map* map, bool addToMap = true);
void DeleteFromDB();
void SetOwnerGUID(ObjectGuid owner)
@@ -737,7 +737,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
void SetGoArtKit(uint8 artkit);
uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
- static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0);
+ static void SetGoArtKit(uint8 artkit, GameObject* go, ObjectGuid::LowType lowguid = UI64LIT(0));
void SetInPhase(uint32 id, bool update, bool apply);
void EnableCollision(bool enable);
@@ -868,7 +868,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
typedef std::map<uint32, ObjectGuid> ChairSlotAndUser;
ChairSlotAndUser ChairListSlots;
- uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid
+ ObjectGuid::LowType m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid
GameObjectTemplate const* m_goInfo;
GameObjectData const* m_goData;
GameObjectValue m_goValue;
diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp
index 01db468c17b..b1b06da4cda 100644
--- a/src/server/game/Entities/Item/Container/Bag.cpp
+++ b/src/server/game/Entities/Item/Container/Bag.cpp
@@ -69,7 +69,7 @@ void Bag::RemoveFromWorld()
Item::RemoveFromWorld();
}
-bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
+bool Bag::Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner)
{
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemid);
diff --git a/src/server/game/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h
index 78182e15e57..09da4530478 100644
--- a/src/server/game/Entities/Item/Container/Bag.h
+++ b/src/server/game/Entities/Item/Container/Bag.h
@@ -35,7 +35,7 @@ class Bag : public Item
void AddToWorld() override;
void RemoveFromWorld() override;
- bool Create(uint32 guidlow, uint32 itemid, Player const* owner) override;
+ bool Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner) override;
void Clear();
void StoreItem(uint8 slot, Item* pItem, bool update);
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 354af413db0..5ec4b917208 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -259,7 +259,7 @@ Item::Item()
m_paidExtendedCost = 0;
}
-bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
+bool Item::Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner)
{
Object::_Create(guidlow, 0, HIGHGUID_ITEM);
@@ -329,9 +329,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, GetOwnerGUID().GetCounter());
- stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_CREATOR).GetCounter());
- stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_GIFTCREATOR).GetCounter());
+ stmt->setUInt64(++index, GetOwnerGUID().GetCounter());
+ stmt->setUInt64(++index, GetGuidValue(ITEM_FIELD_CREATOR).GetCounter());
+ stmt->setUInt64(++index, GetGuidValue(ITEM_FIELD_GIFTCREATOR).GetCounter());
stmt->setUInt32(++index, GetCount());
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURATION));
@@ -355,7 +355,7 @@ void Item::SaveToDB(SQLTransaction& trans)
stmt->setUInt16(++index, GetUInt32Value(ITEM_FIELD_DURABILITY));
stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME));
stmt->setString(++index, m_text);
- stmt->setUInt32(++index, GetGUID().GetCounter());
+ stmt->setUInt64(++index, GetGUID().GetCounter());
trans->Append(stmt);
@@ -371,7 +371,7 @@ void Item::SaveToDB(SQLTransaction& trans)
case ITEM_REMOVED:
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
- stmt->setUInt32(0, GetGUID().GetCounter());
+ stmt->setUInt64(0, GetGUID().GetCounter());
trans->Append(stmt);
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
@@ -423,8 +423,8 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi
SetOwnerGUID(owner_guid);
bool need_save = false; // need explicit save data at load fixes
- SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()));
- SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32()));
+ SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt64()));
+ SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt64()));
SetCount(fields[2].GetUInt32());
uint32 duration = fields[3].GetUInt32();
@@ -475,7 +475,7 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi
stmt->setUInt32(0, GetUInt32Value(ITEM_FIELD_DURATION));
stmt->setUInt32(1, GetUInt32Value(ITEM_FIELD_FLAGS));
stmt->setUInt32(2, GetUInt32Value(ITEM_FIELD_DURABILITY));
- stmt->setUInt32(3, guid);
+ stmt->setUInt64(3, guid);
CharacterDatabase.Execute(stmt);
}
@@ -483,10 +483,10 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi
}
/*static*/
-void Item::DeleteFromDB(SQLTransaction& trans, uint32 itemGuid)
+void Item::DeleteFromDB(SQLTransaction& trans, ObjectGuid::LowType itemGuid)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
- stmt->setUInt32(0, itemGuid);
+ stmt->setUInt64(0, itemGuid);
trans->Append(stmt);
}
@@ -1040,7 +1040,7 @@ Item* Item::CreateItem(uint32 itemEntry, uint32 count, Player const* player)
ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");
Item* item = NewItemOrBag(proto);
- if (item->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), itemEntry, player))
+ if (item->Create(sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->Generate(), itemEntry, player))
{
item->SetCount(count);
return item;
@@ -1102,12 +1102,12 @@ void Item::SaveRefundDataToDB()
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE);
- stmt->setUInt32(0, GetGUID().GetCounter());
+ stmt->setUInt64(0, GetGUID().GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_REFUND_INSTANCE);
- stmt->setUInt32(0, GetGUID().GetCounter());
- stmt->setUInt32(1, GetRefundRecipient().GetCounter());
+ stmt->setUInt64(0, GetGUID().GetCounter());
+ stmt->setUInt64(1, GetRefundRecipient().GetCounter());
stmt->setUInt32(2, GetPaidMoney());
stmt->setUInt16(3, uint16(GetPaidExtendedCost()));
trans->Append(stmt);
@@ -1120,7 +1120,7 @@ void Item::DeleteRefundDataFromDB(SQLTransaction* trans)
if (trans)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE);
- stmt->setUInt32(0, GetGUID().GetCounter());
+ stmt->setUInt64(0, GetGUID().GetCounter());
(*trans)->Append(stmt);
}
@@ -1199,7 +1199,7 @@ void Item::ClearSoulboundTradeable(Player* currentOwner)
allowedGUIDs.clear();
SetState(ITEM_CHANGED, currentOwner);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_BOP_TRADE);
- stmt->setUInt32(0, GetGUID().GetCounter());
+ stmt->setUInt64(0, GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -1528,11 +1528,11 @@ void Item::ItemContainerSaveLootToDB()
if (loot.gold > 0)
{
PreparedStatement* stmt_money = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY);
- stmt_money->setUInt32(0, loot.containerID.GetCounter());
+ stmt_money->setUInt64(0, loot.containerID.GetCounter());
trans->Append(stmt_money);
stmt_money = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_MONEY);
- stmt_money->setUInt32(0, loot.containerID.GetCounter());
+ stmt_money->setUInt64(0, loot.containerID.GetCounter());
stmt_money->setUInt32(1, loot.gold);
trans->Append(stmt_money);
}
@@ -1541,7 +1541,7 @@ void Item::ItemContainerSaveLootToDB()
if (!loot.isLooted())
{
PreparedStatement* stmt_items = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEMS);
- stmt_items->setUInt32(0, loot.containerID.GetCounter());
+ stmt_items->setUInt64(0, loot.containerID.GetCounter());
trans->Append(stmt_items);
// Now insert the items
@@ -1563,7 +1563,7 @@ void Item::ItemContainerSaveLootToDB()
stmt_items = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_ITEMS);
// container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix
- stmt_items->setUInt32(0, loot.containerID.GetCounter());
+ stmt_items->setUInt64(0, loot.containerID.GetCounter());
stmt_items->setUInt32(1, _li->itemid);
stmt_items->setUInt32(2, _li->count);
stmt_items->setBool(3, _li->follow_loot_rules);
@@ -1592,7 +1592,7 @@ bool Item::ItemContainerLoadLootFromDB()
// First, see if there was any money loot. This gets added directly to the container.
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEMCONTAINER_MONEY);
- stmt->setUInt32(0, loot.containerID.GetCounter());
+ stmt->setUInt64(0, loot.containerID.GetCounter());
PreparedQueryResult money_result = CharacterDatabase.Query(stmt);
if (money_result)
@@ -1603,7 +1603,7 @@ bool Item::ItemContainerLoadLootFromDB()
// Next, load any items that were saved
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEMCONTAINER_ITEMS);
- stmt->setUInt32(0, loot.containerID.GetCounter());
+ stmt->setUInt64(0, loot.containerID.GetCounter());
PreparedQueryResult item_result = CharacterDatabase.Query(stmt);
if (item_result)
@@ -1662,7 +1662,7 @@ void Item::ItemContainerDeleteLootItemsFromDB()
{
// Deletes items associated with an openable item from the DB
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEMS);
- stmt->setUInt32(0, GetGUID().GetCounter());
+ stmt->setUInt64(0, GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -1670,7 +1670,7 @@ void Item::ItemContainerDeleteLootItemFromDB(uint32 itemID)
{
// Deletes a single item associated with an openable item from the DB
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEM);
- stmt->setUInt32(0, GetGUID().GetCounter());
+ stmt->setUInt64(0, GetGUID().GetCounter());
stmt->setUInt32(1, itemID);
CharacterDatabase.Execute(stmt);
}
@@ -1679,7 +1679,7 @@ void Item::ItemContainerDeleteLootMoneyFromDB()
{
// Deletes the money loot associated with an openable item from the DB
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY);
- stmt->setUInt32(0, GetGUID().GetCounter());
+ stmt->setUInt64(0, GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
}
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index 3abfb6acffa..d7d40b53f97 100644
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -220,7 +220,7 @@ class Item : public Object
Item();
- virtual bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
+ virtual bool Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const* owner);
ItemTemplate const* GetTemplate() const;
@@ -236,7 +236,7 @@ class Item : public Object
bool IsBoundByEnchant() const;
virtual void SaveToDB(SQLTransaction& trans);
virtual bool LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fields, uint32 entry);
- static void DeleteFromDB(SQLTransaction& trans, uint32 itemGuid);
+ static void DeleteFromDB(SQLTransaction& trans, ObjectGuid::LowType itemGuid);
virtual void DeleteFromDB(SQLTransaction& trans);
static void DeleteFromInventoryDB(SQLTransaction& trans, ObjectGuid::LowType itemGuid);
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 669ec512afd..8f58ea156f2 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -114,7 +114,7 @@ void Object::_InitValues()
m_objectUpdated = false;
}
-void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
+void Object::_Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
{
if (!m_uint32Values) _InitValues();
@@ -1353,7 +1353,7 @@ void WorldObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
transport->RemovePassenger(this);
}
-void WorldObject::_Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask)
+void WorldObject::_Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
{
Object::_Create(guidlow, 0, guidhigh);
m_phaseMask = phaseMask;
@@ -2222,7 +2222,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
break;
}
- if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), this, 0, entry, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), nullptr, vehId))
+ if (!summon->Create(sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate(), this, 0, entry, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), nullptr, vehId))
{
delete summon;
return NULL;
@@ -2320,7 +2320,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
Map* map = GetMap();
GameObject* go = new GameObject();
- if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, GetPhaseMask(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY))
+ if (!go->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), entry, map, GetPhaseMask(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY))
{
delete go;
return NULL;
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index f7e8a7a6447..95d85b2afce 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -205,7 +205,7 @@ class Object
Object();
void _InitValues();
- void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh);
+ void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh);
std::string _ConcatFields(uint16 startIndex, uint16 size) const;
void _LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count);
@@ -578,7 +578,7 @@ class WorldObject : public Object, public WorldLocation
virtual void Update (uint32 /*time_diff*/) { }
- void _Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask);
+ void _Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask);
virtual void RemoveFromWorld() override;
void GetNearPoint2D(float &x, float &y, float distance, float absAngle) const;
diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp
index 9f40b914c58..81023e72070 100644
--- a/src/server/game/Entities/Object/ObjectGuid.cpp
+++ b/src/server/game/Entities/Object/ObjectGuid.cpp
@@ -91,7 +91,7 @@ void PackedGuid::Set(ObjectGuid guid)
}
template<HighGuid high>
-uint64 ObjectGuidGenerator<high>::Generate()
+ObjectGuid::LowType ObjectGuidGenerator<high>::Generate()
{
if (_nextGuid >= ObjectGuid::GetMaxCounter(high) - 1)
{
@@ -136,17 +136,14 @@ std::ostream& operator<<(std::ostream& stream, ObjectGuid const& guid)
return stream;
}
-template uint64 ObjectGuidGenerator<HIGHGUID_ITEM>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_PLAYER>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_GAMEOBJECT>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_TRANSPORT>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_UNIT>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_PET>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_VEHICLE>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_DYNAMICOBJECT>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_CORPSE>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_AREATRIGGER>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_BATTLEGROUND>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_INSTANCE>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_GROUP>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_GUILD>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_PLAYER>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_UNIT>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_PET>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_VEHICLE>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_ITEM>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_PET>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_GAMEOBJECT>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_DYNAMICOBJECT>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_CORPSE>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_AREATRIGGER>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_MO_TRANSPORT>::Generate();
diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h
index 988c1847e7d..d5bfa7ee2f8 100644
--- a/src/server/game/Entities/Object/ObjectGuid.h
+++ b/src/server/game/Entities/Object/ObjectGuid.h
@@ -93,11 +93,12 @@ class ObjectGuid
public:
static ObjectGuid const Empty;
- typedef uint32 LowType;
+
+ typedef uint64 LowType;
ObjectGuid() : _low(0), _high(0) { }
- ObjectGuid(HighGuid hi, uint32 entry, uint64 counter) : _low(counter ? uint64(counter) | (uint64(entry) << 32) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0), _high(0) { }
- ObjectGuid(HighGuid hi, uint64 counter) : _low(counter ? uint64(counter) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0), _high(0) { }
+ ObjectGuid(HighGuid hi, uint32 entry, LowType counter) : _low(counter ? uint64(counter) | (uint64(entry) << 32) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0), _high(0) { }
+ ObjectGuid(HighGuid hi, LowType counter) : _low(counter ? uint64(counter) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0), _high(0) { }
ObjectGuid(ObjectGuid const&) = default;
PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); }
@@ -117,12 +118,12 @@ class ObjectGuid
uint32 GetEntry() const { return HasEntry() ? uint32((_low >> 32) & UI64LIT(0x00000000000FFFFF)) : 0; }
LowType GetCounter() const
{
- return uint32(_low & UI64LIT(0x00000000FFFFFFFF));
+ return _low & UI64LIT(0x00000000FFFFFFFF);
}
- static uint32 GetMaxCounter(HighGuid /*high*/)
+ static LowType GetMaxCounter(HighGuid /*high*/)
{
- return uint32(0xFFFFFFFF);
+ return UI64LIT(0xFFFFFFFF);
}
uint32 GetMaxCounter() const { return GetMaxCounter(GetHigh()); }
@@ -266,11 +267,11 @@ template<HighGuid high>
class ObjectGuidGenerator
{
public:
- explicit ObjectGuidGenerator(uint64 start = 1) : _nextGuid(start) { }
+ explicit ObjectGuidGenerator(ObjectGuid::LowType start = UI64LIT(1)) : _nextGuid(start) { }
void Set(uint64 val) { _nextGuid = val; }
- uint64 Generate();
- uint64 GetNextAfterMaxUsed() const { return _nextGuid; }
+ ObjectGuid::LowType Generate();
+ ObjectGuid::LowType GetNextAfterMaxUsed() const { return _nextGuid; }
private:
uint64 _nextGuid;
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 3934d7da9aa..8af74d318b7 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -99,7 +99,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
{
m_loading = true;
- uint32 ownerid = owner->GetGUID().GetCounter();
+ ObjectGuid::LowType ownerid = owner->GetGUID().GetCounter();
PreparedStatement* stmt;
PreparedQueryResult result;
@@ -108,21 +108,21 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
{
// Known petnumber entry
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_BY_ENTRY);
- stmt->setUInt32(0, ownerid);
+ stmt->setUInt64(0, ownerid);
stmt->setUInt32(1, petnumber);
}
else if (current)
{
// Current pet (slot 0)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT);
- stmt->setUInt32(0, ownerid);
+ stmt->setUInt64(0, ownerid);
stmt->setUInt8(1, uint8(PET_SAVE_AS_CURRENT));
}
else if (petEntry)
{
// known petEntry entry (unique for summoned pet, but non unique for hunter pet (only from current or not stabled pets)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT_2);
- stmt->setUInt32(0, ownerid);
+ stmt->setUInt64(0, ownerid);
stmt->setUInt32(1, petEntry);
stmt->setUInt8(2, uint8(PET_SAVE_AS_CURRENT));
stmt->setUInt8(3, uint8(PET_SAVE_LAST_STABLE_SLOT));
@@ -131,7 +131,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
{
// Any current or other non-stabled pet (for hunter "call pet")
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_BY_SLOT);
- stmt->setUInt32(0, ownerid);
+ stmt->setUInt64(0, ownerid);
stmt->setUInt8(1, uint8(PET_SAVE_AS_CURRENT));
stmt->setUInt8(2, uint8(PET_SAVE_LAST_STABLE_SLOT));
}
@@ -175,8 +175,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
}
Map* map = owner->GetMap();
- uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_PET);
- if (!Create(guid, map, owner->GetPhaseMask(), petEntry, petId))
+ if (!Create(sObjectMgr->GetGenerator<HIGHGUID_PET>()->Generate(), map, owner->GetPhaseMask(), petEntry, petId))
return false;
for (auto itr : owner->GetPhases())
@@ -282,14 +281,14 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID);
stmt->setUInt8(0, uint8(PET_SAVE_NOT_IN_SLOT));
- stmt->setUInt32(1, ownerid);
+ stmt->setUInt64(1, ownerid);
stmt->setUInt8(2, uint8(PET_SAVE_AS_CURRENT));
stmt->setUInt32(3, m_charmInfo->GetPetNumber());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID);
stmt->setUInt8(0, uint8(PET_SAVE_AS_CURRENT));
- stmt->setUInt32(1, ownerid);
+ stmt->setUInt64(1, ownerid);
stmt->setUInt32(2, m_charmInfo->GetPetNumber());
trans->Append(stmt);
@@ -347,7 +346,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
if (getPetType() == HUNTER_PET)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_DECLINED_NAME);
- stmt->setUInt32(0, owner->GetGUID().GetCounter());
+ stmt->setUInt64(0, owner->GetGUID().GetCounter());
stmt->setUInt32(1, GetCharmInfo()->GetPetNumber());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -417,7 +416,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
// current/stable/not_in_slot
if (mode >= PET_SAVE_AS_CURRENT)
{
- uint32 ownerLowGUID = GetOwnerGUID().GetCounter();
+ ObjectGuid::LowType ownerLowGUID = GetOwnerGUID().GetCounter();
std::string name = m_name;
CharacterDatabase.EscapeString(name);
trans = CharacterDatabase.BeginTransaction();
@@ -432,7 +431,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_SLOT);
stmt->setUInt8(0, uint8(PET_SAVE_NOT_IN_SLOT));
- stmt->setUInt32(1, ownerLowGUID);
+ stmt->setUInt64(1, ownerLowGUID);
stmt->setUInt8(2, uint8(mode));
trans->Append(stmt);
}
@@ -441,7 +440,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT || mode > PET_SAVE_LAST_STABLE_SLOT))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_SLOT);
- stmt->setUInt32(0, ownerLowGUID);
+ stmt->setUInt64(0, ownerLowGUID);
stmt->setUInt8(1, uint8(PET_SAVE_AS_CURRENT));
stmt->setUInt8(2, uint8(PET_SAVE_LAST_STABLE_SLOT));
trans->Append(stmt);
@@ -771,9 +770,8 @@ bool Pet::CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner)
bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask)
{
TC_LOG_DEBUG("entities.pet", "Pet::CreateBaseForTamed");
- uint32 guid=sObjectMgr->GenerateLowGuid(HIGHGUID_PET);
uint32 petId = sObjectMgr->GeneratePetNumber();
- if (!Create(guid, map, phaseMask, cinfo->Entry, petId))
+ if (!Create(sObjectMgr->GetGenerator<HIGHGUID_PET>()->Generate(), map, phaseMask, cinfo->Entry, petId))
return false;
setPowerType(POWER_FOCUS);
@@ -1710,7 +1708,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* onlinePet /*= NULL*/)
uint32 exceptPetNumber = onlinePet ? onlinePet->GetCharmInfo()->GetPetNumber() : 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET);
- stmt->setUInt32(0, owner->GetGUID().GetCounter());
+ stmt->setUInt64(0, owner->GetGUID().GetCounter());
stmt->setUInt32(1, exceptPetNumber);
PreparedQueryResult resultPets = CharacterDatabase.Query(stmt);
@@ -1719,7 +1717,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* onlinePet /*= NULL*/)
return;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SPELL_LIST);
- stmt->setUInt32(0, owner->GetGUID().GetCounter());
+ stmt->setUInt64(0, owner->GetGUID().GetCounter());
stmt->setUInt32(1, exceptPetNumber);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -1867,7 +1865,7 @@ bool Pet::IsPermanentPetFor(Player* owner) const
}
}
-bool Pet::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 petId)
+bool Pet::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 petId)
{
ASSERT(map);
SetMap(map);
diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h
index 8c3cf5e0ecc..0d24c1cbd81 100644
--- a/src/server/game/Entities/Pet/Pet.h
+++ b/src/server/game/Entities/Pet/Pet.h
@@ -55,7 +55,7 @@ class Pet : public Guardian
bool IsPermanentPetFor(Player* owner) const; // pet have tab in character windows and set UNIT_FIELD_PETNUMBER
- bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 pet_number);
+ bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 pet_number);
bool CreateBaseAtCreature(Creature* creature);
bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner);
bool CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask);
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 29a5abb767d..26e314d13e5 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -670,7 +670,7 @@ void KillRewarder::Reward()
if (InstanceScript* instance = _victim->GetInstanceScript())
instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, _victim->GetEntry(), _victim);
- if (uint32 guildId = victim->GetMap()->GetOwnerGuildId())
+ if (ObjectGuid::LowType guildId = victim->GetMap()->GetOwnerGuildId())
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
guild->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, victim->GetEntry(), 1, 0, victim, _killer);
}
@@ -974,7 +974,7 @@ void Player::CleanupsBeforeDelete(bool finalCleanup)
itr->second.save->RemovePlayer(this);
}
-bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
+bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo)
{
//FIXME: outfitId not used in player creating
/// @todo need more checks against packet modifications
@@ -1979,7 +1979,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, ByteBuffer* dataBuffer)
float x = fields[10].GetFloat();
float y = fields[11].GetFloat();
float z = fields[12].GetFloat();
- uint32 guildId = fields[13].GetUInt64();
+ uint64 guildId = fields[13].GetUInt64();
ObjectGuid guildGuid;
if (guildId)
guildGuid = ObjectGuid(HIGHGUID_GUILD, guildId);
@@ -3151,7 +3151,7 @@ void Player::GiveLevel(uint8 level)
{
/// @todo Poor design of mail system
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- MailDraft(mailReward->mailTemplateId).SendMailTo(trans, this, MailSender(MAIL_CREATURE, mailReward->senderEntry));
+ MailDraft(mailReward->mailTemplateId).SendMailTo(trans, this, MailSender(MAIL_CREATURE, uint64(mailReward->senderEntry)));
CharacterDatabase.CommitTransaction(trans);
}
@@ -3461,7 +3461,7 @@ void Player::RemoveMail(uint32 id)
}
}
-void Player::SendMailResult(uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError, uint32 item_guid, uint32 item_count)
+void Player::SendMailResult(uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError, ObjectGuid::LowType item_guid, uint32 item_count)
{
WorldPacket data(SMSG_SEND_MAIL_RESULT, (4+4+4+(mailError == MAIL_ERR_EQUIP_ERROR?4:(mailAction == MAIL_ITEM_TAKEN?4+4:0))));
data << uint32(mailId);
@@ -3471,7 +3471,7 @@ void Player::SendMailResult(uint32 mailId, MailResponseType mailAction, MailResp
data << uint32(equipError);
else if (mailAction == MAIL_ITEM_TAKEN)
{
- data << uint32(item_guid); // item guid low?
+ data << uint64(item_guid); // item guid low?
data << uint32(item_count); // item count?
}
GetSession()->SendPacket(&data);
@@ -4669,7 +4669,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
// bones will be deleted by corpse/bones deleting thread shortly
sObjectAccessor->ConvertCorpseForPlayer(playerguid);
- if (uint32 guildId = GetGuildIdFromDB(playerguid))
+ if (ObjectGuid::LowType guildId = GetGuildIdFromDB(playerguid))
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
guild->DeleteMember(playerguid, false, false, true);
@@ -4696,7 +4696,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
SQLTransaction trans = CharacterDatabase.BeginTransaction();
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_COD_ITEM_MAIL);
- stmt->setUInt32(0, guid);
+ stmt->setUInt64(0, guid);
PreparedQueryResult resultMail = CharacterDatabase.Query(stmt);
if (resultMail)
@@ -4708,7 +4708,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
uint32 mail_id = mailFields[0].GetUInt32();
uint8 mailType = mailFields[1].GetUInt8();
uint16 mailTemplateId= mailFields[2].GetUInt16();
- uint32 sender = mailFields[3].GetUInt32();
+ ObjectGuid::LowType sender = mailFields[3].GetUInt64();
std::string subject = mailFields[4].GetString();
std::string body = mailFields[5].GetString();
uint64 money = mailFields[6].GetUInt64();
@@ -4747,14 +4747,14 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
do
{
Field* itemFields = resultItems->Fetch();
- uint32 item_guidlow = itemFields[11].GetUInt32();
+ ObjectGuid::LowType item_guidlow = itemFields[11].GetUInt64();
uint32 item_template = itemFields[12].GetUInt32();
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_template);
if (!itemProto)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
- stmt->setUInt32(0, item_guidlow);
+ stmt->setUInt64(0, item_guidlow);
trans->Append(stmt);
continue;
}
@@ -4787,7 +4787,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
// Unsummon and delete for pets in world is not required: player deleted from CLI or character list with not loaded pet.
// NOW we can finally clear other DB data related to character
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PETS);
- stmt->setUInt32(0, guid);
+ stmt->setUInt64(0, guid);
PreparedQueryResult resultPets = CharacterDatabase.Query(stmt);
if (resultPets)
@@ -4877,7 +4877,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_BY_OWNER);
- stmt->setUInt32(0, guid);
+ stmt->setUInt64(0, guid);
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND);
@@ -4889,19 +4889,19 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL);
- stmt->setUInt32(0, guid);
+ stmt->setUInt64(0, guid);
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEMS);
- stmt->setUInt32(0, guid);
+ stmt->setUInt64(0, guid);
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_OWNER);
- stmt->setUInt32(0, guid);
+ stmt->setUInt64(0, guid);
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME_BY_OWNER);
- stmt->setUInt32(0, guid);
+ stmt->setUInt64(0, guid);
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENTS);
@@ -5204,7 +5204,7 @@ void Player::CreateCorpse()
Corpse* corpse = new Corpse((m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH) ? CORPSE_RESURRECTABLE_PVP : CORPSE_RESURRECTABLE_PVE);
SetPvPDeath(false);
- if (!corpse->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_CORPSE), this))
+ if (!corpse->Create(sObjectMgr->GetGenerator<HIGHGUID_CORPSE>()->Generate(), this))
{
delete corpse;
return;
@@ -7606,7 +7606,7 @@ ObjectGuid::LowType Player::GetGuildIdFromDB(ObjectGuid guid)
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
return result->Fetch()[0].GetUInt64();
- return 0;
+ return UI64LIT(0);
}
uint8 Player::GetRankFromDB(ObjectGuid guid)
@@ -11980,7 +11980,7 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
ss << ' ' << *itr;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_BOP_TRADE);
- stmt->setUInt32(0, pItem->GetGUID().GetCounter());
+ stmt->setUInt64(0, pItem->GetGUID().GetCounter());
stmt->setString(1, ss.str());
CharacterDatabase.Execute(stmt);
}
@@ -15248,7 +15248,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
// prepare Quest Tracker datas
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_QUEST_TRACK);
stmt->setUInt32(0, quest_id);
- stmt->setUInt32(1, GetGUID().GetCounter());
+ stmt->setUInt64(1, GetGUID().GetCounter());
stmt->setString(2, _HASH);
stmt->setString(3, _DATE);
@@ -15281,7 +15281,7 @@ void Player::CompleteQuest(uint32 quest_id)
// prepare Quest Tracker datas
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_COMPLETE_TIME);
stmt->setUInt32(0, quest_id);
- stmt->setUInt32(1, GetGUID().GetCounter());
+ stmt->setUInt64(1, GetGUID().GetCounter());
// add to Quest Tracker
CharacterDatabase.Execute(stmt);
@@ -17035,11 +17035,6 @@ bool Player::HasPvPForcingQuest() const
/*** LOAD SYSTEM ***/
/*********************************************************/
-void Player::Initialize(uint32 guid)
-{
- Object::_Create(guid, 0, HIGHGUID_PLAYER);
-}
-
void Player::_LoadDeclinedNames(PreparedQueryResult result)
{
if (!result)
@@ -18331,7 +18326,7 @@ void Player::_LoadVoidStorage(PreparedQueryResult result)
Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields)
{
Item* item = NULL;
- uint32 itemGuid = fields[13].GetUInt32();
+ ObjectGuid::LowType itemGuid = fields[13].GetUInt64();
uint32 itemEntry = fields[14].GetUInt32();
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry))
{
@@ -18363,7 +18358,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
GetGUID().ToString().c_str(), GetName().c_str(), item->GetGUID().ToString().c_str(), item->GetEntry(), item->GetPlayedTime());
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE);
- stmt->setUInt32(0, item->GetGUID().GetCounter());
+ stmt->setUInt64(0, item->GetGUID().GetCounter());
trans->Append(stmt);
item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE);
@@ -18371,13 +18366,13 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
else
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_REFUNDS);
- stmt->setUInt32(0, item->GetGUID().GetCounter());
- stmt->setUInt32(1, GetGUID().GetCounter());
+ stmt->setUInt64(0, item->GetGUID().GetCounter());
+ stmt->setUInt64(1, GetGUID().GetCounter());
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
- item->SetRefundRecipient(ObjectGuid(HIGHGUID_PLAYER, uint32((*result)[0].GetUInt32())));
- item->SetPaidMoney((*result)[1].GetUInt32());
- item->SetPaidExtendedCost((*result)[2].GetUInt16());
+ item->SetRefundRecipient(GetGUID());
+ item->SetPaidMoney((*result)[0].GetUInt32());
+ item->SetPaidExtendedCost((*result)[1].GetUInt16());
AddRefundReference(item->GetGUID());
}
else
@@ -18391,14 +18386,14 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
else if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_BOP_TRADE);
- stmt->setUInt32(0, item->GetGUID().GetCounter());
+ stmt->setUInt64(0, item->GetGUID().GetCounter());
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
std::string strGUID = (*result)[0].GetString();
Tokenizer GUIDlist(strGUID, ' ');
GuidSet looters;
for (Tokenizer::const_iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr)
- looters.insert(ObjectGuid(HIGHGUID_PLAYER, uint32(atol(*itr))));
+ looters.insert(ObjectGuid(HIGHGUID_PLAYER, uint64(strtoull(*itr, nullptr, 10))));
if (looters.size() > 1 && item->GetTemplate()->GetMaxStackSize() == 1 && item->IsSoulBound())
{
@@ -18432,7 +18427,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
}
else
{
- TC_LOG_ERROR("entities.player", "Player::_LoadInventory: player (%s, name: '%s') has broken item (GUID: %u, entry: %u) in inventory. Deleting item.",
+ TC_LOG_ERROR("entities.player", "Player::_LoadInventory: player (%s, name: '%s') has broken item (GUID: " UI64FMTD ", entry: %u) in inventory. Deleting item.",
GetGUID().ToString().c_str(), GetName().c_str(), itemGuid, itemEntry);
remove = true;
}
@@ -18469,7 +18464,7 @@ void Player::_LoadMailedItems(Mail* mail)
{
Field* fields = result->Fetch();
- uint32 itemGuid = fields[11].GetUInt32();
+ ObjectGuid::LowType itemGuid = fields[11].GetUInt64();
uint32 itemTemplate = fields[12].GetUInt32();
mail->AddItem(itemGuid, itemTemplate);
@@ -18478,26 +18473,26 @@ void Player::_LoadMailedItems(Mail* mail)
if (!proto)
{
- TC_LOG_ERROR("entities.player", "%s has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUID().ToString().c_str(), itemGuid, itemTemplate, mail->messageID);
+ TC_LOG_ERROR("entities.player", "%s has unknown item_template (ProtoType) in mailed items(GUID: " UI64FMTD " template: %u) in mail (%u), deleted.", GetGUID().ToString().c_str(), itemGuid, itemTemplate, mail->messageID);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM);
- stmt->setUInt32(0, itemGuid);
+ stmt->setUInt64(0, itemGuid);
CharacterDatabase.Execute(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
- stmt->setUInt32(0, itemGuid);
+ stmt->setUInt64(0, itemGuid);
CharacterDatabase.Execute(stmt);
continue;
}
Item* item = NewItemOrBag(proto);
- if (!item->LoadFromDB(itemGuid, ObjectGuid(HIGHGUID_PLAYER, fields[13].GetUInt32()), fields, itemTemplate))
+ if (!item->LoadFromDB(itemGuid, ObjectGuid(HIGHGUID_PLAYER, fields[13].GetUInt64()), 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);
+ TC_LOG_ERROR("entities.player", "Player::_LoadMailedItems - Item in mail (" UI64FMTD ") doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM);
- stmt->setUInt32(0, itemGuid);
+ stmt->setUInt64(0, itemGuid);
CharacterDatabase.Execute(stmt);
item->FSetState(ITEM_REMOVED);
@@ -18530,7 +18525,7 @@ void Player::_LoadMail()
m_mail.clear();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL);
- stmt->setUInt32(0, GetGUID().GetCounter());
+ stmt->setUInt64(0, GetGUID().GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
@@ -18542,8 +18537,8 @@ void Player::_LoadMail()
m->messageID = fields[0].GetUInt32();
m->messageType = fields[1].GetUInt8();
- m->sender = fields[2].GetUInt32();
- m->receiver = fields[3].GetUInt32();
+ m->sender = fields[2].GetUInt64();
+ m->receiver = fields[3].GetUInt64();
m->subject = fields[4].GetString();
m->body = fields[5].GetString();
bool has_items = fields[6].GetBool();
@@ -18918,7 +18913,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
}
else if (!perm && group)
{
- TC_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%s) is in group %d but has a non-permanent character bind to map %d (%s), %d, %d", GetName().c_str(), GetGUID().ToString().c_str(), group->GetLowGUID(), mapId, mapname.c_str(), instanceId, difficulty);
+ TC_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%s) is in group %s but has a non-permanent character bind to map %d (%s), %d, %d", GetName().c_str(), GetGUID().ToString().c_str(), group->GetGUID().ToString().c_str(), mapId, mapname.c_str(), instanceId, difficulty);
deleteInstance = true;
}
}
@@ -19406,7 +19401,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setFloat(index++, finiteAlways(GetTransOffsetY()));
stmt->setFloat(index++, finiteAlways(GetTransOffsetZ()));
stmt->setFloat(index++, finiteAlways(GetTransOffsetO()));
- ObjectGuid::LowType transLowGUID = 0;
+ ObjectGuid::LowType transLowGUID = UI64LIT(0);
if (GetTransport())
transLowGUID = GetTransport()->GetGUID().GetCounter();
stmt->setUInt64(index++, transLowGUID);
@@ -19535,7 +19530,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setFloat(index++, finiteAlways(GetTransOffsetY()));
stmt->setFloat(index++, finiteAlways(GetTransOffsetZ()));
stmt->setFloat(index++, finiteAlways(GetTransOffsetO()));
- ObjectGuid::LowType transLowGUID = 0;
+ ObjectGuid::LowType transLowGUID = UI64LIT(0);
if (GetTransport())
transLowGUID = GetTransport()->GetGUID().GetCounter();
stmt->setUInt64(index++, transLowGUID);
@@ -19808,7 +19803,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
- stmt->setUInt32(0, item->GetGUID().GetCounter());
+ stmt->setUInt64(0, item->GetGUID().GetCounter());
trans->Append(stmt);
m_items[i]->FSetState(ITEM_NEW);
}
@@ -19857,7 +19852,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
Item* test = GetItemByPos(item->GetBagSlot(), item->GetSlot());
if (test == NULL)
{
- ObjectGuid::LowType bagTestGUID = 0;
+ ObjectGuid::LowType bagTestGUID = UI64LIT(0);
if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot()))
bagTestGUID = test2->GetGUID().GetCounter();
@@ -19892,7 +19887,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
case ITEM_CHANGED:
stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_INVENTORY_ITEM);
stmt->setUInt64(0, GetGUID().GetCounter());
- stmt->setUInt64(1, container ? container->GetGUID().GetCounter() : 0);
+ stmt->setUInt64(1, container ? container->GetGUID().GetCounter() : UI64LIT(0));
stmt->setUInt8 (2, item->GetSlot());
stmt->setUInt64(3, item->GetGUID().GetCounter());
trans->Append(stmt);
@@ -20002,10 +19997,10 @@ void Player::_SaveMail(SQLTransaction& trans)
if (!m->removedItems.empty())
{
- for (std::vector<uint32>::iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2)
+ for (std::vector<ObjectGuid::LowType>::iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM);
- stmt->setUInt32(0, *itr2);
+ stmt->setUInt64(0, *itr2);
trans->Append(stmt);
}
m->removedItems.clear();
@@ -20019,7 +20014,7 @@ void Player::_SaveMail(SQLTransaction& trans)
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
- stmt->setUInt32(0, itr2->item_guid);
+ stmt->setUInt64(0, itr2->item_guid);
trans->Append(stmt);
}
}
@@ -20897,7 +20892,7 @@ void Player::Whisper(std::string const& text, Language language, Player* target,
ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_DND, target->GetName().c_str(), target->autoReplyMsg.c_str());
}
-Item* Player::GetMItem(uint32 id)
+Item* Player::GetMItem(ObjectGuid::LowType id)
{
ItemMap::const_iterator itr = mMitems.find(id);
return itr != mMitems.end() ? itr->second : NULL;
@@ -20910,7 +20905,7 @@ void Player::AddMItem(Item* it)
mMitems[it->GetGUID().GetCounter()] = it;
}
-bool Player::RemoveMItem(uint32 id)
+bool Player::RemoveMItem(ObjectGuid::LowType id)
{
return mMitems.erase(id) ? true : false;
}
@@ -21389,7 +21384,7 @@ void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
stmt->setUInt8(1, uint8(type));
}
- stmt->setUInt32(0, guid.GetCounter());
+ stmt->setUInt64(0, guid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
@@ -21397,8 +21392,8 @@ void Player::RemovePetitionsAndSigns(ObjectGuid 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();
- ObjectGuid ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
- ObjectGuid petitionguid = ObjectGuid(HIGHGUID_ITEM, fields[1].GetUInt32());
+ ObjectGuid ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt64());
+ ObjectGuid petitionguid = ObjectGuid(HIGHGUID_ITEM, fields[1].GetUInt64());
// send update if charter owner in game
Player* owner = ObjectAccessor::FindConnectedPlayer(ownerguid);
@@ -21410,7 +21405,7 @@ void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_PETITION_SIGNATURES);
- stmt->setUInt32(0, guid.GetCounter());
+ stmt->setUInt64(0, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -21418,7 +21413,7 @@ void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE);
- stmt->setUInt32(0, guid.GetCounter());
+ stmt->setUInt64(0, guid.GetCounter());
stmt->setUInt8(1, uint8(type));
CharacterDatabase.Execute(stmt);
@@ -21429,22 +21424,22 @@ void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
if (type == 10)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER);
- stmt->setUInt32(0, guid.GetCounter());
+ stmt->setUInt64(0, guid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER);
- stmt->setUInt32(0, guid.GetCounter());
+ stmt->setUInt64(0, guid.GetCounter());
trans->Append(stmt);
}
else
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER_AND_TYPE);
- stmt->setUInt32(0, guid.GetCounter());
+ stmt->setUInt64(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.GetCounter());
+ stmt->setUInt64(0, guid.GetCounter());
stmt->setUInt8(1, uint8(type));
trans->Append(stmt);
}
@@ -27267,7 +27262,7 @@ void Player::RefundItem(Item* item)
void Player::SendItemRetrievalMail(uint32 itemEntry, uint32 count)
{
- MailSender sender(MAIL_CREATURE, 34337 /* The Postmaster */);
+ MailSender sender(MAIL_CREATURE, UI64LIT(34337) /* The Postmaster */);
MailDraft draft("Recovered Item", "We recovered a lost item in the twisting nether and noted that it was yours.$B$BPlease find said object enclosed."); // This is the text used in Cataclysm, it probably wasn't changed.
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -27537,7 +27532,7 @@ std::string Player::GetCoordsMapAreaAndZoneString()
Guild* Player::GetGuild()
{
- uint32 guildId = GetGuildId();
+ ObjectGuid::LowType guildId = GetGuildId();
return guildId ? sGuildMgr->GetGuildById(guildId) : NULL;
}
@@ -27583,7 +27578,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
Map* map = GetMap();
uint32 pet_number = sObjectMgr->GeneratePetNumber();
- if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number))
+ if (!pet->Create(sObjectMgr->GetGenerator<HIGHGUID_PET>()->Generate(), map, GetPhaseMask(), entry, pet_number))
{
TC_LOG_ERROR("misc", "no such creature entry %u", entry);
delete pet;
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index a30233ac3aa..eb5acf19fb8 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1270,7 +1270,7 @@ class Player : public Unit, public GridObject<Player>
void SetSummonPoint(uint32 mapid, float x, float y, float z);
void SummonIfPossible(bool agree);
- bool Create(uint32 guidlow, CharacterCreateInfo* createInfo);
+ bool Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo);
void Update(uint32 time) override;
@@ -1674,7 +1674,6 @@ class Player : public Unit, public GridObject<Player>
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(ObjectGuid guid);
@@ -1741,7 +1740,7 @@ class Player : public Unit, public GridObject<Player>
void ClearComboPoints();
void SendComboPoints();
- void SendMailResult(uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError = 0, uint32 item_guid = 0, uint32 item_count = 0);
+ void SendMailResult(uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError = 0, ObjectGuid::LowType item_guid = UI64LIT(0), uint32 item_count = 0);
void SendNewMail();
void UpdateNextMailTimeAndUnreads();
void AddNewMailDeliverTime(time_t deliver_time);
@@ -1765,13 +1764,13 @@ class Player : public Unit, public GridObject<Player>
uint8 unReadMails;
time_t m_nextMailDelivereTime;
- typedef std::unordered_map<uint32, Item*> ItemMap;
+ typedef std::unordered_map<ObjectGuid::LowType, Item*> ItemMap;
ItemMap mMitems; //template defined in objectmgr.cpp
- Item* GetMItem(uint32 id);
+ Item* GetMItem(ObjectGuid::LowType id);
void AddMItem(Item* it);
- bool RemoveMItem(uint32 id);
+ bool RemoveMItem(ObjectGuid::LowType id);
void SendOnCancelExpectedVehicleRideAura();
void PetSpellInitialize();
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index ca935051fb4..9acc84a7da0 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -47,7 +47,7 @@ Transport::~Transport()
UnloadStaticPassengers();
}
-bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
+bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
{
Relocate(x, y, z, ang);
@@ -275,7 +275,7 @@ void Transport::RemovePassenger(WorldObject* passenger)
}
}
-Creature* Transport::CreateNPCPassenger(uint32 guid, CreatureData const* data)
+Creature* Transport::CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData const* data)
{
Map* map = GetMap();
Creature* creature = new Creature();
@@ -330,7 +330,7 @@ Creature* Transport::CreateNPCPassenger(uint32 guid, CreatureData const* data)
return creature;
}
-GameObject* Transport::CreateGOPassenger(uint32 guid, GameObjectData const* data)
+GameObject* Transport::CreateGOPassenger(ObjectGuid::LowType guid, GameObjectData const* data)
{
Map* map = GetMap();
GameObject* go = new GameObject();
@@ -453,7 +453,7 @@ TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSu
pos.GetPosition(x, y, z, o);
CalculatePassengerPosition(x, y, z, &o);
- if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, 0, entry, x, y, z, o, nullptr, vehId))
+ if (!summon->Create(sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate(), map, 0, entry, x, y, z, o, nullptr, vehId))
{
delete summon;
return NULL;
diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h
index 6fd13e76034..59f8c9b110d 100644
--- a/src/server/game/Entities/Transport/Transport.h
+++ b/src/server/game/Entities/Transport/Transport.h
@@ -27,7 +27,7 @@ struct CreatureData;
class Transport : public GameObject, public TransportBase
{
- friend Transport* TransportMgr::CreateTransport(uint32, uint32, Map*, uint32, uint32);
+ friend Transport* TransportMgr::CreateTransport(uint32, ObjectGuid::LowType, Map*, uint32, uint32);
Transport();
public:
@@ -35,7 +35,7 @@ class Transport : public GameObject, public TransportBase
~Transport();
- bool Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress);
+ bool Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress);
void CleanupsBeforeDelete(bool finalCleanup = true) override;
void Update(uint32 diff) override;
@@ -46,8 +46,8 @@ class Transport : public GameObject, public TransportBase
void RemovePassenger(WorldObject* passenger);
PassengerSet const& GetPassengers() const { return _passengers; }
- Creature* CreateNPCPassenger(uint32 guid, CreatureData const* data);
- GameObject* CreateGOPassenger(uint32 guid, GameObjectData const* data);
+ Creature* CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData const* data);
+ GameObject* CreateGOPassenger(ObjectGuid::LowType guid, GameObjectData const* data);
/**
* @fn bool Transport::SummonPassenger(uint64, Position const&, TempSummonType, SummonPropertiesEntry const*, uint32, Unit*, uint32, uint32)
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index cdddb786748..d6e0c822e6a 100644
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -405,9 +405,9 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
return false;
}
- TC_LOG_DEBUG("entities.vehicle", "Unit %s scheduling enter vehicle (entry: %u, vehicleId: %u, %s (dbguid: %u) on seat %d",
+ TC_LOG_DEBUG("entities.vehicle", "Unit %s scheduling enter vehicle (entry: %u, vehicleId: %u, %s (dbguid: " UI64FMTD ") on seat %d",
unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUID().ToString().c_str(),
- (_me->GetTypeId() == TYPEID_UNIT ? _me->ToCreature()->GetDBTableGUIDLow() : 0), (int32)seatId);
+ uint64(_me->GetTypeId() == TYPEID_UNIT ? _me->ToCreature()->GetDBTableGUIDLow() : UI64LIT(0)), (int32)seatId);
// The seat selection code may kick other passengers off the vehicle.
// While the validity of the following may be arguable, it is possible that when such a passenger
diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h
index afd4b96e260..b03d65c035d 100644
--- a/src/server/game/Entities/Vehicle/VehicleDefines.h
+++ b/src/server/game/Entities/Vehicle/VehicleDefines.h
@@ -112,7 +112,8 @@ struct VehicleAccessory
};
typedef std::vector<VehicleAccessory> VehicleAccessoryList;
-typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryContainer;
+typedef std::map<ObjectGuid::LowType, VehicleAccessoryList> VehicleAccessoryContainer;
+typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryTemplateContainer;
typedef std::map<int8, VehicleSeat> SeatMap;
class TransportBase
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index 92cc3181486..2ab7182dcc1 100644
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -372,7 +372,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
int16 event_id = fields[1].GetInt8();
int32 internal_event_id = mGameEvent.size() + event_id - 1;
@@ -380,7 +380,7 @@ void GameEventMgr::LoadFromDB()
CreatureData const* data = sObjectMgr->GetCreatureData(guid);
if (!data)
{
- TC_LOG_ERROR("sql.sql", "`game_event_creature` contains creature (GUID: %u) not found in `creature` table.", guid);
+ TC_LOG_ERROR("sql.sql", "`game_event_creature` contains creature (GUID: " UI64FMTD ") not found in `creature` table.", guid);
continue;
}
@@ -418,7 +418,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
int16 event_id = fields[1].GetInt8();
int32 internal_event_id = mGameEvent.size() + event_id - 1;
@@ -426,7 +426,7 @@ void GameEventMgr::LoadFromDB()
GameObjectData const* data = sObjectMgr->GetGOData(guid);
if (!data)
{
- TC_LOG_ERROR("sql.sql", "`game_event_gameobject` contains gameobject (GUID: %u) not found in `gameobject` table.", guid);
+ TC_LOG_ERROR("sql.sql", "`game_event_gameobject` contains gameobject (GUID: " UI64FMTD ") not found in `gameobject` table.", guid);
continue;
}
@@ -464,7 +464,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
uint32 entry = fields[1].GetUInt32();
uint16 event_id = fields[2].GetUInt8();
@@ -486,13 +486,13 @@ void GameEventMgr::LoadFromDB()
int8 equipId = static_cast<int8>(newModelEquipSet.equipment_id);
if (!sObjectMgr->GetEquipmentInfo(entry, equipId))
{
- TC_LOG_ERROR("sql.sql", "Table `game_event_model_equip` have creature (Guid: %u, entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.",
+ TC_LOG_ERROR("sql.sql", "Table `game_event_model_equip` have creature (Guid: " UI64FMTD ", entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.",
guid, entry, newModelEquipSet.equipment_id);
continue;
}
}
- equiplist.push_back(std::pair<uint32, ModelEquip>(guid, newModelEquipSet));
+ equiplist.push_back(std::pair<ObjectGuid::LowType, ModelEquip>(guid, newModelEquipSet));
++count;
}
@@ -713,7 +713,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
uint16 event_id = fields[1].GetUInt8();
uint32 npcflag = fields[2].GetUInt32();
@@ -799,7 +799,7 @@ void GameEventMgr::LoadFromDB()
NPCVendorList& vendors = mGameEventVendors[event_id];
NPCVendorEntry newEntry;
- uint32 guid = fields[1].GetUInt32();
+ ObjectGuid::LowType guid = fields[1].GetUInt64();
newEntry.item = fields[2].GetUInt32();
newEntry.maxcount = fields[3].GetUInt32();
newEntry.incrtime = fields[4].GetUInt32();
@@ -919,7 +919,7 @@ void GameEventMgr::LoadFromDB()
uint32 GameEventMgr::GetNPCFlag(Creature* cr)
{
uint32 mask = 0;
- uint32 guid = cr->GetDBTableGUIDLow();
+ ObjectGuid::LowType guid = cr->GetDBTableGUIDLow();
for (ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr)
{
@@ -1387,7 +1387,7 @@ bool GameEventMgr::hasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 e
}
return false;
}
-bool GameEventMgr::hasCreatureActiveEventExcept(uint32 creature_id, uint16 event_id)
+bool GameEventMgr::hasCreatureActiveEventExcept(ObjectGuid::LowType creature_id, uint16 event_id)
{
for (ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr)
{
@@ -1403,7 +1403,7 @@ bool GameEventMgr::hasCreatureActiveEventExcept(uint32 creature_id, uint16 event
}
return false;
}
-bool GameEventMgr::hasGameObjectActiveEventExcept(uint32 go_id, uint16 event_id)
+bool GameEventMgr::hasGameObjectActiveEventExcept(ObjectGuid::LowType go_id, uint16 event_id)
{
for (ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr)
{
diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h
index 5afa26ec746..57659837ac9 100644
--- a/src/server/game/Events/GameEventMgr.h
+++ b/src/server/game/Events/GameEventMgr.h
@@ -145,14 +145,14 @@ class GameEventMgr
void SaveWorldEventStateToDB(uint16 event_id);
bool hasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 event_id);
bool hasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 event_id);
- bool hasCreatureActiveEventExcept(uint32 creature_guid, uint16 event_id);
- bool hasGameObjectActiveEventExcept(uint32 go_guid, uint16 event_id);
+ bool hasCreatureActiveEventExcept(ObjectGuid::LowType creature_guid, uint16 event_id);
+ bool hasGameObjectActiveEventExcept(ObjectGuid::LowType go_guid, uint16 event_id);
- typedef std::list<uint32> GuidList;
+ typedef std::list<ObjectGuid::LowType> GuidList;
typedef std::list<uint32> IdList;
typedef std::vector<GuidList> GameEventGuidMap;
typedef std::vector<IdList> GameEventIdMap;
- typedef std::pair<uint32, ModelEquip> ModelEquipPair;
+ typedef std::pair<ObjectGuid::LowType, ModelEquip> ModelEquipPair;
typedef std::list<ModelEquipPair> ModelEquipList;
typedef std::vector<ModelEquipList> GameEventModelEquipMap;
typedef std::pair<uint32, uint32> QuestRelation;
@@ -161,7 +161,7 @@ class GameEventMgr
typedef std::list<NPCVendorEntry> NPCVendorList;
typedef std::vector<NPCVendorList> GameEventNPCVendorMap;
typedef std::map<uint32 /*quest id*/, GameEventQuestToEventConditionNum> QuestIdToEventConditionMap;
- typedef std::pair<uint32 /*guid*/, uint32 /*npcflag*/> GuidNPCFlagPair;
+ typedef std::pair<ObjectGuid::LowType /*guid*/, uint32 /*npcflag*/> GuidNPCFlagPair;
typedef std::list<GuidNPCFlagPair> NPCFlagList;
typedef std::vector<NPCFlagList> GameEventNPCFlagMap;
typedef std::vector<uint32> GameEventBitmask;
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index de013d1f042..c099b37fe2d 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -226,6 +226,23 @@ bool SpellClickInfo::IsFitToRequirements(Unit const* clicker, Unit const* clicke
return true;
}
+template<> ObjectGuidGenerator<HIGHGUID_PLAYER>* ObjectMgr::GetGenerator() { return &_playerGuidGenerator; }
+template<> ObjectGuidGenerator<HIGHGUID_UNIT>* ObjectMgr::GetGenerator() { return &_creatureGuidGenerator; }
+template<> ObjectGuidGenerator<HIGHGUID_PET>* ObjectMgr::GetGenerator() { return &_petGuidGenerator; }
+template<> ObjectGuidGenerator<HIGHGUID_VEHICLE>* ObjectMgr::GetGenerator() { return &_vehicleGuidGenerator; }
+template<> ObjectGuidGenerator<HIGHGUID_ITEM>* ObjectMgr::GetGenerator() { return &_itemGuidGenerator; }
+template<> ObjectGuidGenerator<HIGHGUID_GAMEOBJECT>* ObjectMgr::GetGenerator() { return &_gameObjectGuidGenerator; }
+template<> ObjectGuidGenerator<HIGHGUID_DYNAMICOBJECT>* ObjectMgr::GetGenerator() { return &_dynamicObjectGuidGenerator; }
+template<> ObjectGuidGenerator<HIGHGUID_CORPSE>* ObjectMgr::GetGenerator() { return &_corpseGuidGenerator; }
+template<> ObjectGuidGenerator<HIGHGUID_AREATRIGGER>* ObjectMgr::GetGenerator() { return &_areaTriggerGuidGenerator; }
+template<> ObjectGuidGenerator<HIGHGUID_MO_TRANSPORT>* ObjectMgr::GetGenerator() { return &_moTransportGuidGenerator; }
+
+template<HighGuid type>
+ObjectGuidGenerator<type>* ObjectMgr::GetGenerator()
+{
+ return nullptr;
+}
+
ObjectMgr::ObjectMgr():
_auctionId(1),
_equipmentSetGuid(1),
@@ -233,16 +250,6 @@ ObjectMgr::ObjectMgr():
_mailId(1),
_hiPetNumber(1),
_voidItemId(1),
- _hiCharGuid(1),
- _hiCreatureGuid(1),
- _hiPetGuid(1),
- _hiVehicleGuid(1),
- _hiItemGuid(1),
- _hiGoGuid(1),
- _hiDoGuid(1),
- _hiCorpseGuid(1),
- _hiAreaTriggerGuid(1),
- _hiMoTransGuid(1),
DBCLocaleIndex(LOCALE_enUS)
{
for (uint8 i = 0; i < MAX_CLASSES; ++i)
@@ -1016,12 +1023,12 @@ void ObjectMgr::LoadCreatureAddons()
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
CreatureData const* creData = GetCreatureData(guid);
if (!creData)
{
- TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) does not exist but has a record in `creature_addon`", guid);
+ TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") does not exist but has a record in `creature_addon`", guid);
continue;
}
@@ -1031,7 +1038,7 @@ void ObjectMgr::LoadCreatureAddons()
if (creData->movementType == WAYPOINT_MOTION_TYPE && !creatureAddon.path_id)
{
const_cast<CreatureData*>(creData)->movementType = IDLE_MOTION_TYPE;
- TC_LOG_ERROR("sql.sql", "Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid);
+ TC_LOG_ERROR("sql.sql", "Creature (GUID " UI64FMTD ") has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid);
}
creatureAddon.mount = fields[2].GetUInt32();
@@ -1047,12 +1054,12 @@ void ObjectMgr::LoadCreatureAddons()
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
if (!AdditionalSpellInfo)
{
- TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr)));
+ TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr)));
continue;
}
if (AdditionalSpellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE))
- TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr)));
+ TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr)));
creatureAddon.auras[i++] = uint32(atol(*itr));
}
@@ -1061,14 +1068,14 @@ void ObjectMgr::LoadCreatureAddons()
{
if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount))
{
- TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount);
+ TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount);
creatureAddon.mount = 0;
}
}
if (!sEmotesStore.LookupEntry(creatureAddon.emote))
{
- TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote);
+ TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote);
creatureAddon.emote = 0;
}
@@ -1079,7 +1086,7 @@ void ObjectMgr::LoadCreatureAddons()
TC_LOG_INFO("server.loading", ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
-CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid)
+CreatureAddon const* ObjectMgr::GetCreatureAddon(ObjectGuid::LowType lowguid)
{
CreatureAddonContainer::const_iterator itr = _creatureAddonStore.find(lowguid);
if (itr != _creatureAddonStore.end())
@@ -1090,7 +1097,7 @@ CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid)
CreatureAddon const* ObjectMgr::GetCreatureTemplateAddon(uint32 entry)
{
- CreatureAddonContainer::const_iterator itr = _creatureTemplateAddonStore.find(entry);
+ CreatureTemplateAddonContainer::const_iterator itr = _creatureTemplateAddonStore.find(entry);
if (itr != _creatureTemplateAddonStore.end())
return &(itr->second);
@@ -1333,8 +1340,8 @@ void ObjectMgr::LoadLinkedRespawn()
{
Field* fields = result->Fetch();
- uint32 guidLow = fields[0].GetUInt32();
- uint32 linkedGuidLow = fields[1].GetUInt32();
+ ObjectGuid::LowType guidLow = fields[0].GetUInt64();
+ ObjectGuid::LowType linkedGuidLow = fields[1].GetUInt64();
uint8 linkType = fields[2].GetUInt8();
ObjectGuid guid, linkedGuid;
@@ -1346,7 +1353,7 @@ void ObjectMgr::LoadLinkedRespawn()
const CreatureData* slave = GetCreatureData(guidLow);
if (!slave)
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (guid) '%u' not found in creature table", guidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (guid) '" UI64FMTD "' not found in creature table", guidLow);
error = true;
break;
}
@@ -1354,7 +1361,7 @@ void ObjectMgr::LoadLinkedRespawn()
const CreatureData* master = GetCreatureData(linkedGuidLow);
if (!master)
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (linkedGuid) '%u' not found in creature table", linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (linkedGuid) '" UI64FMTD "' not found in creature table", linkedGuidLow);
error = true;
break;
}
@@ -1362,7 +1369,7 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to Creature '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '" UI64FMTD "' linking to Creature '" UI64FMTD "' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1383,7 +1390,7 @@ void ObjectMgr::LoadLinkedRespawn()
const CreatureData* slave = GetCreatureData(guidLow);
if (!slave)
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (guid) '%u' not found in creature table", guidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (guid) '" UI64FMTD "' not found in creature table", guidLow);
error = true;
break;
}
@@ -1391,7 +1398,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* master = GetGOData(linkedGuidLow);
if (!master)
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) '%u' not found in gameobject table", linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) '" UI64FMTD "' not found in gameobject table", linkedGuidLow);
error = true;
break;
}
@@ -1399,14 +1406,14 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to Gameobject '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '" UI64FMTD "' linking to Gameobject '" UI64FMTD "' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to Gameobject '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '" UI64FMTD "' linking to Gameobject '" UI64FMTD "' with not corresponding spawnMask", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1420,7 +1427,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* slave = GetGOData(guidLow);
if (!slave)
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) '%u' not found in gameobject table", guidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) '" UI64FMTD "' not found in gameobject table", guidLow);
error = true;
break;
}
@@ -1428,7 +1435,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* master = GetGOData(linkedGuidLow);
if (!master)
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) '%u' not found in gameobject table", linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) '" UI64FMTD "' not found in gameobject table", linkedGuidLow);
error = true;
break;
}
@@ -1436,14 +1443,14 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Gameobject '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '" UI64FMTD "' linking to Gameobject '" UI64FMTD "' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Gameobject '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '" UI64FMTD "' linking to Gameobject '" UI64FMTD "' with not corresponding spawnMask", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1457,7 +1464,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* slave = GetGOData(guidLow);
if (!slave)
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) '%u' not found in gameobject table", guidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) '" UI64FMTD "' not found in gameobject table", guidLow);
error = true;
break;
}
@@ -1473,14 +1480,14 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Creature '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '" UI64FMTD "' linking to Creature '" UI64FMTD "' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Creature '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '" UI64FMTD "' linking to Creature '" UI64FMTD "' with not corresponding spawnMask", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1499,7 +1506,7 @@ void ObjectMgr::LoadLinkedRespawn()
TC_LOG_INFO("server.loading", ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
-bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
+bool ObjectMgr::SetCreatureLinkedRespawn(ObjectGuid::LowType guidLow, ObjectGuid::LowType linkedGuidLow)
{
if (!guidLow)
return false;
@@ -1512,7 +1519,7 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
{
_linkedRespawnStore.erase(guid);
PreparedStatement *stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CRELINKED_RESPAWN);
- stmt->setUInt32(0, guidLow);
+ stmt->setUInt64(0, guidLow);
WorldDatabase.Execute(stmt);
return true;
}
@@ -1520,20 +1527,20 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
CreatureData const* slave = GetCreatureData(linkedGuidLow);
if (!slave)
{
- TC_LOG_ERROR("sql.sql", "Creature '%u' linking to non-existent creature '%u'.", guidLow, linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "Creature '" UI64FMTD "' linking to non-existent creature '" UI64FMTD "'.", guidLow, linkedGuidLow);
return false;
}
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);
+ TC_LOG_ERROR("sql.sql", "Creature '" UI64FMTD "' linking to '" UI64FMTD "' on an unpermitted map.", guidLow, linkedGuidLow);
return false;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '" UI64FMTD "' linking to '" UI64FMTD "' with not corresponding spawnMask", guidLow, linkedGuidLow);
return false;
}
@@ -1541,8 +1548,8 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
_linkedRespawnStore[guid] = linkedGuid;
PreparedStatement *stmt = WorldDatabase.GetPreparedStatement(WORLD_REP_CREATURE_LINKED_RESPAWN);
- stmt->setUInt32(0, guidLow);
- stmt->setUInt32(1, linkedGuidLow);
+ stmt->setUInt64(0, guidLow);
+ stmt->setUInt64(1, linkedGuidLow);
WorldDatabase.Execute(stmt);
return true;
}
@@ -1667,13 +1674,13 @@ void ObjectMgr::LoadCreatures()
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
uint32 entry = fields[1].GetUInt32();
CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
if (!cInfo)
{
- TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD ") with non existing creature entry %u, skipped.", guid, entry);
continue;
}
@@ -1705,7 +1712,7 @@ void ObjectMgr::LoadCreatures()
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
if (!mapEntry)
{
- TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u) that spawned at nonexistent map (Id: %u), skipped.", guid, data.mapid);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD ") that spawned at nonexistent map (Id: %u), skipped.", guid, data.mapid);
continue;
}
@@ -1718,7 +1725,7 @@ void ObjectMgr::LoadCreatures()
{
if (_difficultyEntries[diff].find(data.id) != _difficultyEntries[diff].end())
{
- TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u) that is listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD ") that is listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
guid, diff + 1, data.id);
ok = false;
}
@@ -1739,19 +1746,19 @@ void ObjectMgr::LoadCreatures()
if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
{
if (!mapEntry || !mapEntry->IsDungeon())
- 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);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " 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` has creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " 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` has 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: " UI64FMTD " 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;
}
}
@@ -1759,26 +1766,26 @@ void ObjectMgr::LoadCreatures()
{
if (data.spawndist != 0.0f)
{
- 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);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id);
data.spawndist = 0.0f;
}
}
if (std::abs(data.orientation) > 2 * float(M_PI))
{
- TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with abs(`orientation`) > 2*PI (orientation is expressed in radians), normalized.", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " Entry: %u) with abs(`orientation`) > 2*PI (orientation is expressed in radians), normalized.", guid, data.id);
data.orientation = Position::NormalizeOrientation(data.orientation);
}
if (data.phaseMask == 0)
{
- 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);
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
data.phaseMask = 1;
}
if (data.phaseGroup && data.phaseid)
{
- TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: " UI64FMTD " Entry: %u) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
data.phaseGroup = 0;
}
@@ -1806,7 +1813,7 @@ void ObjectMgr::LoadCreatures()
TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " creatures in %u ms", _creatureDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
-void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
+void ObjectMgr::AddCreatureToGrid(ObjectGuid::LowType guid, CreatureData const* data)
{
uint8 mask = data->spawnMask;
for (uint8 i = 0; mask != 0; i++, mask >>= 1)
@@ -1820,7 +1827,7 @@ void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
}
}
-void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
+void ObjectMgr::RemoveCreatureFromGrid(ObjectGuid::LowType guid, CreatureData const* data)
{
uint8 mask = data->spawnMask;
for (uint8 i = 0; mask != 0; i++, mask >>= 1)
@@ -1834,17 +1841,17 @@ void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
}
}
-uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay, float rotation0, float rotation1, float rotation2, float rotation3)
+ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay, float rotation0, float rotation1, float rotation2, float rotation3)
{
GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry);
if (!goinfo)
- return 0;
+ return UI64LIT(0);
Map* map = sMapMgr->CreateBaseMap(mapId);
if (!map)
- return 0;
+ return UI64LIT(0);
- uint32 guid = GenerateLowGuid(HIGHGUID_GAMEOBJECT);
+ ObjectGuid::LowType guid = GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate();
GameObjectData& data = NewGOData(guid);
data.id = entry;
data.mapid = mapId;
@@ -1875,16 +1882,16 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float
{
TC_LOG_ERROR("misc", "AddGOData: cannot add gameobject entry %u to map", entry);
delete go;
- return 0;
+ return UI64LIT(0);
}
}
- TC_LOG_DEBUG("maps", "AddGOData: dbguid %u entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o);
+ TC_LOG_DEBUG("maps", "AddGOData: dbguid " UI64FMTD " entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o);
return guid;
}
-bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, const Position& pos)
+bool ObjectMgr::MoveCreData(ObjectGuid::LowType guid, uint32 mapId, const Position& pos)
{
CreatureData& data = NewOrExistCreatureData(guid);
if (!data.id)
@@ -1917,16 +1924,16 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, const Position& pos)
return true;
}
-uint32 ObjectMgr::AddCreData(uint32 entry, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay /*= 0*/)
+ObjectGuid::LowType ObjectMgr::AddCreData(uint32 entry, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay /*= 0*/)
{
CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
if (!cInfo)
- return 0;
+ return UI64LIT(0);
uint32 level = cInfo->minlevel == cInfo->maxlevel ? cInfo->minlevel : urand(cInfo->minlevel, cInfo->maxlevel); // Only used for extracting creature base stats
CreatureBaseStats const* stats = GetCreatureBaseStats(level, cInfo->unit_class);
- uint32 guid = GenerateLowGuid(HIGHGUID_UNIT);
+ ObjectGuid::LowType guid = GetGenerator<HIGHGUID_UNIT>()->Generate();
CreatureData& data = NewOrExistCreatureData(guid);
data.id = entry;
data.mapid = mapId;
@@ -1962,7 +1969,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 mapId, float x, float y, float
{
TC_LOG_ERROR("misc", "AddCreature: Cannot add creature entry %u to map", entry);
delete creature;
- return 0;
+ return UI64LIT(0);
}
}
}
@@ -2001,13 +2008,13 @@ void ObjectMgr::LoadGameobjects()
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
uint32 entry = fields[1].GetUInt32();
GameObjectTemplate const* gInfo = GetGameObjectTemplate(entry);
if (!gInfo)
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD ") with non existing gameobject entry %u, skipped.", guid, entry);
continue;
}
@@ -2019,14 +2026,14 @@ void ObjectMgr::LoadGameobjects()
case GAMEOBJECT_TYPE_SPELL_FOCUS:
break;
default:
- TC_LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
+ TC_LOG_ERROR("sql.sql", "Gameobject (GUID: " UI64FMTD " Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
break;
}
}
if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId))
{
- TC_LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
+ TC_LOG_ERROR("sql.sql", "Gameobject (GUID: " UI64FMTD " Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
continue;
}
@@ -2047,13 +2054,13 @@ void ObjectMgr::LoadGameobjects()
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
if (!mapEntry)
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid);
continue;
}
if (data.spawntimesecs == 0 && gInfo->IsDespawnAtAction())
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id);
}
data.animprogress = fields[12].GetUInt8();
@@ -2064,7 +2071,7 @@ void ObjectMgr::LoadGameobjects()
{
if (gInfo->type != GAMEOBJECT_TYPE_TRANSPORT || go_state > GO_STATE_TRANSPORT_ACTIVE + MAX_GO_STATE_TRANSPORT_STOP_FRAMES)
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state);
continue;
}
}
@@ -2073,7 +2080,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 unsupported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " 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();
@@ -2083,37 +2090,37 @@ void ObjectMgr::LoadGameobjects()
if (data.phaseGroup && data.phaseid)
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: %u Entry: %u) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: " UI64FMTD " Entry: %u) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
data.phaseGroup = 0;
}
if (std::abs(data.orientation) > 2 * float(M_PI))
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with abs(`orientation`) > 2*PI (orientation is expressed in radians), normalized.", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with abs(`orientation`) > 2*PI (orientation is expressed in radians), normalized.", guid, data.id);
data.orientation = Position::NormalizeOrientation(data.orientation);
}
if (data.rotation2 < -1.0f || data.rotation2 > 1.0f)
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2);
continue;
}
if (data.rotation3 < -1.0f || data.rotation3 > 1.0f)
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3);
continue;
}
if (!MapManager::IsValidMapCoord(data.mapid, data.posX, data.posY, data.posZ, data.orientation))
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with invalid coordinates, skip", guid, data.id);
continue;
}
if (data.phaseMask == 0)
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
data.phaseMask = 1;
}
@@ -2140,7 +2147,7 @@ void ObjectMgr::LoadGameobjects()
TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " gameobjects in %u ms", _gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
-void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
+void ObjectMgr::AddGameobjectToGrid(ObjectGuid::LowType guid, GameObjectData const* data)
{
uint8 mask = data->spawnMask;
for (uint8 i = 0; mask != 0; i++, mask >>= 1)
@@ -2154,7 +2161,7 @@ void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
}
}
-void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data)
+void ObjectMgr::RemoveGameobjectFromGrid(ObjectGuid::LowType guid, GameObjectData const* data)
{
uint8 mask = data->spawnMask;
for (uint8 i = 0; mask != 0; i++, mask >>= 1)
@@ -2168,10 +2175,9 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data
}
}
-Player* ObjectMgr::GetPlayerByLowGUID(uint32 lowguid) const
+Player* ObjectMgr::GetPlayerByLowGUID(ObjectGuid::LowType lowguid) const
{
- ObjectGuid guid(HIGHGUID_PLAYER, lowguid);
- return ObjectAccessor::FindPlayer(guid);
+ return ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, lowguid));
}
// name must be checked to correctness (if received) before call this function
@@ -2977,7 +2983,7 @@ void ObjectMgr::LoadVehicleAccessories()
{
Field* fields = result->Fetch();
- uint32 uiGUID = fields[0].GetUInt32();
+ ObjectGuid::LowType uiGUID = fields[0].GetUInt64();
uint32 uiAccessory = fields[1].GetUInt32();
int8 uiSeat = int8(fields[2].GetInt16());
bool bMinion = fields[3].GetBool();
@@ -5552,7 +5558,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
do
{
Field* fields = items->Fetch();
- item.item_guid = fields[0].GetUInt32();
+ item.item_guid = fields[0].GetUInt64();
item.item_template = fields[1].GetUInt32();
uint32 mailId = fields[2].GetUInt32();
itemsCache[mailId].push_back(item);
@@ -5567,8 +5573,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
Mail* m = new Mail;
m->messageID = fields[0].GetUInt32();
m->messageType = fields[1].GetUInt8();
- m->sender = fields[2].GetUInt32();
- m->receiver = fields[3].GetUInt32();
+ m->sender = fields[2].GetUInt64();
+ m->receiver = fields[3].GetUInt64();
bool has_items = fields[4].GetBool();
m->expire_time = time_t(fields[5].GetUInt32());
m->deliver_time = 0;
@@ -5600,7 +5606,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
- stmt->setUInt32(0, itr2->item_guid);
+ stmt->setUInt64(0, itr2->item_guid);
CharacterDatabase.Execute(stmt);
}
}
@@ -5608,8 +5614,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
{
// Mail will be returned
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL_RETURNED);
- stmt->setUInt32(0, m->receiver);
- stmt->setUInt32(1, m->sender);
+ stmt->setUInt64(0, m->receiver);
+ stmt->setUInt64(1, m->sender);
stmt->setUInt32(2, basetime + 30 * DAY);
stmt->setUInt32(3, basetime);
stmt->setUInt8 (4, uint8(MAIL_CHECK_MASK_RETURNED));
@@ -5619,13 +5625,13 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
{
// Update receiver in mail items for its proper delivery, and in instance_item for avoid lost item at sender delete
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL_ITEM_RECEIVER);
- stmt->setUInt32(0, m->sender);
- stmt->setUInt32(1, itr2->item_guid);
+ stmt->setUInt64(0, m->sender);
+ stmt->setUInt64(1, itr2->item_guid);
CharacterDatabase.Execute(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER);
- stmt->setUInt32(0, m->sender);
- stmt->setUInt32(1, itr2->item_guid);
+ stmt->setUInt64(0, m->sender);
+ stmt->setUInt64(1, itr2->item_guid);
CharacterDatabase.Execute(stmt);
}
delete m;
@@ -6375,29 +6381,29 @@ void ObjectMgr::SetHighestGuids()
{
QueryResult result = CharacterDatabase.Query("SELECT MAX(guid) FROM characters");
if (result)
- _hiCharGuid = (*result)[0].GetUInt64()+1;
+ _playerGuidGenerator.Set((*result)[0].GetUInt64() + 1);
result = WorldDatabase.Query("SELECT MAX(guid) FROM creature");
if (result)
- _hiCreatureGuid = (*result)[0].GetUInt32()+1;
+ _creatureGuidGenerator.Set((*result)[0].GetUInt64() + 1);
result = CharacterDatabase.Query("SELECT MAX(guid) FROM item_instance");
if (result)
- _hiItemGuid = (*result)[0].GetUInt32()+1;
+ _itemGuidGenerator.Set((*result)[0].GetUInt64() + 1);
// 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
- CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", _hiItemGuid); // One-time query
+ CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '%u'", _itemGuidGenerator.GetNextAfterMaxUsed()); // One-time query
+ CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '%u'", _itemGuidGenerator.GetNextAfterMaxUsed()); // One-time query
+ CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE itemguid >= '%u'", _itemGuidGenerator.GetNextAfterMaxUsed()); // One-time query
+ CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", _itemGuidGenerator.GetNextAfterMaxUsed()); // One-time query
result = WorldDatabase.Query("SELECT MAX(guid) FROM gameobject");
if (result)
- _hiGoGuid = (*result)[0].GetUInt32()+1;
+ _gameObjectGuidGenerator.Set((*result)[0].GetUInt32() + 1);
result = WorldDatabase.Query("SELECT MAX(guid) FROM transports");
if (result)
- _hiMoTransGuid = (*result)[0].GetUInt32()+1;
+ _moTransportGuidGenerator.Set((*result)[0].GetUInt32() + 1);
result = CharacterDatabase.Query("SELECT MAX(id) FROM auctionhouse");
if (result)
@@ -6409,7 +6415,7 @@ void ObjectMgr::SetHighestGuids()
result = CharacterDatabase.Query("SELECT MAX(corpseGuid) FROM corpse");
if (result)
- _hiCorpseGuid = (*result)[0].GetUInt64()+1;
+ _corpseGuidGenerator.Set((*result)[0].GetUInt64() + 1);
result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team");
if (result)
@@ -6462,66 +6468,6 @@ uint32 ObjectMgr::GenerateMailID()
return _mailId++;
}
-uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
-{
- switch (guidhigh)
- {
- case HIGHGUID_ITEM:
- {
- ASSERT(_hiItemGuid < 0xFFFFFFFE && "Item guid overflow!");
- return _hiItemGuid++;
- }
- case HIGHGUID_UNIT:
- {
- ASSERT(_hiCreatureGuid < 0x00FFFFFE && "Creature guid overflow!");
- return _hiCreatureGuid++;
- }
- case HIGHGUID_PET:
- {
- ASSERT(_hiPetGuid < 0x00FFFFFE && "Pet guid overflow!");
- return _hiPetGuid++;
- }
- case HIGHGUID_VEHICLE:
- {
- ASSERT(_hiVehicleGuid < 0x00FFFFFF && "Vehicle guid overflow!");
- return _hiVehicleGuid++;
- }
- case HIGHGUID_PLAYER:
- {
- ASSERT(_hiCharGuid < 0xFFFFFFFE && "Player guid overflow!");
- return _hiCharGuid++;
- }
- case HIGHGUID_GAMEOBJECT:
- {
- ASSERT(_hiGoGuid < 0x00FFFFFE && "Gameobject guid overflow!");
- return _hiGoGuid++;
- }
- case HIGHGUID_CORPSE:
- {
- ASSERT(_hiCorpseGuid < 0xFFFFFFFE && "Corpse guid overflow!");
- return _hiCorpseGuid++;
- }
- case HIGHGUID_AREATRIGGER:
- {
- ASSERT(_hiAreaTriggerGuid < 0xFFFFFFFE && "AreaTrigger guid overflow!");
- return _hiAreaTriggerGuid++;
- }
- case HIGHGUID_DYNAMICOBJECT:
- {
- ASSERT(_hiDoGuid < 0xFFFFFFFE && "DynamicObject guid overflow!");
- return _hiDoGuid++;
- }
- case HIGHGUID_MO_TRANSPORT:
- {
- ASSERT(_hiMoTransGuid < 0xFFFFFFFE && "MO Transport guid overflow!");
- return _hiMoTransGuid++;
- }
- default:
- ASSERT(false && "ObjectMgr::GenerateLowGuid - Unknown HIGHGUID type");
- return 0;
- }
-}
-
void ObjectMgr::LoadGameObjectLocales()
{
uint32 oldMSTime = getMSTime();
@@ -7425,7 +7371,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
TC_LOG_INFO("server.loading", ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
-void ObjectMgr::DeleteCreatureData(uint32 guid)
+void ObjectMgr::DeleteCreatureData(ObjectGuid::LowType guid)
{
// remove mapid*cellid -> guid_set map
CreatureData const* data = GetCreatureData(guid);
@@ -7435,7 +7381,7 @@ void ObjectMgr::DeleteCreatureData(uint32 guid)
_creatureDataStore.erase(guid);
}
-void ObjectMgr::DeleteGOData(uint32 guid)
+void ObjectMgr::DeleteGOData(ObjectGuid::LowType guid)
{
// remove mapid*cellid -> guid_set map
GameObjectData const* data = GetGOData(guid);
@@ -9335,7 +9281,7 @@ VehicleAccessoryList const* ObjectMgr::GetVehicleAccessoryList(Vehicle* veh) con
}
// Otherwise return entry-based
- VehicleAccessoryContainer::const_iterator itr = _vehicleTemplateAccessoryStore.find(veh->GetCreatureEntry());
+ VehicleAccessoryTemplateContainer::const_iterator itr = _vehicleTemplateAccessoryStore.find(veh->GetCreatureEntry());
if (itr != _vehicleTemplateAccessoryStore.end())
return &itr->second;
return NULL;
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 798998d3c12..186519e143f 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -479,7 +479,7 @@ struct BroadcastText
typedef std::unordered_map<uint32, BroadcastText> BroadcastTextContainer;
-typedef std::set<uint32> CellGuidSet;
+typedef std::set<ObjectGuid::LowType> CellGuidSet;
typedef std::map<ObjectGuid/*player guid*/, uint32/*instance*/> CellCorpseSet;
struct CellObjectGuids
{
@@ -499,8 +499,8 @@ struct TrinityString
};
typedef std::map<ObjectGuid, ObjectGuid> LinkedRespawnContainer;
-typedef std::unordered_map<uint32, CreatureData> CreatureDataContainer;
-typedef std::unordered_map<uint32, GameObjectData> GameObjectDataContainer;
+typedef std::unordered_map<ObjectGuid::LowType, CreatureData> CreatureDataContainer;
+typedef std::unordered_map<ObjectGuid::LowType, GameObjectData> GameObjectDataContainer;
typedef std::map<TempSummonGroupKey, std::vector<TempSummonData> > TempSummonDataContainer;
typedef std::unordered_map<uint32, CreatureLocale> CreatureLocaleContainer;
typedef std::unordered_map<uint32, GameObjectLocale> GameObjectLocaleContainer;
@@ -754,7 +754,7 @@ class ObjectMgr
typedef std::map<uint32, uint32> CharacterConversionMap;
- Player* GetPlayerByLowGUID(uint32 lowguid) const;
+ Player* GetPlayerByLowGUID(ObjectGuid::LowType lowguid) const;
GameObjectTemplate const* GetGameObjectTemplate(uint32 entry);
GameObjectTemplateContainer const* GetGameObjectTemplates() const { return &_gameObjectTemplateStore; }
@@ -770,7 +770,7 @@ class ObjectMgr
static uint32 ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data = NULL);
static void ChooseCreatureFlags(CreatureTemplate const* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, CreatureData const* data = NULL);
EquipmentInfo const* GetEquipmentInfo(uint32 entry, int8& id);
- CreatureAddon const* GetCreatureAddon(uint32 lowguid);
+ CreatureAddon const* GetCreatureAddon(ObjectGuid::LowType lowguid);
CreatureAddon const* GetCreatureTemplateAddon(uint32 entry);
ItemTemplate const* GetItemTemplate(uint32 entry);
ItemTemplateContainer const* GetItemTemplateStore() const { return &_itemTemplateStore; }
@@ -998,7 +998,7 @@ class ObjectMgr
void LoadTempSummons();
void LoadCreatures();
void LoadLinkedRespawn();
- bool SetCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid);
+ bool SetCreatureLinkedRespawn(ObjectGuid::LowType guid, ObjectGuid::LowType linkedGuid);
void LoadCreatureAddons();
void LoadCreatureModelInfo();
void LoadEquipmentTemplates();
@@ -1075,7 +1075,8 @@ class ObjectMgr
CreatureBaseStats const* GetCreatureBaseStats(uint8 level, uint8 unitClass);
void SetHighestGuids();
- uint32 GenerateLowGuid(HighGuid guidhigh);
+ template<HighGuid type>
+ ObjectGuidGenerator<type>* GetGenerator();
uint32 GenerateAuctionID();
uint64 GenerateEquipmentSetGuid();
uint32 GenerateMailID();
@@ -1136,14 +1137,14 @@ class ObjectMgr
return NULL;
}
- CreatureData const* GetCreatureData(uint32 guid) const
+ CreatureData const* GetCreatureData(ObjectGuid::LowType guid) const
{
CreatureDataContainer::const_iterator itr = _creatureDataStore.find(guid);
if (itr == _creatureDataStore.end()) return NULL;
return &itr->second;
}
- CreatureData& NewOrExistCreatureData(uint32 guid) { return _creatureDataStore[guid]; }
- void DeleteCreatureData(uint32 guid);
+ CreatureData& NewOrExistCreatureData(ObjectGuid::LowType guid) { return _creatureDataStore[guid]; }
+ void DeleteCreatureData(ObjectGuid::LowType guid);
ObjectGuid GetLinkedRespawnGuid(ObjectGuid guid) const
{
LinkedRespawnContainer::const_iterator itr = _linkedRespawnStore.find(guid);
@@ -1199,14 +1200,14 @@ class ObjectMgr
return &itr->second;
}
- GameObjectData const* GetGOData(uint32 guid) const
+ GameObjectData const* GetGOData(ObjectGuid::LowType guid) const
{
GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(guid);
if (itr == _gameObjectDataStore.end()) return NULL;
return &itr->second;
}
- GameObjectData& NewGOData(uint32 guid) { return _gameObjectDataStore[guid]; }
- void DeleteGOData(uint32 guid);
+ GameObjectData& NewGOData(ObjectGuid::LowType guid) { return _gameObjectDataStore[guid]; }
+ void DeleteGOData(ObjectGuid::LowType guid);
TrinityString const* GetTrinityString(uint32 entry) const
{
@@ -1224,13 +1225,13 @@ class ObjectMgr
void DeleteCorpseCellData(uint32 mapid, uint32 cellid, ObjectGuid player_guid);
// grid objects
- void AddCreatureToGrid(uint32 guid, CreatureData const* data);
- void RemoveCreatureFromGrid(uint32 guid, CreatureData const* data);
- void AddGameobjectToGrid(uint32 guid, GameObjectData const* data);
- void RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data);
- uint32 AddGOData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0, float rotation0 = 0, float rotation1 = 0, float rotation2 = 0, float rotation3 = 0);
- uint32 AddCreData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0);
- bool MoveCreData(uint32 guid, uint32 map, const Position& pos);
+ void AddCreatureToGrid(ObjectGuid::LowType guid, CreatureData const* data);
+ void RemoveCreatureFromGrid(ObjectGuid::LowType guid, CreatureData const* data);
+ void AddGameobjectToGrid(ObjectGuid::LowType guid, GameObjectData const* data);
+ void RemoveGameobjectFromGrid(ObjectGuid::LowType guid, GameObjectData const* data);
+ ObjectGuid::LowType AddGOData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0, float rotation0 = 0, float rotation1 = 0, float rotation2 = 0, float rotation3 = 0);
+ ObjectGuid::LowType AddCreData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0);
+ bool MoveCreData(ObjectGuid::LowType guid, uint32 map, const Position& pos);
// reserved names
void LoadReservedPlayersNames();
@@ -1376,16 +1377,16 @@ class ObjectMgr
uint64 _voidItemId;
// first free low guid for selected guid type
- uint32 _hiCharGuid;
- uint32 _hiCreatureGuid;
- uint32 _hiPetGuid;
- uint32 _hiVehicleGuid;
- uint32 _hiItemGuid;
- uint32 _hiGoGuid;
- uint32 _hiDoGuid;
- uint32 _hiCorpseGuid;
- uint32 _hiAreaTriggerGuid;
- uint32 _hiMoTransGuid;
+ ObjectGuidGenerator<HIGHGUID_PLAYER> _playerGuidGenerator;
+ ObjectGuidGenerator<HIGHGUID_UNIT> _creatureGuidGenerator;
+ ObjectGuidGenerator<HIGHGUID_PET> _petGuidGenerator;
+ ObjectGuidGenerator<HIGHGUID_VEHICLE> _vehicleGuidGenerator;
+ ObjectGuidGenerator<HIGHGUID_ITEM> _itemGuidGenerator;
+ ObjectGuidGenerator<HIGHGUID_GAMEOBJECT> _gameObjectGuidGenerator;
+ ObjectGuidGenerator<HIGHGUID_DYNAMICOBJECT> _dynamicObjectGuidGenerator;
+ ObjectGuidGenerator<HIGHGUID_CORPSE> _corpseGuidGenerator;
+ ObjectGuidGenerator<HIGHGUID_AREATRIGGER> _areaTriggerGuidGenerator;
+ ObjectGuidGenerator<HIGHGUID_MO_TRANSPORT> _moTransportGuidGenerator;
QuestMap _questTemplates;
@@ -1432,7 +1433,7 @@ class ObjectMgr
SpellScriptsContainer _spellScriptsStore;
- VehicleAccessoryContainer _vehicleTemplateAccessoryStore;
+ VehicleAccessoryTemplateContainer _vehicleTemplateAccessoryStore;
VehicleAccessoryContainer _vehicleAccessoryStore;
LocaleConstant DBCLocaleIndex;
@@ -1478,7 +1479,7 @@ class ObjectMgr
CreatureTemplateContainer _creatureTemplateStore;
CreatureModelContainer _creatureModelStore;
CreatureAddonContainer _creatureAddonStore;
- CreatureAddonContainer _creatureTemplateAddonStore;
+ CreatureTemplateAddonContainer _creatureTemplateAddonStore;
EquipmentInfoContainer _equipmentInfoStore;
LinkedRespawnContainer _linkedRespawnStore;
CreatureLocaleContainer _creatureLocaleStore;
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index d78f7c2e44f..480bbc84342 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -738,13 +738,13 @@ namespace Trinity
class GameObjectWithDbGUIDCheck
{
public:
- GameObjectWithDbGUIDCheck(WorldObject const& /*obj*/, uint32 db_guid) : i_db_guid(db_guid) { }
+ GameObjectWithDbGUIDCheck(WorldObject const& /*obj*/, ObjectGuid::LowType db_guid) : i_db_guid(db_guid) { }
bool operator()(GameObject const* go) const
{
return go->GetDBTableGUIDLow() == i_db_guid;
}
private:
- uint32 i_db_guid;
+ ObjectGuid::LowType i_db_guid;
};
// Unit checks
@@ -851,13 +851,13 @@ namespace Trinity
class CreatureWithDbGUIDCheck
{
public:
- CreatureWithDbGUIDCheck(WorldObject const* /*obj*/, uint32 lowguid) : i_lowguid(lowguid) { }
+ CreatureWithDbGUIDCheck(WorldObject const* /*obj*/, ObjectGuid::LowType lowguid) : i_lowguid(lowguid) { }
bool operator()(Creature* u)
{
return u->GetDBTableGUIDLow() == i_lowguid;
}
private:
- uint32 i_lowguid;
+ ObjectGuid::LowType i_lowguid;
};
class AnyFriendlyUnitInObjectRangeCheck
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp
index e9a7b6cf221..1b95253f7cf 100644
--- a/src/server/game/Grids/ObjectGridLoader.cpp
+++ b/src/server/game/Grids/ObjectGridLoader.cpp
@@ -119,7 +119,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T>
for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
{
T* obj = new T;
- uint32 guid = *i_guid;
+ ObjectGuid::LowType guid = *i_guid;
//TC_LOG_INFO("misc", "DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid);
if (!obj->LoadFromDB(guid, map))
{
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 80e3b0388df..6109524cd21 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -92,9 +92,8 @@ Group::~Group()
bool Group::Create(Player* leader)
{
ObjectGuid leaderGuid = leader->GetGUID();
- uint32 lowguid = sGroupMgr->GenerateGroupId();
- m_guid = ObjectGuid(HIGHGUID_GROUP, lowguid);
+ m_guid = ObjectGuid(HIGHGUID_GROUP, sGroupMgr->GenerateGroupId());
m_leaderGuid = leaderGuid;
m_leaderName = leader->GetName();
leader->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
@@ -164,14 +163,14 @@ void Group::LoadGroupFromDB(Field* fields)
{
m_dbStoreId = fields[16].GetUInt32();
m_guid = ObjectGuid(HIGHGUID_GROUP, sGroupMgr->GenerateGroupId());
- m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
+ m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt64());
// group leader not exist
if (!sObjectMgr->GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
return;
m_lootMethod = LootMethod(fields[1].GetUInt8());
- m_looterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32());
+ m_looterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt64());
m_lootThreshold = ItemQualities(fields[3].GetUInt8());
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
@@ -193,7 +192,7 @@ void Group::LoadGroupFromDB(Field* fields)
else
m_raidDifficulty = Difficulty(r_diff);
- m_masterLooterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[15].GetUInt32());
+ m_masterLooterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[15].GetUInt64());
if (m_groupType & GROUPTYPE_LFG)
sLFGMgr->_LoadFromDB(fields, GetGUID());
@@ -565,7 +564,7 @@ bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_R
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
- stmt->setUInt32(0, guid.GetCounter());
+ stmt->setUInt64(0, guid.GetCounter());
CharacterDatabase.Execute(stmt);
DelinkMember(guid);
}
@@ -959,7 +958,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))
{
- ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->Generate());
Roll* r = new Roll(newitemGUID, *i);
//a vector is filled with only near party members
@@ -1043,7 +1042,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
continue;
}
- ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->Generate());
Roll* r = new Roll(newitemGUID, *i);
//a vector is filled with only near party members
@@ -1104,7 +1103,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))
{
- ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->Generate());
Roll* r = new Roll(newitemGUID, *i);
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
@@ -1179,7 +1178,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
continue;
item = sObjectMgr->GetItemTemplate(i->itemid);
- ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM));
+ ObjectGuid newitemGUID = ObjectGuid(HIGHGUID_ITEM, sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->Generate());
Roll* r = new Roll(newitemGUID, *i);
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
@@ -2266,11 +2265,6 @@ ObjectGuid Group::GetGUID() const
return m_guid;
}
-uint32 Group::GetLowGUID() const
-{
- return m_guid.GetCounter();
-}
-
char const* Group::GetLeaderName() const
{
return m_leaderName.c_str();
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index b5946a73a17..0bdfbf24a71 100644
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -215,7 +215,6 @@ class Group
bool IsCreated() const;
ObjectGuid GetLeaderGUID() const;
ObjectGuid GetGUID() const;
- uint32 GetLowGUID() const;
const char * GetLeaderName() const;
LootMethod GetLootMethod() const;
ObjectGuid GetLooterGuid() const;
diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp
index 4a2384d0918..92f9bbd20d4 100644
--- a/src/server/game/Groups/GroupMgr.cpp
+++ b/src/server/game/Groups/GroupMgr.cpp
@@ -24,7 +24,7 @@
GroupMgr::GroupMgr()
{
NextGroupDbStoreId = 1;
- NextGroupId = 1;
+ NextGroupId = UI64LIT(1);
}
GroupMgr::~GroupMgr()
@@ -82,7 +82,7 @@ Group* GroupMgr::GetGroupByDbStoreId(uint32 storageId) const
return NULL;
}
-uint32 GroupMgr::GenerateGroupId()
+ObjectGuid::LowType GroupMgr::GenerateGroupId()
{
if (NextGroupId >= 0xFFFFFFFE)
{
@@ -103,12 +103,12 @@ Group* GroupMgr::GetGroupByGUID(ObjectGuid const& groupId) const
void GroupMgr::AddGroup(Group* group)
{
- GroupStore[group->GetLowGUID()] = group;
+ GroupStore[group->GetGUID().GetCounter()] = group;
}
void GroupMgr::RemoveGroup(Group* group)
{
- GroupStore.erase(group->GetLowGUID());
+ GroupStore.erase(group->GetGUID().GetCounter());
}
void GroupMgr::LoadGroups()
diff --git a/src/server/game/Groups/GroupMgr.h b/src/server/game/Groups/GroupMgr.h
index 3e053921f74..74cbbf8df35 100644
--- a/src/server/game/Groups/GroupMgr.h
+++ b/src/server/game/Groups/GroupMgr.h
@@ -33,7 +33,7 @@ public:
return &instance;
}
- typedef std::map<uint32, Group*> GroupContainer;
+ typedef std::map<ObjectGuid::LowType, Group*> GroupContainer;
typedef std::vector<Group*> GroupDbContainer;
Group* GetGroupByGUID(ObjectGuid const& guid) const;
@@ -46,13 +46,13 @@ public:
void SetGroupDbStoreSize(uint32 newSize) { GroupDbStore.resize(newSize); }
void LoadGroups();
- uint32 GenerateGroupId();
+ ObjectGuid::LowType GenerateGroupId();
void AddGroup(Group* group);
void RemoveGroup(Group* group);
protected:
- uint32 NextGroupId;
+ ObjectGuid::LowType NextGroupId;
uint32 NextGroupDbStoreId;
GroupContainer GroupStore;
GroupDbContainer GroupDbStore;
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index ac7e25cb2cd..84a466e5001 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -2724,7 +2724,7 @@ bool Guild::AddMember(ObjectGuid guid, uint8 rankId)
{
m_members[guid] = member;
player->SetInGuild(m_id);
- player->SetGuildIdInvited(0);
+ player->SetGuildIdInvited(UI64LIT(0));
player->SetRank(rankId);
player->SetGuildLevel(GetLevel());
SendLoginInfo(player->GetSession());
@@ -2824,7 +2824,7 @@ void Guild::DeleteMember(ObjectGuid guid, bool isDisbanding, bool isKicked, bool
// If player not online data in data field will be loaded from guild tabs no need to update it !!
if (player)
{
- player->SetInGuild(0);
+ player->SetInGuild(UI64LIT(0));
player->SetRank(0);
player->SetGuildLevel(0);
diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp
index 7e9f0f78d3b..91d8499cdc9 100644
--- a/src/server/game/Guilds/GuildMgr.cpp
+++ b/src/server/game/Guilds/GuildMgr.cpp
@@ -18,7 +18,7 @@
#include "Common.h"
#include "GuildMgr.h"
-GuildMgr::GuildMgr() : NextGuildId(1)
+GuildMgr::GuildMgr() : NextGuildId(UI64LIT(1))
{ }
GuildMgr::~GuildMgr()
@@ -88,7 +88,7 @@ Guild* GuildMgr::GetGuildByName(const std::string& guildName) const
return NULL;
}
-std::string GuildMgr::GetGuildNameById(uint32 guildId) const
+std::string GuildMgr::GetGuildNameById(ObjectGuid::LowType guildId) const
{
if (Guild* guild = GetGuildById(guildId))
return guild->GetName();
@@ -175,7 +175,7 @@ void GuildMgr::LoadGuilds()
do
{
Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt64();
+ uint64 guildId = fields[0].GetUInt64();
if (Guild* guild = GetGuildById(guildId))
guild->LoadRankFromDB(fields);
@@ -214,7 +214,7 @@ void GuildMgr::LoadGuilds()
do
{
Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt64();
+ uint64 guildId = fields[0].GetUInt64();
if (Guild* guild = GetGuildById(guildId))
guild->LoadMemberFromDB(fields);
@@ -248,7 +248,7 @@ void GuildMgr::LoadGuilds()
do
{
Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt64();
+ uint64 guildId = fields[0].GetUInt64();
if (Guild* guild = GetGuildById(guildId))
guild->LoadBankRightFromDB(fields);
@@ -281,7 +281,7 @@ void GuildMgr::LoadGuilds()
do
{
Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt64();
+ uint64 guildId = fields[0].GetUInt64();
if (Guild* guild = GetGuildById(guildId))
guild->LoadEventLogFromDB(fields);
@@ -315,7 +315,7 @@ void GuildMgr::LoadGuilds()
do
{
Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt64();
+ uint64 guildId = fields[0].GetUInt64();
if (Guild* guild = GetGuildById(guildId))
guild->LoadBankEventLogFromDB(fields);
@@ -346,7 +346,7 @@ void GuildMgr::LoadGuilds()
do
{
Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt64();
+ uint64 guildId = fields[0].GetUInt64();
if (Guild* guild = GetGuildById(guildId))
guild->LoadGuildNewsLogFromDB(fields);
@@ -381,7 +381,7 @@ void GuildMgr::LoadGuilds()
do
{
Field* fields = result->Fetch();
- uint32 guildId = fields[0].GetUInt64();
+ uint64 guildId = fields[0].GetUInt64();
if (Guild* guild = GetGuildById(guildId))
guild->LoadBankTabFromDB(fields);
@@ -417,7 +417,7 @@ void GuildMgr::LoadGuilds()
do
{
Field* fields = result->Fetch();
- uint32 guildId = fields[11].GetUInt64();
+ uint64 guildId = fields[11].GetUInt64();
if (Guild* guild = GetGuildById(guildId))
guild->LoadBankItemFromDB(fields);
diff --git a/src/server/game/Guilds/GuildMgr.h b/src/server/game/Guilds/GuildMgr.h
index c01cc561e58..f91629f04e8 100644
--- a/src/server/game/Guilds/GuildMgr.h
+++ b/src/server/game/Guilds/GuildMgr.h
@@ -37,7 +37,7 @@ public:
Guild* GetGuildById(ObjectGuid::LowType guildId) const;
Guild* GetGuildByGuid(ObjectGuid guid) const;
Guild* GetGuildByName(std::string const& guildName) const;
- std::string GetGuildNameById(uint32 guildId) const;
+ std::string GetGuildNameById(ObjectGuid::LowType guildId) const;
void LoadGuildXpForLevel();
void LoadGuildRewards();
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index 5fcf8139ea1..e5f537426cf 100644
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -72,7 +72,7 @@ void WorldSession::SendBattleGroundList(ObjectGuid guid, BattlegroundTypeId bgTy
void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
{
- ObjectGuid::LowType bgTypeId_;
+ uint32 bgTypeId_;
uint32 instanceId;
uint8 asGroup;
bool isPremade = false;
@@ -100,7 +100,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
recvData.ReadByteSeq(guid[1]);
//extract from guid
- bgTypeId_ = guid.GetCounter();
+ bgTypeId_ = uint64(guid.GetCounter()) & 0xFFFFFFFF;
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
{
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index 04b9fc5454f..4d008a940c8 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -246,7 +246,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
return;
}
- CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
+ CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, UI64LIT(0), CalendarEventType(type), dungeonId,
time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);
if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
@@ -451,7 +451,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
- inviteeGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
+ inviteeGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt64());
inviteeTeam = Player::TeamForRace(fields[1].GetUInt8());
inviteeGuildId = Player::GetGuildIdFromDB(inviteeGuid);
}
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index da13796817d..3b236d18a8e 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -126,12 +126,12 @@ bool LoginQueryHolder::Initialize()
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ACTIONS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILCOUNT);
- stmt->setUInt32(0, lowGuid);
+ stmt->setUInt64(0, lowGuid);
stmt->setUInt64(1, uint64(time(NULL)));
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILDATE);
- stmt->setUInt32(0, lowGuid);
+ stmt->setUInt64(0, lowGuid);
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_DATE, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SOCIALLIST);
@@ -214,7 +214,7 @@ bool LoginQueryHolder::Initialize()
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PLAYER_CURRENCY);
- stmt->setUInt32(0, lowGuid);
+ stmt->setUInt64(0, lowGuid);
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_CURRENCY, stmt);
return res;
@@ -632,7 +632,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
Player newChar(this);
newChar.GetMotionMaster()->Initialize();
- if (!newChar.Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PLAYER), createInfo))
+ if (!newChar.Create(sObjectMgr->GetGenerator<HIGHGUID_PLAYER>()->Generate(), createInfo))
{
// Player not create (race/class/etc problem?)
newChar.CleanupsBeforeDelete();
@@ -929,7 +929,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
}
else if (pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
{
- pCurrChar->SetInGuild(0);
+ pCurrChar->SetInGuild(UI64LIT(0));
pCurrChar->SetRank(0);
pCurrChar->SetGuildLevel(0);
}
@@ -982,15 +982,15 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
sObjectAccessor->AddObject(pCurrChar);
//TC_LOG_DEBUG("Player %s added to Map.", pCurrChar->GetName().c_str());
- if (pCurrChar->GetGuildId() != 0)
+ if (pCurrChar->GetGuildId())
{
if (Guild* guild = sGuildMgr->GetGuildById(pCurrChar->GetGuildId()))
guild->SendLoginInfo(this);
else
{
// remove wrong guild data
- TC_LOG_ERROR("misc", "Player %s (%s) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUID().ToString().c_str(), pCurrChar->GetGuildId());
- pCurrChar->SetInGuild(0);
+ TC_LOG_ERROR("misc", "Player %s (%s) marked as member of not existing guild (id: " UI64FMTD "), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUID().ToString().c_str(), pCurrChar->GetGuildId());
+ pCurrChar->SetInGuild(UI64LIT(0));
}
}
diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp
index 061f081919e..dcae8bc35fa 100644
--- a/src/server/game/Handlers/GuildHandler.cpp
+++ b/src/server/game/Handlers/GuildHandler.cpp
@@ -93,8 +93,8 @@ void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/)
{
TC_LOG_DEBUG("guild", "CMSG_GUILD_DECLINE [%s]", GetPlayerInfo().c_str());
- GetPlayer()->SetGuildIdInvited(0);
- GetPlayer()->SetInGuild(0);
+ GetPlayer()->SetGuildIdInvited(UI64LIT(0));
+ GetPlayer()->SetInGuild(UI64LIT(0));
}
void WorldSession::HandleGuildRosterOpcode(WorldPacket& recvPacket)
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index ef9af08acaa..bee4764699c 100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -215,7 +215,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
receiverTeam = sObjectMgr->GetPlayerTeamByGUID(receiverGuid);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT);
- stmt->setUInt32(0, receiverGuid.GetCounter());
+ stmt->setUInt64(0, receiverGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
@@ -510,7 +510,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
{
ObjectGuid mailbox;
uint32 mailId;
- uint32 itemId;
+ ObjectGuid::LowType itemId;
recvData >> mailbox;
recvData >> mailId;
recvData >> itemId; // item guid low
@@ -692,7 +692,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
uint8 item_count = (*itr)->items.size(); // max count is MAX_MAIL_ITEMS (12)
- size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+4+4+MAX_INSPECTED_ENCHANTMENT_SLOT*3*4+4+4+4+4+4+4+1);
+ size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+8+4+MAX_INSPECTED_ENCHANTMENT_SLOT*3*4+4+4+4+4+4+4+1);
if (data.wpos()+next_mail_size > maxPacketSize)
{
@@ -734,7 +734,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
// item index (0-6?)
data << uint8(i);
// item guid low?
- data << uint32((item ? item->GetGUID().GetCounter() : 0));
+ data << uint64((item ? item->GetGUID().GetCounter() : UI64LIT(0)));
// entry
data << uint32((item ? item->GetEntry() : 0));
for (uint8 j = 0; j < MAX_INSPECTED_ENCHANTMENT_SLOT; ++j)
@@ -794,7 +794,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
}
Item* bodyItem = new Item; // This is not bag and then can be used new Item.
- if (!bodyItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, player))
+ if (!bodyItem->Create(sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->Generate(), MAIL_BODY_ITEM_TEMPLATE, player))
{
delete bodyItem;
return;
@@ -855,7 +855,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket& /*recvData*/)
uint32 count = 0;
time_t now = time(NULL);
- std::set<uint32> sentSenders;
+ std::set<ObjectGuid::LowType> sentSenders;
for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
{
Mail* m = (*itr);
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 3d61cd4f798..b4f51b462fc 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -606,7 +606,7 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std
{
Field* fields = result->Fetch();
- friendGuid = ObjectGuid(HIGHGUID_PLAYER, 0, fields[0].GetUInt32());
+ friendGuid = ObjectGuid(HIGHGUID_PLAYER, 0, fields[0].GetUInt64());
team = Player::TeamForRace(fields[1].GetUInt8());
friendAccountId = fields[2].GetUInt32();
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index 4647d11464b..29ce69976d2 100644
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -519,7 +519,7 @@ void WorldSession::SendStablePet(ObjectGuid guid)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOTS_DETAIL);
- stmt->setUInt32(0, _player->GetGUID().GetCounter());
+ stmt->setUInt64(0, _player->GetGUID().GetCounter());
stmt->setUInt8(1, PET_SAVE_FIRST_STABLE_SLOT);
stmt->setUInt8(2, PET_SAVE_LAST_STABLE_SLOT);
@@ -623,7 +623,7 @@ void WorldSession::HandleStablePet(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOTS);
- stmt->setUInt32(0, _player->GetGUID().GetCounter());
+ stmt->setUInt64(0, _player->GetGUID().GetCounter());
stmt->setUInt8(1, PET_SAVE_FIRST_STABLE_SLOT);
stmt->setUInt8(2, PET_SAVE_LAST_STABLE_SLOT);
@@ -683,7 +683,7 @@ void WorldSession::HandleUnstablePet(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_ENTRY);
- stmt->setUInt32(0, _player->GetGUID().GetCounter());
+ stmt->setUInt64(0, _player->GetGUID().GetCounter());
stmt->setUInt32(1, petnumber);
stmt->setUInt8(2, PET_SAVE_FIRST_STABLE_SLOT);
stmt->setUInt8(3, PET_SAVE_LAST_STABLE_SLOT);
@@ -812,7 +812,7 @@ void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOT_BY_ID);
- stmt->setUInt32(0, _player->GetGUID().GetCounter());
+ stmt->setUInt64(0, _player->GetGUID().GetCounter());
stmt->setUInt32(1, petId);
_stableSwapCallback.SetParam(petId);
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index e4aa2838730..180e9bae74c 100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -664,17 +664,18 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_PET_DECLINEDNAME);
- stmt->setUInt32(0, _player->GetGUID().GetCounter());
+ stmt->setUInt32(0, pet->GetCharmInfo()->GetPetNumber());
+ stmt->setUInt64(1, _player->GetGUID().GetCounter());
for (uint8 i = 0; i < 5; i++)
- stmt->setString(i + 1, declinedname.name[i]);
+ stmt->setString(i + 2, declinedname.name[i]);
trans->Append(stmt);
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_NAME);
stmt->setString(0, name);
- stmt->setUInt32(1, _player->GetGUID().GetCounter());
+ stmt->setUInt64(1, _player->GetGUID().GetCounter());
stmt->setUInt32(2, pet->GetCharmInfo()->GetPetNumber());
trans->Append(stmt);
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index 3fe90a28a87..78b593605e0 100644
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -211,7 +211,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
// we checked above, if this player is in an arenateam, so this must be
// datacorruption
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_BY_OWNER);
- stmt->setUInt32(0, _player->GetGUID().GetCounter());
+ stmt->setUInt64(0, _player->GetGUID().GetCounter());
stmt->setUInt8(1, type);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -222,7 +222,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
do
{
Field* fields = result->Fetch();
- ssInvalidPetitionGUIDs << '\'' << fields[0].GetUInt32() << "', ";
+ ssInvalidPetitionGUIDs << '\'' << fields[0].GetUInt64() << "', ";
} while (result->NextRow());
}
@@ -236,8 +236,8 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
trans->PAppend("DELETE FROM petition_sign WHERE petitionguid IN (%s)", ssInvalidPetitionGUIDs.str().c_str());
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION);
- stmt->setUInt32(0, _player->GetGUID().GetCounter());
- stmt->setUInt32(1, charter->GetGUID().GetCounter());
+ stmt->setUInt64(0, _player->GetGUID().GetCounter());
+ stmt->setUInt64(1, charter->GetGUID().GetCounter());
stmt->setString(2, name);
stmt->setUInt8(3, uint8(type));
trans->Append(stmt);
@@ -253,11 +253,9 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
ObjectGuid petitionguid;
recvData >> petitionguid; // petition guid
- uint32 petitionGuidLow = petitionguid.GetCounter();
-
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE);
- stmt->setUInt32(0, petitionGuidLow);
+ stmt->setUInt64(0, petitionguid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -275,7 +273,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE);
- stmt->setUInt32(0, petitionGuidLow);
+ stmt->setUInt64(0, petitionguid.GetCounter());
result = CharacterDatabase.Query(stmt);
@@ -283,20 +281,18 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
if (result)
signs = uint8(result->GetRowCount());
- TC_LOG_DEBUG("network", "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionGuidLow);
+ TC_LOG_DEBUG("network", "CMSG_PETITION_SHOW_SIGNATURES %s", petitionguid.ToString().c_str());
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+1+signs*12));
data << petitionguid; // petition guid
data << _player->GetGUID(); // owner guid
- data << uint32(petitionGuidLow); // 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();
- uint32 lowGuid = fields2[0].GetUInt32();
-
- data << ObjectGuid(HIGHGUID_PLAYER, 0, lowGuid); // Player GUID
+ data << ObjectGuid(HIGHGUID_PLAYER, fields2[0].GetUInt64()); // Player GUID
data << uint32(0); // there 0 ...
result->NextRow();
@@ -325,14 +321,14 @@ void WorldSession::SendPetitionQueryOpcode(ObjectGuid petitionguid)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION);
- stmt->setUInt32(0, petitionguid.GetCounter());
+ stmt->setUInt64(0, petitionguid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
{
Field* fields = result->Fetch();
- ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
+ ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt64());
name = fields[1].GetString();
type = fields[2].GetUInt8();
}
@@ -396,7 +392,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE);
- stmt->setUInt32(0, petitionGuid.GetCounter());
+ stmt->setUInt64(0, petitionGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -441,7 +437,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PETITION_NAME);
stmt->setString(0, newName);
- stmt->setUInt32(1, petitionGuid.GetCounter());
+ stmt->setUInt64(1, petitionGuid.GetCounter());
CharacterDatabase.Execute(stmt);
@@ -464,8 +460,8 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURES);
- stmt->setUInt32(0, petitionGuid.GetCounter());
- stmt->setUInt32(1, petitionGuid.GetCounter());
+ stmt->setUInt64(0, petitionGuid.GetCounter());
+ stmt->setUInt64(1, petitionGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -476,7 +472,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
}
fields = result->Fetch();
- ObjectGuid ownerGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
+ ObjectGuid ownerGuid(HIGHGUID_PLAYER, fields[0].GetUInt64());
uint64 signs = fields[1].GetUInt64();
uint8 type = fields[2].GetUInt8();
@@ -539,7 +535,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIG_BY_ACCOUNT);
stmt->setUInt32(0, GetAccountId());
- stmt->setUInt32(1, petitionGuid.GetCounter());
+ stmt->setUInt64(1, petitionGuid.GetCounter());
result = CharacterDatabase.Query(stmt);
@@ -557,9 +553,9 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION_SIGNATURE);
- stmt->setUInt32(0, ownerGuid.GetCounter());
- stmt->setUInt32(1, petitionGuid.GetCounter());
- stmt->setUInt32(2, _player->GetGUID().GetCounter());
+ stmt->setUInt64(0, ownerGuid.GetCounter());
+ stmt->setUInt64(1, petitionGuid.GetCounter());
+ stmt->setUInt64(2, _player->GetGUID().GetCounter());
stmt->setUInt32(3, GetAccountId());
CharacterDatabase.Execute(stmt);
@@ -594,7 +590,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_OWNER_BY_GUID);
- stmt->setUInt32(0, petitionguid.GetCounter());
+ stmt->setUInt64(0, petitionguid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -602,7 +598,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
return;
Field* fields = result->Fetch();
- ObjectGuid ownerguid(HIGHGUID_PLAYER, 0, fields[0].GetUInt32());
+ ObjectGuid ownerguid(HIGHGUID_PLAYER, 0, fields[0].GetUInt64());
Player* owner = ObjectAccessor::FindConnectedPlayer(ownerguid);
if (owner) // petition owner online
@@ -631,7 +627,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE);
- stmt->setUInt32(0, petitionguid.GetCounter());
+ stmt->setUInt64(0, petitionguid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -696,7 +692,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE);
- stmt->setUInt32(0, petitionguid.GetCounter());
+ stmt->setUInt64(0, petitionguid.GetCounter());
result = CharacterDatabase.Query(stmt);
@@ -713,7 +709,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
for (uint8 i = 1; i <= signs; ++i)
{
Field* fields2 = result->Fetch();
- data << ObjectGuid(HIGHGUID_PLAYER, fields2[0].GetUInt32()); // Player GUID
+ data << ObjectGuid(HIGHGUID_PLAYER, fields2[0].GetUInt64()); // Player GUID
data << uint32(0); // there 0 ...
result->NextRow();
@@ -740,18 +736,18 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "Petition %s turned in by %s", petitionGuid.ToString().c_str(), _player->GetGUID().ToString().c_str());
// Get petition data from db
- uint32 ownerguidlo;
+ ObjectGuid ownerguid;
uint32 type;
std::string name;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION);
- stmt->setUInt32(0, petitionGuid.GetCounter());
+ stmt->setUInt64(0, petitionGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
{
Field* fields = result->Fetch();
- ownerguidlo = fields[0].GetUInt32();
+ ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt64());
name = fields[1].GetString();
type = fields[2].GetUInt8();
}
@@ -762,7 +758,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
}
// Only the petition owner can turn in the petition
- if (_player->GetGUID().GetCounter() != ownerguidlo)
+ if (_player->GetGUID() != ownerguid)
return;
// Petition type (guild/arena) specific checks
@@ -810,7 +806,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
uint8 signatures;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE);
- stmt->setUInt32(0, petitionGuid.GetCounter());
+ stmt->setUInt64(0, petitionGuid.GetCounter());
result = CharacterDatabase.Query(stmt);
if (result)
@@ -858,7 +854,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
for (uint8 i = 0; i < signatures; ++i)
{
Field* fields = result->Fetch();
- guild->AddMember(ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()));
+ guild->AddMember(ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt64()));
result->NextRow();
}
}
@@ -885,7 +881,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
for (uint8 i = 0; i < signatures; ++i)
{
Field* fields = result->Fetch();
- ObjectGuid memberGUID(HIGHGUID_PLAYER, fields[0].GetUInt32());
+ ObjectGuid memberGUID(HIGHGUID_PLAYER, fields[0].GetUInt64());
TC_LOG_DEBUG("network", "PetitionsHandler: Adding arena team (guid: %u) member %s", arenaTeam->GetId(), memberGUID.ToString().c_str());
arenaTeam->AddMember(memberGUID);
result->NextRow();
@@ -895,11 +891,11 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_GUID);
- stmt->setUInt32(0, petitionGuid.GetCounter());
+ stmt->setUInt64(0, petitionGuid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_GUID);
- stmt->setUInt32(0, petitionGuid.GetCounter());
+ stmt->setUInt64(0, petitionGuid.GetCounter());
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index 21849dfbb11..26451751b5d 100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -433,7 +433,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData)
// prepare Quest Tracker datas
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_ABANDON_TIME);
stmt->setUInt32(0, questId);
- stmt->setUInt32(1, _player->GetGUID().GetCounter());
+ stmt->setUInt64(1, _player->GetGUID().GetCounter());
// add to Quest Tracker
CharacterDatabase.Execute(stmt);
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index 6c2037a1ca6..7f76f13495f 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -654,7 +654,7 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
Player* player = creator->ToPlayer();
Guild* guild = NULL;
- if (uint32 guildId = player->GetGuildId())
+ if (ObjectGuid::LowType guildId = player->GetGuildId())
guild = sGuildMgr->GetGuildById(guildId);
data << uint8(player->GetByteValue(PLAYER_BYTES, 0)); // skin
diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp
index 9e5745ba655..882ae6efa90 100644
--- a/src/server/game/Handlers/TicketHandler.cpp
+++ b/src/server/game/Handlers/TicketHandler.cpp
@@ -241,7 +241,7 @@ void WorldSession::HandleReportLag(WorldPacket& recvData)
recvData >> z;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_LAG_REPORT);
- stmt->setUInt32(0, GetPlayer()->GetGUID().GetCounter());
+ stmt->setUInt64(0, GetPlayer()->GetGUID().GetCounter());
stmt->setUInt8 (1, lagType);
stmt->setUInt16(2, mapId);
stmt->setFloat (3, x);
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 2fa3b253e6f..6d41d669dcf 100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -492,7 +492,7 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
void Loot::FillNotNormalLootFor(Player* player, bool presentAtLooting)
{
- uint32 plguid = player->GetGUID().GetCounter();
+ ObjectGuid::LowType plguid = player->GetGUID().GetCounter();
QuestItemMap::const_iterator qmapitr = PlayerQuestItems.find(plguid);
if (qmapitr == PlayerQuestItems.end())
@@ -705,7 +705,7 @@ void Loot::DeleteLootItemFromContainerItemDB(uint32 itemID)
{
// Deletes a single item associated with an openable item from the DB
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEM);
- stmt->setUInt32(0, containerID.GetCounter());
+ stmt->setUInt64(0, containerID.GetCounter());
stmt->setUInt32(1, itemID);
CharacterDatabase.Execute(stmt);
@@ -724,7 +724,7 @@ void Loot::DeleteLootMoneyFromContainerItemDB()
{
// Deletes money loot associated with an openable item from the DB
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY);
- stmt->setUInt32(0, containerID.GetCounter());
+ stmt->setUInt64(0, containerID.GetCounter());
CharacterDatabase.Execute(stmt);
}
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index fcfac13813a..553a5929338 100644
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -195,7 +195,7 @@ class LootTemplate;
typedef std::vector<QuestItem> QuestItemList;
typedef std::vector<LootItem> LootItemList;
-typedef std::map<uint32, QuestItemList*> QuestItemMap;
+typedef std::map<ObjectGuid::LowType, QuestItemList*> QuestItemMap;
typedef std::list<LootStoreItem*> LootStoreItemList;
typedef std::unordered_map<uint32, LootTemplate*> LootTemplateMap;
diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp
index 0edaf627a83..e191a26f61a 100644
--- a/src/server/game/Mails/Mail.cpp
+++ b/src/server/game/Mails/Mail.cpp
@@ -34,11 +34,11 @@ MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery
{
case TYPEID_UNIT:
m_messageType = MAIL_CREATURE;
- m_senderId = sender->GetEntry();
+ m_senderId = uint64(sender->GetEntry());
break;
case TYPEID_GAMEOBJECT:
m_messageType = MAIL_GAMEOBJECT;
- m_senderId = sender->GetEntry();
+ m_senderId = uint64(sender->GetEntry());
break;
/*case TYPEID_ITEM:
m_messageType = MAIL_ITEM;
@@ -50,7 +50,7 @@ MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery
break;
default:
m_messageType = MAIL_NORMAL;
- m_senderId = 0; // will show mail from not existed player
+ m_senderId = UI64LIT(0); // will show mail from not existed player
TC_LOG_ERROR("misc", "MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId());
break;
}
@@ -62,7 +62,7 @@ MailSender::MailSender(CalendarEvent* sender)
}
MailSender::MailSender(AuctionEntry* sender)
- : m_messageType(MAIL_AUCTION), m_senderId(sender->GetHouseId()), m_stationery(MAIL_STATIONERY_AUCTION) { }
+ : m_messageType(MAIL_AUCTION), m_senderId(uint64(sender->GetHouseId())), m_stationery(MAIL_STATIONERY_AUCTION) { }
MailSender::MailSender(Player* sender)
{
@@ -119,7 +119,7 @@ void MailDraft::deleteIncludedItems(SQLTransaction& trans, bool inDB /*= false*/
if (inDB)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
- stmt->setUInt32(0, item->GetGUID().GetCounter());
+ stmt->setUInt64(0, item->GetGUID().GetCounter());
trans->Append(stmt);
}
@@ -129,7 +129,7 @@ void MailDraft::deleteIncludedItems(SQLTransaction& trans, bool inDB /*= false*/
m_items.clear();
}
-void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, SQLTransaction& trans)
+void MailDraft::SendReturnToSender(uint32 sender_acc, ObjectGuid::LowType sender_guid, ObjectGuid::LowType receiver_guid, SQLTransaction& trans)
{
ObjectGuid receiverGuid(HIGHGUID_PLAYER, receiver_guid);
Player* receiver = ObjectAccessor::FindConnectedPlayer(receiverGuid);
@@ -159,8 +159,8 @@ void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32
item->SaveToDB(trans); // item not in inventory and can be save standalone
// owner in data will set at mail receive and item extracting
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER);
- stmt->setUInt32(0, receiver_guid);
- stmt->setUInt32(1, item->GetGUID().GetCounter());
+ stmt->setUInt64(0, receiver_guid);
+ stmt->setUInt64(1, item->GetGUID().GetCounter());
trans->Append(stmt);
}
}
@@ -190,9 +190,6 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver,
// auction mail without any items and money
if (sender.GetMailMessageType() == MAIL_AUCTION && m_items.empty() && !m_money)
expire_delay = sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY);
- // mail from battlemaster (rewardmarks) should last only one day
- else if (sender.GetMailMessageType() == MAIL_CREATURE && sBattlegroundMgr->GetBattleMasterBG(sender.GetSenderId()) != BATTLEGROUND_TYPE_NONE)
- expire_delay = DAY;
// default case: expire time if COD 3 days, if no COD 30 days (or 90 days if sender is a game master)
else
{
@@ -211,15 +208,15 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver,
stmt->setUInt8 (++index, uint8(sender.GetMailMessageType()));
stmt->setInt8 (++index, int8(sender.GetStationery()));
stmt->setUInt16(++index, GetMailTemplateId());
- stmt->setUInt32(++index, sender.GetSenderId());
- stmt->setUInt32(++index, receiver.GetPlayerGUIDLow());
+ stmt->setUInt64(++index, sender.GetSenderId());
+ stmt->setUInt64(++index, receiver.GetPlayerGUIDLow());
stmt->setString(++index, GetSubject());
stmt->setString(++index, GetBody());
stmt->setBool (++index, !m_items.empty());
stmt->setUInt64(++index, uint64(expire_time));
stmt->setUInt64(++index, uint64(deliver_time));
- stmt->setUInt32(++index, m_money);
- stmt->setUInt32(++index, m_COD);
+ stmt->setUInt64(++index, m_money);
+ stmt->setUInt64(++index, m_COD);
stmt->setUInt8 (++index, uint8(checked));
trans->Append(stmt);
@@ -228,8 +225,8 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver,
Item* pItem = mailItemIter->second;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_MAIL_ITEM);
stmt->setUInt32(0, mailId);
- stmt->setUInt32(1, pItem->GetGUID().GetCounter());
- stmt->setUInt32(2, receiver.GetPlayerGUIDLow());
+ stmt->setUInt64(1, pItem->GetGUID().GetCounter());
+ stmt->setUInt64(2, receiver.GetPlayerGUIDLow());
trans->Append(stmt);
}
diff --git a/src/server/game/Mails/Mail.h b/src/server/game/Mails/Mail.h
index 1f33d7ef17c..599a4e60aa1 100644
--- a/src/server/game/Mails/Mail.h
+++ b/src/server/game/Mails/Mail.h
@@ -81,7 +81,7 @@ enum MailShowFlags
class MailSender
{
public: // Constructors
- MailSender(MailMessageType messageType, uint32 sender_guidlow_or_entry, MailStationery stationery = MAIL_STATIONERY_DEFAULT)
+ MailSender(MailMessageType messageType, ObjectGuid::LowType sender_guidlow_or_entry, MailStationery stationery = MAIL_STATIONERY_DEFAULT)
: m_messageType(messageType), m_senderId(sender_guidlow_or_entry), m_stationery(stationery)
{
}
@@ -91,11 +91,11 @@ class MailSender
MailSender(Player* sender);
public: // Accessors
MailMessageType GetMailMessageType() const { return m_messageType; }
- uint32 GetSenderId() const { return m_senderId; }
+ ObjectGuid::LowType GetSenderId() const { return m_senderId; }
MailStationery GetStationery() const { return m_stationery; }
private:
MailMessageType m_messageType;
- uint32 m_senderId; // player low guid or other object entry
+ ObjectGuid::LowType m_senderId; // player low guid or other object entry
MailStationery m_stationery;
};
@@ -115,7 +115,7 @@ class MailReceiver
class MailDraft
{
- typedef std::map<uint32, Item*> MailItemMap;
+ typedef std::map<ObjectGuid::LowType, Item*> MailItemMap;
public: // Constructors
explicit MailDraft(uint16 mailTemplateId, bool need_items = true)
@@ -133,10 +133,10 @@ class MailDraft
public: // modifiers
MailDraft& AddItem(Item* item);
MailDraft& AddMoney(uint64 money) { m_money = money; return *this; }
- MailDraft& AddCOD(uint32 COD) { m_COD = COD; return *this; }
+ MailDraft& AddCOD(uint64 COD) { m_COD = COD; return *this; }
public: // finishers
- void SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, SQLTransaction& trans);
+ void SendReturnToSender(uint32 sender_acc, ObjectGuid::LowType sender_guid, ObjectGuid::LowType receiver_guid, SQLTransaction& trans);
void SendMailTo(SQLTransaction& trans, MailReceiver const& receiver, MailSender const& sender, MailCheckMask checked = MAIL_CHECK_MASK_NONE, uint32 deliver_delay = 0);
private:
@@ -156,7 +156,7 @@ class MailDraft
struct MailItemInfo
{
- uint32 item_guid;
+ ObjectGuid::LowType item_guid;
uint32 item_template;
};
typedef std::vector<MailItemInfo> MailItemInfoVec;
@@ -167,12 +167,12 @@ struct Mail
uint8 messageType;
uint8 stationery;
uint16 mailTemplateId;
- uint32 sender; // TODO: change to uint64 and store full guids
- uint32 receiver;
+ ObjectGuid::LowType sender; // TODO: change to uint64 and store full guids
+ ObjectGuid::LowType receiver;
std::string subject;
std::string body;
std::vector<MailItemInfo> items;
- std::vector<uint32> removedItems;
+ std::vector<ObjectGuid::LowType> removedItems;
time_t expire_time;
time_t deliver_time;
uint64 money;
@@ -180,7 +180,7 @@ struct Mail
uint32 checked;
MailState state;
- void AddItem(uint32 itemGuidLow, uint32 item_template)
+ void AddItem(ObjectGuid::LowType itemGuidLow, uint32 item_template)
{
MailItemInfo mii;
mii.item_guid = itemGuidLow;
@@ -188,7 +188,7 @@ struct Mail
items.push_back(mii);
}
- bool RemoveItem(uint32 item_guid)
+ bool RemoveItem(ObjectGuid::LowType item_guid)
{
for (MailItemInfoVec::iterator itr = items.begin(); itr != items.end(); ++itr)
{
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index d809a183f36..aedbe2af21f 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -3327,7 +3327,7 @@ void Map::UpdateIteratorBack(Player* player)
m_mapRefIter = m_mapRefIter->nocheck_prev();
}
-void Map::SaveCreatureRespawnTime(uint32 dbGuid, time_t respawnTime)
+void Map::SaveCreatureRespawnTime(ObjectGuid::LowType dbGuid, time_t respawnTime)
{
if (!respawnTime)
{
@@ -3339,25 +3339,25 @@ void Map::SaveCreatureRespawnTime(uint32 dbGuid, time_t respawnTime)
_creatureRespawnTimes[dbGuid] = respawnTime;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN);
- stmt->setUInt32(0, dbGuid);
+ stmt->setUInt64(0, dbGuid);
stmt->setUInt32(1, uint32(respawnTime));
stmt->setUInt16(2, GetId());
stmt->setUInt32(3, GetInstanceId());
CharacterDatabase.Execute(stmt);
}
-void Map::RemoveCreatureRespawnTime(uint32 dbGuid)
+void Map::RemoveCreatureRespawnTime(ObjectGuid::LowType dbGuid)
{
_creatureRespawnTimes.erase(dbGuid);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN);
- stmt->setUInt32(0, dbGuid);
+ stmt->setUInt64(0, dbGuid);
stmt->setUInt16(1, GetId());
stmt->setUInt32(2, GetInstanceId());
CharacterDatabase.Execute(stmt);
}
-void Map::SaveGORespawnTime(uint32 dbGuid, time_t respawnTime)
+void Map::SaveGORespawnTime(ObjectGuid::LowType dbGuid, time_t respawnTime)
{
if (!respawnTime)
{
@@ -3369,19 +3369,19 @@ void Map::SaveGORespawnTime(uint32 dbGuid, time_t respawnTime)
_goRespawnTimes[dbGuid] = respawnTime;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GO_RESPAWN);
- stmt->setUInt32(0, dbGuid);
+ stmt->setUInt64(0, dbGuid);
stmt->setUInt32(1, uint32(respawnTime));
stmt->setUInt16(2, GetId());
stmt->setUInt32(3, GetInstanceId());
CharacterDatabase.Execute(stmt);
}
-void Map::RemoveGORespawnTime(uint32 dbGuid)
+void Map::RemoveGORespawnTime(ObjectGuid::LowType dbGuid)
{
_goRespawnTimes.erase(dbGuid);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN);
- stmt->setUInt32(0, dbGuid);
+ stmt->setUInt64(0, dbGuid);
stmt->setUInt16(1, GetId());
stmt->setUInt32(2, GetInstanceId());
CharacterDatabase.Execute(stmt);
@@ -3397,7 +3397,7 @@ void Map::LoadRespawnTimes()
do
{
Field* fields = result->Fetch();
- uint32 loguid = fields[0].GetUInt32();
+ ObjectGuid::LowType loguid = fields[0].GetUInt64();
uint32 respawnTime = fields[1].GetUInt32();
_creatureRespawnTimes[loguid] = time_t(respawnTime);
@@ -3412,7 +3412,7 @@ void Map::LoadRespawnTimes()
do
{
Field* fields = result->Fetch();
- uint32 loguid = fields[0].GetUInt32();
+ ObjectGuid::LowType loguid = fields[0].GetUInt64();
uint32 respawnTime = fields[1].GetUInt32();
_goRespawnTimes[loguid] = time_t(respawnTime);
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 6fe5b5c21aa..cfd3328231b 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -253,7 +253,7 @@ struct ZoneDynamicInfo
#define DEFAULT_HEIGHT_SEARCH 50.0f // default search distance to find height at nearby locations
#define MIN_UNLOAD_DELAY 1 // immediate unload
-typedef std::map<uint32/*leaderDBGUID*/, CreatureGroup*> CreatureGroupHolderType;
+typedef std::map<ObjectGuid::LowType/*leaderDBGUID*/, CreatureGroup*> CreatureGroupHolderType;
typedef std::unordered_map<uint32 /*zoneId*/, ZoneDynamicInfo> ZoneDynamicInfoMap;
@@ -480,28 +480,28 @@ class Map : public GridRefManager<NGridType>
RESPAWN TIMES
*/
time_t GetLinkedRespawnTime(ObjectGuid guid) const;
- time_t GetCreatureRespawnTime(uint32 dbGuid) const
+ time_t GetCreatureRespawnTime(ObjectGuid::LowType dbGuid) const
{
- std::unordered_map<uint32 /*dbGUID*/, time_t>::const_iterator itr = _creatureRespawnTimes.find(dbGuid);
+ std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t>::const_iterator itr = _creatureRespawnTimes.find(dbGuid);
if (itr != _creatureRespawnTimes.end())
return itr->second;
return time_t(0);
}
- time_t GetGORespawnTime(uint32 dbGuid) const
+ time_t GetGORespawnTime(ObjectGuid::LowType dbGuid) const
{
- std::unordered_map<uint32 /*dbGUID*/, time_t>::const_iterator itr = _goRespawnTimes.find(dbGuid);
+ std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t>::const_iterator itr = _goRespawnTimes.find(dbGuid);
if (itr != _goRespawnTimes.end())
return itr->second;
return time_t(0);
}
- void SaveCreatureRespawnTime(uint32 dbGuid, time_t respawnTime);
- void RemoveCreatureRespawnTime(uint32 dbGuid);
- void SaveGORespawnTime(uint32 dbGuid, time_t respawnTime);
- void RemoveGORespawnTime(uint32 dbGuid);
+ void SaveCreatureRespawnTime(ObjectGuid::LowType dbGuid, time_t respawnTime);
+ void RemoveCreatureRespawnTime(ObjectGuid::LowType dbGuid);
+ void SaveGORespawnTime(ObjectGuid::LowType dbGuid, time_t respawnTime);
+ void RemoveGORespawnTime(ObjectGuid::LowType dbGuid);
void LoadRespawnTimes();
void DeleteRespawnTimes();
@@ -607,7 +607,7 @@ class Map : public GridRefManager<NGridType>
Creature* _GetScriptCreature(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const;
WorldObject* _GetScriptWorldObject(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const;
void _ScriptProcessDoor(Object* source, Object* target, const ScriptInfo* scriptInfo) const;
- GameObject* _FindGameObject(WorldObject* pWorldObject, uint32 guid) const;
+ GameObject* _FindGameObject(WorldObject* pWorldObject, ObjectGuid::LowType guid) const;
time_t i_gridExpiry;
@@ -659,8 +659,8 @@ class Map : public GridRefManager<NGridType>
m_activeNonPlayers.erase(obj);
}
- std::unordered_map<uint32 /*dbGUID*/, time_t> _creatureRespawnTimes;
- std::unordered_map<uint32 /*dbGUID*/, time_t> _goRespawnTimes;
+ std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t> _creatureRespawnTimes;
+ std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t> _goRespawnTimes;
ZoneDynamicInfoMap _zoneDynamicInfo;
uint32 _defaultLight;
diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp
index 7df509a6d21..cf61ec3adf8 100644
--- a/src/server/game/Maps/TransportMgr.cpp
+++ b/src/server/game/Maps/TransportMgr.cpp
@@ -348,7 +348,7 @@ void TransportMgr::AddPathNodeToTransport(uint32 transportEntry, uint32 timeSeg,
animNode.Path[timeSeg] = node;
}
-Transport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/, Map* map /*= NULL*/, uint32 phaseid /*= 0*/, uint32 phasegroup /*= 0*/)
+Transport* TransportMgr::CreateTransport(uint32 entry, ObjectGuid::LowType guid /*= 0*/, Map* map /*= NULL*/, uint32 phaseid /*= 0*/, uint32 phasegroup /*= 0*/)
{
// instance case, execute GetGameObjectEntry hook
if (map)
@@ -381,7 +381,7 @@ Transport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/, Map*
float o = tInfo->keyFrames.begin()->InitialOrientation;
// initialize the gameobject base
- uint32 guidLow = guid ? guid : sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT);
+ ObjectGuid::LowType guidLow = guid ? guid : sObjectMgr->GetGenerator<HIGHGUID_MO_TRANSPORT>()->Generate();
if (!trans->Create(guidLow, entry, mapId, x, y, z, o, 255))
{
delete trans;
@@ -431,7 +431,7 @@ void TransportMgr::SpawnContinentTransports()
do
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
uint32 entry = fields[1].GetUInt32();
uint32 phaseid = fields[2].GetUInt32();
uint32 phasegroup = fields[3].GetUInt32();
@@ -457,7 +457,7 @@ void TransportMgr::CreateInstanceTransports(Map* map)
// create transports
for (std::set<uint32>::const_iterator itr = mapTransports->second.begin(); itr != mapTransports->second.end(); ++itr)
- CreateTransport(*itr, 0, map);
+ CreateTransport(*itr, UI64LIT(0), map);
}
TransportAnimationEntry const* TransportAnimation::GetAnimNode(uint32 time) const
diff --git a/src/server/game/Maps/TransportMgr.h b/src/server/game/Maps/TransportMgr.h
index f9d44234844..588e748783c 100644
--- a/src/server/game/Maps/TransportMgr.h
+++ b/src/server/game/Maps/TransportMgr.h
@@ -111,7 +111,7 @@ class TransportMgr
void LoadTransportTemplates();
// Creates a transport using given GameObject template entry
- Transport* CreateTransport(uint32 entry, uint32 guid = 0, Map* map = nullptr, uint32 phaseid = 0, uint32 phasegroup = 0);
+ Transport* CreateTransport(uint32 entry, ObjectGuid::LowType guid = UI64LIT(0), Map* map = nullptr, uint32 phaseid = 0, uint32 phasegroup = 0);
// Spawns all continent transports, used at core startup
void SpawnContinentTransports();
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index c6235839476..cc7c2508b49 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -85,7 +85,7 @@ void OPvPCapturePoint::SendChangePhase()
SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
}
-void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry)
+void OPvPCapturePoint::AddGO(uint32 type, ObjectGuid::LowType guid, uint32 entry)
{
if (!entry)
{
@@ -99,7 +99,7 @@ void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry)
m_ObjectTypes[m_Objects[type]] = type;
}
-void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry)
+void OPvPCapturePoint::AddCre(uint32 type, ObjectGuid::LowType guid, uint32 entry)
{
if (!entry)
{
@@ -115,7 +115,7 @@ void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry)
bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
{
- if (uint32 guid = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3))
+ if (ObjectGuid::LowType guid = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3))
{
AddGO(type, guid, entry);
return true;
@@ -126,7 +126,7 @@ bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x,
bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, TeamId /*teamId = TEAM_NEUTRAL*/, uint32 spawntimedelay /*= 0*/)
{
- if (uint32 guid = sObjectMgr->AddCreData(entry, map, x, y, z, o, spawntimedelay))
+ if (ObjectGuid::LowType guid = sObjectMgr->AddCreData(entry, map, x, y, z, o, spawntimedelay))
{
AddCre(type, guid, entry);
return true;
@@ -176,7 +176,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
return false;
}
TC_LOG_DEBUG("outdoorpvp", "deleting opvp creature type %u", type);
- uint32 guid = cr->GetDBTableGUIDLow();
+ ObjectGuid::LowType guid = cr->GetDBTableGUIDLow();
// Don't save respawn time
cr->SetRespawnTime(0);
cr->RemoveCorpse();
@@ -187,7 +187,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
// map->Remove(cr, false);
// delete respawn time for this creature
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN);
- stmt->setUInt32(0, guid);
+ stmt->setUInt64(0, guid);
stmt->setUInt16(1, cr->GetMapId());
stmt->setUInt32(2, 0); // instance id, always 0 for world maps
CharacterDatabase.Execute(stmt);
@@ -210,7 +210,7 @@ bool OPvPCapturePoint::DelObject(uint32 type)
m_Objects[type].Clear();
return false;
}
- uint32 guid = obj->GetDBTableGUIDLow();
+ ObjectGuid::LowType guid = obj->GetDBTableGUIDLow();
obj->SetRespawnTime(0); // not save respawn time
obj->Delete();
sObjectMgr->DeleteGOData(guid);
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h
index c3161cc8cdd..fd363d6c724 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.h
@@ -131,8 +131,8 @@ class OPvPCapturePoint
GameObject* m_capturePoint;
- void AddGO(uint32 type, uint32 guid, uint32 entry = 0);
- void AddCre(uint32 type, uint32 guid, uint32 entry = 0);
+ void AddGO(uint32 type, ObjectGuid::LowType guid, uint32 entry = 0);
+ void AddCre(uint32 type, ObjectGuid::LowType guid, uint32 entry = 0);
bool SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o = 0,
float rotation0 = 0, float rotation1 = 0, float rotation2 = 0, float rotation3 = 0);
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 3ada9d9740b..614e1afd9f2 100644
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -34,62 +34,62 @@ uint32 ActivePoolData::GetActiveObjectCount(uint32 pool_id) const
// Method that tell if a creature is spawned currently
template<>
-bool ActivePoolData::IsActiveObject<Creature>(uint32 db_guid) const
+bool ActivePoolData::IsActiveObject<Creature>(uint64 db_guid) const
{
return mSpawnedCreatures.find(db_guid) != mSpawnedCreatures.end();
}
// Method that tell if a gameobject is spawned currently
template<>
-bool ActivePoolData::IsActiveObject<GameObject>(uint32 db_guid) const
+bool ActivePoolData::IsActiveObject<GameObject>(uint64 db_guid) const
{
return mSpawnedGameobjects.find(db_guid) != mSpawnedGameobjects.end();
}
// Method that tell if a pool is spawned currently
template<>
-bool ActivePoolData::IsActiveObject<Pool>(uint32 sub_pool_id) const
+bool ActivePoolData::IsActiveObject<Pool>(uint64 sub_pool_id) const
{
return mSpawnedPools.find(sub_pool_id) != mSpawnedPools.end();
}
// Method that tell if a quest can be started
template<>
-bool ActivePoolData::IsActiveObject<Quest>(uint32 quest_id) const
+bool ActivePoolData::IsActiveObject<Quest>(uint64 quest_id) const
{
return mActiveQuests.find(quest_id) != mActiveQuests.end();
}
template<>
-void ActivePoolData::ActivateObject<Creature>(uint32 db_guid, uint32 pool_id)
+void ActivePoolData::ActivateObject<Creature>(uint64 db_guid, uint32 pool_id)
{
mSpawnedCreatures.insert(db_guid);
++mSpawnedPools[pool_id];
}
template<>
-void ActivePoolData::ActivateObject<GameObject>(uint32 db_guid, uint32 pool_id)
+void ActivePoolData::ActivateObject<GameObject>(uint64 db_guid, uint32 pool_id)
{
mSpawnedGameobjects.insert(db_guid);
++mSpawnedPools[pool_id];
}
template<>
-void ActivePoolData::ActivateObject<Pool>(uint32 sub_pool_id, uint32 pool_id)
+void ActivePoolData::ActivateObject<Pool>(uint64 sub_pool_id, uint32 pool_id)
{
mSpawnedPools[sub_pool_id] = 0;
++mSpawnedPools[pool_id];
}
template<>
-void ActivePoolData::ActivateObject<Quest>(uint32 quest_id, uint32 pool_id)
+void ActivePoolData::ActivateObject<Quest>(uint64 quest_id, uint32 pool_id)
{
mActiveQuests.insert(quest_id);
++mSpawnedPools[pool_id];
}
template<>
-void ActivePoolData::RemoveObject<Creature>(uint32 db_guid, uint32 pool_id)
+void ActivePoolData::RemoveObject<Creature>(uint64 db_guid, uint32 pool_id)
{
mSpawnedCreatures.erase(db_guid);
uint32& val = mSpawnedPools[pool_id];
@@ -98,7 +98,7 @@ void ActivePoolData::RemoveObject<Creature>(uint32 db_guid, uint32 pool_id)
}
template<>
-void ActivePoolData::RemoveObject<GameObject>(uint32 db_guid, uint32 pool_id)
+void ActivePoolData::RemoveObject<GameObject>(uint64 db_guid, uint32 pool_id)
{
mSpawnedGameobjects.erase(db_guid);
uint32& val = mSpawnedPools[pool_id];
@@ -107,7 +107,7 @@ void ActivePoolData::RemoveObject<GameObject>(uint32 db_guid, uint32 pool_id)
}
template<>
-void ActivePoolData::RemoveObject<Pool>(uint32 sub_pool_id, uint32 pool_id)
+void ActivePoolData::RemoveObject<Pool>(uint64 sub_pool_id, uint32 pool_id)
{
mSpawnedPools.erase(sub_pool_id);
uint32& val = mSpawnedPools[pool_id];
@@ -116,7 +116,7 @@ void ActivePoolData::RemoveObject<Pool>(uint32 sub_pool_id, uint32 pool_id)
}
template<>
-void ActivePoolData::RemoveObject<Quest>(uint32 quest_id, uint32 pool_id)
+void ActivePoolData::RemoveObject<Quest>(uint64 quest_id, uint32 pool_id)
{
mActiveQuests.erase(quest_id);
uint32& val = mSpawnedPools[pool_id];
@@ -153,7 +153,7 @@ bool PoolGroup<T>::CheckPool() const
}
template <class T>
-PoolObject* PoolGroup<T>::RollOne(ActivePoolData& spawns, uint32 triggerFrom)
+PoolObject* PoolGroup<T>::RollOne(ActivePoolData& spawns, uint64 triggerFrom)
{
if (!ExplicitlyChanced.empty())
{
@@ -184,7 +184,7 @@ PoolObject* PoolGroup<T>::RollOne(ActivePoolData& spawns, uint32 triggerFrom)
// If no guid is passed, the pool is just removed (event end case)
// If guid is filled, cache will be used and no removal will occur, it just fill the cache
template<class T>
-void PoolGroup<T>::DespawnObject(ActivePoolData& spawns, uint32 guid)
+void PoolGroup<T>::DespawnObject(ActivePoolData& spawns, uint64 guid)
{
for (size_t i=0; i < EqualChanced.size(); ++i)
{
@@ -215,7 +215,7 @@ void PoolGroup<T>::DespawnObject(ActivePoolData& spawns, uint32 guid)
// Method that is actualy doing the removal job on one creature
template<>
-void PoolGroup<Creature>::Despawn1Object(uint32 guid)
+void PoolGroup<Creature>::Despawn1Object(uint64 guid)
{
if (CreatureData const* data = sObjectMgr->GetCreatureData(guid))
{
@@ -228,7 +228,7 @@ void PoolGroup<Creature>::Despawn1Object(uint32 guid)
// Same on one gameobject
template<>
-void PoolGroup<GameObject>::Despawn1Object(uint32 guid)
+void PoolGroup<GameObject>::Despawn1Object(uint64 guid)
{
if (GameObjectData const* data = sObjectMgr->GetGOData(guid))
{
@@ -241,14 +241,14 @@ void PoolGroup<GameObject>::Despawn1Object(uint32 guid)
// Same on one pool
template<>
-void PoolGroup<Pool>::Despawn1Object(uint32 child_pool_id)
+void PoolGroup<Pool>::Despawn1Object(uint64 child_pool_id)
{
sPoolMgr->DespawnPool(child_pool_id);
}
// Same on one quest
template<>
-void PoolGroup<Quest>::Despawn1Object(uint32 quest_id)
+void PoolGroup<Quest>::Despawn1Object(uint64 quest_id)
{
// Creatures
QuestRelations* questMap = sObjectMgr->GetCreatureQuestRelationMap();
@@ -312,7 +312,7 @@ void PoolGroup<Pool>::RemoveOneRelation(uint32 child_pool_id)
}
template <class T>
-void PoolGroup<T>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 triggerFrom)
+void PoolGroup<T>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint64 triggerFrom)
{
uint32 lastDespawned = 0;
int count = limit - spawns.GetActiveObjectCount(poolId);
@@ -435,7 +435,7 @@ void PoolGroup<Quest>::Spawn1Object(PoolObject* obj)
}
template <>
-void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 triggerFrom)
+void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint64 triggerFrom)
{
TC_LOG_DEBUG("pool", "PoolGroup<Quest>: Spawning pool %u", poolId);
// load state from db
@@ -607,14 +607,14 @@ void PoolMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ uint64 guid = fields[0].GetUInt32();
uint32 pool_id = fields[1].GetUInt32();
float chance = fields[2].GetFloat();
CreatureData const* data = sObjectMgr->GetCreatureData(guid);
if (!data)
{
- TC_LOG_ERROR("sql.sql", "`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);
+ TC_LOG_ERROR("sql.sql", "`pool_creature` has a non existing creature spawn (GUID: " UI64FMTD ") defined for pool id (%u), skipped.", guid, pool_id);
continue;
}
if (pool_id > max_pool_id)
@@ -624,7 +624,7 @@ void PoolMgr::LoadFromDB()
}
if (chance < 0 || chance > 100)
{
- TC_LOG_ERROR("sql.sql", "`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id);
+ TC_LOG_ERROR("sql.sql", "`pool_creature` has an invalid chance (%f) for creature guid (" UI64FMTD ") in pool id (%u), skipped.", chance, guid, pool_id);
continue;
}
PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id];
@@ -663,14 +663,14 @@ void PoolMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ uint64 guid = fields[0].GetUInt64();
uint32 pool_id = fields[1].GetUInt32();
float chance = fields[2].GetFloat();
GameObjectData const* data = sObjectMgr->GetGOData(guid);
if (!data)
{
- TC_LOG_ERROR("sql.sql", "`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);
+ TC_LOG_ERROR("sql.sql", "`pool_gameobject` has a non existing gameobject spawn (GUID: " UI64FMTD ") defined for pool id (%u), skipped.", guid, pool_id);
continue;
}
@@ -679,7 +679,7 @@ void PoolMgr::LoadFromDB()
goinfo->type != GAMEOBJECT_TYPE_GOOBER &&
goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE)
{
- TC_LOG_ERROR("sql.sql", "`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id);
+ TC_LOG_ERROR("sql.sql", "`pool_gameobject` has a not lootable gameobject spawn (GUID: " UI64FMTD ", type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id);
continue;
}
@@ -998,7 +998,7 @@ void PoolMgr::ChangeWeeklyQuests()
// Call to spawn a pool, if cache if true the method will spawn only if cached entry is different
// If it's same, the creature is respawned only (added back to map)
template<>
-void PoolMgr::SpawnPool<Creature>(uint32 pool_id, uint32 db_guid)
+void PoolMgr::SpawnPool<Creature>(uint32 pool_id, uint64 db_guid)
{
if (!mPoolCreatureGroups[pool_id].isEmpty())
mPoolCreatureGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, db_guid);
@@ -1007,7 +1007,7 @@ void PoolMgr::SpawnPool<Creature>(uint32 pool_id, uint32 db_guid)
// Call to spawn a pool, if cache if true the method will spawn only if cached entry is different
// If it's same, the gameobject is respawned only (added back to map)
template<>
-void PoolMgr::SpawnPool<GameObject>(uint32 pool_id, uint32 db_guid)
+void PoolMgr::SpawnPool<GameObject>(uint32 pool_id, uint64 db_guid)
{
if (!mPoolGameobjectGroups[pool_id].isEmpty())
mPoolGameobjectGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, db_guid);
@@ -1016,7 +1016,7 @@ void PoolMgr::SpawnPool<GameObject>(uint32 pool_id, uint32 db_guid)
// Call to spawn a pool, if cache if true the method will spawn only if cached entry is different
// If it's same, the pool is respawned only
template<>
-void PoolMgr::SpawnPool<Pool>(uint32 pool_id, uint32 sub_pool_id)
+void PoolMgr::SpawnPool<Pool>(uint32 pool_id, uint64 sub_pool_id)
{
if (!mPoolPoolGroups[pool_id].isEmpty())
mPoolPoolGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, sub_pool_id);
@@ -1024,7 +1024,7 @@ void PoolMgr::SpawnPool<Pool>(uint32 pool_id, uint32 sub_pool_id)
// Call to spawn a pool
template<>
-void PoolMgr::SpawnPool<Quest>(uint32 pool_id, uint32 quest_id)
+void PoolMgr::SpawnPool<Quest>(uint32 pool_id, uint64 quest_id)
{
if (!mPoolQuestGroups[pool_id].isEmpty())
mPoolQuestGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, quest_id);
@@ -1068,7 +1068,7 @@ bool PoolMgr::CheckPool(uint32 pool_id) const
// Here we cache only the creature/gameobject whose guid is passed as parameter
// Then the spawn pool call will use this cache to decide
template<typename T>
-void PoolMgr::UpdatePool(uint32 pool_id, uint32 db_guid_or_pool_id)
+void PoolMgr::UpdatePool(uint32 pool_id, uint64 db_guid_or_pool_id)
{
if (uint32 motherpoolid = IsPartOfAPool<Pool>(pool_id))
SpawnPool<Pool>(motherpoolid, pool_id);
@@ -1076,7 +1076,7 @@ void PoolMgr::UpdatePool(uint32 pool_id, uint32 db_guid_or_pool_id)
SpawnPool<T>(pool_id, db_guid_or_pool_id);
}
-template void PoolMgr::UpdatePool<Pool>(uint32 pool_id, uint32 db_guid_or_pool_id);
-template void PoolMgr::UpdatePool<GameObject>(uint32 pool_id, uint32 db_guid_or_pool_id);
-template void PoolMgr::UpdatePool<Creature>(uint32 pool_id, uint32 db_guid_or_pool_id);
-template void PoolMgr::UpdatePool<Quest>(uint32 pool_id, uint32 db_guid_or_pool_id);
+template void PoolMgr::UpdatePool<Pool>(uint32 pool_id, uint64 db_guid_or_pool_id);
+template void PoolMgr::UpdatePool<GameObject>(uint32 pool_id, uint64 db_guid_or_pool_id);
+template void PoolMgr::UpdatePool<Creature>(uint32 pool_id, uint64 db_guid_or_pool_id);
+template void PoolMgr::UpdatePool<Quest>(uint32 pool_id, uint64 db_guid_or_pool_id);
diff --git a/src/server/game/Pools/PoolMgr.h b/src/server/game/Pools/PoolMgr.h
index dd24cceae07..ff633c08ba1 100644
--- a/src/server/game/Pools/PoolMgr.h
+++ b/src/server/game/Pools/PoolMgr.h
@@ -31,31 +31,31 @@ struct PoolTemplateData
struct PoolObject
{
- uint32 guid;
+ uint64 guid;
float chance;
- PoolObject(uint32 _guid, float _chance) : guid(_guid), chance(std::fabs(_chance)) { }
+ PoolObject(uint64 _guid, float _chance) : guid(_guid), chance(std::fabs(_chance)) { }
};
class Pool // for Pool of Pool case
{
};
-typedef std::set<uint32> ActivePoolObjects;
-typedef std::map<uint32, uint32> ActivePoolPools;
+typedef std::set<uint64> ActivePoolObjects;
+typedef std::map<uint64, uint32> ActivePoolPools;
class ActivePoolData
{
public:
template<typename T>
- bool IsActiveObject(uint32 db_guid_or_pool_id) const;
+ bool IsActiveObject(uint64 db_guid_or_pool_id) const;
uint32 GetActiveObjectCount(uint32 pool_id) const;
template<typename T>
- void ActivateObject(uint32 db_guid_or_pool_id, uint32 pool_id);
+ void ActivateObject(uint64 db_guid_or_pool_id, uint32 pool_id);
template<typename T>
- void RemoveObject(uint32 db_guid_or_pool_id, uint32 pool_id);
+ void RemoveObject(uint64 db_guid_or_pool_id, uint32 pool_id);
ActivePoolObjects GetActiveQuests() const { return mActiveQuests; } // a copy of the set
private:
@@ -76,15 +76,15 @@ class PoolGroup
bool isEmpty() const { return ExplicitlyChanced.empty() && EqualChanced.empty(); }
void AddEntry(PoolObject& poolitem, uint32 maxentries);
bool CheckPool() const;
- PoolObject* RollOne(ActivePoolData& spawns, uint32 triggerFrom);
- void DespawnObject(ActivePoolData& spawns, uint32 guid=0);
- void Despawn1Object(uint32 guid);
- void SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 triggerFrom);
+ PoolObject* RollOne(ActivePoolData& spawns, uint64 triggerFrom);
+ void DespawnObject(ActivePoolData& spawns, uint64 guid=0);
+ void Despawn1Object(uint64 guid);
+ void SpawnObject(ActivePoolData& spawns, uint32 limit, uint64 triggerFrom);
void Spawn1Object(PoolObject* obj);
void ReSpawn1Object(PoolObject* obj);
void RemoveOneRelation(uint32 child_pool_id);
- uint32 GetFirstEqualChancedObjectId()
+ uint64 GetFirstEqualChancedObjectId()
{
if (EqualChanced.empty())
return 0;
@@ -121,10 +121,10 @@ class PoolMgr
void Initialize();
template<typename T>
- uint32 IsPartOfAPool(uint32 db_guid_or_pool_id) const;
+ uint32 IsPartOfAPool(uint64 db_guid_or_pool_id) const;
template<typename T>
- bool IsSpawnedObject(uint32 db_guid_or_pool_id) const { return mSpawnedData.IsActiveObject<T>(db_guid_or_pool_id); }
+ bool IsSpawnedObject(uint64 db_guid_or_pool_id) const { return mSpawnedData.IsActiveObject<T>(db_guid_or_pool_id); }
bool CheckPool(uint32 pool_id) const;
@@ -132,7 +132,7 @@ class PoolMgr
void DespawnPool(uint32 pool_id);
template<typename T>
- void UpdatePool(uint32 pool_id, uint32 db_guid_or_pool_id);
+ void UpdatePool(uint32 pool_id, uint64 db_guid_or_pool_id);
void ChangeDailyQuests();
void ChangeWeeklyQuests();
@@ -142,7 +142,7 @@ class PoolMgr
private:
template<typename T>
- void SpawnPool(uint32 pool_id, uint32 db_guid_or_pool_id);
+ void SpawnPool(uint32 pool_id, uint64 db_guid_or_pool_id);
uint32 max_pool_id;
typedef std::vector<PoolTemplateData> PoolTemplateDataMap;
@@ -150,8 +150,8 @@ class PoolMgr
typedef std::vector<PoolGroup<GameObject> > PoolGroupGameObjectMap;
typedef std::vector<PoolGroup<Pool> > PoolGroupPoolMap;
typedef std::vector<PoolGroup<Quest> > PoolGroupQuestMap;
- typedef std::pair<uint32, uint32> SearchPair;
- typedef std::map<uint32, uint32> SearchMap;
+ typedef std::pair<uint64, uint32> SearchPair;
+ typedef std::map<uint64, uint32> SearchMap;
PoolTemplateDataMap mPoolTemplate;
PoolGroupCreatureMap mPoolCreatureGroups;
@@ -171,7 +171,7 @@ class PoolMgr
// Method that tell if the creature is part of a pool and return the pool id if yes
template<>
-inline uint32 PoolMgr::IsPartOfAPool<Creature>(uint32 db_guid) const
+inline uint32 PoolMgr::IsPartOfAPool<Creature>(uint64 db_guid) const
{
SearchMap::const_iterator itr = mCreatureSearchMap.find(db_guid);
if (itr != mCreatureSearchMap.end())
@@ -182,7 +182,7 @@ inline uint32 PoolMgr::IsPartOfAPool<Creature>(uint32 db_guid) const
// Method that tell if the gameobject is part of a pool and return the pool id if yes
template<>
-inline uint32 PoolMgr::IsPartOfAPool<GameObject>(uint32 db_guid) const
+inline uint32 PoolMgr::IsPartOfAPool<GameObject>(uint64 db_guid) const
{
SearchMap::const_iterator itr = mGameobjectSearchMap.find(db_guid);
if (itr != mGameobjectSearchMap.end())
@@ -193,7 +193,7 @@ inline uint32 PoolMgr::IsPartOfAPool<GameObject>(uint32 db_guid) const
// Method that tell if the quest is part of another pool and return the pool id if yes
template<>
-inline uint32 PoolMgr::IsPartOfAPool<Quest>(uint32 pool_id) const
+inline uint32 PoolMgr::IsPartOfAPool<Quest>(uint64 pool_id) const
{
SearchMap::const_iterator itr = mQuestSearchMap.find(pool_id);
if (itr != mQuestSearchMap.end())
@@ -204,7 +204,7 @@ inline uint32 PoolMgr::IsPartOfAPool<Quest>(uint32 pool_id) const
// Method that tell if the pool is part of another pool and return the pool id if yes
template<>
-inline uint32 PoolMgr::IsPartOfAPool<Pool>(uint32 pool_id) const
+inline uint32 PoolMgr::IsPartOfAPool<Pool>(uint64 pool_id) const
{
SearchMap::const_iterator itr = mPoolSearchMap.find(pool_id);
if (itr != mPoolSearchMap.end())
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 697e0b0c194..160c8bc479a 100644
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -229,7 +229,7 @@ inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const
inline void Map::_ScriptProcessDoor(Object* source, Object* target, const ScriptInfo* scriptInfo) const
{
bool bOpen = false;
- uint32 guid = scriptInfo->ToggleDoor.GOGuid;
+ ObjectGuid::LowType guid = scriptInfo->ToggleDoor.GOGuid;
int32 nTimeToToggle = std::max(15, int32(scriptInfo->ToggleDoor.ResetDelay));
switch (scriptInfo->command)
{
@@ -281,7 +281,7 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script
}
}
-inline GameObject* Map::_FindGameObject(WorldObject* searchObject, uint32 guid) const
+inline GameObject* Map::_FindGameObject(WorldObject* searchObject, ObjectGuid::LowType guid) const
{
GameObject* gameobject = NULL;
@@ -820,7 +820,7 @@ void Map::ScriptsProcess()
CellCoord p(Trinity::ComputeCellCoord(wSource->GetPositionX(), wSource->GetPositionY()));
Cell cell(p);
- Trinity::CreatureWithDbGUIDCheck target_check(wSource, step.script->CallScript.CreatureEntry);
+ Trinity::CreatureWithDbGUIDCheck target_check(wSource, uint64(step.script->CallScript.CreatureEntry));
Trinity::CreatureSearcher<Trinity::CreatureWithDbGUIDCheck> checker(wSource, cTarget, target_check);
TypeContainerVisitor<Trinity::CreatureSearcher <Trinity::CreatureWithDbGUIDCheck>, GridTypeMapContainer > unit_checker(checker);
@@ -829,7 +829,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, ObjectGuid(HIGHGUID_UNIT, data->id, step.script->CallScript.CreatureEntry), cTarget);
+ cTarget = ObjectAccessor::GetObjectInWorld<Creature>(data->mapid, data->posX, data->posY, ObjectGuid(HIGHGUID_UNIT, data->id, uint64(step.script->CallScript.CreatureEntry)), cTarget);
}
if (!cTarget)
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 3ed63a1602c..d5a54a7f1a1 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1559,7 +1559,7 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex)
if (!caster->IsInWorld())
return;
DynamicObject* dynObj = new DynamicObject(false);
- if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL))
+ if (!dynObj->CreateDynamicObject(sObjectMgr->GetGenerator<HIGHGUID_DYNAMICOBJECT>()->Generate(), caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL))
{
delete dynObj;
return;
@@ -2391,7 +2391,7 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex)
return;
DynamicObject* dynObj = new DynamicObject(true);
- if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
+ if (!dynObj->CreateDynamicObject(sObjectMgr->GetGenerator<HIGHGUID_DYNAMICOBJECT>()->Generate(), m_caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
{
delete dynObj;
return;
@@ -3205,7 +3205,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
Map* map = target->GetMap();
- if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map,
+ if (!pGameObj->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), gameobject_id, map,
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
delete pGameObj;
@@ -3233,7 +3233,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
GameObject* linkedGO = new GameObject;
- if (linkedGO->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map,
+ if (linkedGO->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), linkedEntry, map,
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
for (auto phase : m_caster->GetPhases())
@@ -3859,7 +3859,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
uint32 gameobject_id = m_spellInfo->Effects[effIndex].MiscValue;
Map* map = m_caster->GetMap();
- if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id,
+ if (!pGameObj->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), gameobject_id,
map, 0,
m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2,
m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2,
@@ -4222,7 +4222,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
Map* map = m_caster->GetMap();
- if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
+ if (!go->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), go_id, map,
0, x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
delete go;
@@ -4855,7 +4855,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
GameObject* pGameObj = new GameObject;
- if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap,
+ if (!pGameObj->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), name_id, cMap,
0, fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
delete pGameObj;
@@ -4924,7 +4924,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
GameObject* linkedGO = new GameObject;
- if (linkedGO->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap,
+ if (linkedGO->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), linkedEntry, cMap,
0, fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
for (auto phase : m_caster->GetPhases())
@@ -5757,6 +5757,6 @@ void Spell::EffectCreateAreaTrigger(SpellEffIndex effIndex)
uint32 triggerEntry = GetSpellInfo()->Effects[effIndex].MiscValue;
AreaTrigger * areaTrigger = new AreaTrigger;
- if (!areaTrigger->CreateAreaTrigger(sObjectMgr->GenerateLowGuid(HIGHGUID_AREATRIGGER), triggerEntry, GetCaster(), GetSpellInfo(), pos))
+ if (!areaTrigger->CreateAreaTrigger(sObjectMgr->GetGenerator<HIGHGUID_AREATRIGGER>()->Generate(), triggerEntry, GetCaster(), GetSpellInfo(), pos))
delete areaTrigger;
}
diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp
index 8d457687f22..752f33ff952 100644
--- a/src/server/game/Tools/PlayerDump.cpp
+++ b/src/server/game/Tools/PlayerDump.cpp
@@ -160,43 +160,30 @@ bool changetoknth(std::string &str, int n, char const* with, bool insert = false
return true;
}
-uint32 registerNewGuid(uint32 oldGuid, std::map<uint32, uint32> &guidMap, uint32 hiGuid)
+uint32 registerNewGuid(uint64 oldGuid, std::map<uint64, uint64> &guidMap, uint64 hiGuid)
{
- std::map<uint32, uint32>::const_iterator itr = guidMap.find(oldGuid);
+ std::map<uint64, uint64>::const_iterator itr = guidMap.find(oldGuid);
if (itr != guidMap.end())
return itr->second;
- uint32 newguid = hiGuid + guidMap.size();
+ uint64 newguid = hiGuid + guidMap.size();
guidMap[oldGuid] = newguid;
return newguid;
}
-bool changeGuid(std::string &str, int n, std::map<uint32, uint32> &guidMap, uint32 hiGuid, bool nonzero = false)
+bool changeGuid(std::string &str, int n, std::map<uint64, uint64> &guidMap, uint64 hiGuid, bool nonzero = false)
{
- char chritem[20];
- uint32 oldGuid = atoi(getnth(str, n).c_str());
- if (nonzero && oldGuid == 0)
+ char chritem[21];
+ ObjectGuid::LowType oldGuid = strtoull(getnth(str, n).c_str(), nullptr, 10);
+ if (nonzero && !oldGuid)
return true; // not an error
uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
- snprintf(chritem, 20, "%u", newGuid);
+ snprintf(chritem, 21, UI64FMTD, newGuid);
return changenth(str, n, chritem, false, nonzero);
}
-bool changetokGuid(std::string &str, int n, std::map<uint32, uint32> &guidMap, uint32 hiGuid, bool nonzero = false)
-{
- char chritem[20];
- uint32 oldGuid = atoi(gettoknth(str, n).c_str());
- if (nonzero && oldGuid == 0)
- return true; // not an error
-
- uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
- snprintf(chritem, 20, "%u", newGuid);
-
- return changetoknth(str, n, chritem, false, nonzero);
-}
-
std::string CreateDumpString(char const* tableName, QueryResult result)
{
if (!tableName || !result) return "";
@@ -259,7 +246,7 @@ void StoreGUID(QueryResult result, uint32 data, uint32 field, PlayerDumpWriter::
{
Field* fields = result->Fetch();
std::string dataStr = fields[data].GetString();
- ObjectGuid::LowType guid = atoll(gettoknth(dataStr, field).c_str());
+ ObjectGuid::LowType guid = strtoull(gettoknth(dataStr, field).c_str(), nullptr, 10);
if (guid)
guids.insert(guid);
}
@@ -413,18 +400,18 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
// make sure the same guid doesn't already exist and is safe to use
bool incHighest = true;
- if (guid && guid < sObjectMgr->_hiCharGuid)
+ if (guid && guid < sObjectMgr->GetGenerator<HIGHGUID_PLAYER>()->GetNextAfterMaxUsed())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHECK_GUID);
stmt->setUInt64(0, guid);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
- guid = sObjectMgr->_hiCharGuid; // use first free if exists
+ guid = sObjectMgr->GetGenerator<HIGHGUID_PLAYER>()->GetNextAfterMaxUsed(); // use first free if exists
else incHighest = false;
}
else
- guid = sObjectMgr->_hiCharGuid;
+ guid = sObjectMgr->GetGenerator<HIGHGUID_PLAYER>()->GetNextAfterMaxUsed();
// normalize the name if specified and check if it exists
if (!normalizePlayerName(name))
@@ -449,8 +436,8 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
snprintf(newpetid, 20, "%u", sObjectMgr->GeneratePetNumber());
snprintf(lastpetid, 20, "%s", "");
- std::map<uint32, uint32> items;
- std::map<uint32, uint32> mails;
+ std::map<uint64, uint64> items;
+ std::map<uint64, uint64> mails;
char buf[32000] = "";
typedef std::map<uint32, uint32> PetIds; // old->new petid relation
@@ -583,9 +570,9 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
if (!changenth(line, 1, newguid)) // character_inventory.guid update
ROLLBACK(DUMP_FILE_BROKEN);
- if (!changeGuid(line, 2, items, sObjectMgr->_hiItemGuid, true))
+ if (!changeGuid(line, 2, items, sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->GetNextAfterMaxUsed(), true))
ROLLBACK(DUMP_FILE_BROKEN); // character_inventory.bag update
- if (!changeGuid(line, 4, items, sObjectMgr->_hiItemGuid))
+ if (!changeGuid(line, 4, items, sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // character_inventory.item update
break;
}
@@ -601,7 +588,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
{
if (!changeGuid(line, 1, mails, sObjectMgr->_mailId))
ROLLBACK(DUMP_FILE_BROKEN); // mail_items.id
- if (!changeGuid(line, 2, items, sObjectMgr->_hiItemGuid))
+ if (!changeGuid(line, 2, items, sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // mail_items.item_guid
if (!changenth(line, 3, newguid)) // mail_items.receiver
ROLLBACK(DUMP_FILE_BROKEN);
@@ -610,7 +597,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
case DTT_ITEM:
{
// item, owner, data field:item, owner guid
- if (!changeGuid(line, 1, items, sObjectMgr->_hiItemGuid))
+ if (!changeGuid(line, 1, items, sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // item_instance.guid update
if (!changenth(line, 3, newguid)) // item_instance.owner_guid update
ROLLBACK(DUMP_FILE_BROKEN);
@@ -620,7 +607,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
{
if (!changenth(line, 1, newguid)) // character_gifts.guid update
ROLLBACK(DUMP_FILE_BROKEN);
- if (!changeGuid(line, 2, items, sObjectMgr->_hiItemGuid))
+ if (!changeGuid(line, 2, items, sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // character_gifts.item_guid update
break;
}
@@ -681,11 +668,11 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
// in case of name conflict player has to rename at login anyway
sWorld->AddCharacterNameData(ObjectGuid(HIGHGUID_PLAYER, guid), name, gender, race, playerClass, level);
- sObjectMgr->_hiItemGuid += items.size();
+ sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->Set(sObjectMgr->GetGenerator<HIGHGUID_ITEM>()->GetNextAfterMaxUsed() + items.size());
sObjectMgr->_mailId += mails.size();
if (incHighest)
- ++sObjectMgr->_hiCharGuid;
+ sObjectMgr->GetGenerator<HIGHGUID_PLAYER>()->Generate();
fclose(fin);
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index b31c0b11d39..1b664204784 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -909,11 +909,11 @@ public:
guidStr = strtok(NULL, " ");
}
- uint32 guid = 0;
+ ObjectGuid::LowType guid = UI64LIT(0);
if (guidStr)
{
- guid = uint32(atoi(guidStr));
+ guid = strtoull(guidStr, nullptr, 10);
if (!guid)
{
handler->PSendSysMessage(LANG_INVALID_CHARACTER_GUID);
@@ -969,7 +969,7 @@ public:
ObjectGuid guid;
// character name can't start from number
if (isNumeric(playerStr))
- guid = ObjectGuid(HIGHGUID_PLAYER, uint32(atoi(playerStr)));
+ guid = ObjectGuid(HIGHGUID_PLAYER, strtoull(playerStr, nullptr, 10));
else
{
std::string name = handler->extractPlayerNameFromLink(playerStr);
@@ -990,7 +990,7 @@ public:
return false;
}
- switch (PlayerDumpWriter().WriteDump(fileStr, uint32(guid.GetCounter())))
+ switch (PlayerDumpWriter().WriteDump(fileStr, guid.GetCounter()))
{
case DUMP_SUCCESS:
handler->PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index f93208a4186..678dd91c87d 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -373,7 +373,7 @@ public:
GameObject* obj = handler->GetNearbyGameObject();
if (!obj)
{
- handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, 0);
+ handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, UI64LIT(0));
handler->SetSentErrorMessage(true);
ifs.close();
return false;
@@ -385,7 +385,7 @@ public:
GameObject* obj = handler->GetNearbyGameObject();
if (!obj)
{
- handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, 0);
+ handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, UI64LIT(0));
handler->SetSentErrorMessage(true);
ifs.close();
return false;
@@ -928,7 +928,7 @@ public:
Map* map = handler->GetSession()->GetPlayer()->GetMap();
- if (!v->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_VEHICLE), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, x, y, z, o, nullptr, id))
+ if (!v->Create(sObjectMgr->GetGenerator<HIGHGUID_VEHICLE>()->Generate(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, x, y, z, o, nullptr, id))
{
delete v;
return false;
@@ -987,10 +987,10 @@ public:
if (!e || !f)
return false;
- uint32 guid = (uint32)atoi(e);
+ ObjectGuid::LowType guid = strtoull(e, nullptr, 10);
uint32 index = (uint32)atoi(f);
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid));
+ Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
if (!i)
return false;
@@ -1000,7 +1000,7 @@ public:
uint32 value = i->GetUInt32Value(index);
- handler->PSendSysMessage("Item %u: value at %u is %u", guid, index, value);
+ handler->PSendSysMessage("Item " UI64FMTD ": value at %u is %u", guid, index, value);
return true;
}
@@ -1017,11 +1017,11 @@ public:
if (!e || !f || !g)
return false;
- uint32 guid = (uint32)atoi(e);
+ ObjectGuid::LowType guid = strtoull(e, nullptr, 10);
uint32 index = (uint32)atoi(f);
uint32 value = (uint32)atoi(g);
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid));
+ Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
if (!i)
return false;
@@ -1043,7 +1043,7 @@ public:
if (!e)
return false;
- uint32 guid = (uint32)atoi(e);
+ ObjectGuid::LowType guid = strtoull(e, nullptr, 10);
Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index a7fa77fbe97..cd0e1dd9ea3 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -135,7 +135,7 @@ public:
float z = fields[2].GetFloat();
float o = fields[3].GetFloat();
uint32 mapId = fields[4].GetUInt16();
- uint32 guid = fields[5].GetUInt32();
+ ObjectGuid::LowType guid = fields[5].GetUInt64();
uint32 id = fields[6].GetUInt32();
Transport* transport = NULL;
@@ -278,7 +278,7 @@ public:
if (!id)
return false;
- int32 guid = atoi(id);
+ ObjectGuid::LowType guid = strtoull(id, nullptr, 10);
if (!guid)
return false;
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index cacb9e1f543..7086aa82e6f 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -81,7 +81,7 @@ public:
if (!id)
return false;
- uint32 guidLow = atoi(id);
+ ObjectGuid::LowType guidLow = strtoull(id, nullptr, 10);
if (!guidLow)
return false;
@@ -150,7 +150,7 @@ public:
Map* map = player->GetMap();
GameObject* object = new GameObject;
- uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
+ ObjectGuid::LowType guidLow = sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate();
if (!object->Create(guidLow, objectInfo->entry, map, 0, x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
@@ -293,14 +293,15 @@ public:
bool found = false;
float x, y, z, o;
- uint32 guidLow, id, phase;
+ ObjectGuid::LowType guidLow;
+ uint32 id, phase;
uint16 mapId;
uint32 poolId;
do
{
Field* fields = result->Fetch();
- guidLow = fields[0].GetUInt32();
+ guidLow = fields[0].GetUInt64();
id = fields[1].GetUInt32();
x = fields[2].GetFloat();
y = fields[3].GetFloat();
@@ -353,7 +354,7 @@ public:
if (!id)
return false;
- uint32 guidLow = atoi(id);
+ ObjectGuid::LowType guidLow = strtoull(id, nullptr, 10);
if (!guidLow)
return false;
@@ -401,7 +402,7 @@ public:
if (!id)
return false;
- uint32 guidLow = atoi(id);
+ ObjectGuid::LowType guidLow = strtoull(id, nullptr, 10);
if (!guidLow)
return false;
@@ -450,7 +451,7 @@ public:
if (!id)
return false;
- uint32 guidLow = atoi(id);
+ ObjectGuid::LowType guidLow = strtoull(id, nullptr, 10);
if (!guidLow)
return false;
@@ -569,7 +570,7 @@ public:
do
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
uint32 entry = fields[1].GetUInt32();
float x = fields[2].GetFloat();
float y = fields[3].GetFloat();
@@ -638,7 +639,7 @@ public:
if (!id)
return false;
- uint32 guidLow = atoi(id);
+ ObjectGuid::LowType guidLow = strtoull(id, nullptr, 10);
if (!guidLow)
return false;
diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp
index 3d524b79e79..5112a2f2e2c 100644
--- a/src/server/scripts/Commands/cs_group.cpp
+++ b/src/server/scripts/Commands/cs_group.cpp
@@ -269,7 +269,7 @@ public:
const char* onlineState = "";
// Parse the guid to uint32...
- ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args)));
+ ObjectGuid parseGUID(HIGHGUID_PLAYER, strtoull(args, nullptr, 10));
// ... and try to extract a player out of it.
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget))
diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp
index bbf7feb9aa8..977e6ceb1e3 100644
--- a/src/server/scripts/Commands/cs_guild.cpp
+++ b/src/server/scripts/Commands/cs_guild.cpp
@@ -160,7 +160,7 @@ public:
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
return false;
- uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid);
+ ObjectGuid::LowType guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid);
if (!guildId)
return false;
@@ -186,7 +186,7 @@ public:
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &target_name))
return false;
- uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid);
+ ObjectGuid::LowType guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid);
if (!guildId)
return false;
@@ -254,15 +254,9 @@ public:
if (args && args[0] != '\0')
{
if (isNumeric(args))
- {
- uint32 guildId = uint32(atoi(args));
- guild = sGuildMgr->GetGuildById(guildId);
- }
+ guild = sGuildMgr->GetGuildById(strtoull(args, nullptr, 10));
else
- {
- std::string guildName = args;
- guild = sGuildMgr->GetGuildByName(guildName);
- }
+ guild = sGuildMgr->GetGuildByName(args);
}
else if (Player* target = handler->getSelectedPlayerOrSelf())
guild = target->GetGuild();
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index 2afac2ab0c2..44e4f8714cd 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -109,7 +109,7 @@ public:
do
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
float x = fields[1].GetFloat();
float y = fields[2].GetFloat();
float z = fields[3].GetFloat();
@@ -235,9 +235,9 @@ public:
do
{
Field* fields = result->Fetch();
- uint32 itemGuid = fields[0].GetUInt32();
- uint32 itemSender = fields[1].GetUInt32();
- uint32 itemReceiver = fields[2].GetUInt32();
+ ObjectGuid::LowType itemGuid = fields[0].GetUInt64();
+ ObjectGuid::LowType itemSender = fields[1].GetUInt64();
+ ObjectGuid::LowType itemReceiver = fields[2].GetUInt64();
uint32 itemSenderAccountId = fields[3].GetUInt32();
std::string itemSenderName = fields[4].GetString();
uint32 itemReceiverAccount = fields[5].GetUInt32();
@@ -398,7 +398,7 @@ public:
do
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
float x = fields[1].GetFloat();
float y = fields[2].GetFloat();
float z = fields[3].GetFloat();
@@ -476,7 +476,7 @@ public:
if (!*args)
return false;
- ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args)));
+ ObjectGuid parseGUID(HIGHGUID_PLAYER, strtoull(args, nullptr, 10));
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
{
@@ -487,7 +487,7 @@ public:
return false;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_COUNT);
- stmt->setUInt32(0, targetGuid.GetCounter());
+ stmt->setUInt64(0, targetGuid.GetCounter());
PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
if (queryResult)
{
@@ -499,7 +499,7 @@ public:
handler->PSendSysMessage(LANG_ACCOUNT_LIST_BAR);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_INFO);
- stmt->setUInt32(0, targetGuid.GetCounter());
+ stmt->setUInt64(0, targetGuid.GetCounter());
PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
if (queryResult)
@@ -508,9 +508,9 @@ public:
{
Field* queryFields = queryResult->Fetch();
uint32 messageId = queryFields[0].GetUInt32();
- uint32 senderId = queryFields[1].GetUInt32();
+ ObjectGuid::LowType senderId = queryFields[1].GetUInt64();
std::string sender = queryFields[2].GetString();
- uint32 receiverId = queryFields[3].GetUInt32();
+ ObjectGuid::LowType receiverId = queryFields[3].GetUInt64();
std::string receiver = queryFields[4].GetString();
std::string subject = queryFields[5].GetString();
uint64 deliverTime = queryFields[6].GetUInt32();
@@ -536,7 +536,7 @@ public:
{
uint32 item_guid = (*result2)[0].GetUInt32();
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_ITEMS);
- stmt->setUInt32(0, item_guid);
+ stmt->setUInt64(0, item_guid);
PreparedQueryResult result3 = CharacterDatabase.Query(stmt);
if (result3)
{
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index c1aee9620b8..f07dc7c18c9 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1390,7 +1390,7 @@ public:
PreparedStatement* stmt = NULL;
// To make sure we get a target, we convert our guid to an omniversal...
- ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args)));
+ ObjectGuid parseGUID(HIGHGUID_PLAYER, strtoull(args, nullptr, 10));
// ... and make sure we get a target, somehow.
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
@@ -1479,7 +1479,7 @@ public:
std::string zoneName = handler->GetTrinityString(LANG_UNKNOWN);
// Guild data print variables defined so that they exist, but are not necessarily used
- ObjectGuid::LowType guildId = 0;
+ ObjectGuid::LowType guildId = UI64LIT(0);
uint8 guildRankId = 0;
std::string guildName;
std::string guildRank;
@@ -1735,7 +1735,7 @@ public:
// Mail Data - an own query, because it may or may not be useful.
// SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?"
PreparedStatement* stmt4 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);
- stmt4->setUInt32(0, lowguid);
+ stmt4->setUInt64(0, lowguid);
PreparedQueryResult result6 = CharacterDatabase.Query(stmt4);
if (result6)
{
@@ -2124,7 +2124,7 @@ public:
return false;
}
- int32 guid = atoi(guidStr);
+ ObjectGuid::LowType guid = strtoull(guidStr, nullptr, 10);
if (!guid)
{
handler->SendSysMessage(LANG_BAD_VALUE);
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 57506661cf4..feba03d259e 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -261,7 +261,7 @@ public:
if (Transport* trans = chr->GetTransport())
{
- uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT);
+ ObjectGuid::LowType guid = sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate();
CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid);
data.id = id;
data.phaseMask = chr->GetPhaseMask();
@@ -279,7 +279,7 @@ public:
}
Creature* creature = new Creature();
- if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMask(), id, x, y, z, o))
+ if (!creature->Create(sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate(), map, chr->GetPhaseMask(), id, x, y, z, o))
{
delete creature;
return false;
@@ -290,7 +290,7 @@ public:
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMask());
- uint32 db_guid = creature->GetDBTableGUIDLow();
+ ObjectGuid::LowType db_guid = creature->GetDBTableGUIDLow();
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells()
// current "creature" variable is deleted and created fresh new, otherwise old values might trigger asserts or cause undefined behavior
@@ -374,7 +374,7 @@ public:
char* guidStr = strtok((char*)args, " ");
char* waitStr = strtok((char*)NULL, " ");
- uint32 lowGuid = atoi((char*)guidStr);
+ ObjectGuid::LowType lowGuid = strtoull(guidStr, nullptr, 10);
Creature* creature = NULL;
@@ -409,7 +409,7 @@ public:
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE);
stmt->setUInt8(0, uint8(WAYPOINT_MOTION_TYPE));
- stmt->setUInt32(1, lowGuid);
+ stmt->setUInt64(1, lowGuid);
WorldDatabase.Execute(stmt);
@@ -522,7 +522,7 @@ public:
if (!cId)
return false;
- uint32 lowguid = atoi(cId);
+ ObjectGuid::LowType lowguid = strtoull(cId, nullptr, 10);
if (!lowguid)
return false;
@@ -799,7 +799,7 @@ public:
do
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
uint32 entry = fields[1].GetUInt32();
float x = fields[2].GetFloat();
float y = fields[3].GetFloat();
@@ -825,7 +825,7 @@ public:
//move selected creature
static bool HandleNpcMoveCommand(ChatHandler* handler, char const* args)
{
- uint32 lowguid = 0;
+ ObjectGuid::LowType lowguid = UI64LIT(0);
Creature* creature = handler->getSelectedCreature();
@@ -836,7 +836,7 @@ public:
if (!cId)
return false;
- lowguid = atoi(cId);
+ lowguid = strtoull(cId, nullptr, 10);
/* FIXME: impossible without entry
if (lowguid)
@@ -902,7 +902,7 @@ public:
stmt->setFloat(1, y);
stmt->setFloat(2, z);
stmt->setFloat(3, o);
- stmt->setUInt32(4, lowguid);
+ stmt->setUInt64(4, lowguid);
WorldDatabase.Execute(stmt);
@@ -986,7 +986,7 @@ public:
if (!guid_str)
return false;
- uint32 lowguid = 0;
+ ObjectGuid::LowType lowguid = UI64LIT(0);
Creature* creature = NULL;
if (dontdel_str)
@@ -1028,7 +1028,7 @@ public:
}
else // case .setmovetype #creature_guid $move_type (with selected creature)
{
- lowguid = atoi((char*)guid_str);
+ lowguid = strtoull(guid_str, nullptr, 10);
/* impossible without entry
if (lowguid)
@@ -1142,14 +1142,14 @@ public:
mtype = RANDOM_MOTION_TYPE;
Creature* creature = handler->getSelectedCreature();
- uint32 guidLow = 0;
+ ObjectGuid::LowType guidLow = UI64LIT(0);
if (creature)
guidLow = creature->GetDBTableGUIDLow();
else
return false;
- creature->SetRespawnRadius((float)option);
+ creature->SetRespawnRadius(option);
creature->SetDefaultMovementType(mtype);
creature->GetMotionMaster()->Initialize();
if (creature->IsAlive()) // dead creature will reset movement generator at respawn
@@ -1162,7 +1162,7 @@ public:
stmt->setFloat(0, option);
stmt->setUInt8(1, uint8(mtype));
- stmt->setUInt32(2, guidLow);
+ stmt->setUInt64(2, guidLow);
WorldDatabase.Execute(stmt);
@@ -1191,7 +1191,7 @@ public:
}
Creature* creature = handler->getSelectedCreature();
- uint32 guidLow = 0;
+ ObjectGuid::LowType guidLow = UI64LIT(0);
if (creature)
guidLow = creature->GetDBTableGUIDLow();
@@ -1201,7 +1201,7 @@ public:
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_SPAWN_TIME_SECS);
stmt->setUInt32(0, uint32(spawnTime));
- stmt->setUInt32(1, guidLow);
+ stmt->setUInt64(1, guidLow);
WorldDatabase.Execute(stmt);
@@ -1323,7 +1323,7 @@ public:
return false;
}
- ObjectGuid receiver_guid(HIGHGUID_PLAYER, uint32(atol(receiver_str)));
+ ObjectGuid receiver_guid(HIGHGUID_PLAYER, strtoull(receiver_str, nullptr, 10));
// check online security
Player* receiver = ObjectAccessor::FindPlayer(receiver_guid);
@@ -1455,7 +1455,7 @@ public:
if (!*args)
return false;
- uint32 leaderGUID = (uint32) atoi((char*)args);
+ ObjectGuid::LowType leaderGUID = strtoull(args, nullptr, 10);
Creature* creature = handler->getSelectedCreature();
if (!creature || !creature->GetDBTableGUIDLow())
@@ -1465,7 +1465,7 @@ public:
return false;
}
- uint32 lowguid = creature->GetDBTableGUIDLow();
+ ObjectGuid::LowType lowguid = creature->GetDBTableGUIDLow();
if (creature->GetFormation())
{
handler->PSendSysMessage("Selected creature is already member of group %u", creature->GetFormation()->GetId());
@@ -1489,8 +1489,8 @@ public:
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_FORMATION);
- stmt->setUInt32(0, leaderGUID);
- stmt->setUInt32(1, lowguid);
+ stmt->setUInt64(0, leaderGUID);
+ stmt->setUInt64(1, lowguid);
stmt->setFloat(2, group_member->follow_dist);
stmt->setFloat(3, group_member->follow_angle);
stmt->setUInt32(4, uint32(group_member->groupAI));
@@ -1507,7 +1507,7 @@ public:
if (!*args)
return false;
- uint32 linkguid = (uint32) atoi((char*)args);
+ ObjectGuid::LowType linkguid = strtoull(args, nullptr, 10);
Creature* creature = handler->getSelectedCreature();
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 6abc7032d0d..b5186bdb948 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -243,7 +243,7 @@ public:
// prepare Quest Tracker datas
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_GM_COMPLETE);
stmt->setUInt32(0, quest->GetQuestId());
- stmt->setUInt32(1, player->GetGUID().GetCounter());
+ stmt->setUInt64(1, player->GetGUID().GetCounter());
// add to Quest Tracker
CharacterDatabase.Execute(stmt);
diff --git a/src/server/scripts/Commands/cs_send.cpp b/src/server/scripts/Commands/cs_send.cpp
index 1c13403a5a5..8c0ba551423 100644
--- a/src/server/scripts/Commands/cs_send.cpp
+++ b/src/server/scripts/Commands/cs_send.cpp
@@ -77,7 +77,7 @@ public:
std::string text = msgText;
// from console show not existed sender
- MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM);
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : UI64LIT(0), MAIL_STATIONERY_GM);
/// @todo Fix poor design
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -176,7 +176,7 @@ public:
}
// from console show not existed sender
- MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM);
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : UI64LIT(0), MAIL_STATIONERY_GM);
// fill mail
MailDraft draft(subject, text);
@@ -236,7 +236,7 @@ public:
std::string text = msgText;
// from console show not existed sender
- MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM);
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : UI64LIT(0), MAIL_STATIONERY_GM);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index f8ef57e53c4..2222a929538 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -150,7 +150,7 @@ public:
path_number = strtok((char*)args, " ");
uint32 pathid = 0;
- uint32 guidLow = 0;
+ ObjectGuid::LowType guidLow = UI64LIT(0);
Creature* target = handler->getSelectedCreature();
// Did player provide a path_id?
@@ -183,7 +183,7 @@ public:
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_ADDON_BY_GUID);
- stmt->setUInt32(0, guidLow);
+ stmt->setUInt64(0, guidLow);
PreparedQueryResult result = WorldDatabase.Query(stmt);
@@ -192,13 +192,13 @@ public:
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_ADDON_PATH);
stmt->setUInt32(0, pathid);
- stmt->setUInt32(1, guidLow);
+ stmt->setUInt64(1, guidLow);
}
else
{
stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_ADDON);
- stmt->setUInt32(0, guidLow);
+ stmt->setUInt64(0, guidLow);
stmt->setUInt32(1, pathid);
}
@@ -207,7 +207,7 @@ public:
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE);
stmt->setUInt8(0, uint8(WAYPOINT_MOTION_TYPE));
- stmt->setUInt32(1, guidLow);
+ stmt->setUInt64(1, guidLow);
WorldDatabase.Execute(stmt);
@@ -246,8 +246,8 @@ public:
return true;
}
- uint32 guidLow = target->GetDBTableGUIDLow();
- if (guidLow == 0)
+ ObjectGuid::LowType guidLow = target->GetDBTableGUIDLow();
+ if (!guidLow)
{
handler->PSendSysMessage("%s%s|r", "|cffff33ff", "Target is not saved to DB.");
return true;
@@ -261,14 +261,14 @@ public:
}
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
- stmt->setUInt32(0, guidLow);
+ stmt->setUInt64(0, guidLow);
WorldDatabase.Execute(stmt);
target->UpdateWaypointID(0);
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE);
stmt->setUInt8(0, uint8(IDLE_MOTION_TYPE));
- stmt->setUInt32(1, guidLow);
+ stmt->setUInt64(1, guidLow);
WorldDatabase.Execute(stmt);
target->LoadPath(0);
@@ -577,7 +577,7 @@ public:
// Check the creature
stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_WPGUID);
- stmt->setUInt32(0, wpGuid.GetCounter());
+ stmt->setUInt64(0, wpGuid.GetCounter());
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
@@ -674,7 +674,7 @@ public:
}
// re-create
Creature* wpCreature2 = new Creature();
- if (!wpCreature2->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMask(), VISUAL_WAYPOINT, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation()))
+ if (!wpCreature2->Create(sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate(), map, chr->GetPhaseMask(), VISUAL_WAYPOINT, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation()))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
delete wpCreature2;
@@ -790,7 +790,7 @@ public:
}
stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID);
- stmt->setUInt32(0, target->GetGUID().GetCounter());
+ stmt->setUInt64(0, target->GetGUID().GetCounter());
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
@@ -849,7 +849,7 @@ public:
do
{
Field* fields = result2->Fetch();
- uint32 wpguid = fields[0].GetUInt32();
+ ObjectGuid::LowType wpguid = fields[0].GetUInt64();
Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpguid));
if (!creature)
@@ -858,7 +858,7 @@ public:
hasError = true;
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
- stmt->setUInt32(0, wpguid);
+ stmt->setUInt64(0, wpguid);
WorldDatabase.Execute(stmt);
}
else
@@ -894,7 +894,7 @@ public:
float o = chr->GetOrientation();
Creature* wpCreature = new Creature();
- if (!wpCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMask(), id, x, y, z, o))
+ if (!wpCreature->Create(sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate(), map, chr->GetPhaseMask(), id, x, y, z, o))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete wpCreature;
@@ -906,7 +906,7 @@ public:
// Set "wpguid" column to the visual waypoint
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_WPGUID);
- stmt->setUInt32(0, wpCreature->GetGUID().GetCounter());
+ stmt->setUInt64(0, wpCreature->GetGUID().GetCounter());
stmt->setUInt32(1, pathid);
stmt->setUInt32(2, point);
WorldDatabase.Execute(stmt);
@@ -959,7 +959,7 @@ public:
Map* map = chr->GetMap();
Creature* creature = new Creature();
- if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMask(), id, x, y, z, o))
+ if (!creature->Create(sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate(), map, chr->GetPhaseMask(), id, x, y, z, o))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete creature;
@@ -1011,7 +1011,7 @@ public:
Map* map = chr->GetMap();
Creature* creature = new Creature();
- if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMask(), id, x, y, z, o))
+ if (!creature->Create(sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate(), map, chr->GetPhaseMask(), id, x, y, z, o))
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
delete creature;
@@ -1054,7 +1054,7 @@ public:
do
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, guid));
if (!creature)
{
@@ -1062,7 +1062,7 @@ public:
hasError = true;
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
- stmt->setUInt32(0, guid);
+ stmt->setUInt64(0, guid);
WorldDatabase.Execute(stmt);
}
else
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
index d7e4d8f76b2..c9621bdf161 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
@@ -381,7 +381,7 @@ class instance_halls_of_reflection : public InstanceMapScript
_teamInInstance = player->GetTeam();
}
- if (Transport* gunship = sTransportMgr->CreateTransport(_teamInInstance == HORDE ? GO_ORGRIMS_HAMMER : GO_THE_SKYBREAKER, 0, instance))
+ if (Transport* gunship = sTransportMgr->CreateTransport(_teamInInstance == HORDE ? GO_ORGRIMS_HAMMER : GO_THE_SKYBREAKER, UI64LIT(0), instance))
gunship->EnableMovement(GetBossState(DATA_THE_LICH_KING_ESCAPE) == DONE);
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
index 1c5ef133b89..a0f871eacff 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
@@ -1000,7 +1000,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
Talk(SAY_SAURFANG_INTRO_2);
break;
case EVENT_INTRO_SUMMON_SKYBREAKER:
- sTransportMgr->CreateTransport(GO_THE_SKYBREAKER_H, 0, me->GetMap());
+ sTransportMgr->CreateTransport(GO_THE_SKYBREAKER_H, UI64LIT(0), me->GetMap());
break;
case EVENT_INTRO_H_3:
Talk(SAY_SAURFANG_INTRO_3);
@@ -1270,7 +1270,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
Talk(SAY_MURADIN_INTRO_2);
break;
case EVENT_INTRO_SUMMON_ORGRIMS_HAMMER:
- sTransportMgr->CreateTransport(GO_ORGRIMS_HAMMER_A, 0, me->GetMap());
+ sTransportMgr->CreateTransport(GO_ORGRIMS_HAMMER_A, UI64LIT(0), me->GetMap());
break;
case EVENT_INTRO_A_3:
Talk(SAY_MURADIN_INTRO_3);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index 9324379e9d6..01ec8594f75 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -648,7 +648,7 @@ class npc_spinestalker : public CreatureScript
// Increase add count
if (!me->isDead())
{
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid(HIGHGUID_UNIT, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade
Reset();
}
}
@@ -671,7 +671,7 @@ class npc_spinestalker : public CreatureScript
void JustRespawned() override
{
ScriptedAI::JustRespawned();
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid(HIGHGUID_UNIT, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade
}
void JustDied(Unit* /*killer*/) override
@@ -784,7 +784,7 @@ class npc_rimefang : public CreatureScript
// Increase add count
if (!me->isDead())
{
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid(HIGHGUID_UNIT, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade
Reset();
}
}
@@ -807,7 +807,7 @@ class npc_rimefang : public CreatureScript
void JustRespawned() override
{
ScriptedAI::JustRespawned();
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid(HIGHGUID_UNIT, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade
}
void JustDied(Unit* /*killer*/) override
@@ -951,7 +951,7 @@ class npc_sindragosa_trash : public CreatureScript
if (!me->isDead())
{
if (me->GetEntry() == NPC_FROSTWING_WHELP)
- _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetGuidData(_frostwyrmId, ObjectGuid(HIGHGUID_UNIT, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade
Reset();
}
}
@@ -974,7 +974,7 @@ class npc_sindragosa_trash : public CreatureScript
// Increase add count
if (me->GetEntry() == NPC_FROSTWING_WHELP)
- _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
+ _instance->SetGuidData(_frostwyrmId, ObjectGuid(HIGHGUID_UNIT, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade
}
void SetData(uint32 type, uint32 data) override
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
index 22fa44541a1..abe178a874d 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
@@ -545,7 +545,7 @@ class npc_highlord_tirion_fordring_lh : public CreatureScript
case EVENT_MURADIN_RUN:
case EVENT_SAURFANG_RUN:
if (Creature* factionNPC = ObjectAccessor::GetCreature(*me, _factionNPC))
- factionNPC->GetMotionMaster()->MovePath(factionNPC->GetDBTableGUIDLow()*10, false);
+ factionNPC->GetMotionMaster()->MovePath(factionNPC->GetDBTableGUIDLow() * 10, false);
me->setActive(false);
_damnedKills = 3;
break;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
index fb257995842..69349241160 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
@@ -989,7 +989,7 @@ class instance_icecrown_citadel : public InstanceMapScript
{
SetBossState(DATA_ICECROWN_GUNSHIP_BATTLE, NOT_STARTED);
uint32 gunshipEntry = TeamInInstance == HORDE ? GO_ORGRIMS_HAMMER_H : GO_THE_SKYBREAKER_A;
- if (Transport* gunship = sTransportMgr->CreateTransport(gunshipEntry, 0, instance))
+ if (Transport* gunship = sTransportMgr->CreateTransport(gunshipEntry, UI64LIT(0), instance))
GunshipGUID = gunship->GetGUID();
}
}
@@ -1010,15 +1010,6 @@ class instance_icecrown_citadel : public InstanceMapScript
case DATA_ORB_WHISPERER_ACHIEVEMENT:
IsOrbWhispererEligible = data ? true : false;
break;
- case DATA_SINDRAGOSA_FROSTWYRMS:
- FrostwyrmGUIDs.insert(data);
- break;
- case DATA_SPINESTALKER:
- SpinestalkerTrash.insert(data);
- break;
- case DATA_RIMEFANG:
- RimefangTrash.insert(data);
- break;
case DATA_COLDFLAME_JETS:
ColdflameJetsState = data;
if (ColdflameJetsState == DONE)
@@ -1069,6 +1060,22 @@ class instance_icecrown_citadel : public InstanceMapScript
}
}
+ void SetGuidData(uint32 type, ObjectGuid guid) override
+ {
+ switch (type)
+ {
+ case DATA_SINDRAGOSA_FROSTWYRMS:
+ FrostwyrmGUIDs.insert(guid.GetCounter());
+ break;
+ case DATA_SPINESTALKER:
+ SpinestalkerTrash.insert(guid.GetCounter());
+ break;
+ case DATA_RIMEFANG:
+ RimefangTrash.insert(guid.GetCounter());
+ break;
+ }
+ }
+
bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/) override
{
switch (criteria_id)
@@ -1469,9 +1476,9 @@ class instance_icecrown_citadel : public InstanceMapScript
uint32 TeamInInstance;
uint32 ColdflameJetsState;
uint32 UpperSpireTeleporterActiveState;
- std::set<uint32> FrostwyrmGUIDs;
- std::set<uint32> SpinestalkerTrash;
- std::set<uint32> RimefangTrash;
+ std::set<ObjectGuid::LowType> FrostwyrmGUIDs;
+ std::set<ObjectGuid::LowType> SpinestalkerTrash;
+ std::set<ObjectGuid::LowType> RimefangTrash;
uint32 BloodQuickeningState;
uint32 HeroicAttempts;
uint16 BloodQuickeningMinutes;
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
index d8612e1f5dd..c063996da8d 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
@@ -74,7 +74,7 @@ public:
void SpawnGameObject(uint32 entry, Position& pos)
{
GameObject* go = new GameObject;
- if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, instance,
+ if (!go->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), entry, instance,
PHASEMASK_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(),
0, 0, 0, 0, 120, GO_STATE_READY))
{
diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp
index 27d3e6dadc6..ce2cef9798a 100644
--- a/src/server/scripts/Northrend/zone_dalaran.cpp
+++ b/src/server/scripts/Northrend/zone_dalaran.cpp
@@ -184,7 +184,7 @@ class npc_minigob_manabonk : public CreatureScript
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
int16 deliverDelay = irand(MAIL_DELIVER_DELAY_MIN, MAIL_DELIVER_DELAY_MAX);
- MailDraft(MAIL_MINIGOB_ENTRY, true).SendMailTo(trans, MailReceiver(player), MailSender(MAIL_CREATURE, me->GetEntry()), MAIL_CHECK_MASK_NONE, deliverDelay);
+ MailDraft(MAIL_MINIGOB_ENTRY, true).SendMailTo(trans, MailReceiver(player), MailSender(MAIL_CREATURE, uint64(me->GetEntry())), MAIL_CHECK_MASK_NONE, deliverDelay);
CharacterDatabase.CommitTransaction(trans);
}
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index 49250c9d638..9cf862e5fdc 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -166,7 +166,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
return true;
}
- if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
+ if (!go->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
{
delete go;
return true;
@@ -203,7 +203,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
return true;
}
- if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
+ if (!go->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
{
delete go;
return true;
diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp
index 8cc8652b3db..9d2aa868234 100644
--- a/src/server/scripts/World/action_ip_logger.cpp
+++ b/src/server/scripts/World/action_ip_logger.cpp
@@ -96,7 +96,6 @@ class AccountActionIpLogger : public AccountScript
// We declare all the required variables
uint32 playerGuid = accountId;
- uint32 characterGuid = 0;
std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it later.
// With this switch, we change systemNote so that we have a more accurate phrasing of what type it is.
@@ -141,7 +140,7 @@ class AccountActionIpLogger : public AccountScript
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING);
stmt->setUInt32(0, playerGuid);
- stmt->setUInt32(1, characterGuid);
+ stmt->setUInt32(1, 0);
stmt->setUInt8(2, aType);
stmt->setUInt32(3, playerGuid);
stmt->setString(4, systemNote.c_str());
@@ -152,7 +151,7 @@ class AccountActionIpLogger : public AccountScript
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_FACL_IP_LOGGING);
stmt->setUInt32(0, playerGuid);
- stmt->setUInt32(1, characterGuid);
+ stmt->setUInt32(1, 0);
stmt->setUInt8(2, aType);
stmt->setUInt32(3, playerGuid);
stmt->setString(4, systemNote.c_str());
@@ -233,7 +232,7 @@ class CharacterActionIpLogger : public PlayerScript
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_CHAR_IP_LOGGING);
stmt->setUInt32(0, playerGuid);
- stmt->setUInt32(1, player->GetGUID().GetCounter());
+ stmt->setUInt64(1, player->GetGUID().GetCounter());
stmt->setUInt8(2, aType);
stmt->setString(3, currentIp.c_str()); // We query the ip here.
stmt->setString(4, systemNote.c_str());
@@ -291,7 +290,7 @@ public:
PreparedStatement* stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING);
stmt2->setUInt32(0, playerGuid);
- stmt2->setUInt32(1, guid.GetCounter());
+ stmt2->setUInt64(1, guid.GetCounter());
stmt2->setUInt8(2, aType);
stmt2->setUInt32(3, playerGuid);
stmt2->setString(4, systemNote.c_str());
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index b927e4c5472..803d456b9c6 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -143,7 +143,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_UPD_MAIL_ITEM_RECEIVER, "UPDATE mail_items SET receiver = ? WHERE item_guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_ITEM_OWNER, "UPDATE item_instance SET owner_guid = ? WHERE guid = ?", CONNECTION_ASYNC);
- PrepareStatement(CHAR_SEL_ITEM_REFUNDS, "SELECT player_guid, paidMoney, paidExtendedCost FROM item_refund_instance WHERE item_guid = ? AND player_guid = ? LIMIT 1", CONNECTION_SYNCH);
+ PrepareStatement(CHAR_SEL_ITEM_REFUNDS, "SELECT paidMoney, paidExtendedCost FROM item_refund_instance WHERE item_guid = ? AND player_guid = ? LIMIT 1", CONNECTION_SYNCH);
PrepareStatement(CHAR_SEL_ITEM_BOP_TRADE, "SELECT allowedPlayers FROM item_soulbound_trade_data WHERE itemGuid = ? LIMIT 1", CONNECTION_SYNCH);
PrepareStatement(CHAR_DEL_ITEM_BOP_TRADE, "DELETE FROM item_soulbound_trade_data WHERE itemGuid = ? LIMIT 1", CONNECTION_ASYNC);
PrepareStatement(CHAR_INS_ITEM_BOP_TRADE, "INSERT INTO item_soulbound_trade_data VALUES (?, ?)", CONNECTION_ASYNC);