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

#include "OutdoorPvPEP.h"

Inheritance diagram for OPvPCapturePointEP_NPT:
OPvPCapturePoint

Public Member Functions

 OPvPCapturePointEP_NPT (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 ()
 
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 ()
 

Protected Member Functions

void SummonGO (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

uint32 m_TowerState
 
TeamId m_SummonedGOSideId
 
- Protected Attributes inherited from OPvPCapturePoint
PlayerSet m_activePlayers [2]
 
float m_maxValue
 
float m_minValue
 
float m_maxSpeed
 
float m_value
 
TeamId m_team
 
ObjectiveStates m_OldState
 
ObjectiveStates m_State
 
uint32 m_neutralValuePct
 
OutdoorPvPm_PvP
 
std::map< uint32, ObjectGuid::LowTypem_Objects
 
std::map< uint32, ObjectGuid::LowTypem_Creatures
 
std::map< ObjectGuid::LowType, uint32m_ObjectTypes
 
std::map< ObjectGuid::LowType, uint32m_CreatureTypes
 

Additional Inherited Members

- Public Attributes inherited from OPvPCapturePoint
ObjectGuid::LowType m_capturePointSpawnId
 
GameObjectm_capturePoint
 

Detailed Description

Constructor & Destructor Documentation

◆ OPvPCapturePointEP_NPT()

OPvPCapturePointEP_NPT::OPvPCapturePointEP_NPT ( OutdoorPvP pvp)
165{
168}
@ EP_NPT_FLAGS
Definition: OutdoorPvPEP.h:108
const go_type EPCapturePoints[EP_TOWER_NUM]
Definition: OutdoorPvPEP.h:123
@ EP_TS_N
Definition: OutdoorPvPEP.h:168
@ EP_NPT
Definition: OutdoorPvPEP.h:117
const go_type EPTowerFlags[EP_TOWER_NUM]
Definition: OutdoorPvPEP.h:131
@ TEAM_NEUTRAL
Definition: SharedDefines.h:734
Definition: OutdoorPvP.h:89
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:93
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:115
uint32 m_TowerState
Definition: OutdoorPvPEP.h:232
TeamId m_SummonedGOSideId
Definition: OutdoorPvPEP.h:234

References OPvPCapturePoint::AddObject(), EP_NPT, EP_NPT_FLAGS, EPCapturePoints, EPTowerFlags, and OPvPCapturePoint::SetCapturePointData().

Member Function Documentation

◆ ChangeState()

void OPvPCapturePointEP_NPT::ChangeState ( )
overridevirtual

Implements OPvPCapturePoint.

171{
172 // if changing from controlling alliance to horde or vice versa
174 {
175 sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_A));
176 ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, TEAM_NEUTRAL);
177 }
179 {
180 sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_H));
181 ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, TEAM_NEUTRAL);
182 }
183
184 uint32 artkit = 21;
185
186 switch (m_State)
187 {
190 artkit = 2;
192 ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, TEAM_ALLIANCE);
193 if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A));
194 break;
197 artkit = 1;
199 ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, TEAM_HORDE);
200 if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H));
201 break;
206 break;
209 break;
214 break;
217 break;
222 break;
223 }
224
225 Map* map = sMapMgr->FindMap(0, 0);
226 auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
227 for (auto itr = bounds.first; itr != bounds.second; ++itr)
228 itr->second->SetGoArtKit(artkit);
229
230 bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_NPT_FLAGS]);
231 for (auto itr = bounds.first; itr != bounds.second; ++itr)
232 itr->second->SetGoArtKit(artkit);
233
235
236 // complete quest objective
239}
std::uint32_t uint32
Definition: Define.h:108
#define sObjectMgr
Definition: ObjectMgr.h:1640
#define sMapMgr
Definition: MapMgr.h:221
@ LANG_OPVP_EP_CAPTURE_NPT_A
Definition: Language.h:1240
@ LANG_OPVP_EP_LOSE_NPT_H
Definition: Language.h:1247
@ LANG_OPVP_EP_CAPTURE_NPT_H
Definition: Language.h:1239
@ LANG_OPVP_EP_LOSE_NPT_A
Definition: Language.h:1248
@ OBJECTIVESTATE_HORDE
Definition: OutdoorPvP.h:44
@ OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE
Definition: OutdoorPvP.h:46
@ OBJECTIVESTATE_ALLIANCE
Definition: OutdoorPvP.h:43
@ OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE
Definition: OutdoorPvP.h:45
@ OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE
Definition: OutdoorPvP.h:48
@ OBJECTIVESTATE_NEUTRAL
Definition: OutdoorPvP.h:42
@ OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE
Definition: OutdoorPvP.h:47
@ EP_NPT_BUFF
Definition: OutdoorPvPEP.h:107
@ 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
const uint32 EP_NPT_CM
Definition: OutdoorPvPEP.h:36
const uint32 EP_GraveYardZone
Definition: OutdoorPvPEP.h:28
@ TEAM_ALLIANCE
Definition: SharedDefines.h:732
@ TEAM_HORDE
Definition: SharedDefines.h:733
#define sWorld
Definition: World.h:451
Definition: Map.h:312
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:521
ObjectiveStates m_OldState
Definition: OutdoorPvP.h:178
OutdoorPvP * m_PvP
Definition: OutdoorPvP.h:185
ObjectiveStates m_State
Definition: OutdoorPvP.h:179
std::map< uint32, ObjectGuid::LowType > m_Objects
Definition: OutdoorPvP.h:189
ObjectGuid::LowType m_capturePointSpawnId
Definition: OutdoorPvP.h:131
bool DelObject(uint32 type)
Definition: OutdoorPvP.cpp:178
void SendObjectiveComplete(uint32 id, ObjectGuid guid=ObjectGuid::Empty)
Definition: OutdoorPvP.cpp:431
void SummonGO(TeamId teamId)
Definition: OutdoorPvPEP.cpp:289
void UpdateTowerState()
Definition: OutdoorPvPEP.cpp:261
Definition: OutdoorPvPEP.h:290

