mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-05 03:53:48 +00:00
fix(Core): ScriptName not readable in creature and gameobject table fix (#8715)
This commit is contained in:
@@ -1031,7 +1031,7 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, u
|
||||
//! Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there
|
||||
m_positionZ += GetHoverHeight();
|
||||
|
||||
LastUsedScriptID = GetCreatureTemplate()->ScriptID;
|
||||
LastUsedScriptID = GetScriptId();
|
||||
|
||||
if (IsSpiritHealer() || IsSpiritGuide() || (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GHOST_VISIBILITY))
|
||||
{
|
||||
@@ -2769,6 +2769,9 @@ std::string Creature::GetScriptName() const
|
||||
|
||||
uint32 Creature::GetScriptId() const
|
||||
{
|
||||
if (CreatureData const* creatureData = GetCreatureData())
|
||||
return creatureData->ScriptId;
|
||||
|
||||
return sObjectMgr->GetCreatureTemplate(GetEntry())->ScriptID;
|
||||
}
|
||||
|
||||
|
||||
@@ -285,6 +285,7 @@ struct CreatureData
|
||||
uint32 npcflag{0};
|
||||
uint32 unit_flags{0}; // enum UnitFlags mask values
|
||||
uint32 dynamicflags{0};
|
||||
uint32 ScriptId;
|
||||
bool dbData{true};
|
||||
bool overwrittenZ{false};
|
||||
};
|
||||
|
||||
@@ -2090,6 +2090,14 @@ void GameObject::EventInform(uint32 eventId)
|
||||
m_zoneScript->ProcessEvent(this, eventId);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@@ -711,6 +711,7 @@ struct GameObjectData
|
||||
float orientation{0.0f};
|
||||
G3D::Quat rotation;
|
||||
int32 spawntimesecs{0};
|
||||
uint32 ScriptId;
|
||||
uint32 animprogress{0};
|
||||
GOState go_state{GO_STATE_ACTIVE};
|
||||
uint8 spawnMask{0};
|
||||
@@ -933,7 +934,7 @@ public:
|
||||
|
||||
void EventInform(uint32 eventId);
|
||||
|
||||
[[nodiscard]] virtual uint32 GetScriptId() const { return GetGOInfo()->ScriptId; }
|
||||
[[nodiscard]] virtual uint32 GetScriptId() const;
|
||||
[[nodiscard]] GameObjectAI* AI() const { return m_AI; }
|
||||
|
||||
[[nodiscard]] std::string GetAIName() const;
|
||||
|
||||
Reference in New Issue
Block a user