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

#include "OutdoorPvPEP.h"

Inheritance diagram for OutdoorPvPEP:
OutdoorPvP ZoneScript

Public Member Functions

 OutdoorPvPEP ()
 
bool SetupOutdoorPvP () override
 
void HandlePlayerEnterZone (Player *player, uint32 zone) override
 
void HandlePlayerLeaveZone (Player *player, uint32 zone) override
 
bool Update (uint32 diff) override
 
void FillInitialWorldStates (WorldPacket &data) override
 
void SendRemoveWorldStates (Player *player) override
 
void BuffTeams ()
 
void SetControlledState (uint32 index, TeamId teamId)
 
- Public Member Functions inherited from OutdoorPvP
 OutdoorPvP ()=default
 
 ~OutdoorPvP () override
 
void DeleteSpawns ()
 
virtual void FillInitialWorldStates (WorldPacket &)
 
virtual bool HandleAreaTrigger (Player *player, uint32 trigger)
 
virtual bool HandleCustomSpell (Player *player, uint32 spellId, GameObject *go)
 
virtual bool HandleOpenGo (Player *player, GameObject *go)
 
virtual bool SetupOutdoorPvP ()
 
void OnGameObjectCreate (GameObject *go) override
 
void OnGameObjectRemove (GameObject *go) override
 
void OnCreatureCreate (Creature *creature) override
 
void OnCreatureRemove (Creature *creature) override
 
void SendUpdateWorldState (uint32 field, uint32 value)
 
virtual bool Update (uint32 diff)
 
virtual void HandleKill (Player *killer, Unit *killed)
 
virtual void HandleKillImpl (Player *, Unit *)
 
bool IsInsideObjective (Player *player) const
 
virtual void AwardKillBonus (Player *)
 
uint32 GetTypeId () const
 
virtual bool HandleDropFlag (Player *player, uint32 spellId)
 
virtual bool HandleGossipOption (Player *player, Creature *creature, uint32 gossipId)
 
virtual bool CanTalkTo (Player *player, Creature *c, GossipMenuItems const &gso)
 
void TeamApplyBuff (TeamId teamId, uint32 spellId, uint32 spellId2=0, Player *sameMapPlr=nullptr)
 
MapGetMap () const
 
- Public Member Functions inherited from ZoneScript
 ZoneScript ()
 
virtual ~ZoneScript ()
 
virtual uint32 GetCreatureEntry (ObjectGuid::LowType, CreatureData const *data)
 
virtual uint32 GetGameObjectEntry (ObjectGuid::LowType, uint32 entry)
 
virtual void OnCreatureCreate (Creature *)
 
virtual void OnCreatureRemove (Creature *)
 
virtual void OnGameObjectCreate (GameObject *)
 
virtual void OnGameObjectRemove (GameObject *)
 
virtual void OnUnitDeath (Unit *)
 
virtual void OnCreatureEvade (Creature *)
 
virtual ObjectGuid GetGuidData (uint32) const
 
virtual void SetGuidData (uint32, ObjectGuid)
 
virtual uint64 GetData64 (uint32) const
 
virtual void SetData64 (uint32, uint64)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void ProcessEvent (WorldObject *, uint32)
 

Private Attributes

TeamId EP_ControlsId [EP_TOWER_NUM]
 
uint32 m_AllianceTowersControlled
 
uint32 m_HordeTowersControlled
 

Additional Inherited Members

- Public Types inherited from OutdoorPvP
typedef std::map< ObjectGuid::LowType, OPvPCapturePoint * > OPvPCapturePointMap
 
typedef std::pair< ObjectGuid::LowType, GameObject * > GoScriptPair
 
typedef std::pair< ObjectGuid::LowType, Creature * > CreatureScriptPair
 
- Protected Member Functions inherited from OutdoorPvP
void BroadcastPacket (WorldPacket &data) const
 
virtual void SendRemoveWorldStates (Player *)
 
virtual void HandlePlayerEnterZone (Player *player, uint32 zone)
 
virtual void HandlePlayerLeaveZone (Player *player, uint32 zone)
 
virtual void HandlePlayerResurrects (Player *player, uint32 zone)
 
void AddCapturePoint (OPvPCapturePoint *cp)
 
OPvPCapturePointGetCapturePoint (ObjectGuid::LowType spawnId) const
 
void RegisterZone (uint32 zoneid)
 
bool HasPlayer (Player const *player) const
 
void TeamCastSpell (TeamId team, int32 spellId, Player *sameMapPlr=nullptr)
 
void SetMapFromZone (uint32 zone)
 
- Protected Attributes inherited from OutdoorPvP
OPvPCapturePointMap _capturePoints
 
std::array< PlayerSet, 2 > _players
 
uint32 _typeId {}
 
bool _sendUpdate { true }
 
Map_map {}
 
std::unordered_map< ObjectGuid::LowType, GameObject * > _goScriptStore
 
std::unordered_map< ObjectGuid::LowType, Creature * > _creatureScriptStore
 

Detailed Description

Constructor & Destructor Documentation

◆ OutdoorPvPEP()

OutdoorPvPEP::OutdoorPvPEP ( )
610{
612 memset(EP_ControlsId, TEAM_NEUTRAL, sizeof(EP_ControlsId));
615}
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
@ OUTDOOR_PVP_EP
Definition: OutdoorPvP.h:34
uint32 _typeId
Definition: OutdoorPvP.h:269
uint32 m_AllianceTowersControlled
Definition: OutdoorPvPEP.h:313
uint32 m_HordeTowersControlled
Definition: OutdoorPvPEP.h:314
TeamId EP_ControlsId[EP_TOWER_NUM]
Definition: OutdoorPvPEP.h:311

References OutdoorPvP::_typeId, EP_ControlsId, m_AllianceTowersControlled, m_HordeTowersControlled, OUTDOOR_PVP_EP, and TEAM_NEUTRAL.

Member Function Documentation

◆ BuffTeams()

void OutdoorPvPEP::BuffTeams ( )
686{
687 for (PlayerSet::iterator itr = _players[0].begin(); itr != _players[0].end(); ++itr)
688 {
689 if (Player* player = ObjectAccessor::FindPlayer(*itr))
690 {
691 for (int i = 0; i < 4; ++i)
692 player->RemoveAurasDueToSpell(EP_AllianceBuffs[i]);
694 player->CastSpell(player, EP_AllianceBuffs[m_AllianceTowersControlled - 1], true);
695 }
696 }
697 for (PlayerSet::iterator itr = _players[1].begin(); itr != _players[1].end(); ++itr)
698 {
699 if (Player* player = ObjectAccessor::FindPlayer(*itr))
700 {
701 for (int i = 0; i < 4; ++i)
702 player->RemoveAurasDueToSpell(EP_HordeBuffs[i]);
704 player->CastSpell(player, EP_HordeBuffs[m_HordeTowersControlled - 1], true);
705 }
706 }
707}
const uint32 EP_AllianceBuffs[4]
Definition: OutdoorPvPEP.h:24
const uint32 EP_HordeBuffs[4]
Definition: OutdoorPvPEP.h:26
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:245
Definition: Player.h:1081
std::array< PlayerSet, 2 > _players
Definition: OutdoorPvP.h:268

References OutdoorPvP::_players, EP_AllianceBuffs, EP_HordeBuffs, ObjectAccessor::FindPlayer(), m_AllianceTowersControlled, and m_HordeTowersControlled.

Referenced by Update().

◆ FillInitialWorldStates()

void OutdoorPvPEP::FillInitialWorldStates ( WorldPacket data)
overridevirtual

Reimplemented from OutdoorPvP.

715{
719 data << EP_UI_TOWER_SLIDER_POS << uint32(50);
720 data << EP_UI_TOWER_SLIDER_N << uint32(100);
721 for (OPvPCapturePointMap::iterator itr = _capturePoints.begin(); itr != _capturePoints.end(); ++itr)
722 {
723 itr->second->FillInitialWorldStates(data);
724 }
725}
std::uint32_t uint32
Definition: Define.h:107
@ EP_UI_TOWER_SLIDER_DISPLAY
Definition: OutdoorPvPEP.h:87
@ EP_UI_TOWER_COUNT_H
Definition: OutdoorPvPEP.h:92
@ EP_UI_TOWER_COUNT_A
Definition: OutdoorPvPEP.h:91
@ EP_UI_TOWER_SLIDER_POS
Definition: OutdoorPvPEP.h:88
@ EP_UI_TOWER_SLIDER_N
Definition: OutdoorPvPEP.h:89
OPvPCapturePointMap _capturePoints
Definition: OutdoorPvP.h:267

