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

#include "OutdoorPvPHP.h"

Inheritance diagram for OutdoorPvPHP:
OutdoorPvP ZoneScript

Public Member Functions

 OutdoorPvPHP ()
 
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 HandleKillImpl (Player *player, Unit *killed) override
 
uint32 GetAllianceTowersControlled () const
 
void SetAllianceTowersControlled (uint32 count)
 
uint32 GetHordeTowersControlled () const
 
void SetHordeTowersControlled (uint32 count)
 
- 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

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

◆ OutdoorPvPHP()

OutdoorPvPHP::OutdoorPvPHP ( )
64{
68}
@ OUTDOOR_PVP_HP
Definition: OutdoorPvP.h:29
uint32 _typeId
Definition: OutdoorPvP.h:269
uint32 m_AllianceTowersControlled
Definition: OutdoorPvPHP.h:133
uint32 m_HordeTowersControlled
Definition: OutdoorPvPHP.h:134

References OutdoorPvP::_typeId, m_AllianceTowersControlled, m_HordeTowersControlled, and OUTDOOR_PVP_HP.

Member Function Documentation

◆ FillInitialWorldStates()

void OutdoorPvPHP::FillInitialWorldStates ( WorldPacket data)
overridevirtual

Reimplemented from OutdoorPvP.

157{
158 data << uint32(HP_UI_TOWER_DISPLAY_A) << uint32(1);
159 data << uint32(HP_UI_TOWER_DISPLAY_H) << uint32(1);
163 data << uint32(HP_UI_TOWER_SLIDER_POS) << uint32(50);
164 data << uint32(HP_UI_TOWER_SLIDER_N) << uint32(100);
165 for (OPvPCapturePointMap::iterator itr = _capturePoints.begin(); itr != _capturePoints.end(); ++itr)
166 {
167 itr->second->FillInitialWorldStates(data);
168 }
169}
std::uint32_t uint32
Definition: Define.h:107
@ HP_UI_TOWER_COUNT_A
Definition: OutdoorPvPHP.h:55
@ HP_UI_TOWER_SLIDER_POS
Definition: OutdoorPvPHP.h:58
@ HP_UI_TOWER_DISPLAY_A
Definition: OutdoorPvPHP.h:51
@ HP_UI_TOWER_DISPLAY_H
Definition: OutdoorPvPHP.h:52
@ HP_UI_TOWER_COUNT_H
Definition: OutdoorPvPHP.h:54
@ HP_UI_TOWER_SLIDER_N
Definition: OutdoorPvPHP.h:57
@ HP_UI_TOWER_SLIDER_DISPLAY
Definition: OutdoorPvPHP.h:59
OPvPCapturePointMap _capturePoints
Definition: OutdoorPvP.h:267

References OutdoorPvP::_capturePoints, HP_UI_TOWER_COUNT_A, HP_UI_TOWER_COUNT_H, HP_UI_TOWER_DISPLAY_A, HP_UI_TOWER_DISPLAY_H, HP_UI_TOWER_SLIDER_DISPLAY, HP_UI_TOWER_SLIDER_N, HP_UI_TOWER_SLIDER_POS, m_AllianceTowersControlled, and m_HordeTowersControlled.

◆ GetAllianceTowersControlled()

uint32 OutdoorPvPHP::GetAllianceTowersControlled ( ) const
334{
336}

References m_AllianceTowersControlled.

◆ GetHordeTowersControlled()

uint32 OutdoorPvPHP::GetHordeTowersControlled ( ) const
344{
346}

References m_HordeTowersControlled.

◆ HandleKillImpl()

void OutdoorPvPHP::HandleKillImpl ( Player player,
Unit killed 
)
overridevirtual

Reimplemented from OutdoorPvP.

323{
324 if (!killed->IsPlayer())
325 return;
326
327 if (player->GetTeamId() == TEAM_ALLIANCE && killed->ToPlayer()->GetTeamId() != TEAM_ALLIANCE)
328 player->CastSpell(player, AlliancePlayerKillReward, true);
329 else if (player->GetTeamId() == TEAM_HORDE && killed->ToPlayer()->GetTeamId() != TEAM_HORDE)
330 player->CastSpell(player, HordePlayerKillReward, true);
331}
@ HordePlayerKillReward
Definition: OutdoorPvPHP.h:30
@ AlliancePlayerKillReward
Definition: OutdoorPvPHP.h:29
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
bool IsPlayer() const
Definition: Object.h:200
Player * ToPlayer()
Definition: Object.h:201
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

References AlliancePlayerKillReward, Unit::CastSpell(), Player::GetTeamId(), HordePlayerKillReward, Object::IsPlayer(), TEAM_ALLIANCE, TEAM_HORDE, and Object::ToPlayer().

◆ HandlePlayerEnterZone()

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

Reimplemented from OutdoorPvP.

90{
91 // add buffs
92 if (player->GetTeamId() == TEAM_ALLIANCE)
93 {
95 player->CastSpell(player, AllianceBuff, true);
96 }
97 else
98 {
100 player->CastSpell(player, HordeBuff, true);
101 }
103}
@ AllianceBuff
Definition: OutdoorPvPHP.h:31
@ HordeBuff
Definition: OutdoorPvPHP.h:32
virtual void HandlePlayerEnterZone(Player *player, uint32 zone)
Definition: OutdoorPvP.cpp:277

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

