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

#include "OutdoorPvPTF.h"

Inheritance diagram for OPvPCapturePointTF:
OPvPCapturePoint

Public Member Functions

 OPvPCapturePointTF (OutdoorPvP *pvp, OutdoorPvPTF_TowerType type)
 
bool Update (uint32 diff) override
 
void ChangeState () override
 
void SendChangePhase () override
 
void FillInitialWorldStates (WorldPacket &data) override
 
bool HandlePlayerEnter (Player *player) override
 
void HandlePlayerLeave (Player *player) override
 
void ResetToTeamControlled (TeamId team)
 
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

OutdoorPvPTF_TowerType 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

◆ OPvPCapturePointTF()

OPvPCapturePointTF::OPvPCapturePointTF ( OutdoorPvP pvp,
OutdoorPvPTF_TowerType  type 
)
49{
50 SetCapturePointData(TFCapturePoints[type].entry, TFCapturePoints[type].map, TFCapturePoints[type].x, TFCapturePoints[type].y, TFCapturePoints[type].z, TFCapturePoints[type].o, TFCapturePoints[type].rot0, TFCapturePoints[type].rot1, TFCapturePoints[type].rot2, TFCapturePoints[type].rot3);
51}
const go_type TFCapturePoints[TF_TOWER_NUM]
Definition: OutdoorPvPTF.h:56
@ TF_TOWERSTATE_N
Definition: OutdoorPvPTF.h:119
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: OutdoorPvPTF.h:148
OutdoorPvPTF_TowerType m_TowerType
Definition: OutdoorPvPTF.h:146

References OPvPCapturePoint::SetCapturePointData(), and TFCapturePoints.

Member Function Documentation

◆ ChangeState()

void OPvPCapturePointTF::ChangeState ( )
overridevirtual

Implements OPvPCapturePoint.

394{
395 // if changing from controlling alliance to horde
397 {
398 if (uint32 alliance_towers = ((OutdoorPvPTF*)_pvp)->GetAllianceTowersControlled())
399 ((OutdoorPvPTF*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
400 sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_LOSE_A));
401 }
402 // if changing from controlling horde to alliance
404 {
405 if (uint32 horde_towers = ((OutdoorPvPTF*)_pvp)->GetHordeTowersControlled())
406 ((OutdoorPvPTF*)_pvp)->SetHordeTowersControlled(--horde_towers);
407 sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_LOSE_H));
408 }
409
410 uint32 artkit = 21;
411
412 switch (_state)
413 {
415 {
417 artkit = 2;
418 uint32 alliance_towers = ((OutdoorPvPTF*)_pvp)->GetAllianceTowersControlled();
419 if (alliance_towers < TF_TOWER_NUM)
420 ((OutdoorPvPTF*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
421
422 sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A));
423
424 for (PlayerSet::iterator itr = _activePlayers[0].begin(); itr != _activePlayers[0].end(); ++itr)
425 if (Player* player = ObjectAccessor::FindPlayer(*itr))
426 player->AreaExploredOrEventHappens(TF_ALLY_QUEST);
427 break;
428 }
430 {
432 artkit = 1;
433 uint32 horde_towers = ((OutdoorPvPTF*)_pvp)->GetHordeTowersControlled();
434 if (horde_towers < TF_TOWER_NUM)
435 ((OutdoorPvPTF*)_pvp)->SetHordeTowersControlled(++horde_towers);
436
437 sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H));
438
439 for (PlayerSet::iterator itr = _activePlayers[1].begin(); itr != _activePlayers[1].end(); ++itr)
440 if (Player* player = ObjectAccessor::FindPlayer(*itr))
441 player->AreaExploredOrEventHappens(TF_HORDE_QUEST);
442 break;
443 }
450 break;
451 }
452
453 auto bounds = sMapMgr->FindMap(530, 0)->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
454 for (auto itr = bounds.first; itr != bounds.second; ++itr)
455 itr->second->SetGoArtKit(artkit);
456
458}
std::uint32_t uint32
Definition: Define.h:107
const uint32 TF_HORDE_QUEST
Definition: OutdoorPvPTF.h:44
const uint32 TF_ALLY_QUEST
Definition: OutdoorPvPTF.h:43
@ TF_TOWERSTATE_H
Definition: OutdoorPvPTF.h:120
@ TF_TOWERSTATE_A
Definition: OutdoorPvPTF.h:121
const uint32 OutdoorPvPTFBuffZones[OutdoorPvPTFBuffZonesNum]
Definition: OutdoorPvPTF.h:25
@ TF_TOWER_NUM
Definition: OutdoorPvPTF.h:53
#define sMapMgr
Definition: MapMgr.h:219
#define sObjectMgr
Definition: ObjectMgr.h:1635
@ LANG_OPVP_TF_CAPTURE_H
Definition: Language.h:1230
@ LANG_OPVP_TF_CAPTURE_A
Definition: Language.h:1231
@ LANG_OPVP_TF_LOSE_A
Definition: Language.h:1233
@ LANG_OPVP_TF_LOSE_H
Definition: Language.h:1232
@ 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
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:245
Definition: Player.h:1081
ObjectiveStates _state
Definition: OutdoorPvP.h:166
ObjectiveStates _oldState
Definition: OutdoorPvP.h:165
ObjectGuid::LowType m_capturePointSpawnId
Definition: OutdoorPvP.h:124
std::array< PlayerSet, 2 > _activePlayers
Definition: OutdoorPvP.h:150
OutdoorPvP * _pvp
Definition: OutdoorPvP.h:172
void UpdateTowerState()
Definition: OutdoorPvPTF.cpp:175
Definition: OutdoorPvPTF.h:152

References OPvPCapturePoint::_activePlayers, OPvPCapturePoint::_oldState, OPvPCapturePoint::_pvp, OPvPCapturePoint::_state, ObjectAccessor::FindPlayer(), LANG_OPVP_TF_CAPTURE_A, LANG_OPVP_TF_CAPTURE_H, LANG_OPVP_TF_LOSE_A, LANG_OPVP_TF_LOSE_H, 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, OutdoorPvPTFBuffZones, sMapMgr, sObjectMgr, sWorld, TF_ALLY_QUEST, TF_HORDE_QUEST, TF_TOWER_NUM, TF_TOWERSTATE_A, TF_TOWERSTATE_H, TF_TOWERSTATE_N, and UpdateTowerState().

Referenced by ResetToTeamControlled().

◆ FillInitialWorldStates()

void OPvPCapturePointTF::FillInitialWorldStates ( WorldPacket data)
overridevirtual

Reimplemented from OPvPCapturePoint.

54{
58}
const tf_tower_world_state TFTowerWorldStates[TF_TOWER_NUM]
Definition: OutdoorPvPTF.h:72

References m_TowerState, m_TowerType, TF_TOWERSTATE_A, TF_TOWERSTATE_H, TF_TOWERSTATE_N, and TFTowerWorldStates.

◆ HandlePlayerEnter()

bool OPvPCapturePointTF::HandlePlayerEnter ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

183{
185 {
187 uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
190 return true;
191 }
192 return false;
193}
phase
Definition: boss_skadi.cpp:103
@ TF_UI_TOWER_SLIDER_DISPLAY
Definition: OutdoorPvPTF.h:103
@ TF_UI_TOWER_SLIDER_POS
Definition: OutdoorPvPTF.h:101
@ TF_UI_TOWER_SLIDER_N
Definition: OutdoorPvPTF.h:102
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(), Player::SendUpdateWorldState(), TF_UI_TOWER_SLIDER_DISPLAY, TF_UI_TOWER_SLIDER_N, and TF_UI_TOWER_SLIDER_POS.

◆ HandlePlayerLeave()

void OPvPCapturePointTF::HandlePlayerLeave ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

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

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

◆ ResetToTeamControlled()

void OPvPCapturePointTF::ResetToTeamControlled ( TeamId  team)
150{
151 switch (team)
152 {
153 case TEAM_HORDE:
157 break;
158 case TEAM_ALLIANCE:
162 break;
163 case TEAM_NEUTRAL:
167 break;
168 }
169
170 _value = 0.0f;
171 ChangeState();
173}
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
TeamId _team
Definition: OutdoorPvP.h:162
void SendChangePhase() override
Definition: OutdoorPvPTF.cpp:460
void ChangeState() override
Definition: OutdoorPvPTF.cpp:393

References OPvPCapturePoint::_oldState, OPvPCapturePoint::_state, OPvPCapturePoint::_team, OPvPCapturePoint::_value, ChangeState(), OBJECTIVESTATE_ALLIANCE, OBJECTIVESTATE_HORDE, OBJECTIVESTATE_NEUTRAL, SendChangePhase(), TEAM_ALLIANCE, TEAM_HORDE, and TEAM_NEUTRAL.

◆ SendChangePhase()

void OPvPCapturePointTF::SendChangePhase ( )
overridevirtual

Reimplemented from OPvPCapturePoint.

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

References OPvPCapturePoint::_maxValue, OPvPCapturePoint::_neutralValuePct, OPvPCapturePoint::_value, OPvPCapturePoint::SendUpdateWorldState(), TF_UI_TOWER_SLIDER_DISPLAY, TF_UI_TOWER_SLIDER_N, and TF_UI_TOWER_SLIDER_POS.

Referenced by ResetToTeamControlled().

◆ Update()

bool OPvPCapturePointTF::Update ( uint32  diff)
overridevirtual

Reimplemented from OPvPCapturePoint.

384{
385 // can update even in locked state if gathers the controlling faction
386 bool canupdate = ((((OutdoorPvPTF*)_pvp)->GetAllianceTowersControlled() > 0) && _activePlayers[0].size() > _activePlayers[1].size()) ||
387 ((((OutdoorPvPTF*)_pvp)->GetHordeTowersControlled() > 0) && _activePlayers[0].size() < _activePlayers[1].size());
388 // if gathers the other faction, then only update if the pvp is unlocked
389 canupdate = canupdate || !((OutdoorPvPTF*)_pvp)->IsLocked();
390 return canupdate && OPvPCapturePoint::Update(diff);
391}
virtual bool Update(uint32 diff)
Definition: OutdoorPvP.cpp:316

References OPvPCapturePoint::_activePlayers, OPvPCapturePoint::_pvp, and OPvPCapturePoint::Update().

◆ UpdateTowerState()

Member Data Documentation

◆ m_TowerState

uint32 OPvPCapturePointTF::m_TowerState
protected

◆ m_TowerType

OutdoorPvPTF_TowerType OPvPCapturePointTF::m_TowerType
protected