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