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

#include <OutdoorPvPSI.h>

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 (WorldPackets::WorldState::InitWorldStates &packet) override
 
void SendRemoveWorldStates (Player *player) override
 
bool HandleAreaTrigger (Player *player, uint32 trigger, bool entered) 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 ()
 
virtual ~OutdoorPvP ()
 
void DeleteSpawns ()
 
virtual bool HandleOpenGo (Player *player, GameObject *go)
 
void OnGameObjectCreate (GameObject *go) override
 
void OnGameObjectRemove (GameObject *go) override
 
void OnCreatureCreate (Creature *) override
 
void SendUpdateWorldState (uint32 field, uint32 value)
 
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 HandleGossipOption (Player *player, Creature *creature, uint32 gossipid)
 
virtual bool CanTalkTo (Player *player, Creature *c, GossipMenuItems const &gso)
 
void TeamApplyBuff (TeamId team, uint32 spellId, uint32 spellId2=0)
 
void SendDefenseMessage (uint32 zoneId, uint32 id)
 
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 OnCreatureRemove (Creature *)
 
virtual void OnUnitDeath (Unit *)
 
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
 
uint32 m_LastController
 

Additional Inherited Members

- Public Types inherited from OutdoorPvP
typedef std::map
< ObjectGuid::LowType,
OPvPCapturePoint * > 
OPvPCapturePointMap
 
- Static Public Member Functions inherited from OutdoorPvP
static TeamId GetTeamIdByTeam (uint32 team)
 
- Protected Member Functions inherited from OutdoorPvP
void BroadcastPacket (WorldPacket const *data) const
 
virtual void HandlePlayerResurrects (Player *player, uint32 zone)
 
void AddCapturePoint (OPvPCapturePoint *cp)
 
OPvPCapturePointGetCapturePoint (ObjectGuid::LowType guid) const
 
void RegisterZone (uint32 zoneid)
 
bool HasPlayer (Player const *player) const
 
void TeamCastSpell (TeamId team, int32 spellId)
 
template<class Worker >
void BroadcastWorker (Worker &_worker, uint32 zoneId)
 
void SetMapFromZone (uint32 zone)
 
- Protected Attributes inherited from OutdoorPvP
OPvPCapturePointMap m_capturePoints
 
GuidSet m_players [2]
 
uint32 m_TypeId
 
bool m_sendUpdate
 
Mapm_map
 

Constructor & Destructor Documentation

OutdoorPvPSI::OutdoorPvPSI ( )
31 {
33  m_Gathered_A = 0;
34  m_Gathered_H = 0;
35  m_LastController = 0;
36 }
uint32 m_Gathered_A
Definition: OutdoorPvPSI.h:79
uint32 m_Gathered_H
Definition: OutdoorPvPSI.h:80
uint32 m_TypeId
Definition: OutdoorPvP.h:273
uint32 m_LastController
Definition: OutdoorPvPSI.h:82
Definition: OutdoorPvP.h:34

Member Function Documentation

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

Reimplemented from OutdoorPvP.

39 {
40  packet.Worldstates.emplace_back(uint32(SI_GATHERED_A), int32(m_Gathered_A));
41  packet.Worldstates.emplace_back(uint32(SI_GATHERED_H), int32(m_Gathered_H));
43 }
const uint32 SI_MAX_RESOURCES
Definition: OutdoorPvPSI.h:31
std::list< WorldStateInfo > Worldstates
Definition: WorldStatePackets.h:47
uint32 m_Gathered_A
Definition: OutdoorPvPSI.h:79
uint32 m_Gathered_H
Definition: OutdoorPvPSI.h:80
Definition: OutdoorPvPSI.h:50
Definition: OutdoorPvPSI.h:49
int32_t int32
Definition: g3dmath.h:167
uint32_t uint32
Definition: g3dmath.h:168
Definition: OutdoorPvPSI.h:51
bool OutdoorPvPSI::HandleAreaTrigger ( Player player,
uint32  trigger,
bool  entered 
)
overridevirtual
Todo:
: confirm this text
Todo:
: confirm this text

Reimplemented from OutdoorPvP.

88 {
89  switch (trigger)
90  {
91  case SI_AREATRIGGER_A:
92  if (player->GetTeam() == ALLIANCE && player->HasAura(SI_SILITHYST_FLAG))
93  {
94  // remove aura
95  player->RemoveAurasDueToSpell(SI_SILITHYST_FLAG);
96  ++ m_Gathered_A;
98  {
101  sWorld->SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_A));
103  m_Gathered_A = 0;
104  m_Gathered_H = 0;
105  }
107  // reward player
108  player->CastSpell(player, SI_TRACES_OF_SILITHYST, true);
109  // add 19 honor
110  player->RewardHonor(NULL, 1, 19);
111  // add 20 cenarion circle repu
112  player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20);
113  // complete quest
114  player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_A);
115  }
116  return true;
117  case SI_AREATRIGGER_H:
118  if (player->GetTeam() == HORDE && player->HasAura(SI_SILITHYST_FLAG))
119  {
120  // remove aura
121  player->RemoveAurasDueToSpell(SI_SILITHYST_FLAG);
122  ++ m_Gathered_H;
124  {
127  sWorld->SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_H));
129  m_Gathered_A = 0;
130  m_Gathered_H = 0;
131  }
133  // reward player
134  player->CastSpell(player, SI_TRACES_OF_SILITHYST, true);
135  // add 19 honor
136  player->RewardHonor(NULL, 1, 19);
137  // add 20 cenarion circle repu
138  player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20);
139  // complete quest
140  player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_H);
141  }
142  return true;
143  }
144  return false;
145 }
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2=0)
Definition: OutdoorPvP.cpp:610
Definition: OutdoorPvPSI.h:27
Definition: Language.h:1180
const uint32 SI_MAX_RESOURCES
Definition: OutdoorPvPSI.h:31
uint32 m_Gathered_A
Definition: OutdoorPvPSI.h:79
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Language.h:1181
void UpdateWorldState()
Definition: OutdoorPvPSI.cpp:52
#define sWorld
Definition: World.h:887
#define sObjectMgr
Definition: ObjectMgr.h:1567
const uint32 SI_TURNIN_QUEST_CM_A
Definition: OutdoorPvPSI.h:41
const uint32 SI_AREATRIGGER_A
Definition: OutdoorPvPSI.h:39
Definition: SharedDefines.h:1000
const uint32 OutdoorPvPSIBuffZones[OutdoorPvPSIBuffZonesNum]
Definition: OutdoorPvPSI.h:35
Definition: SharedDefines.h:992
Definition: OutdoorPvPSI.h:26
Definition: SharedDefines.h:999
uint32 m_Gathered_H
Definition: OutdoorPvPSI.h:80
DBCStorage< FactionEntry > sFactionStore(Factionfmt)
Definition: SharedDefines.h:993
uint32 m_LastController
Definition: OutdoorPvPSI.h:82
const uint32 SI_AREATRIGGER_H
Definition: OutdoorPvPSI.h:37
const uint32 SI_TURNIN_QUEST_CM_H
Definition: OutdoorPvPSI.h:43
Definition: OutdoorPvPSI.h:28

+ Here is the call graph for this function:

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

Reimplemented from OutdoorPvP.

223 {
224  if (!go || spellId != SI_SILITHYST_FLAG_GO_SPELL)
225  return false;
226  player->CastSpell(player, SI_SILITHYST_FLAG, true);
227  if (go->GetGOInfo()->entry == SI_SILITHYST_MOUND)
228  {
229  // despawn go
230  go->SetRespawnTime(0);
231  go->Delete();
232  }
233  return true;
234 }
void SetRespawnTime(int32 respawn)
Definition: GameObject.h:945
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
Definition: OutdoorPvPSI.h:26
uint32 entry
Definition: GameObject.h:36
const uint32 SI_SILITHYST_MOUND
Definition: OutdoorPvPSI.h:45
Definition: OutdoorPvPSI.h:25
void Delete()
Definition: GameObject.cpp:726

+ Here is the call graph for this function:

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

Reimplemented from OutdoorPvP.

