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

#include "OutdoorPvPEP.h"

Inheritance diagram for OPvPCapturePointEP_PWT:
OPvPCapturePoint

Public Member Functions

 OPvPCapturePointEP_PWT (OutdoorPvP *pvp)
 
void ChangeState () override
 
void SendChangePhase () override
 
void FillInitialWorldStates (WorldPacket &data) override
 
bool HandlePlayerEnter (Player *player) override
 
void HandlePlayerLeave (Player *player) override
 
- 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 Member Functions

void SummonFlightMaster (TeamId teamId)
 
void UpdateTowerState ()
 
- 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 ()
 

Protected Attributes

TeamId m_FlightMasterSpawnedId
 
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 {}
 

Detailed Description

Constructor & Destructor Documentation

◆ OPvPCapturePointEP_PWT()

OPvPCapturePointEP_PWT::OPvPCapturePointEP_PWT ( OutdoorPvP pvp)
434{
437}
@ EP_PWT_FLAGS
Definition: OutdoorPvPEP.h:111
const go_type EPCapturePoints[EP_TOWER_NUM]
Definition: OutdoorPvPEP.h:123
@ EP_TS_N
Definition: OutdoorPvPEP.h:168
@ EP_PWT
Definition: OutdoorPvPEP.h:118
const go_type EPTowerFlags[EP_TOWER_NUM]
Definition: OutdoorPvPEP.h:131
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
Definition: OutdoorPvP.h:91
bool AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
Definition: OutdoorPvP.cpp:105
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: OutdoorPvPEP.h:286
TeamId m_FlightMasterSpawnedId
Definition: OutdoorPvPEP.h:284

References OPvPCapturePoint::AddObject(), EP_PWT, EP_PWT_FLAGS, EPCapturePoints, EPTowerFlags, and OPvPCapturePoint::SetCapturePointData().

Member Function Documentation

◆ ChangeState()

void OPvPCapturePointEP_PWT::ChangeState ( )
overridevirtual

Implements OPvPCapturePoint.

440{
441 // if changing from controlling alliance to horde or vice versa
443 {
444 sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_A));
445 ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_NEUTRAL);
446 }
448 {
449 sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_H));
450 ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_NEUTRAL);
451 }
452
453 uint32 artkit = 21;
454
455 switch (_state)
456 {
460 artkit = 2;
461 ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_ALLIANCE);
462 if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A));
463 break;
467 artkit = 1;
468 ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_HORDE);
469 if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H));
470 break;
475 break;
478 break;
483 break;
486 break;
491 break;
492 }
493
494 Map* map = sMapMgr->FindMap(0, 0);
495 auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
496 for (auto itr = bounds.first; itr != bounds.second; ++itr)
497 itr->second->SetGoArtKit(artkit);
498
499 bounds = map->GetGameObjectBySpawnIdStore().equal_range(_objects[EP_PWT_FLAGS]);
500 for (auto itr = bounds.first; itr != bounds.second; ++itr)
501 itr->second->SetGoArtKit(artkit);
502
504
505 // complete quest objective
508}
std::uint32_t uint32
Definition: Define.h:107
#define sMapMgr
Definition: MapMgr.h:221
@ 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 sObjectMgr
Definition: ObjectMgr.h:1623
@ LANG_OPVP_EP_CAPTURE_PWT_A
Definition: Language.h:1242
@ LANG_OPVP_EP_LOSE_PWT_H
Definition: Language.h:1249
@ LANG_OPVP_EP_LOSE_PWT_A
Definition: Language.h:1250
@ LANG_OPVP_EP_CAPTURE_PWT_H
Definition: Language.h:1241
const uint32 EP_PWT_CM
Definition: OutdoorPvPEP.h:37
@ EP_TS_A
Definition: OutdoorPvPEP.h:173
@ EP_TS_N_A
Definition: OutdoorPvPEP.h:169
@ EP_TS_N_H
Definition: OutdoorPvPEP.h:170
@ EP_TS_H
Definition: OutdoorPvPEP.h:174
@ EP_PWT_FLIGHTMASTER
Definition: OutdoorPvPEP.h:102
const uint32 EP_GraveYardZone
Definition: OutdoorPvPEP.h:28
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
#define sWorld
Definition: World.h:444
Definition: Map.h:313
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:523
ObjectiveStates _state
Definition: OutdoorPvP.h:167
ObjectiveStates _oldState
Definition: OutdoorPvP.h:166
ObjectGuid::LowType m_capturePointSpawnId
Definition: OutdoorPvP.h:125
OutdoorPvP * _pvp
Definition: OutdoorPvP.h:173
bool DelCreature(uint32 type)
Definition: OutdoorPvP.cpp:151
std::unordered_map< uint32, ObjectGuid::LowType > _objects
Definition: OutdoorPvP.h:178
void SendObjectiveComplete(uint32 id, ObjectGuid guid=ObjectGuid::Empty)
Definition: OutdoorPvP.cpp:476
void SummonFlightMaster(TeamId teamId)
Definition: OutdoorPvPEP.cpp:558
void UpdateTowerState()
Definition: OutdoorPvPEP.cpp:530
Definition: OutdoorPvPEP.h:290

References OPvPCapturePoint::_objects, OPvPCapturePoint::_oldState, OPvPCapturePoint::_pvp, OPvPCapturePoint::_state, OPvPCapturePoint::DelCreature(), EP_GraveYardZone, EP_PWT, EP_PWT_CM, EP_PWT_FLAGS, EP_PWT_FLIGHTMASTER, EP_TS_A, EP_TS_H, EP_TS_N, EP_TS_N_A, EP_TS_N_H, Map::GetGameObjectBySpawnIdStore(), LANG_OPVP_EP_CAPTURE_PWT_A, LANG_OPVP_EP_CAPTURE_PWT_H, LANG_OPVP_EP_LOSE_PWT_A, LANG_OPVP_EP_LOSE_PWT_H, OPvPCapturePoint::m_capturePointSpawnId, m_FlightMasterSpawnedId, m_TowerState, OBJECTIVESTATE_ALLIANCE, OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE, OBJECTIVESTATE_HORDE, OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE, OBJECTIVESTATE_NEUTRAL, OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE, OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE, OPvPCapturePoint::SendObjectiveComplete(), sMapMgr, sObjectMgr, SummonFlightMaster(), sWorld, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, and UpdateTowerState().

◆ FillInitialWorldStates()

void OPvPCapturePointEP_PWT::FillInitialWorldStates ( WorldPacket data)
overridevirtual

Reimplemented from OPvPCapturePoint.

522{
523 data << EP_PWT_A << uint32(bool(m_TowerState & EP_TS_A));
524 data << EP_PWT_H << uint32(bool(m_TowerState & EP_TS_H));
525 data << EP_PWT_N_A << uint32(bool(m_TowerState & EP_TS_N_A));
526 data << EP_PWT_N_H << uint32(bool(m_TowerState & EP_TS_N_H));
527 data << EP_PWT_N << uint32(bool(m_TowerState & EP_TS_N));
528}
@ EP_PWT_N_A
Definition: OutdoorPvPEP.h:69
@ EP_PWT_A
Definition: OutdoorPvPEP.h:71
@ EP_PWT_H
Definition: OutdoorPvPEP.h:72
@ EP_PWT_N
Definition: OutdoorPvPEP.h:73
@ EP_PWT_N_H
Definition: OutdoorPvPEP.h:70

References EP_PWT_A, EP_PWT_H, EP_PWT_N, EP_PWT_N_A, EP_PWT_N_H, EP_TS_A, EP_TS_H, EP_TS_N, EP_TS_N_A, EP_TS_N_H, and m_TowerState.

◆ HandlePlayerEnter()

bool OPvPCapturePointEP_PWT::HandlePlayerEnter ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

540{
542 {
544 uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
547 return true;
548 }
549 return false;
550}
phase
Definition: boss_skadi.cpp:103
@ EP_UI_TOWER_SLIDER_DISPLAY
Definition: OutdoorPvPEP.h:87
@ EP_UI_TOWER_SLIDER_POS
Definition: OutdoorPvPEP.h:88
@ EP_UI_TOWER_SLIDER_N
Definition: OutdoorPvPEP.h:89
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2193
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, EP_UI_TOWER_SLIDER_DISPLAY, EP_UI_TOWER_SLIDER_N, EP_UI_TOWER_SLIDER_POS, OPvPCapturePoint::HandlePlayerEnter(), and Player::SendUpdateWorldState().

◆ HandlePlayerLeave()

void OPvPCapturePointEP_PWT::HandlePlayerLeave ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

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

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

◆ SendChangePhase()

void OPvPCapturePointEP_PWT::SendChangePhase ( )
overridevirtual

Reimplemented from OPvPCapturePoint.

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

References OPvPCapturePoint::_maxValue, OPvPCapturePoint::_neutralValuePct, OPvPCapturePoint::_value, EP_UI_TOWER_SLIDER_DISPLAY, EP_UI_TOWER_SLIDER_N, EP_UI_TOWER_SLIDER_POS, and OPvPCapturePoint::SendUpdateWorldState().

◆ SummonFlightMaster()

void OPvPCapturePointEP_PWT::SummonFlightMaster ( TeamId  teamId)
protected
559{
560 if (m_FlightMasterSpawnedId != teamId)
561 {
565 /*
566 // sky - we need update gso code
567
568 Creature* c = HashMapHolder<Creature>::Find(_creatures[EP_PWT_FLIGHTMASTER]);
569 //Spawn flight master as friendly to capturing team
570 c->SetUInt32Value(GAMEOBJECT_FACTION, (teamId == TEAM_ALLIANCE ? 55 : 68));
571 if (c)
572 {
573 GossipOption gso;
574 gso.Action = GOSSIP_OPTION_OUTDOORPVP;
575 gso.GossipId = 0;
576 gso.OptionText.assign(sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_FLIGHT_NPT));
577 gso.Id = 50;
578 gso.Icon = 0;
579 gso.NpcFlag = 0;
580 gso.BoxMoney = 0;
581 gso.Coded = false;
582 c->addGossipOption(gso);
583
584 gso.Action = GOSSIP_OPTION_OUTDOORPVP;
585 gso.GossipId = 0;
586 gso.OptionText.assign(sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_FLIGHT_EWT));
587 gso.Id = 50;
588 gso.Icon = 0;
589 gso.NpcFlag = 0;
590 gso.BoxMoney = 0;
591 gso.Coded = false;
592 c->addGossipOption(gso);
593
594 gso.Action = GOSSIP_OPTION_OUTDOORPVP;
595 gso.GossipId = 0;
596 gso.OptionText.assign(sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_FLIGHT_CGT));
597 gso.Id = 50;
598 gso.Icon = 0;
599 gso.NpcFlag = 0;
600 gso.BoxMoney = 0;
601 gso.Coded = false;
602 c->addGossipOption(gso);
603 }
604 */
605 }
606}
const creature_type EP_PWT_FlightMaster
Definition: OutdoorPvPEP.h:178
float y
Definition: OutdoorPvP.h:73
float x
Definition: OutdoorPvP.h:72
uint32 entry
Definition: OutdoorPvP.h:70
float o
Definition: OutdoorPvP.h:75
uint32 map
Definition: OutdoorPvP.h:71
float z
Definition: OutdoorPvP.h:74
bool AddCreature(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimeDelay=0)
Definition: OutdoorPvP.cpp:116

References OPvPCapturePoint::AddCreature(), OPvPCapturePoint::DelCreature(), creature_type::entry, EP_PWT_FLIGHTMASTER, EP_PWT_FlightMaster, m_FlightMasterSpawnedId, creature_type::map, creature_type::o, creature_type::x, creature_type::y, and creature_type::z.

Referenced by ChangeState().

◆ UpdateTowerState()

void OPvPCapturePointEP_PWT::UpdateTowerState ( )
protected

Member Data Documentation

◆ m_FlightMasterSpawnedId

TeamId OPvPCapturePointEP_PWT::m_FlightMasterSpawnedId
protected

Referenced by ChangeState(), and SummonFlightMaster().

◆ m_TowerState

uint32 OPvPCapturePointEP_PWT::m_TowerState
protected