aboutsummaryrefslogtreecommitdiff
path: root/src/game/GameObject.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/GameObject.h')
-rw-r--r--src/game/GameObject.h202
1 files changed, 151 insertions, 51 deletions
diff --git a/src/game/GameObject.h b/src/game/GameObject.h
index 2eb51a6fbe4..43f8fb0ea5f 100644
--- a/src/game/GameObject.h
+++ b/src/game/GameObject.h
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
- * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,10 +41,13 @@ struct GameObjectInfo
uint32 type;
uint32 displayId;
char *name;
+ char *IconName;
char *castBarCaption;
+ char *unk1;
uint32 faction;
uint32 flags;
float size;
+ uint32 questItems[4];
union // different GO types have different data field
{
//0 GAMEOBJECT_TYPE_DOOR
@@ -56,6 +59,7 @@ struct GameObjectInfo
uint32 noDamageImmune; //3 break opening whenever you recieve damage?
uint32 openTextID; //4 can be used to replace castBarCaption?
uint32 closeTextID; //5
+ uint32 ignoredByPathing; //6
} door;
//1 GAMEOBJECT_TYPE_BUTTON
struct
@@ -103,7 +107,9 @@ struct GameObjectInfo
uint32 logLoot; //13
uint32 openTextID; //14 can be used to replace castBarCaption?
uint32 groupLootRules; //15
+ uint32 floatingTooltip; //16
} chest;
+ //4 GAMEOBJECT_TYPE_BINDER - empty
//5 GAMEOBJECT_TYPE_GENERIC
struct
{
@@ -131,6 +137,7 @@ struct GameObjectInfo
uint32 stealthAffected; //11
uint32 openTextID; //12 can be used to replace castBarCaption?
uint32 closeTextID; //13
+ uint32 ignoreTotems; //14
} trap;
//7 GAMEOBJECT_TYPE_CHAIR
struct
@@ -138,6 +145,7 @@ struct GameObjectInfo
uint32 slots; //0
uint32 height; //1
uint32 onlyCreatorUse; //2
+ uint32 triggeredEvent; //3
} chair;
//8 GAMEOBJECT_TYPE_SPELL_FOCUS
struct
@@ -148,6 +156,7 @@ struct GameObjectInfo
uint32 serverOnly; //3
uint32 questID; //4
uint32 large; //5
+ uint32 floatingTooltip; //6
} spellFocus;
//9 GAMEOBJECT_TYPE_TEXT
struct
@@ -178,6 +187,9 @@ struct GameObjectInfo
uint32 closeTextID; //15
uint32 losOK; //16 isBattlegroundObject
uint32 allowMounted; //17
+ uint32 floatingTooltip; //18
+ uint32 gossipID; //19
+ uint32 WorldStateSetsState; //20
} goober;
//11 GAMEOBJECT_TYPE_TRANSPORT
struct
@@ -185,6 +197,8 @@ struct GameObjectInfo
uint32 pause; //0
uint32 startOpen; //1
uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000
+ uint32 pause1EventID; //3
+ uint32 pause2EventID; //4
} transport;
//12 GAMEOBJECT_TYPE_AREADAMAGE
struct
@@ -206,6 +220,7 @@ struct GameObjectInfo
uint32 eventID; //2
uint32 openTextID; //3 can be used to replace castBarCaption?
} camera;
+ //14 GAMEOBJECT_TYPE_MAPOBJECT - empty
//15 GAMEOBJECT_TYPE_MO_TRANSPORT
struct
{
@@ -216,13 +231,10 @@ struct GameObjectInfo
uint32 stopEventID; //4
uint32 transportPhysics; //5
uint32 mapID; //6
+ uint32 worldState1; //7
} moTransport;
- //17 GAMEOBJECT_TYPE_FISHINGNODE
- struct
- {
- uint32 _data0; //0
- uint32 lootId; //1
- } fishnode;
+ //16 GAMEOBJECT_TYPE_DUELFLAG - empty
+ //17 GAMEOBJECT_TYPE_FISHINGNODE - empty
//18 GAMEOBJECT_TYPE_SUMMONING_RITUAL
struct
{
@@ -235,11 +247,8 @@ struct GameObjectInfo
uint32 castersGrouped; //6
uint32 ritualNoTargetCheck; //7
} summoningRitual;
- //20 GAMEOBJECT_TYPE_AUCTIONHOUSE
- struct
- {
- uint32 actionHouseID; //0
- } auctionhouse;
+ //19 GAMEOBJECT_TYPE_MAILBOX - empty
+ //20 GAMEOBJECT_TYPE_DONOTUSE - empty
//21 GAMEOBJECT_TYPE_GUARDPOST
struct
{
@@ -252,6 +261,8 @@ struct GameObjectInfo
uint32 spellId; //0
uint32 charges; //1
uint32 partyOnly; //2
+ uint32 allowMounted; //3
+ uint32 large; //4
} spellcaster;
//23 GAMEOBJECT_TYPE_MEETINGSTONE
struct
@@ -318,6 +329,8 @@ struct GameObjectInfo
uint32 maxTime; //17
uint32 large; //18
uint32 highlight; //19
+ uint32 startingValue; //20
+ uint32 unidirectional; //21
} capturePoint;
//30 GAMEOBJECT_TYPE_AURA_GENERATOR
struct
@@ -336,23 +349,51 @@ struct GameObjectInfo
uint32 mapID; //0
uint32 difficulty; //1
} dungeonDifficulty;
- //32 GAMEOBJECT_TYPE_DO_NOT_USE_YET
+ //32 GAMEOBJECT_TYPE_BARBER_CHAIR
struct
{
- uint32 mapID; //0
- uint32 difficulty; //1
- } doNotUseYet;
+ uint32 chairheight; //0
+ uint32 heightOffset; //1
+ } barberChair;
//33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
struct
{
- uint32 dmgPctState1; //0
- uint32 dmgPctState2; //1
+ uint32 intactNumHits; //0
+ uint32 creditProxyCreature; //1
uint32 state1Name; //2
- uint32 state2Name; //3
- } destructibleBuilding;
+ uint32 intactEvent; //3
+ uint32 damagedDisplayId; //4
+ uint32 damagedNumHits; //5
+ uint32 empty3; //6
+ uint32 empty4; //7
+ uint32 empty5; //8
+ uint32 damagedEvent; //9
+ uint32 destroyedDisplayId; //10
+ uint32 empty7; //11
+ uint32 empty8; //12
+ uint32 empty9; //13
+ uint32 destroyedEvent; //14
+ uint32 empty10; //15
+ uint32 debuildingTimeSecs; //16
+ uint32 empty11; //17
+ uint32 destructibleData; //18
+ uint32 rebuildingEvent; //19
+ uint32 empty12; //20
+ uint32 empty13; //21
+ uint32 damageEvent; //22
+ uint32 empty14; //23
+ } building;
+ //34 GAMEOBJECT_TYPE_GUILDBANK - empty
+ //35 GAMEOBJECT_TYPE_TRAPDOOR
+ struct
+ {
+ uint32 whenToPause; // 0
+ uint32 startOpen; // 1
+ uint32 autoClose; // 2
+ } trapDoor;
// not use for specific field access (only for output with loop by all filed), also this determinate max union size
- struct // GAMEOBJECT_TYPE_SPELLCASTER
+ struct
{
uint32 data[24];
} raw;
@@ -360,17 +401,52 @@ struct GameObjectInfo
uint32 ScriptId;
};
+class OPvPCapturePoint;
+
+union GameObjectValue
+{
+ //29 GAMEOBJECT_TYPE_CAPTURE_POINT
+ struct
+ {
+ OPvPCapturePoint *OPvPObj;
+ }capturePoint;
+ //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
+ struct
+ {
+ uint32 health;
+ }building;
+};
+
+// 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
{
+ explicit GameObjectData() : dbData(true) {}
uint32 id; // entry in gamobject_template
- uint32 mapid;
+ uint16 mapid;
+ uint16 phaseMask;
float posX;
float posY;
float posZ;
@@ -381,18 +457,12 @@ struct GameObjectData
float rotation3;
int32 spawntimesecs;
uint32 animprogress;
- uint32 go_state;
+ GOState go_state;
uint8 spawnMask;
- uint32 ArtKit;
+ uint8 ArtKit;
+ bool dbData;
};
-// 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) -> ...
@@ -419,10 +489,12 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
void AddToWorld();
void RemoveFromWorld();
- bool Create(uint32 guidlow, uint32 name_id, Map *map, 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;
+ GameObjectInfo const* GetGOInfo() const { return m_goInfo; }
+ GameObjectData const* GetGOData() const { return m_goData; }
+ GameObjectValue * GetGOValue() const { return m_goValue; }
bool IsTransport() const;
@@ -436,23 +508,21 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
- void Say(const char* text, uint32 language, uint64 TargetGuid) { MonsterSay(text,language,TargetGuid); }
- void Yell(const char* text, uint32 language, uint64 TargetGuid) { MonsterYell(text,language,TargetGuid); }
- void TextEmote(const char* text, uint64 TargetGuid) { MonsterTextEmote(text,TargetGuid); }
- void Whisper(const char* text,uint64 receiver) { MonsterWhisper(text,receiver); }
+ void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f);
+
void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); }
void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); }
void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); }
void Whisper(int32 textId, uint64 receiver) { MonsterWhisper(textId,receiver); }
+ void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); }
// overwrite WorldObject function for proper name localization
const char* GetNameForLocaleIdx(int32 locale_idx) const;
void SaveToDB();
- void SaveToDB(uint32 mapid, uint8 spawnMask);
+ 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
@@ -474,6 +544,20 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
}
}
+ bool GetDespawnPossibility() const
+ {
+ switch(GetGoType())
+ {
+ case GAMEOBJECT_TYPE_DOOR: return GetGOInfo()->door.noDamageImmune;
+ case GAMEOBJECT_TYPE_BUTTON: return GetGOInfo()->button.noDamageImmune;
+ case GAMEOBJECT_TYPE_QUESTGIVER: return GetGOInfo()->questgiver.noDamageImmune;
+ case GAMEOBJECT_TYPE_GOOBER: return GetGOInfo()->goober.noDamageImmune;
+ case GAMEOBJECT_TYPE_FLAGSTAND: return GetGOInfo()->flagstand.noDamageImmune;
+ case GAMEOBJECT_TYPE_FLAGDROP: return GetGOInfo()->flagdrop.noDamageImmune;
+ default: return true;
+ }
+ }
+
time_t GetRespawnTime() const { return m_respawnTime; }
time_t GetRespawnTimeEx() const
{
@@ -503,19 +587,20 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
void Delete();
void SetSpellId(uint32 id) { m_spellId = id;}
uint32 GetSpellId() const { return m_spellId;}
- void getFishLoot(Loot *loot);
- GameobjectTypes GetGoType() const { return GameobjectTypes(GetUInt32Value(GAMEOBJECT_TYPE_ID)); }
- void SetGoType(GameobjectTypes type) { SetUInt32Value(GAMEOBJECT_TYPE_ID, type); }
- uint32 GetGoState() const { return GetUInt32Value(GAMEOBJECT_STATE); }
- void SetGoState(uint32 state) { SetUInt32Value(GAMEOBJECT_STATE, state); }
- uint32 GetGoArtKit() const { return GetUInt32Value(GAMEOBJECT_ARTKIT); }
- void SetGoArtKit(uint32 artkit);
- uint32 GetGoAnimProgress() const { return GetUInt32Value(GAMEOBJECT_ANIMPROGRESS); }
- void SetGoAnimProgress(uint32 animprogress) { SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, animprogress); }
+ 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); }
+ 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); }
+ void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
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
@@ -539,7 +624,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
{
@@ -578,6 +666,14 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
GridReference<GameObject> &GetGridRef() { return m_gridRef; }
void CastSpell(Unit *target, uint32 spell);
+ void SendCustomAnim();
+ bool IsInRange(float x, float y, float z, float radius) const;
+ void TakenDamage(uint32 damage);
+ void Rebuild();
+
+ void EventInform(uint32 eventId);
+
+ uint64 GetRotation() const { return m_rotation; }
protected:
uint32 m_charges; // Spell charges for GAMEOBJECT_TYPE_SPELLCASTER (22)
uint32 m_spellId;
@@ -594,8 +690,12 @@ 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;
+ GameObjectData const* m_goData;
+ GameObjectValue * const m_goValue;
+
+ uint64 m_rotation;
private:
- void SwitchDoorOrButton(bool activate);
+ void SwitchDoorOrButton(bool activate, bool alternative = false);
GridReference<GameObject> m_gridRef;
};