mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 19:37:01 +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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -670,6 +670,8 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
|||
void SetGoArtKit(uint8 artkit) { SetByteValue(GAMEOBJECT_BYTES_1, 2, artkit); }
|
||||
uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
|
||||
void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
|
||||
uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); }
|
||||
void SetDisplayId(uint32 modelId);
|
||||
|
||||
float GetObjectBoundingRadius() const; // overwrite WorldObject version
|
||||
|
||||
|
|
@ -739,6 +741,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
|||
GuidsSet m_UniqueUsers; // all players who use item, some items activated after specific amount unique uses
|
||||
|
||||
GameObjectInfo const* m_goInfo;
|
||||
GameObjectDisplayInfoEntry const* m_displayInfo;
|
||||
uint64 m_rotation;
|
||||
private:
|
||||
void SwitchDoorOrButton(bool activate, bool alternative = false);
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
|
|||
SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
|
||||
SetEntry(goinfo->id);
|
||||
|
||||
SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);
|
||||
SetDisplayId(goinfo->displayId);
|
||||
|
||||
SetGoState(GO_STATE_READY);
|
||||
SetGoType(GameobjectTypes(goinfo->type));
|
||||
|
|
|
|||
|
|
@ -1781,9 +1781,9 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
|
||||
uint32 m_AuraFlags;
|
||||
|
||||
uint32 GetDisplayId() { return GetUInt32Value(UNIT_FIELD_DISPLAYID); }
|
||||
uint32 GetDisplayId() const { return GetUInt32Value(UNIT_FIELD_DISPLAYID); }
|
||||
void SetDisplayId(uint32 modelId);
|
||||
uint32 GetNativeDisplayId() { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); }
|
||||
uint32 GetNativeDisplayId() const { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); }
|
||||
void SetNativeDisplayId(uint32 modelId) { SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, modelId); }
|
||||
void setTransForm(uint32 spellid) { m_transform = spellid;}
|
||||
uint32 getTransForm() const { return m_transform;}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11380"
|
||||
#define REVISION_NR "11381"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue