TrinityCore
Loading...
Searching...
No Matches
OutdoorPvPMgr.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 OUTDOOR_PVP_MGR_H_
19#define OUTDOOR_PVP_MGR_H_
20
21#define OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL 1000
22
23#include "OutdoorPvP.h"
24#include <array>
25#include <unordered_map>
26
27class Player;
28class GameObject;
29class Creature;
30class ZoneScript;
31struct GossipMenuItems;
33
34// class to handle player enter / leave / areatrigger / GO use events
36{
37 private:
40
41 public:
42 static OutdoorPvPMgr* instance();
43
44 // create outdoor pvp events
45 void InitOutdoorPvP();
46
47 // cleanup
48 void Die();
49
50 // called when a player enters an outdoor pvp area
51 void HandlePlayerEnterZone(Player* player, uint32 areaflag);
52
53 // called when player leaves an outdoor pvp area
54 void HandlePlayerLeaveZone(Player* player, uint32 areaflag);
55
56 // called when player resurrects
57 void HandlePlayerResurrects(Player* player, uint32 areaflag);
58
59 // return assigned outdoor pvp
60 OutdoorPvP* GetOutdoorPvPToZoneId(uint32 zoneid);
61
62 // handle custom (non-exist in dbc) spell if registered
63 bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
64
65 // handle custom go if registered
66 bool HandleOpenGo(Player* player, GameObject* go);
67
68 ZoneScript* GetZoneScript(uint32 zoneId);
69
70 void AddZone(uint32 zoneid, OutdoorPvP* handle);
71
72 void Update(uint32 diff);
73
74 void HandleGossipOption(Player* player, Creature* creature, uint32 gossipid);
75
76 bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso);
77
78 void HandleDropFlag(Player* player, uint32 spellId);
79
80 std::string GetDefenseMessage(uint32 zoneId, uint32 id, LocaleConstant locale) const;
81
82 private:
83 typedef std::vector<OutdoorPvP*> OutdoorPvPSet;
84 typedef std::unordered_map<uint32 /*zoneid*/, OutdoorPvP*> OutdoorPvPMap;
85 typedef std::array<uint32, MAX_OUTDOORPVP_TYPES> OutdoorPvPScriptIds;
86
87 // contains all initiated outdoor pvp events
88 // used when initing / cleaning up
90
91 // maps the zone ids to an outdoor pvp event
92 // used in player event handling
94
95 // Holds the outdoor PvP templates
96 OutdoorPvPScriptIds m_OutdoorPvPDatas = {};
97
98 // update interval
100};
101
102#define sOutdoorPvPMgr OutdoorPvPMgr::instance()
103
104#endif /*OUTDOOR_PVP_MGR_H_*/
LocaleConstant
Definition Common.h:48
#define TC_GAME_API
Definition Define.h:114
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
std::vector< OutdoorPvP * > OutdoorPvPSet
OutdoorPvPMap m_OutdoorPvPMap
OutdoorPvPSet m_OutdoorPvPSet
std::unordered_map< uint32, OutdoorPvP * > OutdoorPvPMap
std::array< uint32, MAX_OUTDOORPVP_TYPES > OutdoorPvPScriptIds
uint32 m_UpdateTimer