diff options
author | Krudor <erikstrandberg93@hotmail.com> | 2017-03-18 11:31:31 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2017-03-18 11:31:31 +0100 |
commit | 5a36a2eb17aeec937b4375f341239fdb9dce5fda (patch) | |
tree | eac8a498a243fa145877636402f8bf86528a7cfb /src/server/game/Globals/ObjectMgr.cpp | |
parent | 0a35c473c8df41ec5e0699873e0746700eeb6b41 (diff) |
Core/Scripts: Add support for spawn specific C++ scripts
Closes #19247
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index c07f6bd83bf..a6ddfc172fa 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1843,8 +1843,10 @@ void ObjectMgr::LoadCreatures() // 0 1 2 3 4 5 6 7 8 9 10 QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, " - // 11 12 13 14 15 16 17 18 19 20 21 22 - "currentwaypoint, curhealth, curmana, MovementType, spawnMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags, creature.phaseid, creature.phasegroup " + // 11 12 13 14 15 16 17 18 19 20 21 + "currentwaypoint, curhealth, curmana, MovementType, spawnMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags, creature.phaseid, " + // 22 23 + "creature.phasegroup, creature.ScriptName " "FROM creature " "LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid " "LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid"); @@ -1901,6 +1903,9 @@ void ObjectMgr::LoadCreatures() data.dynamicflags = fields[20].GetUInt32(); data.phaseid = fields[21].GetUInt32(); data.phaseGroup = fields[22].GetUInt32(); + data.ScriptId = GetScriptId(fields[23].GetString()); + if (!data.ScriptId) + data.ScriptId = cInfo->ScriptID; MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) @@ -2172,8 +2177,10 @@ void ObjectMgr::LoadGameobjects() // 0 1 2 3 4 5 6 QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, id, map, position_x, position_y, position_z, orientation, " - // 7 8 9 10 11 12 13 14 15 16 17 18 - "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, eventEntry, pool_entry, phaseid, phasegroup " + // 7 8 9 10 11 12 13 14 15 16 + "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, eventEntry, pool_entry, " + // 17 18 19 + "phaseid, phasegroup, ScriptName " "FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid " "LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid"); @@ -2314,6 +2321,10 @@ void ObjectMgr::LoadGameobjects() } } + data.ScriptId = GetScriptId(fields[19].GetString()); + if (!data.ScriptId) + data.ScriptId = gInfo->ScriptId; + if (std::abs(data.orientation) > 2 * float(M_PI)) { 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); @@ -8851,10 +8862,14 @@ void ObjectMgr::LoadScriptNames() QueryResult result = WorldDatabase.Query( "SELECT DISTINCT(ScriptName) FROM battleground_template WHERE ScriptName <> '' " "UNION " + "SELECT DISTINCT(ScriptName) FROM creature WHERE ScriptName <> '' " + "UNION " "SELECT DISTINCT(ScriptName) FROM creature_template WHERE ScriptName <> '' " "UNION " "SELECT DISTINCT(ScriptName) FROM criteria_data WHERE ScriptName <> '' AND type = 11 " "UNION " + "SELECT DISTINCT(ScriptName) FROM gameobject WHERE ScriptName <> '' " + "UNION " "SELECT DISTINCT(ScriptName) FROM gameobject_template WHERE ScriptName <> '' " "UNION " "SELECT DISTINCT(ScriptName) FROM item_script_names WHERE ScriptName <> '' " |