[7715] Provided way for scripts set alternative gameobject state for client show. Author: VladimirMangos
Also use enum for gsmeobject states. --HG-- branch : trunk
This commit is contained in:
+27
-14
@@ -368,12 +368,29 @@ struct GameObjectInfo
|
||||
uint32 ScriptId;
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
|
||||
#if defined( __GNUC__ )
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
struct GameObjectLocale
|
||||
{
|
||||
std::vector<std::string> Name;
|
||||
std::vector<std::string> CastBarCaption;
|
||||
};
|
||||
|
||||
// client side GO show states
|
||||
enum GOState
|
||||
{
|
||||
GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open)
|
||||
GO_STATE_READY = 1, // show in world as ready (closed door close)
|
||||
GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire)
|
||||
};
|
||||
|
||||
#define MAX_GO_STATE 3
|
||||
|
||||
// from `gameobject`
|
||||
struct GameObjectData
|
||||
{
|
||||
@@ -390,18 +407,11 @@ struct GameObjectData
|
||||
float rotation3;
|
||||
int32 spawntimesecs;
|
||||
uint32 animprogress;
|
||||
uint32 go_state;
|
||||
GOState go_state;
|
||||
uint8 spawnMask;
|
||||
uint32 ArtKit;
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
|
||||
#if defined( __GNUC__ )
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
|
||||
// For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
|
||||
// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
|
||||
@@ -428,7 +438,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
void AddToWorld();
|
||||
void RemoveFromWorld();
|
||||
|
||||
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state, uint32 ArtKit = 0);
|
||||
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 ArtKit = 0);
|
||||
void Update(uint32 p_time);
|
||||
static GameObject* GetGameObject(WorldObject& object, uint64 guid);
|
||||
GameObjectInfo const* GetGOInfo() const;
|
||||
@@ -460,7 +470,6 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
|
||||
bool LoadFromDB(uint32 guid, Map *map);
|
||||
void DeleteFromDB();
|
||||
void SetLootState(LootState s) { m_lootState = s; }
|
||||
static uint32 GetLootId(GameObjectInfo const* info);
|
||||
uint32 GetLootId() const { return GetLootId(GetGOInfo()); }
|
||||
uint32 GetLockId() const
|
||||
@@ -528,8 +537,8 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
void getFishLoot(Loot *loot, Player* loot_owner);
|
||||
GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); }
|
||||
void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); }
|
||||
uint8 GetGoState() const { return GetByteValue(GAMEOBJECT_BYTES_1, 0); }
|
||||
void SetGoState(uint8 state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); }
|
||||
GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); }
|
||||
void SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); }
|
||||
uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); }
|
||||
void SetGoArtKit(uint8 artkit);
|
||||
uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
|
||||
@@ -538,6 +547,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
void Use(Unit* user);
|
||||
|
||||
LootState getLootState() const { return m_lootState; }
|
||||
void SetLootState(LootState s) { m_lootState = s; }
|
||||
|
||||
void AddToSkillupList(uint32 PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
|
||||
bool IsInSkillupList(uint32 PlayerGuidLow) const
|
||||
@@ -561,7 +571,10 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
bool hasQuest(uint32 quest_id) const;
|
||||
bool hasInvolvedQuest(uint32 quest_id) const;
|
||||
bool ActivateToQuest(Player *pTarget) const;
|
||||
void UseDoorOrButton(uint32 time_to_restore = 0); // 0 = use `gameobject`.`spawntimesecs`
|
||||
void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false);
|
||||
// 0 = use `gameobject`.`spawntimesecs`
|
||||
void ResetDoorOrButton();
|
||||
// 0 = use `gameobject`.`spawntimesecs`
|
||||
|
||||
uint32 GetLinkedGameObjectEntry() const
|
||||
{
|
||||
@@ -617,7 +630,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid
|
||||
GameObjectInfo const* m_goInfo;
|
||||
private:
|
||||
void SwitchDoorOrButton(bool activate);
|
||||
void SwitchDoorOrButton(bool activate, bool alternative = false);
|
||||
|
||||
GridReference<GameObject> m_gridRef;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user