References OutdoorPvP::_capturePoints, EP_UI_TOWER_COUNT_A, EP_UI_TOWER_COUNT_H, EP_UI_TOWER_SLIDER_DISPLAY, EP_UI_TOWER_SLIDER_N, EP_UI_TOWER_SLIDER_POS, m_AllianceTowersControlled, and m_HordeTowersControlled.

◆ HandlePlayerEnterZone()

void OutdoorPvPEP::HandlePlayerEnterZone ( Player player,
uint32  zone 
)
overridevirtual

Reimplemented from OutdoorPvP.

654{
655 // add buffs
656 if (player->GetTeamId() == TEAM_ALLIANCE)
657 {
659 player->CastSpell(player, EP_AllianceBuffs[m_AllianceTowersControlled - 1], true);
660 }
661 else
662 {
664 player->CastSpell(player, EP_HordeBuffs[m_HordeTowersControlled - 1], true);
665 }
667}
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2108
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1167
virtual void HandlePlayerEnterZone(Player *player, uint32 zone)
Definition: OutdoorPvP.cpp:277

References Unit::CastSpell(), EP_AllianceBuffs, EP_HordeBuffs, Player::GetTeamId(), OutdoorPvP::HandlePlayerEnterZone(), m_AllianceTowersControlled, m_HordeTowersControlled, and TEAM_ALLIANCE.

◆ HandlePlayerLeaveZone()

void OutdoorPvPEP::HandlePlayerLeaveZone ( Player player,
uint32  zone 
)
overridevirtual

Reimplemented from OutdoorPvP.

670{
671 // remove buffs
672 if (player->GetTeamId() == TEAM_ALLIANCE)
673 {
674 for (int i = 0; i < 4; ++i)
676 }
677 else
678 {
679 for (int i = 0; i < 4; ++i)
681 }
683}
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4909
virtual void HandlePlayerLeaveZone(Player *player, uint32 zone)
Definition: OutdoorPvP.cpp:282

References EP_AllianceBuffs, EP_HordeBuffs, Player::GetTeamId(), OutdoorPvP::HandlePlayerLeaveZone(), Unit::RemoveAurasDueToSpell(), and TEAM_ALLIANCE.

◆ SendRemoveWorldStates()

void OutdoorPvPEP::SendRemoveWorldStates ( Player player)
overridevirtual

Reimplemented from OutdoorPvP.

728{
734
735 player->SendUpdateWorldState(EP_EWT_A, 0);
736 player->SendUpdateWorldState(EP_EWT_H, 0);
737 player->SendUpdateWorldState(EP_EWT_N, 0);
740
741 player->SendUpdateWorldState(EP_PWT_A, 0);
742 player->SendUpdateWorldState(EP_PWT_H, 0);
743 player->SendUpdateWorldState(EP_PWT_N, 0);
746
747 player->SendUpdateWorldState(EP_NPT_A, 0);
748 player->SendUpdateWorldState(EP_NPT_H, 0);
749 player->SendUpdateWorldState(EP_NPT_N, 0);
752
753 player->SendUpdateWorldState(EP_CGT_A, 0);
754 player->SendUpdateWorldState(EP_CGT_H, 0);
755 player->SendUpdateWorldState(EP_CGT_N, 0);
758}
@ 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
@ EP_EWT_H
Definition: OutdoorPvPEP.h:52
@ EP_EWT_N
Definition: OutdoorPvPEP.h:55
@ EP_EWT_A
Definition: OutdoorPvPEP.h:51
@ EP_EWT_N_H
Definition: OutdoorPvPEP.h:54
@ EP_EWT_N_A
Definition: OutdoorPvPEP.h:53
@ EP_CGT_N
Definition: OutdoorPvPEP.h:82
@ EP_CGT_H
Definition: OutdoorPvPEP.h:81
@ EP_CGT_N_H
Definition: OutdoorPvPEP.h:79
@ EP_CGT_A
Definition: OutdoorPvPEP.h:80
@ EP_CGT_N_A
Definition: OutdoorPvPEP.h:78
@ EP_NPT_A
Definition: OutdoorPvPEP.h:63
@ EP_NPT_N
Definition: OutdoorPvPEP.h:60
@ EP_NPT_N_H
Definition: OutdoorPvPEP.h:62
@ EP_NPT_H
Definition: OutdoorPvPEP.h:64
@ EP_NPT_N_A
Definition: OutdoorPvPEP.h:61
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2197

