aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/GameObject
diff options
context:
space:
mode:
authorKrudor <erikstrandberg93@hotmail.com>2017-03-18 11:31:31 +0100
committerShauren <shauren.trinity@gmail.com>2017-03-18 11:31:31 +0100
commit5a36a2eb17aeec937b4375f341239fdb9dce5fda (patch)
treeeac8a498a243fa145877636402f8bf86528a7cfb /src/server/game/Entities/GameObject
parent0a35c473c8df41ec5e0699873e0746700eeb6b41 (diff)
Core/Scripts: Add support for spawn specific C++ scripts
Closes #19247
Diffstat (limited to 'src/server/game/Entities/GameObject')
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp8
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h3
2 files changed, 10 insertions, 1 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index d5931dc1718..e2dfed4fb8c 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -1988,6 +1988,14 @@ void GameObject::EventInform(uint32 eventId, WorldObject* invoker /*= nullptr*/)
bgMap->GetBG()->ProcessEvent(this, eventId, invoker);
}
+uint32 GameObject::GetScriptId() const
+{
+ if (GameObjectData const* gameObjectData = GetGOData())
+ return gameObjectData->ScriptId;
+
+ return GetGOInfo()->ScriptId;
+}
+
// overwrite WorldObject function for proper name localization
std::string const & GameObject::GetNameForLocaleIdx(LocaleConstant loc_idx) const
{
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 0e22c841022..7e265ebf2cd 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -913,6 +913,7 @@ struct GameObjectData
uint8 artKit;
uint32 phaseid;
uint32 phaseGroup;
+ uint32 ScriptId;
bool dbData;
};
@@ -1124,7 +1125,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
void EventInform(uint32 eventId, WorldObject* invoker = NULL);
- virtual uint32 GetScriptId() const { return GetGOInfo()->ScriptId; }
+ virtual uint32 GetScriptId() const;
GameObjectAI* AI() const { return m_AI; }
std::string GetAIName() const;