TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OPvPCapturePointTF Class Reference

#include <OutdoorPvPTF.h>

Public Member Functions

 OPvPCapturePointTF (OutdoorPvP *pvp, OutdoorPvPTF_TowerType type)
 
bool Update (uint32 diff) override
 
void ChangeState () override
 
void FillInitialWorldStates (WorldPackets::WorldState::InitWorldStates &packet) override
 
void UpdateTowerState ()
 
- Public Member Functions inherited from OPvPCapturePoint
 OPvPCapturePoint (OutdoorPvP *pvp)
 
virtual ~OPvPCapturePoint ()
 
void SendUpdateWorldState (uint32 field, uint32 value)
 
void SendObjectiveComplete (uint32 id, ObjectGuid guid)
 
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 void ChangeTeam (TeamId)
 
virtual void SendChangePhase ()
 
virtual bool HandleGossipOption (Player *, Creature *, uint32)
 
virtual bool CanTalkTo (Player *, Creature *, GossipMenuItems const &)
 
virtual bool HandleDropFlag (Player *, uint32)
 
virtual void DeleteSpawns ()
 
void AddGO (uint32 type, ObjectGuid::LowType guid)
 
void AddCre (uint32 type, ObjectGuid::LowType guid)
 
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)
 

Protected Attributes

OutdoorPvPTF_TowerType m_TowerType
 
uint32 m_TowerState
 
- Protected Attributes inherited from OPvPCapturePoint
GuidSet 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::LowType
m_Objects
 
std::map< uint32,
ObjectGuid::LowType
m_Creatures
 
std::map< ObjectGuid::LowType,
uint32
m_ObjectTypes
 
std::map< ObjectGuid::LowType,
uint32
m_CreatureTypes
 

Additional Inherited Members

- Public Attributes inherited from OPvPCapturePoint
ObjectGuid::LowType m_capturePointSpawnId
 
GameObjectm_capturePoint
 
- 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)
 
virtual bool AddCreature (uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL, uint32 spawntimedelay=0)
 
bool DelCreature (uint32 type)
 
bool DelObject (uint32 type)
 
bool DelCapturePoint ()
 

Constructor & Destructor Documentation

OPvPCapturePointTF::OPvPCapturePointTF ( OutdoorPvP pvp,
OutdoorPvPTF_TowerType  type 
)
45 {
46  SetCapturePointData(TFCapturePoints[type].entry, TFCapturePoints[type].map, TFCapturePoints[type].x, TFCapturePoints[type].y, TFCapturePoints[type].z, TFCapturePoints[type].o, TFCapturePoints[type].rot0, TFCapturePoints[type].rot1, TFCapturePoints[type].rot2, TFCapturePoints[type].rot3);
47 }
OutdoorPvPTF_TowerType m_TowerType
Definition: OutdoorPvPTF.h:144
OPvPCapturePoint(OutdoorPvP *pvp)
Definition: OutdoorPvP.cpp:52
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:131
Definition: OutdoorPvPTF.h:125
uint32 m_TowerState
Definition: OutdoorPvPTF.h:146
G3D::int16 z
Definition: Vector3int16.h:46
const go_type TFCapturePoints[TF_TOWER_NUM]
Definition: OutdoorPvPTF.h:66
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the call graph for this function:

Member Function Documentation

void OPvPCapturePointTF::ChangeState ( )
overridevirtual

Implements OPvPCapturePoint.