References OPvPCapturePoint::DelObject(), EP_GraveYardZone, EP_NPT, EP_NPT_BUFF, EP_NPT_CM, EP_NPT_FLAGS, EP_TS_A, EP_TS_H, EP_TS_N, EP_TS_N_A, EP_TS_N_H, Map::GetGameObjectBySpawnIdStore(), LANG_OPVP_EP_CAPTURE_NPT_A, LANG_OPVP_EP_CAPTURE_NPT_H, LANG_OPVP_EP_LOSE_NPT_A, LANG_OPVP_EP_LOSE_NPT_H, OPvPCapturePoint::m_capturePointSpawnId, OPvPCapturePoint::m_Objects, OPvPCapturePoint::m_OldState, OPvPCapturePoint::m_PvP, OPvPCapturePoint::m_State, m_SummonedGOSideId, 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, SummonGO(), sWorld, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, and UpdateTowerState().

◆ FillInitialWorldStates()

void OPvPCapturePointEP_NPT::FillInitialWorldStates ( WorldPacket data)
overridevirtual

Reimplemented from OPvPCapturePoint.

253{
254 data << EP_NPT_A << uint32(bool(m_TowerState & EP_TS_A));
255 data << EP_NPT_H << uint32(bool(m_TowerState & EP_TS_H));
256 data << EP_NPT_N_A << uint32(bool(m_TowerState & EP_TS_N_A));
257 data << EP_NPT_N_H << uint32(bool(m_TowerState & EP_TS_N_H));
258 data << EP_NPT_N << uint32(bool(m_TowerState & EP_TS_N));
259}
@ 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

References EP_NPT_A, EP_NPT_H, EP_NPT_N, EP_NPT_N_A, EP_NPT_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_NPT::HandlePlayerEnter ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

271{
273 {
275 uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
278 return true;
279 }
280 return false;
281}
phase
Definition: boss_skadi.cpp:102
@ 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:2194
float m_value
Definition: OutdoorPvP.h:173
uint32 m_neutralValuePct
Definition: OutdoorPvP.h:182
float m_maxValue
Definition: OutdoorPvP.h:166
virtual bool HandlePlayerEnter(Player *player)
Definition: OutdoorPvP.cpp:36

