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

#include "OutdoorPvPEP.h"

Inheritance diagram for OPvPCapturePointEP_CGT:
OPvPCapturePoint

Public Member Functions

 OPvPCapturePointEP_CGT (OutdoorPvP *pvp)
 
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
 

Protected Member Functions

void LinkGraveyard (TeamId teamId)
 
void UpdateTowerState ()
 
- 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

uint32 m_TowerState
 
TeamId m_GraveyardSide
 
- 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
 

Additional Inherited Members

- Public Attributes inherited from OPvPCapturePoint
ObjectGuid::LowType m_capturePointSpawnId {}
 
GameObject_capturePoint {}
 

Detailed Description

Constructor & Destructor Documentation

◆ OPvPCapturePointEP_CGT()

OPvPCapturePointEP_CGT::OPvPCapturePointEP_CGT ( OutdoorPvP pvp)
307{
310}
@ EP_CGT_FLAGS
Definition: OutdoorPvPEP.h:110
const go_type EPCapturePoints[EP_TOWER_NUM]
Definition: OutdoorPvPEP.h:123
@ EP_TS_N
Definition: OutdoorPvPEP.h:168
@ EP_CGT
Definition: OutdoorPvPEP.h:119
const go_type EPTowerFlags[EP_TOWER_NUM]
Definition: OutdoorPvPEP.h:131
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
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
uint32 m_TowerState
Definition: OutdoorPvPEP.h:258
TeamId m_GraveyardSide
Definition: OutdoorPvPEP.h:260

References OPvPCapturePoint::AddObject(), EP_CGT, EP_CGT_FLAGS, EPCapturePoints, EPTowerFlags, and OPvPCapturePoint::SetCapturePointData().

Member Function Documentation

◆ ChangeState()

void OPvPCapturePointEP_CGT::ChangeState ( )
overridevirtual

Implements OPvPCapturePoint.

313{
314 // if changing from controlling alliance to horde or vice versa
316 {
317 sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_A));
318 ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_NEUTRAL);
319 }
321 {
322 sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_H));
323 ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_NEUTRAL);
324 }
325
326 uint32 artkit = 21;
327
328 switch (_state)
329 {
332 artkit = 2;
334 ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_ALLIANCE);
335 if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A));
336 break;
339 artkit = 1;
341 ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_HORDE);
342 if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H));
343 break;
346 break;
350 break;
354 break;
355 }
356
357 Map* map = sMapMgr->FindMap(0, 0);
358 auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
359 for (auto itr = bounds.first; itr != bounds.second; ++itr)
360 itr->second->SetGoArtKit(artkit);
361
362 bounds = map->GetGameObjectBySpawnIdStore().equal_range(_objects[EP_CGT_FLAGS]);
363 for (auto itr = bounds.first; itr != bounds.second; ++itr)
364 itr->second->SetGoArtKit(artkit);
365
367
368 // complete quest objective
371}
std::uint32_t uint32
Definition: Define.h:107
const uint32 EP_CGT_CM
Definition: OutdoorPvPEP.h:35
@ EP_TS_A
Definition: OutdoorPvPEP.h:173
@ EP_TS_N_A
Definition: OutdoorPvPEP.h:169
@ EP_TS_N_H
Definition: OutdoorPvPEP.h:170
@ EP_TS_H
Definition: OutdoorPvPEP.h:174
const uint32 EP_GraveYardZone
Definition: OutdoorPvPEP.h:28
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
#define sMapMgr
Definition: MapMgr.h:219
#define sObjectMgr
Definition: ObjectMgr.h:1635
@ LANG_OPVP_EP_LOSE_CGT_A
Definition: Language.h:1248
@ LANG_OPVP_EP_LOSE_CGT_H
Definition: Language.h:1247
@ LANG_OPVP_EP_CAPTURE_CGT_H
Definition: Language.h:1239
@ LANG_OPVP_EP_CAPTURE_CGT_A
Definition: Language.h:1240
@ 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 UpdateTowerState()
Definition: OutdoorPvPEP.cpp:393
void LinkGraveyard(TeamId teamId)
Definition: OutdoorPvPEP.cpp:421
Definition: OutdoorPvPEP.h:290

References OPvPCapturePoint::_objects, OPvPCapturePoint::_oldState, OPvPCapturePoint::_pvp, OPvPCapturePoint::_state, EP_CGT, EP_CGT_CM, EP_CGT_FLAGS, EP_GraveYardZone, EP_TS_A, EP_TS_H, EP_TS_N, EP_TS_N_A, EP_TS_N_H, Map::GetGameObjectBySpawnIdStore(), LANG_OPVP_EP_CAPTURE_CGT_A, LANG_OPVP_EP_CAPTURE_CGT_H, LANG_OPVP_EP_LOSE_CGT_A, LANG_OPVP_EP_LOSE_CGT_H, LinkGraveyard(), OPvPCapturePoint::m_capturePointSpawnId, m_TowerState, OBJECTIVESTATE_ALLIANCE, OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE, OBJECTIVESTATE_HORDE, OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE, OBJECTIVESTATE_NEUTRAL, OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE, OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE, OPvPCapturePoint::SendObjectiveComplete(), sMapMgr, sObjectMgr, sWorld, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, and UpdateTowerState().

◆ FillInitialWorldStates()

void OPvPCapturePointEP_CGT::FillInitialWorldStates ( WorldPacket data)
overridevirtual

Reimplemented from OPvPCapturePoint.

385{
386 data << EP_CGT_A << uint32(bool(m_TowerState & EP_TS_A));
387 data << EP_CGT_H << uint32(bool(m_TowerState & EP_TS_H));
388 data << EP_CGT_N_A << uint32(bool(m_TowerState & EP_TS_N_A));
389 data << EP_CGT_N_H << uint32(bool(m_TowerState & EP_TS_N_H));
390 data << EP_CGT_N << uint32(bool(m_TowerState & EP_TS_N));
391}
@ EP_CGT_N
Definition: OutdoorPvPEP.h:82
@ EP_CGT_H
Definition: OutdoorPvPEP.h:81
@ EP_CGT_N_H
Definition: OutdoorPvPEP.h:79
@ EP_CGT_A
Definition: OutdoorPvPEP.h:80
@ EP_CGT_N_A
Definition: OutdoorPvPEP.h:78

References EP_CGT_A, EP_CGT_H, EP_CGT_N, EP_CGT_N_A, EP_CGT_N_H, EP_TS_A, EP_TS_H, EP_TS_N, EP_TS_N_A, EP_TS_N_H, and m_TowerState.

◆ HandlePlayerEnter()

bool OPvPCapturePointEP_CGT::HandlePlayerEnter ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

403{
405 {
407 uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
410 return true;
411 }
412 return false;
413}
phase
Definition: boss_skadi.cpp:103
@ EP_UI_TOWER_SLIDER_DISPLAY
Definition: OutdoorPvPEP.h:87
@ EP_UI_TOWER_SLIDER_POS
Definition: OutdoorPvPEP.h:88
@ EP_UI_TOWER_SLIDER_N
Definition: OutdoorPvPEP.h:89
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, EP_UI_TOWER_SLIDER_DISPLAY, EP_UI_TOWER_SLIDER_N, EP_UI_TOWER_SLIDER_POS, OPvPCapturePoint::HandlePlayerEnter(), and Player::SendUpdateWorldState().

◆ HandlePlayerLeave()

void OPvPCapturePointEP_CGT::HandlePlayerLeave ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

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

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

◆ LinkGraveyard()

void OPvPCapturePointEP_CGT::LinkGraveyard ( TeamId  teamId)
protected
422{
423 if (m_GraveyardSide != teamId)
424 {
425 sGraveyard->RemoveGraveyardLink(EP_GraveYardId, EP_GraveYardZone, m_GraveyardSide, false);
426 sGraveyard->AddGraveyardLink(EP_GraveYardId, EP_GraveYardZone, teamId, false);
427 m_GraveyardSide = teamId;
428 }
429}
const uint32 EP_GraveYardId
Definition: OutdoorPvPEP.h:30
#define sGraveyard
Definition: GameGraveyard.h:74

References EP_GraveYardId, EP_GraveYardZone, m_GraveyardSide, and sGraveyard.

Referenced by ChangeState().

◆ SendChangePhase()

void OPvPCapturePointEP_CGT::SendChangePhase ( )
overridevirtual

Reimplemented from OPvPCapturePoint.

374{
375 // send this too, sometimes the slider disappears, dunno why :(
377 // send these updates to only the ones in this objective
378 uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
380 // send this too, sometimes it resets :S
382}
void SendUpdateWorldState(uint32 field, uint32 value)
Definition: OutdoorPvP.cpp:465

References OPvPCapturePoint::_maxValue, OPvPCapturePoint::_neutralValuePct, OPvPCapturePoint::_value, EP_UI_TOWER_SLIDER_DISPLAY, EP_UI_TOWER_SLIDER_N, EP_UI_TOWER_SLIDER_POS, and OPvPCapturePoint::SendUpdateWorldState().

◆ UpdateTowerState()

void OPvPCapturePointEP_CGT::UpdateTowerState ( )
protected

Member Data Documentation

◆ m_GraveyardSide

TeamId OPvPCapturePointEP_CGT::m_GraveyardSide
protected

Referenced by LinkGraveyard().

◆ m_TowerState

uint32 OPvPCapturePointEP_CGT::m_TowerState
protected