aboutsummaryrefslogtreecommitdiff
path: root/src/game/InstanceData.h
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-01 18:24:12 -0500
committermegamage <none@none>2009-05-01 18:24:12 -0500
commitc9cd3b07f9e69030a86bcd9f06055f4247732d1d (patch)
tree83b1e7ae98cd92c2edbc7ab2f6c83450199a77f8 /src/game/InstanceData.h
parent5a667740082b8afa6af30d0f1e7082e8a3321fd3 (diff)
*Add some InstanceData functions to better handle instance doors.
--HG-- branch : trunk
Diffstat (limited to 'src/game/InstanceData.h')
-rw-r--r--src/game/InstanceData.h45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/game/InstanceData.h b/src/game/InstanceData.h
index ec36a794525..2f2b0c49be0 100644
--- a/src/game/InstanceData.h
+++ b/src/game/InstanceData.h
@@ -31,6 +31,24 @@ class Player;
class GameObject;
class Creature;
+enum EncounterState
+{
+ NOT_STARTED = 0,
+ IN_PROGRESS = 1,
+ FAIL = 2,
+ DONE = 3,
+ SPECIAL = 4
+};
+
+typedef std::set<GameObject*> DoorSet;
+
+struct BossInfo
+{
+ BossInfo() : state(NOT_STARTED) {}
+ EncounterState state;
+ DoorSet roomDoor, passageDoor;
+};
+
class TRINITY_DLL_SPEC InstanceData
{
public:
@@ -56,7 +74,7 @@ class TRINITY_DLL_SPEC InstanceData
//Used by the map's CanEnter function.
//This is to prevent players from entering during boss encounters.
- virtual bool IsEncounterInProgress() const { return false; };
+ virtual bool IsEncounterInProgress() const;
//Called when a player successfully enters the instance.
virtual void OnPlayerEnter(Player *) {}
@@ -67,6 +85,9 @@ class TRINITY_DLL_SPEC InstanceData
//called on creature creation
virtual void OnCreatureCreate(Creature * /*creature*/, uint32 /*creature_entry*/) {}
+ virtual void OnCreatureRemove(Creature*) {}
+ virtual void OnObjectRemove(GameObject*) {}
+
//All-purpose data storage 32 bit
virtual uint32 GetData(uint32) { return 0; }
virtual void SetData(uint32, uint32 data) {}
@@ -74,7 +95,27 @@ class TRINITY_DLL_SPEC InstanceData
//Handle open / close objects
//use HandleGameObject(NULL,boolen,GO); in OnObjectCreate in instance scripts
//use HandleGameObject(GUID,boolen,NULL); in any other script
- virtual void HandleGameObject(uint64 GUID, bool open, GameObject *go = NULL);
+ void HandleGameObject(uint64 GUID, bool open, GameObject *go = NULL);
+
+ protected:
+ void AddBossRoomDoor(uint32 id, GameObject *door);
+ void AddBossPassageDoor(uint32 id, GameObject *door);
+ void RemoveBossRoomDoor(uint32 id, GameObject *door);
+ void RemoveBossPassageDoor(uint32 id, GameObject *door);
+
+ void SetBossState(uint32 id, EncounterState state);
+
+ std::string GetBossSave()
+ {
+ std::ostringstream saveStream;
+ for(std::vector<BossInfo>::iterator i = bosses.begin(); i != bosses.end(); ++i)
+ saveStream << (uint32)i->state << " ";
+ return saveStream.str();
+ }
+
+ private:
+ std::vector<BossInfo> bosses;
+
};
#endif