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 ()
 
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 ()
 

Protected Attributes

ZM_BeaconType m_TowerType
 
uint32 m_TowerState
 
- Protected Attributes inherited from OPvPCapturePoint
PlayerSet m_activePlayers [2]
 
float m_maxValue
 
float m_minValue
 
float m_maxSpeed
 
float m_value
 
TeamId m_team
 
ObjectiveStates m_OldState
 
ObjectiveStates m_State
 
uint32 m_neutralValuePct
 
OutdoorPvPm_PvP
 
std::map< uint32, ObjectGuid::LowTypem_Objects
 
std::map< uint32, ObjectGuid::LowTypem_Creatures
 
std::map< ObjectGuid::LowType, uint32m_ObjectTypes
 
std::map< ObjectGuid::LowType, uint32m_CreatureTypes
 

Additional Inherited Members

- Public Attributes inherited from OPvPCapturePoint
ObjectGuid::LowType m_capturePointSpawnId
 
GameObjectm_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:89
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:115
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*)m_PvP)->GetAllianceTowersControlled())
80 ((OutdoorPvPZM*)m_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*)m_PvP)->GetHordeTowersControlled())
87 ((OutdoorPvPZM*)m_PvP)->SetHordeTowersControlled(--horde_towers);
88 sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseH[m_TowerType]));
89 }
90
91 switch (m_State)
92 {
94 {
96 uint32 alliance_towers = ((OutdoorPvPZM*)m_PvP)->GetAllianceTowersControlled();
97 if (alliance_towers < ZM_NUM_BEACONS)
98 ((OutdoorPvPZM*)m_PvP)->SetAllianceTowersControlled(++alliance_towers);
99 sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureA[m_TowerType]));
100 break;
101 }
103 {
105 uint32 horde_towers = ((OutdoorPvPZM*)m_PvP)->GetHordeTowersControlled();
106 if (horde_towers < ZM_NUM_BEACONS)
107 ((OutdoorPvPZM*)m_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:108
#define sObjectMgr
Definition: ObjectMgr.h:1640
@ 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
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:451
ObjectiveStates m_OldState
Definition: OutdoorPvP.h:178
OutdoorPvP * m_PvP
Definition: OutdoorPvP.h:185
ObjectiveStates m_State
Definition: OutdoorPvP.h:179
void UpdateTowerState()
Definition: OutdoorPvPZM.cpp:45
Definition: OutdoorPvPZM.h:232

References OPvPCapturePoint::m_OldState, OPvPCapturePoint::m_PvP, OPvPCapturePoint::m_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((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
63 return true;
64 }
65 return false;
66}
phase
Definition: boss_skadi.cpp:102
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2194
float m_value
Definition: OutdoorPvP.h:173
uint32 m_neutralValuePct
Definition: OutdoorPvP.h:182
float m_maxValue
Definition: OutdoorPvP.h:166
virtual bool HandlePlayerEnter(Player *player)
Definition: OutdoorPvP.cpp:36

References OPvPCapturePoint::HandlePlayerEnter(), OPvPCapturePoint::m_maxValue, OPvPCapturePoint::m_neutralValuePct, m_TowerType, OPvPCapturePoint::m_value, 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:47

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((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
131}
void SendUpdateWorldState(uint32 field, uint32 value)
Definition: OutdoorPvP.cpp:420

References OPvPCapturePoint::m_maxValue, OPvPCapturePoint::m_neutralValuePct, m_TowerType, OPvPCapturePoint::m_value, OPvPCapturePoint::SendUpdateWorldState(), and ZMBeaconInfo.

◆ UpdateTowerState()

Member Data Documentation

◆ m_TowerState

uint32 OPvPCapturePointZM_Beacon::m_TowerState
protected

◆ m_TowerType