254 {
255  // if changing from controlling alliance to horde
257  {
258  if (uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled())
259  ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(--alliance_towers);
261  }
262  // if changing from controlling horde to alliance
263  else if (m_OldState == OBJECTIVESTATE_HORDE)
264  {
265  if (uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled())
266  ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(--horde_towers);
268  }
269 
270  uint32 artkit = 21;
271 
272  switch (m_State)
273  {
275  {
277  artkit = 2;
278  uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled();
279  if (alliance_towers < TF_TOWER_NUM)
280  ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(++alliance_towers);
281 
282  m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_ALLIANCE);
283 
284  for (GuidSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr)
285  if (Player* player = ObjectAccessor::FindPlayer(*itr))
286  player->AreaExploredOrEventHappens(TF_ALLY_QUEST);
287  break;
288  }
290  {
292  artkit = 1;
293  uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled();
294  if (horde_towers < TF_TOWER_NUM)
295  ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(++horde_towers);
296 
297  m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_HORDE);
298 
299  for (GuidSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr)
300  if (Player* player = ObjectAccessor::FindPlayer(*itr))
301  player->AreaExploredOrEventHappens(TF_HORDE_QUEST);
302  break;
303  }
310  break;
311  }
312 
313  auto bounds = sMapMgr->FindMap(530, 0)->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
314  for (auto itr = bounds.first; itr != bounds.second; ++itr)
315  itr->second->SetGoArtKit(artkit);
316 
318 }
OutdoorPvP * m_PvP
Definition: OutdoorPvP.h:177
GuidSet m_activePlayers[2]
Definition: OutdoorPvP.h:155
Definition: OutdoorPvPTF.h:30
Definition: OutdoorPvP.h:46
Definition: OutdoorPvPTF.h:149
void UpdateTowerState()
Definition: OutdoorPvPTF.cpp:95
const uint32 TF_ALLY_QUEST
Definition: OutdoorPvPTF.h:53
Definition: OutdoorPvPTF.h:125
Definition: OutdoorPvPTF.h:126
Definition: OutdoorPvPTF.h:29
uint32 m_TowerState
Definition: OutdoorPvPTF.h:146
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
Definition: OutdoorPvPTF.h:63
ObjectGuid::LowType m_capturePointSpawnId
Definition: OutdoorPvP.h:131
Definition: OutdoorPvP.h:43
uint32_t uint32
Definition: Define.h:150
Definition: OutdoorPvP.h:45
Definition: OutdoorPvPTF.h:28
void SendDefenseMessage(uint32 zoneId, uint32 id)
Definition: OutdoorPvP.cpp:634
const uint32 OutdoorPvPTFBuffZones[OutdoorPvPTFBuffZonesNum]
Definition: OutdoorPvPTF.h:35
Definition: OutdoorPvPTF.h:127
Definition: OutdoorPvP.h:42
Definition: OutdoorPvPTF.h:27
#define sMapMgr
Definition: MapManager.h:194
const uint32 TF_HORDE_QUEST
Definition: OutdoorPvPTF.h:54
Definition: OutdoorPvP.h:47
ObjectiveStates m_OldState
Definition: OutdoorPvP.h:170
ObjectiveStates m_State
Definition: OutdoorPvP.h:171
Definition: OutdoorPvP.h:41

+ Here is the call graph for this function:

void OPvPCapturePointTF::FillInitialWorldStates ( WorldPackets::WorldState::InitWorldStates packet)
overridevirtual

Reimplemented from OPvPCapturePoint.

50 {
54 }
OutdoorPvPTF_TowerType m_TowerType
Definition: OutdoorPvPTF.h:144
std::list< WorldStateInfo > Worldstates
Definition: WorldStatePackets.h:47
Definition: OutdoorPvPTF.h:125
Definition: OutdoorPvPTF.h:126
uint32 m_TowerState
Definition: OutdoorPvPTF.h:146
const tf_tower_world_state TFTowerWorldStates[TF_TOWER_NUM]
Definition: OutdoorPvPTF.h:82
Definition: OutdoorPvPTF.h:127
int32_t int32
Definition: g3dmath.h:167
uint32_t uint32
Definition: g3dmath.h:168
bool OPvPCapturePointTF::Update ( uint32  diff)
overridevirtual

Reimplemented from OPvPCapturePoint.

244 {
245  // can update even in locked state if gathers the controlling faction
246  bool canupdate = ((((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled() > 0) && m_activePlayers[0].size() > m_activePlayers[1].size()) ||
247  ((((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled() > 0) && m_activePlayers[0].size() < m_activePlayers[1].size());
248  // if gathers the other faction, then only update if the pvp is unlocked
249  canupdate = canupdate || !((OutdoorPvPTF*)m_PvP)->IsLocked();
250  return canupdate && OPvPCapturePoint::Update(diff);
251 }
OutdoorPvP * m_PvP
Definition: OutdoorPvP.h:177
GuidSet m_activePlayers[2]
Definition: OutdoorPvP.h:155
Definition: OutdoorPvPTF.h:149
virtual bool Update(uint32 diff)
Definition: OutdoorPvP.cpp:287

+ Here is the call graph for this function:

void OPvPCapturePointTF::UpdateTowerState ( )
96 {
100 }
OutdoorPvPTF_TowerType m_TowerType
Definition: OutdoorPvPTF.h:144
OutdoorPvP * m_PvP
Definition: OutdoorPvP.h:177
Definition: OutdoorPvPTF.h:125
Definition: OutdoorPvPTF.h:126
uint32 m_TowerState
Definition: OutdoorPvPTF.h:146
const tf_tower_world_state TFTowerWorldStates[TF_TOWER_NUM]
Definition: OutdoorPvPTF.h:82
Definition: OutdoorPvPTF.h:127
uint32_t uint32
Definition: g3dmath.h:168
void SendUpdateWorldState(uint32 field, uint32 value)
Definition: OutdoorPvP.cpp:409

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

uint32 OPvPCapturePointTF::m_TowerState
protected
OutdoorPvPTF_TowerType OPvPCapturePointTF::m_TowerType
protected

The documentation for this class was generated from the following files: