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

#include "OutdoorPvPSI.h"

Inheritance diagram for OutdoorPvPSI:
OutdoorPvP ZoneScript

Public Member Functions

 OutdoorPvPSI ()
 
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
 
bool HandleAreaTrigger (Player *player, uint32 trigger) override
 
bool HandleDropFlag (Player *player, uint32 spellId) override
 
bool HandleCustomSpell (Player *player, uint32 spellId, GameObject *go) override
 
void UpdateWorldState ()
 
- 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_Gathered_A
 
uint32 m_Gathered_H
 
TeamId m_LastController
 

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

◆ OutdoorPvPSI()

OutdoorPvPSI::OutdoorPvPSI ( )
33{
35 m_Gathered_A = 0;
36 m_Gathered_H = 0;
38}
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
@ OUTDOOR_PVP_SI
Definition: OutdoorPvP.h:33
uint32 _typeId
Definition: OutdoorPvP.h:269
TeamId m_LastController
Definition: OutdoorPvPSI.h:82
uint32 m_Gathered_A
Definition: OutdoorPvPSI.h:79
uint32 m_Gathered_H
Definition: OutdoorPvPSI.h:80

References OutdoorPvP::_typeId, m_Gathered_A, m_Gathered_H, m_LastController, OUTDOOR_PVP_SI, and TEAM_NEUTRAL.

Member Function Documentation

◆ FillInitialWorldStates()

void OutdoorPvPSI::FillInitialWorldStates ( WorldPacket data)
overridevirtual

Reimplemented from OutdoorPvP.

41{
42 data << SI_GATHERED_A << m_Gathered_A;
43 data << SI_GATHERED_H << m_Gathered_H;
45}
const uint32 SI_MAX_RESOURCES
Definition: OutdoorPvPSI.h:31
@ SI_GATHERED_H
Definition: OutdoorPvPSI.h:50
@ SI_SILITHYST_MAX
Definition: OutdoorPvPSI.h:51
@ SI_GATHERED_A
Definition: OutdoorPvPSI.h:49

References m_Gathered_A, m_Gathered_H, SI_GATHERED_A, SI_GATHERED_H, SI_MAX_RESOURCES, and SI_SILITHYST_MAX.

◆ HandleAreaTrigger()

bool OutdoorPvPSI::HandleAreaTrigger ( Player player,
uint32  trigger 
)
overridevirtual

Reimplemented from OutdoorPvP.

91{
92 std::lock_guard<std::mutex> guard(sOutdoorPvPMgr->_lock);
93
94 switch (trigger)
95 {
97 if (player->GetTeamId() == TEAM_ALLIANCE && player->HasAura(SI_SILITHYST_FLAG))
98 {
99 // remove aura
101 ++ m_Gathered_A;
103 {
105 sWorld->SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_SI_CAPTURE_A));
107 m_Gathered_A = 0;
108 m_Gathered_H = 0;
109 }
111 // reward player, xinef: has no effect on characters above level 70
112 if (player->GetLevel() < 70)
113 player->CastSpell(player, SI_TRACES_OF_SILITHYST, true);
114 // add 19 honor
115 player->RewardHonor(nullptr, 1, 19);
116 // add 20 cenarion circle repu
117 player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20.f);
118 // complete quest
120 }
121 return true;
122 case SI_AREATRIGGER_H:
123 if (player->GetTeamId() == TEAM_HORDE && player->HasAura(SI_SILITHYST_FLAG))
124 {
125 // remove aura
127 ++ m_Gathered_H;
129 {
131 sWorld->SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_SI_CAPTURE_H));
133 m_Gathered_A = 0;
134 m_Gathered_H = 0;
135 }
137 // reward player, xinef: has no effect on characters above level 70
138 if (player->GetLevel() < 70)
139 player->CastSpell(player, SI_TRACES_OF_SILITHYST, true);
140 // add 19 honor
141 player->RewardHonor(nullptr, 1, 19);
142 // add 20 cenarion circle repu
143 player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20.f);
144 // complete quest
146 }
147 return true;
148 }
149 return false;
150}
const uint32 OutdoorPvPSIBuffZones[OutdoorPvPSIBuffZonesNum]
Definition: OutdoorPvPSI.h:35
const uint32 SI_TURNIN_QUEST_CM_A
Definition: OutdoorPvPSI.h:41
@ SI_CENARION_FAVOR
Definition: OutdoorPvPSI.h:28
@ SI_SILITHYST_FLAG
Definition: OutdoorPvPSI.h:26
@ SI_TRACES_OF_SILITHYST
Definition: OutdoorPvPSI.h:27
const uint32 SI_AREATRIGGER_H
Definition: OutdoorPvPSI.h:37
const uint32 SI_AREATRIGGER_A
Definition: OutdoorPvPSI.h:39
const uint32 SI_TURNIN_QUEST_CM_H
Definition: OutdoorPvPSI.h:43
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
#define sObjectMgr
Definition: ObjectMgr.h:1635
@ LANG_OPVP_SI_CAPTURE_A
Definition: Language.h:1253
@ LANG_OPVP_SI_CAPTURE_H
Definition: Language.h:1252
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
#define sOutdoorPvPMgr
Definition: OutdoorPvPMgr.h:102
#define sWorld
Definition: World.h:443
bool RewardHonor(Unit *victim, uint32 groupsize, int32 honor=-1, bool awardXP=true)
Definition: Player.cpp:6095
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition: PlayerQuest.cpp:1926
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2108
ReputationMgr & GetReputationMgr()
Definition: Player.h:2125
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5698
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
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4909
uint8 GetLevel() const
Definition: Unit.h:1024
void TeamApplyBuff(TeamId teamId, uint32 spellId, uint32 spellId2=0, Player *sameMapPlr=nullptr)
Definition: OutdoorPvP.cpp:670
bool ModifyReputation(FactionEntry const *factionEntry, float standing, bool noSpillOver=false, Optional< ReputationRank > repMaxCap={})
Definition: ReputationMgr.h:117
void UpdateWorldState()
Definition: OutdoorPvPSI.cpp:54

References Unit::CastSpell(), Unit::GetLevel(), Player::GetReputationMgr(), Player::GetTeamId(), Unit::HasAura(), Player::KilledMonsterCredit(), LANG_OPVP_SI_CAPTURE_A, LANG_OPVP_SI_CAPTURE_H, m_Gathered_A, m_Gathered_H, m_LastController, ReputationMgr::ModifyReputation(), OutdoorPvPSIBuffZones, Unit::RemoveAurasDueToSpell(), Player::RewardHonor(), sFactionStore, SI_AREATRIGGER_A, SI_AREATRIGGER_H, SI_CENARION_FAVOR, SI_MAX_RESOURCES, SI_SILITHYST_FLAG, SI_TRACES_OF_SILITHYST, SI_TURNIN_QUEST_CM_A, SI_TURNIN_QUEST_CM_H, sObjectMgr, sOutdoorPvPMgr, sWorld, TEAM_ALLIANCE, TEAM_HORDE, OutdoorPvP::TeamApplyBuff(), and UpdateWorldState().

◆ HandleCustomSpell()

bool OutdoorPvPSI::HandleCustomSpell ( Player player,
uint32  spellId,
GameObject go 
)
overridevirtual

Reimplemented from OutdoorPvP.

236{
237 if (!go || spellId != SI_SILITHYST_FLAG_GO_SPELL)
238 return false;
239 player->CastSpell(player, SI_SILITHYST_FLAG, true);
240 if (go->GetGOInfo()->entry == SI_SILITHYST_MOUND)
241 {
242 // despawn go
243 go->SetRespawnTime(0);
244 go->Delete();
245 }
246 return true;
247}
const uint32 SI_SILITHYST_MOUND
Definition: OutdoorPvPSI.h:45
@ SI_SILITHYST_FLAG_GO_SPELL
Definition: OutdoorPvPSI.h:25
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:136
void Delete()
Definition: GameObject.cpp:981
void SetRespawnTime(int32 respawn)
Definition: GameObject.cpp:1305
uint32 entry
Definition: GameObjectData.h:32

References Unit::CastSpell(), GameObject::Delete(), GameObjectTemplate::entry, GameObject::GetGOInfo(), GameObject::SetRespawnTime(), SI_SILITHYST_FLAG, SI_SILITHYST_FLAG_GO_SPELL, and SI_SILITHYST_MOUND.

◆ HandleDropFlag()

bool OutdoorPvPSI::HandleDropFlag ( Player player,
uint32  spellId 
)
overridevirtual

Reimplemented from OutdoorPvP.

153{
154 if (spellId == SI_SILITHYST_FLAG)
155 {
156 // if it was dropped away from the player's turn-in point, then create a silithyst mound, if it was dropped near the areatrigger, then it was dispelled by the outdoorpvp, so do nothing
157 switch (player->GetTeamId())
158 {
159 case TEAM_ALLIANCE:
160 {
161 AreaTrigger const* atEntry = sObjectMgr->GetAreaTrigger(SI_AREATRIGGER_A);
162 if (atEntry)
163 {
164 // 5.0f is safe-distance
165 if (player->GetDistance(atEntry->x, atEntry->y, atEntry->z) > 5.0f + atEntry->radius)
166 {
167 // he dropped it further, summon mound
168 GameObject* go = sObjectMgr->IsGameObjectStaticTransport(SI_SILITHYST_MOUND) ? new StaticTransport() : new GameObject();
169 Map* map = player->GetMap();
170 if (!map)
171 {
172 delete go;
173 return true;
174 }
175
176 if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
177 {
178 delete go;
179 return true;
180 }
181
182 go->SetRespawnTime(0);
183
184 if (!map->AddToMap(go))
185 {
186 delete go;
187 return true;
188 }
189 }
190 }
191 }
192 break;
193 case TEAM_HORDE:
194 {
195 AreaTrigger const* atEntry = sObjectMgr->GetAreaTrigger(SI_AREATRIGGER_H);
196 if (atEntry)
197 {
198 // 5.0f is safe-distance
199 if (player->GetDistance(atEntry->x, atEntry->y, atEntry->z) > 5.0f + atEntry->radius)
200 {
201 // he dropped it further, summon mound
202 GameObject* go = sObjectMgr->IsGameObjectStaticTransport(SI_SILITHYST_MOUND) ? new StaticTransport() : new GameObject();
203 Map* map = player->GetMap();
204 if (!map)
205 {
206 delete go;
207 return true;
208 }
209
210 if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
211 {
212 delete go;
213 return true;
214 }
215
216 go->SetRespawnTime(0);
217
218 if (!map->AddToMap(go))
219 {
220 delete go;
221 return true;
222 }
223 }
224 }
225 }
226 break;
227 default:
228 break;
229 }
230 return true;
231 }
232 return false;
233}
@ GO_STATE_READY
Definition: GameObjectData.h:690
Definition: GameObject.h:120
virtual bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const &rotation, uint32 animprogress, GOState go_state, uint32 artKit=0)
Definition: GameObject.cpp:254
uint32 GetPhaseMask() const
Definition: Object.h:451
Map * GetMap() const
Definition: Object.h:536
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1256
float GetPositionZ() const
Definition: Position.h:118
float GetOrientation() const
Definition: Position.h:119
float GetPositionX() const
Definition: Position.h:116
float GetPositionY() const
Definition: Position.h:117
Definition: Transport.h:112
Definition: ObjectMgr.h:420
float x
Definition: ObjectMgr.h:423
float y
Definition: ObjectMgr.h:424
float radius
Definition: ObjectMgr.h:426
float z
Definition: ObjectMgr.h:425
Definition: Map.h:311
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:636
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:558

References Map::AddToMap(), GameObject::Create(), Map::GenerateLowGuid(), WorldObject::GetDistance(), WorldObject::GetMap(), Position::GetOrientation(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Player::GetTeamId(), GO_STATE_READY, AreaTrigger::radius, GameObject::SetRespawnTime(), SI_AREATRIGGER_A, SI_AREATRIGGER_H, SI_SILITHYST_FLAG, SI_SILITHYST_MOUND, sObjectMgr, TEAM_ALLIANCE, TEAM_HORDE, AreaTrigger::x, AreaTrigger::y, and AreaTrigger::z.

◆ HandlePlayerEnterZone()

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

Reimplemented from OutdoorPvP.

77{
78 if (player->GetTeamId() == m_LastController)
79 player->CastSpell(player, SI_CENARION_FAVOR, true);
81}
virtual void HandlePlayerEnterZone(Player *player, uint32 zone)
Definition: OutdoorPvP.cpp:277

References Unit::CastSpell(), Player::GetTeamId(), OutdoorPvP::HandlePlayerEnterZone(), m_LastController, and SI_CENARION_FAVOR.

◆ HandlePlayerLeaveZone()

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

Reimplemented from OutdoorPvP.

84{
85 // remove buffs
88}
virtual void HandlePlayerLeaveZone(Player *player, uint32 zone)
Definition: OutdoorPvP.cpp:282

References OutdoorPvP::HandlePlayerLeaveZone(), Unit::RemoveAurasDueToSpell(), and SI_CENARION_FAVOR.

◆ SendRemoveWorldStates()

void OutdoorPvPSI::SendRemoveWorldStates ( Player player)
overridevirtual

Reimplemented from OutdoorPvP.

48{
52}
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2197

References Player::SendUpdateWorldState(), SI_GATHERED_A, SI_GATHERED_H, and SI_SILITHYST_MAX.

◆ SetupOutdoorPvP()

bool OutdoorPvPSI::SetupOutdoorPvP ( )
overridevirtual

Reimplemented from OutdoorPvP.

62{
63 for (uint8 i = 0; i < OutdoorPvPSIBuffZonesNum; ++i)
65
67
68 return true;
69}
std::uint8_t uint8
Definition: Define.h:109
const uint8 OutdoorPvPSIBuffZonesNum
Definition: OutdoorPvPSI.h:33
void RegisterZone(uint32 zoneid)
Definition: OutdoorPvP.cpp:641
void SetMapFromZone(uint32 zone)
Definition: OutdoorPvP.cpp:718

References OutdoorPvPSIBuffZones, OutdoorPvPSIBuffZonesNum, OutdoorPvP::RegisterZone(), and OutdoorPvP::SetMapFromZone().

◆ Update()

bool OutdoorPvPSI::Update ( uint32  diff)
overridevirtual

Reimplemented from OutdoorPvP.

72{
73 return false;
74}

◆ UpdateWorldState()

Member Data Documentation

◆ m_Gathered_A

uint32 OutdoorPvPSI::m_Gathered_A
private

◆ m_Gathered_H

uint32 OutdoorPvPSI::m_Gathered_H
private

◆ m_LastController

TeamId OutdoorPvPSI::m_LastController
private