aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
authorSeyden <saiifii@live.de>2022-12-27 16:39:05 +0100
committerGitHub <noreply@github.com>2022-12-27 16:39:05 +0100
commit61c51b76c00d932a9180bc6781a244dc18375ef7 (patch)
tree291da8d7ade7f1eb9663007550c84936a51f21d3 /src/server/game/Globals/ObjectMgr.cpp
parent8e6842b8b6c12a1a7537909ceea386a215250b89 (diff)
Core/Creatures: Implement StringId for Creatures, a custom identifier to make finding specific creatures in script easier (#28500)
Allows targeting specific spawns without hardcoding guids or find a bunch of different creatures with a single search Co-authored-by: Shauren <shauren.trinity@gmail.com>
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 03ecfec1d82..248306ad8c3 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -366,8 +366,8 @@ void ObjectMgr::LoadCreatureTemplates()
// "RacialLeader, movementId, CreatureDifficultyID, WidgetSetID, WidgetSetUnitConditionID, RegenHealth, "
// 67 68 69
// "mechanic_immune_mask, spell_school_immune_mask, flags_extra, "
- // 70
- // "ScriptName FROM creature_template WHERE entry = ? OR 1 = ?");
+ // 70 71
+ // "ScriptName, StringId FROM creature_template WHERE entry = ? OR 1 = ?");
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_TEMPLATE);
stmt->setUInt32(0, 0);
@@ -501,6 +501,7 @@ void ObjectMgr::LoadCreatureTemplate(Field* fields)
creatureTemplate.SpellSchoolImmuneMask = fields[68].GetUInt32();
creatureTemplate.flags_extra = fields[69].GetUInt32();
creatureTemplate.ScriptID = GetScriptId(fields[70].GetString());
+ creatureTemplate.StringId = fields[71].GetString();
}
void ObjectMgr::LoadCreatureTemplateResistances()
@@ -2199,8 +2200,8 @@ void ObjectMgr::LoadCreatures()
QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, position_x, position_y, position_z, orientation, modelid, equipment_id, spawntimesecs, wander_distance, "
// 11 12 13 14 15 16 17 18 19 20 21
"currentwaypoint, curhealth, curmana, MovementType, spawnDifficulties, eventEntry, poolSpawnId, creature.npcflag, creature.unit_flags, creature.unit_flags2, creature.unit_flags3, "
- // 22 23 24 25 26 27
- "creature.dynamicflags, creature.phaseUseFlags, creature.phaseid, creature.phasegroup, creature.terrainSwapMap, creature.ScriptName "
+ // 22 23 24 25 26 27 28
+ "creature.dynamicflags, creature.phaseUseFlags, creature.phaseid, creature.phasegroup, creature.terrainSwapMap, creature.ScriptName, creature.StringId "
"FROM creature "
"LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid "
"LEFT OUTER JOIN pool_members ON pool_members.type = 0 AND creature.guid = pool_members.spawnId");
@@ -2261,6 +2262,7 @@ void ObjectMgr::LoadCreatures()
data.phaseGroup = fields[25].GetUInt32();
data.terrainSwapMap = fields[26].GetInt32();
data.scriptId = GetScriptId(fields[27].GetString());
+ data.StringId = fields[28].GetString();
data.spawnGroupData = IsTransportMap(data.mapId) ? GetLegacySpawnGroup() : GetDefaultSpawnGroup(); // transport spawns default to compatibility group
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapId);