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 
)
32{
33 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);
34}
const go_type ZMCapturePoints[ZM_NUM_BEACONS]
Definition: OutdoorPvPZM.h:119
@ ZM_TOWERSTATE_N
Definition: OutdoorPvPZM.h:162
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
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.

76{
77 // if changing from controlling alliance to horde
79 {
80 if (uint32 alliance_towers = ((OutdoorPvPZM*)_pvp)->GetAllianceTowersControlled())
81 ((OutdoorPvPZM*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
82 sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseA[m_TowerType]));
83 }
84 // if changing from controlling horde to alliance
86 {
87 if (uint32 horde_towers = ((OutdoorPvPZM*)_pvp)->GetHordeTowersControlled())
88 ((OutdoorPvPZM*)_pvp)->SetHordeTowersControlled(--horde_towers);
89 sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseH[m_TowerType]));
90 }
91
92 switch (_state)
93 {
95 {
97 uint32 alliance_towers = ((OutdoorPvPZM*)_pvp)->GetAllianceTowersControlled();
98 if (alliance_towers < ZM_NUM_BEACONS)
99 ((OutdoorPvPZM*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
100 sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureA[m_TowerType]));
101 break;
102 }
104 {
106 uint32 horde_towers = ((OutdoorPvPZM*)_pvp)->GetHordeTowersControlled();
107 if (horde_towers < ZM_NUM_BEACONS)
108 ((OutdoorPvPZM*)_pvp)->SetHordeTowersControlled(++horde_towers);
109 sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureH[m_TowerType]));
110 break;
111 }
118 break;
119 }
120
122}
std::uint32_t uint32
Definition: Define.h:108
#define sObjectMgr
Definition: ObjectMgr.h:1640
@ 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
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 sWorld
Definition: World.h:447
ObjectiveStates _state
Definition: OutdoorPvP.h:167
ObjectiveStates _oldState
Definition: OutdoorPvP.h:166
OutdoorPvP * _pvp
Definition: OutdoorPvP.h:173
void UpdateTowerState()
Definition: OutdoorPvPZM.cpp:46
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.

37{
38 data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_n) << uint32(bool(m_TowerState & ZM_TOWERSTATE_N));
39 data << uint32(ZMBeaconInfo[m_TowerType].map_tower_n) << uint32(bool(m_TowerState & ZM_TOWERSTATE_N));
40 data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_a) << uint32(bool(m_TowerState & ZM_TOWERSTATE_A));
41 data << uint32(ZMBeaconInfo[m_TowerType].map_tower_a) << uint32(bool(m_TowerState & ZM_TOWERSTATE_A));
42 data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_h) << uint32(bool(m_TowerState & ZM_TOWERSTATE_H));
43 data << uint32(ZMBeaconInfo[m_TowerType].map_tower_h) << uint32(bool(m_TowerState & ZM_TOWERSTATE_H));
44}
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.

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

◆ HandlePlayerLeave()

void OPvPCapturePointZM_Beacon::HandlePlayerLeave ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

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

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

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