mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[11381] Add methods GetDisplayId/SetDisplayId for gameobjects
Useful for GO type 33
This commit is contained in:
parent
820a3c0eff
commit
55709e265e
5 changed files with 19 additions and 10 deletions
|
|
@ -39,7 +39,9 @@
|
|||
#include "Util.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
GameObject::GameObject() : WorldObject()
|
||||
GameObject::GameObject() : WorldObject(),
|
||||
m_goInfo(NULL),
|
||||
m_displayInfo(NULL)
|
||||
{
|
||||
m_objectType |= TYPEMASK_GAMEOBJECT;
|
||||
m_objectTypeId = TYPEID_GAMEOBJECT;
|
||||
|
|
@ -54,7 +56,6 @@ GameObject::GameObject() : WorldObject()
|
|||
m_useTimes = 0;
|
||||
m_spellId = 0;
|
||||
m_cooldownTime = 0;
|
||||
m_goInfo = NULL;
|
||||
|
||||
m_rotation = 0;
|
||||
}
|
||||
|
|
@ -140,8 +141,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
|
|||
SetFlag(GAMEOBJECT_FLAGS, (GO_FLAG_TRANSPORT | GO_FLAG_NODESPAWN));
|
||||
|
||||
SetEntry(goinfo->id);
|
||||
|
||||
SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);
|
||||
SetDisplayId(goinfo->displayId);
|
||||
|
||||
// GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
|
||||
SetGoState(go_state);
|
||||
|
|
@ -1749,13 +1749,19 @@ bool GameObject::IsFriendlyTo(Unit const* unit) const
|
|||
return tester_faction->IsFriendlyTo(*target_faction);
|
||||
}
|
||||
|
||||
void GameObject::SetDisplayId(uint32 modelId)
|
||||
{
|
||||
SetUInt32Value(GAMEOBJECT_DISPLAYID, modelId);
|
||||
m_displayInfo = sGameObjectDisplayInfoStore.LookupEntry(modelId);
|
||||
}
|
||||
|
||||
float GameObject::GetObjectBoundingRadius() const
|
||||
{
|
||||
//FIXME:
|
||||
// 1. This is clearly hack way because GameObjectDisplayInfoEntry have 6 floats related to GO sizes, but better that use DEFAULT_WORLD_OBJECT_SIZE
|
||||
// 2. In some cases this must be only interactive size, not GO size, current way can affect creature target point auto-selection in strange ways for big underground/virtual GOs
|
||||
if (GameObjectDisplayInfoEntry const* dispEntry = sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
|
||||
return fabs(dispEntry->unknown12) * GetObjectScale();
|
||||
if (m_displayInfo)
|
||||
return fabs(m_displayInfo->unknown12) * GetObjectScale();
|
||||
|
||||
return DEFAULT_WORLD_OBJECT_SIZE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue