AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
OPvPCapturePointHP Class Reference

#include "OutdoorPvPHP.h"

Inheritance diagram for OPvPCapturePointHP:
OPvPCapturePoint

Public Member Functions

 OPvPCapturePointHP (OutdoorPvP *pvp, OutdoorPvPHPTowerType type)
 
void ChangeState () override
 
void SendChangePhase () override
 
void FillInitialWorldStates (WorldPacket &data) override
 
bool HandlePlayerEnter (Player *player) override
 
void HandlePlayerLeave (Player *player) override
 
- Public Member Functions inherited from OPvPCapturePoint
 OPvPCapturePoint (OutdoorPvP *pvp)
 
virtual ~OPvPCapturePoint ()=default
 
virtual void FillInitialWorldStates (WorldPacket &)
 
void SendUpdateWorldState (uint32 field, uint32 value)
 
void SendObjectiveComplete (uint32 id, ObjectGuid guid=ObjectGuid::Empty)
 
virtual bool HandlePlayerEnter (Player *player)
 
virtual void HandlePlayerLeave (Player *player)
 
bool IsInsideObjective (Player *player) const
 
virtual bool HandleCustomSpell (Player *player, uint32 spellId, GameObject *go)
 
virtual int32 HandleOpenGo (Player *player, GameObject *go)
 
virtual bool Update (uint32 diff)
 
virtual void ChangeState ()=0
 
virtual void ChangeTeam (TeamId)
 
virtual void SendChangePhase ()
 
virtual bool HandleGossipOption (Player *player, Creature *creature, uint32 gossipId)
 
virtual bool CanTalkTo (Player *player, Creature *c, GossipMenuItems const &gso)
 
virtual bool HandleDropFlag (Player *player, uint32 spellId)
 
virtual void DeleteSpawns ()
 
void AddGO (uint32 type, ObjectGuid::LowType guid, uint32 entry=0)
 
void AddCre (uint32 type, ObjectGuid::LowType guid, uint32 entry=0)
 
bool SetCapturePointData (uint32 entry, uint32 map, float x, float y, float z, float o=0, float rotation0=0, float rotation1=0, float rotation2=0, float rotation3=0)
 
void SetSlider (float slider)
 
float GetSlider () const
 

Private Attributes

OutdoorPvPHPTowerType m_TowerType
 

Additional Inherited Members

- Public Attributes inherited from OPvPCapturePoint
ObjectGuid::LowType m_capturePointSpawnId {}
 
GameObject_capturePoint {}
 
