[2] | 1 | /* |
---|
[102] | 2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
| 3 | * |
---|
[44] | 4 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
---|
[2] | 5 | * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify |
---|
| 7 | * it under the terms of the GNU General Public License as published by |
---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 9 | * (at your option) any later version. |
---|
| 10 | * |
---|
| 11 | * This program is distributed in the hope that it will be useful, |
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
[44] | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
[2] | 14 | * GNU General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU General Public License |
---|
| 17 | * along with this program; if not, write to the Free Software |
---|
[44] | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
[2] | 19 | */ |
---|
| 20 | |
---|
[44] | 21 | #ifndef TRINITY_INSTANCE_DATA_H |
---|
| 22 | #define TRINITY_INSTANCE_DATA_H |
---|
[2] | 23 | |
---|
| 24 | #include "Common.h" |
---|
| 25 | |
---|
| 26 | class Map; |
---|
| 27 | class Unit; |
---|
| 28 | class Player; |
---|
| 29 | class GameObject; |
---|
| 30 | class Creature; |
---|
| 31 | |
---|
[44] | 32 | class TRINITY_DLL_SPEC InstanceData |
---|
[2] | 33 | { |
---|
| 34 | public: |
---|
| 35 | |
---|
| 36 | explicit InstanceData(Map *map) : instance(map) {} |
---|
| 37 | virtual ~InstanceData() {} |
---|
| 38 | |
---|
| 39 | Map *instance; |
---|
| 40 | |
---|
| 41 | //On creation, NOT load. |
---|
| 42 | virtual void Initialize() {} |
---|
| 43 | |
---|
| 44 | //On load |
---|
| 45 | virtual void Load(const char* /*data*/) {} |
---|
| 46 | |
---|
| 47 | //When save is needed, this function generates the data |
---|
| 48 | virtual const char* Save() { return ""; } |
---|
| 49 | |
---|
| 50 | void SaveToDB(); |
---|
| 51 | |
---|
| 52 | //Called every map update |
---|
| 53 | virtual void Update(uint32 /*diff*/) {} |
---|
| 54 | |
---|
| 55 | //Used by the map's CanEnter function. |
---|
| 56 | //This is to prevent players from entering during boss encounters. |
---|
| 57 | virtual bool IsEncounterInProgress() const { return false; }; |
---|
| 58 | |
---|
| 59 | //Called when a player successfully enters the instance. |
---|
| 60 | virtual void OnPlayerEnter(Player *) {} |
---|
| 61 | |
---|
| 62 | //Called when a gameobject is created |
---|
| 63 | virtual void OnObjectCreate(GameObject *) {} |
---|
| 64 | |
---|
| 65 | //called on creature creation |
---|
| 66 | virtual void OnCreatureCreate(Creature * /*creature*/, uint32 /*creature_entry*/) {} |
---|
| 67 | }; |
---|
| 68 | #endif |
---|