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

#include "OutdoorPvPZM.h"

Inheritance diagram for OPvPCapturePointZM_Beacon:
OPvPCapturePoint

Public Member Functions

 OPvPCapturePointZM_Beacon (OutdoorPvP *pvp, ZM_BeaconType type)
 
void ChangeState () override
 
void SendChangePhase () override
 
void FillInitialWorldStates (WorldPackets::WorldState::InitWorldStates &packet) override
 
bool HandlePlayerEnter (Player *player) override
 
void HandlePlayerLeave (Player *player) override
 
void UpdateTowerState ()
 
- Public Member Functions inherited from OPvPCapturePoint
 OPvPCapturePoint (OutdoorPvP *pvp)
 
virtual ~OPvPCapturePoint ()=default
 
void SendUpdateWorldState (uint32 field, uint32 value)
 
void SendObjectiveComplete (uint32 id, ObjectGuid guid=ObjectGuid::Empty)
 
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 ChangeTeam (TeamId)
 
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 Attributes

ZM_BeaconType m_TowerType
 
uint32 m_TowerState
 
- 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 {}
 
- 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 ()
 

Detailed Description

Constructor & Destructor Documentation

◆ OPvPCapturePointZM_Beacon()

OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon ( OutdoorPvP pvp,
ZM_BeaconType  type 
)
34{
35 SetCapturePointData(ZMCapturePoints[type].entry, ZMCapturePoints[type].map, ZMCapturePoints[type].x, ZMCapturePoints[type].y, ZMCapturePoints[type].z, ZMCapturePoints[type].o, ZMCapturePoints[type].rot0, ZMCapturePoints[type].rot1, ZMCapturePoints[type].rot2, ZMCapturePoints[type].rot3);
36}
const go_type ZMCapturePoints[ZM_NUM_BEACONS]
Definition OutdoorPvPZM.h:119
@ ZM_TOWERSTATE_N
Definition OutdoorPvPZM.h:127
uint32 m_TowerState
Definition OutdoorPvPZM.h:153
ZM_BeaconType m_TowerType
Definition OutdoorPvPZM.h:152
Definition OutdoorPvP.h:91
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

References OPvPCapturePoint::SetCapturePointData(), and ZMCapturePoints.

Member Function Documentation

◆ ChangeState()

void OPvPCapturePointZM_Beacon::ChangeState ( )
overridevirtual

Implements OPvPCapturePoint.

79{
80 // if changing from controlling alliance to horde
82 {
83 if (uint32 alliance_towers = ((OutdoorPvPZM*)_pvp)->GetAllianceTowersControlled())
84 ((OutdoorPvPZM*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
85 sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseA[m_TowerType]));
86 }
87 // if changing from controlling horde to alliance
89 {
90 if (uint32 horde_towers = ((OutdoorPvPZM*)_pvp)->GetHordeTowersControlled())
91 ((OutdoorPvPZM*)_pvp)->SetHordeTowersControlled(--horde_towers);
92 sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseH[m_TowerType]));
93 }
94
95 switch (_state)
96 {
98 {
100 uint32 alliance_towers = ((OutdoorPvPZM*)_pvp)->GetAllianceTowersControlled();
101 if (alliance_towers < ZM_NUM_BEACONS)
102 ((OutdoorPvPZM*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
103 sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureA[m_TowerType]));
104 break;
105 }
107 {
109 uint32 horde_towers = ((OutdoorPvPZM*)_pvp)->GetHordeTowersControlled();
110 if (horde_towers < ZM_NUM_BEACONS)
111 ((OutdoorPvPZM*)_pvp)->SetHordeTowersControlled(++horde_towers);
112 sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureH[m_TowerType]));
113 break;
114 }
121 break;
122 }
123
125}
std::uint32_t uint32
Definition Define.h:107
#define sObjectMgr
Definition ObjectMgr.h:1636
const uint32 ZM_GRAVEYARD_ZONE
Definition OutdoorPvPZM.h:30
const uint32 ZMBeaconLoseH[ZM_NUM_BEACONS]
Definition OutdoorPvPZM.h:113
const uint32 ZMBeaconCaptureH[ZM_NUM_BEACONS]
Definition OutdoorPvPZM.h:101
@ ZM_TOWERSTATE_H
Definition OutdoorPvPZM.h:129
@ ZM_TOWERSTATE_A
Definition OutdoorPvPZM.h:128
@ ZM_NUM_BEACONS
Definition OutdoorPvPZM.h:86
const uint32 ZMBeaconLoseA[ZM_NUM_BEACONS]
Definition OutdoorPvPZM.h:107
const uint32 ZMBeaconCaptureA[ZM_NUM_BEACONS]
Definition OutdoorPvPZM.h:95
@ 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 sWorldSessionMgr
Definition WorldSessionMgr.h:110
void UpdateTowerState()
Definition OutdoorPvPZM.cpp:49
ObjectiveStates _state
Definition OutdoorPvP.h:167
ObjectiveStates _oldState
Definition OutdoorPvP.h:166
OutdoorPvP * _pvp
Definition OutdoorPvP.h:173
Definition OutdoorPvPZM.h:197

