aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorModoX <moardox@gmail.com>2024-04-09 16:33:39 +0200
committerShauren <shauren.trinity@gmail.com>2024-10-05 17:55:14 +0200
commitd900e0e9558d310e7ca35a18dadac76310d47d77 (patch)
tree4cbc135f110fecce9a7ad180fceed4cd650b21e7
parent6e6454860cac701ffa8a921677239b9b13e0e5de (diff)
Core/Entities: Added GetStringId helper methods
(cherry picked from commit 5cea37153eb6675bf0a25320a1c11cd0ec4969b6)
-rw-r--r--src/server/game/Entities/Creature/Creature.h1
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h1
-rw-r--r--src/server/shared/SharedDefines.h7
3 files changed, 9 insertions, 0 deletions
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 789912326ec..5be6ec7b27f 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -201,6 +201,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
bool HasStringId(std::string_view id) const;
void SetScriptStringId(std::string id);
std::array<std::string_view, 3> const& GetStringIds() const { return m_stringIds; }
+ std::string_view const& GetStringId(StringIdType type) const { return m_stringIds[AsUnderlyingType(type)]; }
// override WorldObject function for proper name localization
std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override;
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 882146faab9..af5261be1b1 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -277,6 +277,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
bool HasStringId(std::string_view id) const;
void SetScriptStringId(std::string id);
std::array<std::string_view, 3> const& GetStringIds() const { return m_stringIds; }
+ std::string_view const& GetStringId(StringIdType type) const { return m_stringIds[AsUnderlyingType(type)]; }
void SetDisplayId(uint32 displayid);
uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); }
diff --git a/src/server/shared/SharedDefines.h b/src/server/shared/SharedDefines.h
index 2ae3043b79c..e255a05f42f 100644
--- a/src/server/shared/SharedDefines.h
+++ b/src/server/shared/SharedDefines.h
@@ -2766,6 +2766,13 @@ enum CreatureEliteType
CREATURE_ELITE_TRIVIAL = 5 // found in 2.2.3 for 2 mobs
};
+enum class StringIdType : int32
+{
+ Template = 0,
+ Spawn = 1,
+ Script = 2
+};
+
// values based at Holidays.dbc
enum HolidayIds
{