TrinityCore
Loading...
Searching...
No Matches
BattlefieldMgr.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef BATTLEFIELD_MGR_H_
19#define BATTLEFIELD_MGR_H_
20
21#include "Battlefield.h"
22
23class Player;
24class ZoneScript;
25
26// class to handle player enter / leave / areatrigger / GO use events
28{
29 public:
30 static BattlefieldMgr* instance();
31
32 // create battlefield events
33 void InitBattlefield();
34
35 // called when a player enters an battlefield area
36 void HandlePlayerEnterZone(Player* player, uint32 zoneId);
37 // called when player leaves an battlefield area
38 void HandlePlayerLeaveZone(Player* player, uint32 zoneId);
39
40 // return assigned battlefield
41 Battlefield* GetBattlefieldToZoneId(uint32 zoneId);
42 Battlefield* GetBattlefieldByBattleId(uint32 battleId);
43
44 ZoneScript* GetZoneScript(uint32 zoneId);
45
46 void AddZone(uint32 zoneId, Battlefield* bf);
47
48 void Update(uint32 diff);
49
50 private:
53
54 typedef std::vector<Battlefield*> BattlefieldSet;
55 typedef std::map<uint32 /*zoneId*/, Battlefield*> BattlefieldMap;
56 // contains all initiated battlefield events
57 // used when initing / cleaning up
59 // maps the zone ids to an battlefield event
60 // used in player event handling
62 // update interval
64};
65
66#define sBattlefieldMgr BattlefieldMgr::instance()
67
68#endif // BATTLEFIELD_MGR_H_
#define TC_GAME_API
Definition Define.h:114
uint32_t uint32
Definition Define.h:133
BattlefieldMap _battlefieldMap
std::vector< Battlefield * > BattlefieldSet
BattlefieldSet _battlefieldSet
std::map< uint32, Battlefield * > BattlefieldMap