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

#include "OutdoorPvPNA.h"

Inheritance diagram for OutdoorPvPNA:
OutdoorPvP ZoneScript

Public Member Functions

 OutdoorPvPNA ()
 
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 HandleKill (Player *killer, Unit *killed) override
 
void HandleKillImpl (Player *player, Unit *killed) override
 
OPvPCapturePointNAGetCapturePoint ()
 
- 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

OPvPCapturePointNAm_obj
 

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

◆ OutdoorPvPNA()

OutdoorPvPNA::OutdoorPvPNA ( )
33{
35 m_obj = nullptr;
36}
@ OUTDOOR_PVP_NA
Definition: OutdoorPvP.h:30
uint32 _typeId
Definition: OutdoorPvP.h:269
OPvPCapturePointNA * m_obj
Definition: OutdoorPvPNA.h:301

References OutdoorPvP::_typeId, m_obj, and OUTDOOR_PVP_NA.

Member Function Documentation

◆ FillInitialWorldStates()

void OutdoorPvPNA::FillInitialWorldStates ( WorldPacket data)
overridevirtual

Reimplemented from OutdoorPvP.

302{
304}
void FillInitialWorldStates(WorldPacket &data) override
Definition: OutdoorPvPNA.cpp:306

References OPvPCapturePointNA::FillInitialWorldStates(), and m_obj.

◆ GetCapturePoint()

OPvPCapturePointNA * OutdoorPvPNA::GetCapturePoint ( )
inline
298{ return m_obj; }

References m_obj.

◆ HandleKill()

void OutdoorPvPNA::HandleKill ( Player killer,
Unit killed 
)
overridevirtual

Reimplemented from OutdoorPvP.

43{
44 if (Group* group = killer->GetGroup())
45 {
46 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
47 {
48 Player* groupGuy = itr->GetSource();
49
50 if (!groupGuy)
51 continue;
52
53 // skip if too far away
54 if (!groupGuy->IsAtGroupRewardDistance(killed) && killer != groupGuy)
55 continue;
56
57 // creature kills must be notified, even if not inside objective / not outdoor pvp active
58 // player kills only count if active and inside objective
59 if ((groupGuy->IsOutdoorPvPActive() && groupGuy->GetAreaId() == NA_HALAA_ZONE_ID) || killed->IsCreature())
60 {
61 HandleKillImpl(groupGuy, killed);
62 }
63 }
64 }
65 else
66 {
67 // creature kills must be notified, even if not inside objective / not outdoor pvp active
68 if (killer && ((killer->IsOutdoorPvPActive() && killer->ToPlayer()->GetAreaId() == NA_HALAA_ZONE_ID) || killed->IsCreature()))
69 {
70 HandleKillImpl(killer, killed);
71 }
72 }
73}
uint32 const NA_HALAA_ZONE_ID
Definition: OutdoorPvPNA.h:43
Player * ToPlayer()
Definition: Object.h:201
bool IsCreature() const
Definition: Object.h:204
uint32 GetAreaId() const
Definition: Object.cpp:3165
Definition: Player.h:1081
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
Definition: Player.cpp:12797
Group * GetGroup()
Definition: Player.h:2468
bool IsOutdoorPvPActive()
Definition: Player.cpp:6436
Definition: Group.h:169
Definition: GroupReference.h:27
GroupReference * next()
Definition: GroupReference.h:36
void HandleKillImpl(Player *player, Unit *killed) override
Definition: OutdoorPvPNA.cpp:75

References WorldObject::GetAreaId(), Player::GetGroup(), HandleKillImpl(), Player::IsAtGroupRewardDistance(), Object::IsCreature(), Player::IsOutdoorPvPActive(), NA_HALAA_ZONE_ID, GroupReference::next(), and Object::ToPlayer().

◆ HandleKillImpl()

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

Reimplemented from OutdoorPvP.