References EP_UI_TOWER_SLIDER_DISPLAY, EP_UI_TOWER_SLIDER_N, EP_UI_TOWER_SLIDER_POS, OPvPCapturePoint::HandlePlayerEnter(), OPvPCapturePoint::m_maxValue, OPvPCapturePoint::m_neutralValuePct, OPvPCapturePoint::m_value, and Player::SendUpdateWorldState().

◆ HandlePlayerLeave()

void OPvPCapturePointEP_NPT::HandlePlayerLeave ( Player player)
overridevirtual

Reimplemented from OPvPCapturePoint.

284{
287}
virtual void HandlePlayerLeave(Player *player)
Definition: OutdoorPvP.cpp:47

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

◆ SendChangePhase()

void OPvPCapturePointEP_NPT::SendChangePhase ( )
overridevirtual

Reimplemented from OPvPCapturePoint.

242{
243 // send this too, sometimes the slider disappears, dunno why :(
245 // send these updates to only the ones in this objective
246 uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
248 // send this too, sometimes it resets :S
250}
void SendUpdateWorldState(uint32 field, uint32 value)
Definition: OutdoorPvP.cpp:420

References EP_UI_TOWER_SLIDER_DISPLAY, EP_UI_TOWER_SLIDER_N, EP_UI_TOWER_SLIDER_POS, OPvPCapturePoint::m_maxValue, OPvPCapturePoint::m_neutralValuePct, OPvPCapturePoint::m_value, and OPvPCapturePoint::SendUpdateWorldState().

◆ SummonGO()

void OPvPCapturePointEP_NPT::SummonGO ( TeamId  teamId)
protected
290{
291 if (m_SummonedGOSideId != teamId)
292 {
293 m_SummonedGOSideId = teamId;
296 Map* map = sMapMgr->FindMap(0, 0);
297 auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_NPT_BUFF]);
298 for (auto itr = bounds.first; itr != bounds.second; ++itr)
299 if (GameObject* go = itr->second)
300 go->SetUInt32Value(GAMEOBJECT_FACTION, (teamId == TEAM_ALLIANCE ? 84 : 83));
301 }
302}
@ GAMEOBJECT_FACTION
Definition: UpdateFields.h:402
const go_type EP_NPT_LordaeronShrine
Definition: OutdoorPvPEP.h:181
Definition: GameObject.h:122
float x
Definition: OutdoorPvP.h:56
uint32 map
Definition: OutdoorPvP.h:55
uint32 entry
Definition: OutdoorPvP.h:54
float o
Definition: OutdoorPvP.h:59
float z
Definition: OutdoorPvP.h:58
float rot3
Definition: OutdoorPvP.h:63
float rot0
Definition: OutdoorPvP.h:60
float rot1
Definition: OutdoorPvP.h:61
float y
Definition: OutdoorPvP.h:57
float rot2
Definition: OutdoorPvP.h:62

References OPvPCapturePoint::AddObject(), OPvPCapturePoint::DelObject(), go_type::entry, EP_NPT_BUFF, EP_NPT_LordaeronShrine, GAMEOBJECT_FACTION, Map::GetGameObjectBySpawnIdStore(), OPvPCapturePoint::m_Objects, m_SummonedGOSideId, go_type::map, go_type::o, go_type::rot0, go_type::rot1, go_type::rot2, go_type::rot3, sMapMgr, TEAM_ALLIANCE, go_type::x, go_type::y, and go_type::z.

Referenced by ChangeState().

◆ UpdateTowerState()

void OPvPCapturePointEP_NPT::UpdateTowerState ( )
protected

Member Data Documentation

◆ m_SummonedGOSideId

TeamId OPvPCapturePointEP_NPT::m_SummonedGOSideId
protected

Referenced by ChangeState(), and SummonGO().

◆ m_TowerState

uint32 OPvPCapturePointEP_NPT::m_TowerState
protected