54 m_capturePointSpawnId(), m_capturePoint(nullptr), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0),
122 AddGO(type, guid, entry);
133 AddCre(type, guid, entry);
142 TC_LOG_DEBUG(
"outdoorpvp",
"Creating capture point {}", entry);
148 TC_LOG_ERROR(
"outdoorpvp",
"OutdoorPvP: GO {} is not capture point!", entry);
171 TC_LOG_DEBUG(
"outdoorpvp",
"opvp creature type {} was already deleted", type);
174 TC_LOG_DEBUG(
"outdoorpvp",
"deleting opvp creature type {}", type);
209 for (std::map<uint32, ObjectGuid::LowType>::iterator i =
m_Objects.begin(); i !=
m_Objects.end(); ++i)
211 for (std::map<uint32, ObjectGuid::LowType>::iterator i =
m_Creatures.begin(); i !=
m_Creatures.end(); ++i)
222 go->ClearZoneScript();
228 if (
Creature* creature = itr->second)
229 creature->ClearZoneScript();
235 itr->second->DeleteSpawns();
257 itr->second->HandlePlayerLeave(player);
269 bool objective_changed =
false;
272 if (itr->second->Update(diff))
273 objective_changed =
true;
275 return objective_changed;
285 for (
uint32 team = 0; team < 2; ++team)
298 std::list<Player*> players;
303 for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
305 Player*
const player = *itr;
327 if (fact_diff < -maxDiff)
328 fact_diff = -maxDiff;
338 if (fact_diff > maxDiff)
365 else if (oldValue *
m_value <= 0)
371 else if (Challenger ==
HORDE)
403 for (
int i = 0; i < 2; ++i)
406 player->SendUpdateWorldState(field, value);
411 for (
uint32 team = 0; team < 2; ++team)
416 player->SendUpdateWorldState(field, value);
438 player->KilledMonsterCredit(
id, guid);
445 for (
GroupReference* itr = group->GetFirstMember(); itr !=
nullptr; itr = itr->next())
447 Player* groupGuy = itr->GetSource();
473 if (itr->second->IsInsideObjective(player))
482 return plSet.find(player->
GetGUID()) != plSet.end();
488 if (itr->second->HandleCustomSpell(player, spellId, go))
504 if (itr->second->HandleOpenGo(player, go) >= 0)
513 if (itr->second->HandleGossipOption(player, creature,
id))
522 if (itr->second->CanTalkTo(player, c, gso))
531 if (itr->second->HandleDropFlag(player,
id))
570 for (GuidSet::const_iterator itr =
m_players[team].begin(); itr !=
m_players[team].end(); ++itr)
583 return plSet.find(player->
GetGUID()) != plSet.end();
590 for (GuidSet::iterator itr =
m_players[team].begin(); itr !=
m_players[team].end(); ++itr)
592 player->CastSpell(player, (
uint32)spellId,
true);
596 for (GuidSet::iterator itr =
m_players[team].begin(); itr !=
m_players[team].end(); ++itr)
598 player->RemoveAura((
uint32)-spellId);
616 cp->m_capturePoint = go;
627 cp->m_capturePoint =
nullptr;
648template<
class Worker>
654 if (player->GetZoneId() == zoneId)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
std::set< ObjectGuid > GuidSet
#define OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL
@ OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE
@ OBJECTIVESTATE_ALLIANCE
@ OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE
@ OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE
@ OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE
@ GAMEOBJECT_TYPE_CAPTURE_POINT
uint8 constexpr PVP_TEAMS_COUNT
T CalculatePct(T base, U pct)
static bool DeleteFromDB(ObjectGuid::LowType spawnId)
void operator()(WorldPacket &data, LocaleConstant locale) const
DefenseMessageBuilder(uint32 zoneId, uint32 id)
uint32 _id
BroadcastTextId.
bool IsWithinDistInMap(Player const *player) const
GameObjectTemplate const * GetGOInfo() const
void SetRespawnTime(int32 respawn)
GameobjectTypes GetGoType() const
ObjectGuid::LowType GetSpawnId() const
static bool DeleteFromDB(ObjectGuid::LowType spawnId)
bool Instanceable() const
OPvPCapturePoint(OutdoorPvP *pvp)
std::map< uint32, ObjectGuid::LowType > m_Creatures
virtual void ChangeState()=0
virtual bool HandleCustomSpell(Player *player, uint32 spellId, GameObject *go)
ObjectiveStates m_OldState
virtual bool HandleGossipOption(Player *player, Creature *guid, uint32 gossipid)
bool AddCreature(uint32 type, uint32 entry, uint32 map, Position const &pos, TeamId teamId=TEAM_NEUTRAL, uint32 spawntimedelay=0)
std::map< ObjectGuid::LowType, uint32 > m_ObjectTypes
virtual bool Update(uint32 diff)
std::map< ObjectGuid::LowType, uint32 > m_CreatureTypes
virtual void DeleteSpawns()
std::map< uint32, ObjectGuid::LowType > m_Objects
virtual bool CanTalkTo(Player *player, Creature *c, GossipMenuItems const &gso)
void AddCre(uint32 type, ObjectGuid::LowType guid, uint32 entry=0)
GuidSet m_activePlayers[2]
void SendUpdateWorldState(uint32 field, uint32 value)
virtual void HandlePlayerLeave(Player *player)
void SendObjectiveComplete(uint32 id, ObjectGuid guid)
GameObject * m_capturePoint
ObjectGuid::LowType m_capturePointSpawnId
virtual bool HandleDropFlag(Player *player, uint32 spellId)
virtual bool HandlePlayerEnter(Player *player)
bool SetCapturePointData(uint32 entry, uint32 map, Position const &pos, QuaternionData const &rot)
virtual void ChangeTeam(TeamId)
virtual int32 HandleOpenGo(Player *player, GameObject *go)
bool DelCreature(uint32 type)
bool AddObject(uint32 type, uint32 entry, uint32 map, Position const &pos, QuaternionData const &rot)
bool DelObject(uint32 type)
bool IsInsideObjective(Player *player) const
virtual void SendChangePhase()
void AddGO(uint32 type, ObjectGuid::LowType guid, uint32 entry=0)
LowType GetCounter() const
static ObjectGuid GetGUID(Object const *o)
virtual void HandlePlayerEnterZone(Player *player, uint32 zone)
void OnCreatureCreate(Creature *) override
OPvPCapturePointMap m_capturePoints
bool HasPlayer(Player const *player) const
virtual bool HandleAreaTrigger(Player *player, uint32 trigger)
virtual bool Update(uint32 diff)
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2=0)
void OnGameObjectRemove(GameObject *go) override
std::pair< ObjectGuid::LowType, Creature * > CreatureScriptPair
void OnGameObjectCreate(GameObject *go) override
void RegisterZone(uint32 zoneid)
virtual void SendRemoveWorldStates(Player *)
virtual bool HandleCustomSpell(Player *player, uint32 spellId, GameObject *go)
OPvPCapturePoint * GetCapturePoint(ObjectGuid::LowType guid) const
void OnCreatureRemove(Creature *) override
virtual void HandlePlayerLeaveZone(Player *player, uint32 zone)
virtual bool HandleGossipOption(Player *player, Creature *creature, uint32 gossipid)
virtual bool HandleOpenGo(Player *player, GameObject *go)
void TeamCastSpell(TeamId team, int32 spellId)
virtual void HandlePlayerResurrects(Player *player, uint32 zone)
void SendUpdateWorldState(uint32 field, uint32 value)
std::map< ObjectGuid::LowType, Creature * > m_CreatureScriptStore
virtual bool CanTalkTo(Player *player, Creature *c, GossipMenuItems const &gso)
bool IsInsideObjective(Player *player) const
virtual void HandleKillImpl(Player *, Unit *)
void SetMapFromZone(uint32 zone)
std::pair< ObjectGuid::LowType, GameObject * > GoScriptPair
void BroadcastWorker(Worker &_worker, uint32 zoneId)
void SendDefenseMessage(uint32 zoneId, uint32 id)
void BroadcastPacket(WorldPacket &data) const
std::map< ObjectGuid::LowType, GameObject * > m_GoScriptStore
virtual void HandleKill(Player *killer, Unit *killed)
virtual bool HandleDropFlag(Player *player, uint32 spellId)
void SendUpdateWorldState(uint32 variable, uint32 value) const
void SendDirectMessage(WorldPacket const *data) const
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
WorldSession * GetSession() const
bool IsOutdoorPvPActive() const
std::string const & GetName() const
void Initialize(uint16 opcode, size_t newres=200)
bool PlayerLogout() const
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
struct GameObjectTemplate::@191::@216 capturePoint