76{
77 if (killed->IsPlayer() && player->GetTeamId() != killed->ToPlayer()->GetTeamId())
78 {
80 player->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? NA_KILL_TOKEN_ALLIANCE : NA_KILL_TOKEN_HORDE, true);
81 }
82}
const uint32 NA_CREDIT_MARKER
Definition: OutdoorPvPNA.h:33
@ NA_KILL_TOKEN_HORDE
Definition: OutdoorPvPNA.h:28
@ NA_KILL_TOKEN_ALLIANCE
Definition: OutdoorPvPNA.h:27
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
bool IsPlayer() const
Definition: Object.h:200
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition: PlayerQuest.cpp:1926
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 Unit::CastSpell(), Player::GetTeamId(), Object::IsPlayer(), Player::KilledMonsterCredit(), NA_CREDIT_MARKER, NA_KILL_TOKEN_ALLIANCE, NA_KILL_TOKEN_HORDE, TEAM_ALLIANCE, and Object::ToPlayer().

Referenced by HandleKill().

◆ HandlePlayerEnterZone()

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

Reimplemented from OutdoorPvP.

287{
288 // add buffs
289 if (player->GetTeamId() == m_obj->GetControllingFaction())
290 player->CastSpell(player, NA_CAPTURE_BUFF, true);
292}
@ NA_CAPTURE_BUFF
Definition: OutdoorPvPNA.h:29
virtual void HandlePlayerEnterZone(Player *player, uint32 zone)
Definition: OutdoorPvP.cpp:277
TeamId GetControllingFaction() const
Definition: OutdoorPvPNA.cpp:116

References Unit::CastSpell(), OPvPCapturePointNA::GetControllingFaction(), Player::GetTeamId(), OutdoorPvP::HandlePlayerEnterZone(), m_obj, and NA_CAPTURE_BUFF.

◆ HandlePlayerLeaveZone()

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

Reimplemented from OutdoorPvP.

295{
296 // remove buffs
299}
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 OutdoorPvP::HandlePlayerLeaveZone(), NA_CAPTURE_BUFF, and Unit::RemoveAurasDueToSpell().

◆ SendRemoveWorldStates()

void OutdoorPvPNA::SendRemoveWorldStates ( Player player)
overridevirtual

Reimplemented from OutdoorPvP.

359{
388}
@ NA_MAP_HALAA_NEU_A
Definition: OutdoorPvPNA.h:83
@ NA_MAP_WYVERN_SOUTH_NEU_H
Definition: OutdoorPvPNA.h:67
@ NA_MAP_HALAA_HORDE
Definition: OutdoorPvPNA.h:85
@ NA_UI_ALLIANCE_GUARDS_SHOW
Definition: OutdoorPvPNA.h:54
@ NA_MAP_WYVERN_NORTH_NEU_A
Definition: OutdoorPvPNA.h:63
@ NA_UI_TOWER_SLIDER_DISPLAY
Definition: OutdoorPvPNA.h:58
@ NA_MAP_HALAA_NEUTRAL
Definition: OutdoorPvPNA.h:82
@ NA_MAP_WYVERN_WEST_NEU_A
Definition: OutdoorPvPNA.h:73
@ NA_MAP_WYVERN_SOUTH_NEU_A
Definition: OutdoorPvPNA.h:68
@ NA_MAP_WYVERN_WEST_H
Definition: OutdoorPvPNA.h:74
@ NA_MAP_WYVERN_NORTH_NEU_H
Definition: OutdoorPvPNA.h:62
@ NA_UI_HORDE_GUARDS_SHOW
Definition: OutdoorPvPNA.h:53
@ NA_MAP_HALAA_ALLIANCE
Definition: OutdoorPvPNA.h:86
@ NA_MAP_WYVERN_EAST_H
Definition: OutdoorPvPNA.h:79
@ NA_MAP_WYVERN_SOUTH_A
Definition: OutdoorPvPNA.h:70
@ NA_UI_TOWER_SLIDER_N
Definition: OutdoorPvPNA.h:60
@ NA_UI_GUARDS_MAX
Definition: OutdoorPvPNA.h:55
@ NA_MAP_WYVERN_EAST_A
Definition: OutdoorPvPNA.h:80
@ NA_UI_TOWER_SLIDER_POS
Definition: OutdoorPvPNA.h:59
@ NA_MAP_WYVERN_NORTH_H
Definition: OutdoorPvPNA.h:64
@ NA_UI_GUARDS_LEFT
Definition: OutdoorPvPNA.h:56
@ NA_MAP_WYVERN_WEST_A
Definition: OutdoorPvPNA.h:75
@ NA_MAP_WYVERN_EAST_NEU_A
Definition: OutdoorPvPNA.h:78
@ NA_MAP_WYVERN_EAST_NEU_H
Definition: OutdoorPvPNA.h:77
@ NA_MAP_HALAA_NEU_H
Definition: OutdoorPvPNA.h:84
@ NA_MAP_WYVERN_WEST_NEU_H
Definition: OutdoorPvPNA.h:72
@ NA_MAP_WYVERN_NORTH_A
Definition: OutdoorPvPNA.h:65
@ NA_MAP_WYVERN_SOUTH_H
Definition: OutdoorPvPNA.h:69
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2197