References OPvPCapturePoint::_oldState, OPvPCapturePoint::_pvp, OPvPCapturePoint::_state, m_TowerState, m_TowerType, OBJECTIVESTATE_ALLIANCE, OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE, OBJECTIVESTATE_HORDE, OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE, OBJECTIVESTATE_NEUTRAL, OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE, OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE, sObjectMgr, sWorldSessionMgr, UpdateTowerState(), ZM_GRAVEYARD_ZONE, ZM_NUM_BEACONS, ZM_TOWERSTATE_A, ZM_TOWERSTATE_H, ZM_TOWERSTATE_N, ZMBeaconCaptureA, ZMBeaconCaptureH, ZMBeaconLoseA, and ZMBeaconLoseH.

◆ FillInitialWorldStates()

void OPvPCapturePointZM_Beacon::FillInitialWorldStates ( WorldPackets::WorldState::InitWorldStates packet)
overridevirtual

Reimplemented from OPvPCapturePoint.

39{
40 packet.Worldstates.reserve(6);
41 packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].ui_tower_n, (m_TowerState & ZM_TOWERSTATE_N) != 0 ? 1 : 0);
42 packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].map_tower_n, (m_TowerState & ZM_TOWERSTATE_N) != 0 ? 1 : 0);
43 packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].ui_tower_a, (m_TowerState & ZM_TOWERSTATE_A) != 0 ? 1 : 0);
44 packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].map_tower_a, (m_TowerState & ZM_TOWERSTATE_A) != 0 ? 1 : 0);
45 packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].ui_tower_h, (m_TowerState & ZM_TOWERSTATE_H) != 0 ? 1 : 0);
46 packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].map_tower_h, (m_TowerState & ZM_TOWERSTATE_H) != 0 ? 1 : 0);
47}
const zm_beacon ZMBeaconInfo[ZM_NUM_BEACONS]
Definition OutdoorPvPZM.h:89
std::vector< WorldStateInfo > Worldstates
Definition WorldStatePackets.h:46

References m_TowerState, m_TowerType, WorldPackets::WorldState::InitWorldStates::Worldstates, ZM_TOWERSTATE_A, ZM_TOWERSTATE_H, ZM_TOWERSTATE_N, and ZMBeaconInfo.

◆ HandlePlayerEnter()

bool OPvPCapturePointZM_Beacon::HandlePlayerEnter ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

60{
62 {
63 player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 1);
64 uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
67 return true;
68 }
69 return false;
70}
phase
Definition boss_skadi.cpp:103
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
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition PlayerUpdates.cpp:2243

References OPvPCapturePoint::_maxValue, OPvPCapturePoint::_neutralValuePct, OPvPCapturePoint::_value, OPvPCapturePoint::HandlePlayerEnter(), m_TowerType, Player::SendUpdateWorldState(), and ZMBeaconInfo.

◆ HandlePlayerLeave()

void OPvPCapturePointZM_Beacon::HandlePlayerLeave ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

73{
74 player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 0);
76}
virtual void HandlePlayerLeave(Player *player)
Definition OutdoorPvP.cpp:46

References OPvPCapturePoint::HandlePlayerLeave(), m_TowerType, Player::SendUpdateWorldState(), and ZMBeaconInfo.

◆ SendChangePhase()

void OPvPCapturePointZM_Beacon::SendChangePhase ( )
overridevirtual

Reimplemented from OPvPCapturePoint.

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

References OPvPCapturePoint::_maxValue, OPvPCapturePoint::_neutralValuePct, OPvPCapturePoint::_value, m_TowerType, OPvPCapturePoint::SendUpdateWorldState(), and ZMBeaconInfo.

◆ UpdateTowerState()

Member Data Documentation

◆ m_TowerState

uint32 OPvPCapturePointZM_Beacon::m_TowerState
protected

◆ m_TowerType


The documentation for this class was generated from the following files: