diff options
| author | joschiwald <joschiwald@online.de> | 2013-08-21 19:43:46 +0200 |
|---|---|---|
| committer | joschiwald <joschiwald@online.de> | 2013-08-21 19:43:46 +0200 |
| commit | a383885f5c39ae85b2796c8f098f9ed03b152360 (patch) | |
| tree | 2f91de210105605d5c0241ac68f71b454820f287 /src/server/game/Instances/InstanceScript.h | |
| parent | 1e89ae1960affb23ea5f120b0e7287c705323480 (diff) | |
Scripts/AhnKahet: reworked InstanceScript
Diffstat (limited to 'src/server/game/Instances/InstanceScript.h')
| -rw-r--r-- | src/server/game/Instances/InstanceScript.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 1e349207b2f..943ae672046 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -22,8 +22,6 @@ #include "ZoneScript.h" #include "World.h" #include "ObjectMgr.h" -//#include "GameObject.h" -//#include "Map.h" #define OUT_SAVE_INST_DATA TC_LOG_DEBUG(LOG_FILTER_TSCR, "Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_SAVE_INST_DATA_COMPLETE TC_LOG_DEBUG(LOG_FILTER_TSCR, "Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) @@ -235,4 +233,16 @@ class InstanceScript : public ZoneScript MinionInfoMap minions; uint32 completedEncounters; // completed encounter mask, bit indexes are DungeonEncounter.dbc boss numbers, used for packets }; -#endif + +template<class AI, class T> +AI* GetInstanceAI(T* obj, char const* scriptName) +{ + if (InstanceMap* instance = obj->GetMap()->ToInstanceMap()) + if (instance->GetInstanceScript()) + if (instance->GetScriptId() == sObjectMgr->GetScriptId(scriptName)) + return new AI(obj); + + return NULL; +} + +#endif // TRINITY_INSTANCE_DATA_H |
