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 (WorldPacket &data) 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
 
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 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 
)
31{
32 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);
33}
const go_type ZMCapturePoints[ZM_NUM_BEACONS]
Definition: OutdoorPvPZM.h:119
@ ZM_TOWERSTATE_N
Definition: OutdoorPvPZM.h:162
Definition: OutdoorPvP.h:90
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: OutdoorPvPZM.h:188
ZM_BeaconType m_TowerType
Definition: OutdoorPvPZM.h:187

References OPvPCapturePoint::SetCapturePointData(), and ZMCapturePoints.

Member Function Documentation

◆ ChangeState()

void OPvPCapturePointZM_Beacon::ChangeState ( )
overridevirtual

Implements OPvPCapturePoint.

75{
76 // if changing from controlling alliance to horde
78 {
79 if (uint32 alliance_towers = ((OutdoorPvPZM*)_pvp)->GetAllianceTowersControlled())
80 ((OutdoorPvPZM*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
81 sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseA[m_TowerType]));
82 }
83 // if changing from controlling horde to alliance
85 {
86 if (uint32 horde_towers = ((OutdoorPvPZM*)_pvp)->GetHordeTowersControlled())
87 ((OutdoorPvPZM*)_pvp)->SetHordeTowersControlled(--horde_towers);
88 sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseH[m_TowerType]));
89 }
90
91 switch (_state)
92 {
94 {
96 uint32 alliance_towers = ((OutdoorPvPZM*)_pvp)->GetAllianceTowersControlled();
97 if (alliance_towers < ZM_NUM_BEACONS)
98 ((OutdoorPvPZM*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
99 sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureA[m_TowerType]));
100 break;
101 }
103 {
105 uint32 horde_towers = ((OutdoorPvPZM*)_pvp)->GetHordeTowersControlled();
106 if (horde_towers < ZM_NUM_BEACONS)
107 ((OutdoorPvPZM*)_pvp)->SetHordeTowersControlled(++horde_towers);
108 sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureH[m_TowerType]));
109 break;
110 }
117 break;
118 }
119
121}
std::uint32_t uint32
Definition: Define.h:107
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:164
@ ZM_TOWERSTATE_A
Definition: OutdoorPvPZM.h:163
@ 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
#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
ObjectiveStates _state
Definition: OutdoorPvP.h:166
ObjectiveStates _oldState
Definition: OutdoorPvP.h:165
OutdoorPvP * _pvp
Definition: OutdoorPvP.h:172
void UpdateTowerState()
Definition: OutdoorPvPZM.cpp:45
Definition: OutdoorPvPZM.h:232

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, sWorld, 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 ( WorldPacket data)
overridevirtual

Reimplemented from OPvPCapturePoint.

36{
37 data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_n) << uint32(bool(m_TowerState & ZM_TOWERSTATE_N));
38 data << uint32(ZMBeaconInfo[m_TowerType].map_tower_n) << uint32(bool(m_TowerState & ZM_TOWERSTATE_N));
39 data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_a) << uint32(bool(m_TowerState & ZM_TOWERSTATE_A));
40 data << uint32(ZMBeaconInfo[m_TowerType].map_tower_a) << uint32(bool(m_TowerState & ZM_TOWERSTATE_A));
41 data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_h) << uint32(bool(m_TowerState & ZM_TOWERSTATE_H));
42 data << uint32(ZMBeaconInfo[m_TowerType].map_tower_h) << uint32(bool(m_TowerState & ZM_TOWERSTATE_H));
43}
const zm_beacon ZMBeaconInfo[ZM_NUM_BEACONS]
Definition: OutdoorPvPZM.h:89

References m_TowerState, m_TowerType, ZM_TOWERSTATE_A, ZM_TOWERSTATE_H, ZM_TOWERSTATE_N, and ZMBeaconInfo.

◆ HandlePlayerEnter()

bool OPvPCapturePointZM_Beacon::HandlePlayerEnter ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

56{
58 {
59 player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 1);
60 uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
63 return true;
64 }
65 return false;
66}
phase
Definition: boss_skadi.cpp:103
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(), m_TowerType, Player::SendUpdateWorldState(), and ZMBeaconInfo.

◆ HandlePlayerLeave()

void OPvPCapturePointZM_Beacon::HandlePlayerLeave ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

69{
70 player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 0);
72}
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.

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