- Protected Member Functions inherited from OPvPCapturePoint
bool AddObject (uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
 
bool AddCreature (uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimeDelay=0)
 
bool DelCreature (uint32 type)
 
bool DelObject (uint32 type)
 
bool DelCapturePoint ()
 
- Protected Attributes inherited from OPvPCapturePoint
std::array< PlayerSet, 2 > _activePlayers
 
float _maxValue {}
 
float _minValue {}
 
float _maxSpeed {}
 
float _value {}
 
TeamId _team { TEAM_NEUTRAL }
 
ObjectiveStates _oldState { OBJECTIVESTATE_NEUTRAL }
 
ObjectiveStates _state { OBJECTIVESTATE_NEUTRAL }
 
uint32 _neutralValuePct {}
 
OutdoorPvP_pvp {}
 
std::unordered_map< uint32, ObjectGuid::LowType_objects
 
std::unordered_map< uint32, ObjectGuid::LowType_creatures
 
std::unordered_map< ObjectGuid::LowType, uint32_objectTypes
 
std::unordered_map< ObjectGuid::LowType, uint32_creatureTypes
 

Detailed Description

Constructor & Destructor Documentation

◆ OPvPCapturePointHP()

OPvPCapturePointHP::OPvPCapturePointHP ( OutdoorPvP pvp,
OutdoorPvPHPTowerType  type 
)
38 : OPvPCapturePoint(pvp), m_TowerType(type)
39{
41 HPCapturePoints[type].map,
42 HPCapturePoints[type].x,
43 HPCapturePoints[type].y,
44 HPCapturePoints[type].z,
45 HPCapturePoints[type].o,
46 HPCapturePoints[type].rot0,
47 HPCapturePoints[type].rot1,
48 HPCapturePoints[type].rot2,
49 HPCapturePoints[type].rot3);
50 AddObject(type,
51 HPTowerFlags[type].entry,
52 HPTowerFlags[type].map,
53 HPTowerFlags[type].x,
54 HPTowerFlags[type].y,
55 HPTowerFlags[type].z,
56 HPTowerFlags[type].o,
57 HPTowerFlags[type].rot0,
58 HPTowerFlags[type].rot1,
59 HPTowerFlags[type].rot2,
60 HPTowerFlags[type].rot3);
61}
const go_type HPCapturePoints[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:74
const go_type HPTowerFlags[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:81
Definition: OutdoorPvP.h:90
bool AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
Definition: OutdoorPvP.cpp:105
bool SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o=0, float rotation0=0, float rotation1=0, float rotation2=0, float rotation3=0)
Definition: OutdoorPvP.cpp:127
OutdoorPvPHPTowerType m_TowerType
Definition: OutdoorPvPHP.h:104

References OPvPCapturePoint::AddObject(), HPCapturePoints, HPTowerFlags, and OPvPCapturePoint::SetCapturePointData().

Member Function Documentation

◆ ChangeState()

void OPvPCapturePointHP::ChangeState ( )
overridevirtual

Implements OPvPCapturePoint.

172{
173 uint32 field = 0;
174 switch (_oldState)
175 {
177 field = HP_MAP_N[m_TowerType];
178 break;
180 field = HP_MAP_A[m_TowerType];
181 if (uint32 alliance_towers = ((OutdoorPvPHP*)_pvp)->GetAllianceTowersControlled())
182 ((OutdoorPvPHP*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
183 sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_LOSE_A[m_TowerType]));
184 break;
186 field = HP_MAP_H[m_TowerType];
187 if (uint32 horde_towers = ((OutdoorPvPHP*)_pvp)->GetHordeTowersControlled())
188 ((OutdoorPvPHP*)_pvp)->SetHordeTowersControlled(--horde_towers);
189 sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_LOSE_H[m_TowerType]));
190 break;
192 field = HP_MAP_N[m_TowerType];
193 break;
195 field = HP_MAP_N[m_TowerType];
196 break;
198 field = HP_MAP_A[m_TowerType];
199 break;
201 field = HP_MAP_H[m_TowerType];
202 break;
203 }
204
205 // send world state update
206 if (field)
207 {
208 _pvp->SendUpdateWorldState(field, 0);
209 field = 0;
210 }
211 uint32 artkit = 21;
213 switch (_state)
214 {
216 field = HP_MAP_N[m_TowerType];
217 break;
219 {
220 field = HP_MAP_A[m_TowerType];
221 artkit = 2;
222 artkit2 = HP_TowerArtKit_A[m_TowerType];
223 uint32 alliance_towers = ((OutdoorPvPHP*)_pvp)->GetAllianceTowersControlled();
224 if (alliance_towers < 3)
225 ((OutdoorPvPHP*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
226 sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType]));
227 break;
228 }
230 {
231 field = HP_MAP_H[m_TowerType];
232 artkit = 1;
233 artkit2 = HP_TowerArtKit_H[m_TowerType];
234 uint32 horde_towers = ((OutdoorPvPHP*)_pvp)->GetHordeTowersControlled();
235 if (horde_towers < 3)
236 ((OutdoorPvPHP*)_pvp)->SetHordeTowersControlled(++horde_towers);
237 sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType]));
238 break;
239 }
244 field = HP_MAP_N[m_TowerType];
245 break;
246 }
247
248 Map* map = sMapMgr->FindMap(530, 0);
249 auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
250 for (auto itr = bounds.first; itr != bounds.second; ++itr)
251 itr->second->SetGoArtKit(artkit);
252
253 bounds = map->GetGameObjectBySpawnIdStore().equal_range(_objects[m_TowerType]);
254 for (auto itr = bounds.first; itr != bounds.second; ++itr)
255 itr->second->SetGoArtKit(artkit2);
256
257 // send world state update
258 if (field)
259 _pvp->SendUpdateWorldState(field, 1);
260
261 // complete quest objective
264}
std::uint32_t uint32
Definition: Define.h:107
const uint32 HP_CREDITMARKER[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:43
const uint32 HP_TowerArtKit_H[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:70
const uint32 OutdoorPvPHPBuffZones[OutdoorPvPHPBuffZonesNum]
Definition: OutdoorPvPHP.h:25
const uint32 HP_MAP_N[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:62
const uint32 HP_MAP_H[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:66
const uint32 HP_MAP_A[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:64
const uint32 HP_TowerArtKit_A[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:68
const uint32 HP_TowerArtKit_N[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:72
const uint32 HP_LANG_LOSE_A[HP_TOWER_NUM]
Definition: OutdoorPvPHP.cpp:29
const uint32 HP_LANG_CAPTURE_H[HP_TOWER_NUM]
Definition: OutdoorPvPHP.cpp:35
const uint32 HP_LANG_CAPTURE_A[HP_TOWER_NUM]
Definition: OutdoorPvPHP.cpp:33
const uint32 HP_LANG_LOSE_H[HP_TOWER_NUM]
Definition: OutdoorPvPHP.cpp:31
#define sMapMgr
Definition: MapMgr.h:219
#define sObjectMgr
Definition: ObjectMgr.h:1635
@ OBJECTIVESTATE_HORDE
Definition: OutdoorPvP.h:44
@ OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE
Definition: OutdoorPvP.h:46
@ OBJECTIVESTATE_ALLIANCE
Definition: OutdoorPvP.h:43
@ OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE
Definition: OutdoorPvP.h:45
@ OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE
Definition: OutdoorPvP.h:48
@ OBJECTIVESTATE_NEUTRAL
Definition: OutdoorPvP.h:42
@ OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE
Definition: OutdoorPvP.h:47
#define sWorld
Definition: World.h:443
Definition: Map.h:311
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:521
ObjectiveStates _state
Definition: OutdoorPvP.h:166
ObjectiveStates _oldState
Definition: OutdoorPvP.h:165
ObjectGuid::LowType m_capturePointSpawnId
Definition: OutdoorPvP.h:124
OutdoorPvP * _pvp
Definition: OutdoorPvP.h:172
std::unordered_map< uint32, ObjectGuid::LowType > _objects
Definition: OutdoorPvP.h:177
void SendObjectiveComplete(uint32 id, ObjectGuid guid=ObjectGuid::Empty)
Definition: OutdoorPvP.cpp:476
void SendUpdateWorldState(uint32 field, uint32 value)
Definition: OutdoorPvP.cpp:456
Definition: OutdoorPvPHP.h:108

References OPvPCapturePoint::_objects, OPvPCapturePoint::_oldState, OPvPCapturePoint::_pvp, OPvPCapturePoint::_state, Map::GetGameObjectBySpawnIdStore(), HP_CREDITMARKER, HP_LANG_CAPTURE_A, HP_LANG_CAPTURE_H, HP_LANG_LOSE_A, HP_LANG_LOSE_H, HP_MAP_A, HP_MAP_H, HP_MAP_N, HP_TowerArtKit_A, HP_TowerArtKit_H, HP_TowerArtKit_N, OPvPCapturePoint::m_capturePointSpawnId, m_TowerType, OBJECTIVESTATE_ALLIANCE, OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE, OBJECTIVESTATE_HORDE, OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE, OBJECTIVESTATE_NEUTRAL, OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE, OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE, OutdoorPvPHPBuffZones, OPvPCapturePoint::SendObjectiveComplete(), OutdoorPvP::SendUpdateWorldState(), sMapMgr, sObjectMgr, and sWorld.

◆ FillInitialWorldStates()

◆ HandlePlayerEnter()

bool OPvPCapturePointHP::HandlePlayerEnter ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

304{
306 {
308 uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
311 return true;
312 }
313 return false;
314}
phase
Definition: boss_skadi.cpp:103
@ HP_UI_TOWER_SLIDER_POS
Definition: OutdoorPvPHP.h:58
@ HP_UI_TOWER_SLIDER_N
Definition: OutdoorPvPHP.h:57
@ HP_UI_TOWER_SLIDER_DISPLAY
Definition: OutdoorPvPHP.h:59
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2197
uint32 _neutralValuePct
Definition: OutdoorPvP.h:169
float _maxValue
Definition: OutdoorPvP.h:153
virtual bool HandlePlayerEnter(Player *player)
Definition: OutdoorPvP.cpp:34
float _value
Definition: OutdoorPvP.h:160

References OPvPCapturePoint::_maxValue, OPvPCapturePoint::_neutralValuePct, OPvPCapturePoint::_value, OPvPCapturePoint::HandlePlayerEnter(), HP_UI_TOWER_SLIDER_DISPLAY, HP_UI_TOWER_SLIDER_N, HP_UI_TOWER_SLIDER_POS, and Player::SendUpdateWorldState().

◆ HandlePlayerLeave()

void OPvPCapturePointHP::HandlePlayerLeave ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

317{
320}
virtual void HandlePlayerLeave(Player *player)
Definition: OutdoorPvP.cpp:46

References OPvPCapturePoint::HandlePlayerLeave(), HP_UI_TOWER_SLIDER_DISPLAY, and Player::SendUpdateWorldState().

◆ SendChangePhase()

void OPvPCapturePointHP::SendChangePhase ( )
overridevirtual

Reimplemented from OPvPCapturePoint.

267{
269 // send these updates to only the ones in this objective
270 uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
272 // send this too, sometimes the slider disappears, dunno why :(
274}
void SendUpdateWorldState(uint32 field, uint32 value)
Definition: OutdoorPvP.cpp:465

References OPvPCapturePoint::_maxValue, OPvPCapturePoint::_neutralValuePct, OPvPCapturePoint::_value, HP_UI_TOWER_SLIDER_DISPLAY, HP_UI_TOWER_SLIDER_N, HP_UI_TOWER_SLIDER_POS, and OPvPCapturePoint::SendUpdateWorldState().

Member Data Documentation

◆ m_TowerType

OutdoorPvPHPTowerType OPvPCapturePointHP::m_TowerType
private