TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OutdoorPvPMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
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 OUTDOOR_PVP_MGR_H_
19 #define OUTDOOR_PVP_MGR_H_
20 
21 #define OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL 1000
22 
23 #include "OutdoorPvP.h"
24 
25 class Player;
26 class GameObject;
27 class Creature;
28 class ZoneScript;
29 struct GossipMenuItems;
30 
32 {
35 };
36 
37 // class to handle player enter / leave / areatrigger / GO use events
39 {
40  private:
41  OutdoorPvPMgr();
43 
44  public:
45  static OutdoorPvPMgr* instance();
46 
47  // create outdoor pvp events
48  void InitOutdoorPvP();
49 
50  // cleanup
51  void Die();
52 
53  // called when a player enters an outdoor pvp area
54  void HandlePlayerEnterZone(Player* player, uint32 areaflag);
55 
56  // called when player leaves an outdoor pvp area
57  void HandlePlayerLeaveZone(Player* player, uint32 areaflag);
58 
59  // called when player resurrects
60  void HandlePlayerResurrects(Player* player, uint32 areaflag);
61 
62  // return assigned outdoor pvp
63  OutdoorPvP* GetOutdoorPvPToZoneId(uint32 zoneid);
64 
65  // handle custom (non-exist in dbc) spell if registered
66  bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
67 
68  // handle custom go if registered
69  bool HandleOpenGo(Player* player, GameObject* go);
70 
71  ZoneScript* GetZoneScript(uint32 zoneId);
72 
73  void AddZone(uint32 zoneid, OutdoorPvP* handle);
74 
75  void Update(uint32 diff);
76 
77  void HandleGossipOption(Player* player, Creature* creature, uint32 gossipid);
78 
79  bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso);
80 
81  void HandleDropFlag(Player* player, uint32 spellId);
82 
83  std::string GetDefenseMessage(uint32 zoneId, uint32 id, LocaleConstant locale) const;
84 
85  private:
86  typedef std::vector<OutdoorPvP*> OutdoorPvPSet;
87  typedef std::map<uint32 /* zoneid */, OutdoorPvP*> OutdoorPvPMap;
88  typedef std::map<OutdoorPvPTypes, OutdoorPvPData*> OutdoorPvPDataMap;
89 
90  // contains all initiated outdoor pvp events
91  // used when initing / cleaning up
92  OutdoorPvPSet m_OutdoorPvPSet;
93 
94  // maps the zone ids to an outdoor pvp event
95  // used in player event handling
96  OutdoorPvPMap m_OutdoorPvPMap;
97 
98  // Holds the outdoor PvP templates
99  OutdoorPvPDataMap m_OutdoorPvPDatas;
100 
101  // update interval
103 };
104 
105 #define sOutdoorPvPMgr OutdoorPvPMgr::instance()
106 
107 #endif /*OUTDOOR_PVP_MGR_H_*/
uint32 m_UpdateTimer
Definition: OutdoorPvPMgr.h:102
OutdoorPvPSet m_OutdoorPvPSet
Definition: OutdoorPvPMgr.h:92
Definition: OutdoorPvPMgr.h:38
~OutdoorPvPMgr()
Definition: OutdoorPvPMgr.h:42
Definition: OutdoorPvPMgr.h:31
Definition: Creature.h:467
std::map< uint32, OutdoorPvP * > OutdoorPvPMap
Definition: OutdoorPvPMgr.h:87
OutdoorPvPDataMap m_OutdoorPvPDatas
Definition: OutdoorPvPMgr.h:99
OutdoorPvPTypes TypeId
Definition: OutdoorPvPMgr.h:33
Definition: ObjectMgr.h:510
Definition: ZoneScript.h:26
LocaleConstant
Definition: Common.h:115
OutdoorPvPTypes
Definition: OutdoorPvP.h:28
uint32_t uint32
Definition: Define.h:150
Definition: GameObject.h:880
OutdoorPvPMap m_OutdoorPvPMap
Definition: OutdoorPvPMgr.h:96
Definition: OutdoorPvP.h:188
#define TC_GAME_API
Definition: Define.h:134
uint32 ScriptId
Definition: OutdoorPvPMgr.h:34
std::map< OutdoorPvPTypes, OutdoorPvPData * > OutdoorPvPDataMap
Definition: OutdoorPvPMgr.h:88
std::vector< OutdoorPvP * > OutdoorPvPSet
Definition: OutdoorPvPMgr.h:86
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150