148 {
149  if (spellId == SI_SILITHYST_FLAG)
150  {
151  // 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
152  switch (player->GetTeam())
153  {
154  case ALLIANCE:
155  {
156  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(SI_AREATRIGGER_A);
157  if (atEntry)
158  {
159  // 5.0f is safe-distance
160  if (player->GetDistance(atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z) > 5.0f + atEntry->Radius)
161  {
162  // he dropped it further, summon mound
163  GameObject* go = new GameObject;
164  Map* map = player->GetMap();
165 
166  if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
167  {
168  delete go;
169  return true;
170  }
171 
172  go->CopyPhaseFrom(player);
173 
174  go->SetRespawnTime(0);
175 
176  if (!map->AddToMap(go))
177  {
178  delete go;
179  return true;
180  }
181  }
182  }
183  }
184  break;
185  case HORDE:
186  {
187  AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(SI_AREATRIGGER_H);
188  if (atEntry)
189  {
190  // 5.0f is safe-distance
191  if (player->GetDistance(atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z) > 5.0f + atEntry->Radius)
192  {
193  // he dropped it further, summon mound
194  GameObject* go = new GameObject;
195  Map* map = player->GetMap();
196 
197  if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
198  {
199  delete go;
200  return true;
201  }
202 
203  go->CopyPhaseFrom(player);
204 
205  go->SetRespawnTime(0);
206 
207  if (!map->AddToMap(go))
208  {
209  delete go;
210  return true;
211  }
212  }
213  }
214  }
215  break;
216  }
217  return true;
218  }
219  return false;
220 }
float Z
Definition: DBCEnums.h:36
float Y
Definition: DBCEnums.h:35
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerfmt)
void CopyPhaseFrom(WorldObject *obj, bool update=false)
Definition: Object.cpp:2915
void SetRespawnTime(int32 respawn)
Definition: GameObject.h:945
const uint32 SI_AREATRIGGER_A
Definition: OutdoorPvPSI.h:39
Definition: SharedDefines.h:1000
DBCPosition3D Pos
Definition: DBCStructure.h:78
bool AddToMap(T *)
Definition: Map.cpp:566
Definition: GameObject.h:880
Definition: OutdoorPvPSI.h:26
float X
Definition: DBCEnums.h:34
Definition: Map.h:259
Definition: SharedDefines.h:999
Definition: GameObject.h:823
const uint32 SI_SILITHYST_MOUND
Definition: OutdoorPvPSI.h:45
bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit=0)
Definition: GameObject.cpp:173
float Radius
Definition: DBCStructure.h:82
Definition: DBCStructure.h:74
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:561
const uint32 SI_AREATRIGGER_H
Definition: OutdoorPvPSI.h:37

+ Here is the call graph for this function:

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

Reimplemented from OutdoorPvP.

74 {
75  if (player->GetTeam() == m_LastController)
76  player->CastSpell(player, SI_CENARION_FAVOR, true);
78 }
virtual void HandlePlayerEnterZone(Player *player, uint32 zone)
Definition: OutdoorPvP.cpp:257
uint32 m_LastController
Definition: OutdoorPvPSI.h:82
Definition: OutdoorPvPSI.h:28

+ Here is the call graph for this function:

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

Reimplemented from OutdoorPvP.

81 {
82  // remove buffs
83  player->RemoveAurasDueToSpell(SI_CENARION_FAVOR);
85 }
Definition: OutdoorPvPSI.h:28
virtual void HandlePlayerLeaveZone(Player *player, uint32 zone)
Definition: OutdoorPvP.cpp:262

+ Here is the call graph for this function:

void OutdoorPvPSI::SendRemoveWorldStates ( Player player)
overridevirtual

Reimplemented from OutdoorPvP.

46 {
47  player->SendUpdateWorldState(SI_GATHERED_A, 0);
48  player->SendUpdateWorldState(SI_GATHERED_H, 0);
49  player->SendUpdateWorldState(SI_SILITHYST_MAX, 0);
50 }
Definition: OutdoorPvPSI.h:50
Definition: OutdoorPvPSI.h:49
Definition: OutdoorPvPSI.h:51
bool OutdoorPvPSI::SetupOutdoorPvP ( )
overridevirtual

Reimplemented from OutdoorPvP.

60 {
62 
63  for (uint8 i = 0; i < OutdoorPvPSIBuffZonesNum; ++i)
65  return true;
66 }
void SetMapFromZone(uint32 zone)
Definition: OutdoorPvP.cpp:651
const uint8 OutdoorPvPSIBuffZonesNum
Definition: OutdoorPvPSI.h:33
const uint32 OutdoorPvPSIBuffZones[OutdoorPvPSIBuffZonesNum]
Definition: OutdoorPvPSI.h:35
void RegisterZone(uint32 zoneid)
Definition: OutdoorPvP.cpp:583
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

bool OutdoorPvPSI::Update ( uint32  diff)
overridevirtual

Reimplemented from OutdoorPvP.

69 {
70  return false;
71 }
void OutdoorPvPSI::UpdateWorldState ( )
53 {
57 }
const uint32 SI_MAX_RESOURCES
Definition: OutdoorPvPSI.h:31
uint32 m_Gathered_A
Definition: OutdoorPvPSI.h:79
uint32 m_Gathered_H
Definition: OutdoorPvPSI.h:80
Definition: OutdoorPvPSI.h:50
Definition: OutdoorPvPSI.h:49
Definition: OutdoorPvPSI.h:51
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 OutdoorPvPSI::m_Gathered_A
private
uint32 OutdoorPvPSI::m_Gathered_H
private
uint32 OutdoorPvPSI::m_LastController
private

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