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 
)
39 : OPvPCapturePoint(pvp), m_TowerType(type)
40{
42 HPCapturePoints[type].map,
43 HPCapturePoints[type].x,
44 HPCapturePoints[type].y,
45 HPCapturePoints[type].z,
46 HPCapturePoints[type].o,
47 HPCapturePoints[type].rot0,
48 HPCapturePoints[type].rot1,
49 HPCapturePoints[type].rot2,
50 HPCapturePoints[type].rot3);
51 AddObject(type,
52 HPTowerFlags[type].entry,
53 HPTowerFlags[type].map,
54 HPTowerFlags[type].x,
55 HPTowerFlags[type].y,
56 HPTowerFlags[type].z,
57 HPTowerFlags[type].o,
58 HPTowerFlags[type].rot0,
59 HPTowerFlags[type].rot1,
60 HPTowerFlags[type].rot2,
61 HPTowerFlags[type].rot3);
62}
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:91
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.

173{
174 uint32 field = 0;
175 switch (_oldState)
176 {
178 field = HP_MAP_N[m_TowerType];
179 break;
181 field = HP_MAP_A[m_TowerType];
182 if (uint32 alliance_towers = ((OutdoorPvPHP*)_pvp)->GetAllianceTowersControlled())
183 ((OutdoorPvPHP*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
184 sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_LOSE_A[m_TowerType]));
185 break;
187 field = HP_MAP_H[m_TowerType];
188 if (uint32 horde_towers = ((OutdoorPvPHP*)_pvp)->GetHordeTowersControlled())
189 ((OutdoorPvPHP*)_pvp)->SetHordeTowersControlled(--horde_towers);
190 sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_LOSE_H[m_TowerType]));
191 break;
193 field = HP_MAP_N[m_TowerType];
194 break;
196 field = HP_MAP_N[m_TowerType];
197 break;
199 field = HP_MAP_A[m_TowerType];
200 break;
202 field = HP_MAP_H[m_TowerType];
203 break;
204 }
205
206 // send world state update
207 if (field)
208 {
209 _pvp->SendUpdateWorldState(field, 0);
210 field = 0;
211 }
212 uint32 artkit = 21;
214 switch (_state)
215 {
217 field = HP_MAP_N[m_TowerType];
218 break;
220 {
221 field = HP_MAP_A[m_TowerType];
222 artkit = 2;
223 artkit2 = HP_TowerArtKit_A[m_TowerType];
224 uint32 alliance_towers = ((OutdoorPvPHP*)_pvp)->GetAllianceTowersControlled();
225 if (alliance_towers < 3)
226 ((OutdoorPvPHP*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
227 sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType]));
228 break;
229 }
231 {
232 field = HP_MAP_H[m_TowerType];
233 artkit = 1;
234 artkit2 = HP_TowerArtKit_H[m_TowerType];
235 uint32 horde_towers = ((OutdoorPvPHP*)_pvp)->GetHordeTowersControlled();
236 if (horde_towers < 3)
237 ((OutdoorPvPHP*)_pvp)->SetHordeTowersControlled(++horde_towers);
238 sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType]));
239 break;
240 }
245 field = HP_MAP_N[m_TowerType];
246 break;
247 }
248
249 Map* map = sMapMgr->FindMap(530, 0);
250 auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
251 for (auto itr = bounds.first; itr != bounds.second; ++itr)
252 itr->second->SetGoArtKit(artkit);
253
254 bounds = map->GetGameObjectBySpawnIdStore().equal_range(_objects[m_TowerType]);
255 for (auto itr = bounds.first; itr != bounds.second; ++itr)
256 itr->second->SetGoArtKit(artkit2);
257
258 // send world state update
259 if (field)
260 _pvp->SendUpdateWorldState(field, 1);
261
262 // complete quest objective
265}
std::uint32_t uint32
Definition: Define.h:107
#define sMapMgr
Definition: MapMgr.h:221
@ OBJECTIVESTATE_HORDE
Definition: OutdoorPvP.h:45
@ OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE
Definition: OutdoorPvP.h:47
@ OBJECTIVESTATE_ALLIANCE
Definition: OutdoorPvP.h:44
@ OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE
Definition: OutdoorPvP.h:46
@ OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE
Definition: OutdoorPvP.h:49
@ OBJECTIVESTATE_NEUTRAL
Definition: OutdoorPvP.h:43
@ OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE
Definition: OutdoorPvP.h:48
#define sObjectMgr
Definition: ObjectMgr.h:1623
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:30
const uint32 HP_LANG_CAPTURE_H[HP_TOWER_NUM]
Definition: OutdoorPvPHP.cpp:36
const uint32 HP_LANG_CAPTURE_A[HP_TOWER_NUM]
Definition: OutdoorPvPHP.cpp:34
const uint32 HP_LANG_LOSE_H[HP_TOWER_NUM]
Definition: OutdoorPvPHP.cpp:32
#define sWorld
Definition: World.h:444
Definition: Map.h:313
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:523
ObjectiveStates _state
Definition: OutdoorPvP.h:167
ObjectiveStates _oldState
Definition: OutdoorPvP.h:166
ObjectGuid::LowType m_capturePointSpawnId
Definition: OutdoorPvP.h:125
OutdoorPvP * _pvp
Definition: OutdoorPvP.h:173
std::unordered_map< uint32, ObjectGuid::LowType > _objects
Definition: OutdoorPvP.h:178
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.

305{
307 {
309 uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
312 return true;
313 }
314 return false;
315}
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:2193
uint32 _neutralValuePct
Definition: OutdoorPvP.h:170
float _maxValue
Definition: OutdoorPvP.h:154
virtual bool HandlePlayerEnter(Player *player)
Definition: OutdoorPvP.cpp:34
float _value
Definition: OutdoorPvP.h:161

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.

318{
321}
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.

268{
270 // send these updates to only the ones in this objective
271 uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
273 // send this too, sometimes the slider disappears, dunno why :(
275}
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