References EP_CGT_A, EP_CGT_H, EP_CGT_N, EP_CGT_N_A, EP_CGT_N_H, EP_EWT_A, EP_EWT_H, EP_EWT_N, EP_EWT_N_A, EP_EWT_N_H, EP_NPT_A, EP_NPT_H, EP_NPT_N, EP_NPT_N_A, EP_NPT_N_H, EP_PWT_A, EP_PWT_H, EP_PWT_N, EP_PWT_N_A, EP_PWT_N_H, EP_UI_TOWER_COUNT_A, EP_UI_TOWER_COUNT_H, EP_UI_TOWER_SLIDER_DISPLAY, EP_UI_TOWER_SLIDER_N, EP_UI_TOWER_SLIDER_POS, and Player::SendUpdateWorldState().

◆ SetControlledState()

void OutdoorPvPEP::SetControlledState ( uint32  index,
TeamId  teamId 
)
710{
711 EP_ControlsId[index] = teamId;
712}

References EP_ControlsId.

◆ SetupOutdoorPvP()

bool OutdoorPvPEP::SetupOutdoorPvP ( )
overridevirtual

Reimplemented from OutdoorPvP.

618{
619 for (uint8 i = 0; i < EPBuffZonesNum; ++i)
621
623
628
629 return true;
630}
std::uint8_t uint8
Definition: Define.h:109
const uint32 EPBuffZones[EPBuffZonesNum]
Definition: OutdoorPvPEP.h:39
const uint8 EPBuffZonesNum
Definition: OutdoorPvPEP.h:32
void RegisterZone(uint32 zoneid)
Definition: OutdoorPvP.cpp:641
void SetMapFromZone(uint32 zone)
Definition: OutdoorPvP.cpp:718
void AddCapturePoint(OPvPCapturePoint *cp)
Definition: OutdoorPvP.h:253
Definition: OutdoorPvPEP.h:186
Definition: OutdoorPvPEP.h:212
Definition: OutdoorPvPEP.h:238
Definition: OutdoorPvPEP.h:264

References OutdoorPvP::AddCapturePoint(), EPBuffZones, EPBuffZonesNum, OutdoorPvP::RegisterZone(), and OutdoorPvP::SetMapFromZone().

◆ Update()

bool OutdoorPvPEP::Update ( uint32  diff)
overridevirtual

Reimplemented from OutdoorPvP.

633{
634 if (OutdoorPvP::Update(diff))
635 {
638 for (int i = 0; i < EP_TOWER_NUM; ++i)
639 {
642 else if (EP_ControlsId[i] == TEAM_HORDE)
646 BuffTeams();
647 }
648 return true;
649 }
650 return false;
651}
@ EP_TOWER_NUM
Definition: OutdoorPvPEP.h:120
@ TEAM_HORDE
Definition: SharedDefines.h:761
virtual bool Update(uint32 diff)
Definition: OutdoorPvP.cpp:304
void SendUpdateWorldState(uint32 field, uint32 value)
Definition: OutdoorPvP.cpp:456
void BuffTeams()
Definition: OutdoorPvPEP.cpp:685

References BuffTeams(), EP_ControlsId, EP_TOWER_NUM, EP_UI_TOWER_COUNT_A, EP_UI_TOWER_COUNT_H, m_AllianceTowersControlled, m_HordeTowersControlled, OutdoorPvP::SendUpdateWorldState(), TEAM_ALLIANCE, TEAM_HORDE, and OutdoorPvP::Update().

Member Data Documentation

◆ EP_ControlsId

TeamId OutdoorPvPEP::EP_ControlsId[EP_TOWER_NUM]
private

◆ m_AllianceTowersControlled

uint32 OutdoorPvPEP::m_AllianceTowersControlled
private

◆ m_HordeTowersControlled

uint32 OutdoorPvPEP::m_HordeTowersControlled
private