References NA_MAP_HALAA_ALLIANCE, NA_MAP_HALAA_HORDE, NA_MAP_HALAA_NEU_A, NA_MAP_HALAA_NEU_H, NA_MAP_HALAA_NEUTRAL, NA_MAP_WYVERN_EAST_A, NA_MAP_WYVERN_EAST_H, NA_MAP_WYVERN_EAST_NEU_A, NA_MAP_WYVERN_EAST_NEU_H, NA_MAP_WYVERN_NORTH_A, NA_MAP_WYVERN_NORTH_H, NA_MAP_WYVERN_NORTH_NEU_A, NA_MAP_WYVERN_NORTH_NEU_H, NA_MAP_WYVERN_SOUTH_A, NA_MAP_WYVERN_SOUTH_H, NA_MAP_WYVERN_SOUTH_NEU_A, NA_MAP_WYVERN_SOUTH_NEU_H, NA_MAP_WYVERN_WEST_A, NA_MAP_WYVERN_WEST_H, NA_MAP_WYVERN_WEST_NEU_A, NA_MAP_WYVERN_WEST_NEU_H, NA_UI_ALLIANCE_GUARDS_SHOW, NA_UI_GUARDS_LEFT, NA_UI_GUARDS_MAX, NA_UI_HORDE_GUARDS_SHOW, NA_UI_TOWER_SLIDER_DISPLAY, NA_UI_TOWER_SLIDER_N, NA_UI_TOWER_SLIDER_POS, and Player::SendUpdateWorldState().

◆ SetupOutdoorPvP()

bool OutdoorPvPNA::SetupOutdoorPvP ( )
overridevirtual

Reimplemented from OutdoorPvP.

267{
268 // _typeId = OUTDOOR_PVP_NA; _MUST_ be set in ctor, because of spawns cleanup
269 // add the zones affected by the pvp buff
272
273 // halaa
274 m_obj = new OPvPCapturePointNA(this);
275 if (!m_obj)
276 return false;
278
279 //Remove linked graveyard at the server start to avoid players spawning in halaa
282
283 return true;
284}
const uint32 NA_HALAA_GRAVEYARD
Definition: OutdoorPvPNA.h:39
const uint32 NA_HALAA_GRAVEYARD_ZONE
Definition: OutdoorPvPNA.h:41
const uint32 NA_BUFF_ZONE
Definition: OutdoorPvPNA.h:37
@ TEAM_HORDE
Definition: SharedDefines.h:761
#define sGraveyard
Definition: GameGraveyard.h:74
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: OutdoorPvPNA.h:222

References OutdoorPvP::AddCapturePoint(), m_obj, NA_BUFF_ZONE, NA_HALAA_GRAVEYARD, NA_HALAA_GRAVEYARD_ZONE, OutdoorPvP::RegisterZone(), OutdoorPvP::SetMapFromZone(), sGraveyard, TEAM_ALLIANCE, and TEAM_HORDE.

◆ Update()

bool OutdoorPvPNA::Update ( uint32  diff)
overridevirtual

Reimplemented from OutdoorPvP.

391{
392 return m_obj->Update(diff);
393}
bool Update(uint32 diff) override
Definition: OutdoorPvPNA.cpp:601

References m_obj, and OPvPCapturePointNA::Update().

Member Data Documentation

◆ m_obj