◆ HandlePlayerLeaveZone()

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

Reimplemented from OutdoorPvP.

106{
107 // remove buffs
108 if (player->GetTeamId() == TEAM_ALLIANCE)
109 {
111 }
112 else
113 {
115 }
117}
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 AllianceBuff, Player::GetTeamId(), OutdoorPvP::HandlePlayerLeaveZone(), HordeBuff, Unit::RemoveAurasDueToSpell(), and TEAM_ALLIANCE.

◆ SendRemoveWorldStates()

void OutdoorPvPHP::SendRemoveWorldStates ( Player player)
overridevirtual

Reimplemented from OutdoorPvP.

140{
148 for (int i = 0; i < HP_TOWER_NUM; ++i)
149 {
150 player->SendUpdateWorldState(HP_MAP_N[i], 0);
151 player->SendUpdateWorldState(HP_MAP_A[i], 0);
152 player->SendUpdateWorldState(HP_MAP_H[i], 0);
153 }
154}
const uint32 HP_MAP_N[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:62
const uint32 HP_MAP_H[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:66
const uint32 HP_MAP_A[HP_TOWER_NUM]
Definition: OutdoorPvPHP.h:64
@ HP_TOWER_NUM
Definition: OutdoorPvPHP.h:40
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2197

References HP_MAP_A, HP_MAP_H, HP_MAP_N, HP_TOWER_NUM, HP_UI_TOWER_COUNT_A, HP_UI_TOWER_COUNT_H, HP_UI_TOWER_DISPLAY_A, HP_UI_TOWER_DISPLAY_H, HP_UI_TOWER_SLIDER_DISPLAY, HP_UI_TOWER_SLIDER_N, HP_UI_TOWER_SLIDER_POS, and Player::SendUpdateWorldState().

◆ SetAllianceTowersControlled()

void OutdoorPvPHP::SetAllianceTowersControlled ( uint32  count)
339{
341}

References m_AllianceTowersControlled.

◆ SetHordeTowersControlled()

void OutdoorPvPHP::SetHordeTowersControlled ( uint32  count)
349{
351}

References m_HordeTowersControlled.

◆ SetupOutdoorPvP()

bool OutdoorPvPHP::SetupOutdoorPvP ( )
overridevirtual

Reimplemented from OutdoorPvP.

71{
74 // add the zones affected by the pvp buff
75 for (int i = 0; i < OutdoorPvPHPBuffZonesNum; ++i)
77
79
81
83
85
86 return true;
87}
#define OutdoorPvPHPBuffZonesNum
Definition: OutdoorPvPHP.h:23
const uint32 OutdoorPvPHPBuffZones[OutdoorPvPHPBuffZonesNum]
Definition: OutdoorPvPHP.h:25
@ HP_TOWER_STADIUM
Definition: OutdoorPvPHP.h:39
@ HP_TOWER_OVERLOOK
Definition: OutdoorPvPHP.h:38
@ HP_TOWER_BROKEN_HILL
Definition: OutdoorPvPHP.h:37
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: OutdoorPvPHP.h:89

References OutdoorPvP::AddCapturePoint(), HP_TOWER_BROKEN_HILL, HP_TOWER_OVERLOOK, HP_TOWER_STADIUM, m_AllianceTowersControlled, m_HordeTowersControlled, OutdoorPvPHPBuffZones, OutdoorPvPHPBuffZonesNum, OutdoorPvP::RegisterZone(), and OutdoorPvP::SetMapFromZone().

◆ Update()

bool OutdoorPvPHP::Update ( uint32  diff)
overridevirtual

Reimplemented from OutdoorPvP.

120{
121 bool changed = OutdoorPvP::Update(diff);
122 if (changed)
123 {
126 else if (m_HordeTowersControlled == 3)
128 else
129 {
132 }
135 }
136 return changed;
137}
void TeamApplyBuff(TeamId teamId, uint32 spellId, uint32 spellId2=0, Player *sameMapPlr=nullptr)
Definition: OutdoorPvP.cpp:670
virtual bool Update(uint32 diff)
Definition: OutdoorPvP.cpp:304
void TeamCastSpell(TeamId team, int32 spellId, Player *sameMapPlr=nullptr)
Definition: OutdoorPvP.cpp:652
void SendUpdateWorldState(uint32 field, uint32 value)
Definition: OutdoorPvP.cpp:456

References AllianceBuff, HordeBuff, HP_UI_TOWER_COUNT_A, HP_UI_TOWER_COUNT_H, m_AllianceTowersControlled, m_HordeTowersControlled, OutdoorPvP::SendUpdateWorldState(), TEAM_ALLIANCE, TEAM_HORDE, OutdoorPvP::TeamApplyBuff(), OutdoorPvP::TeamCastSpell(), and OutdoorPvP::Update().

Member Data Documentation

◆ m_AllianceTowersControlled

◆ m_HordeTowersControlled