83bool OPvPCapturePoint::AddObject(
uint32 type,
uint32 entry,
uint32 map,
float x,
float y,
float z,
float o,
float rotation0,
float rotation1,
float rotation2,
float rotation3)
85 if (
uint32 guid =
sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3))
87 AddGO(type, guid, entry);
96 if (
uint32 guid =
sObjectMgr->AddCreData(entry, team, map, x, y, z, o, spawntimedelay))
107 SF_LOG_DEBUG(
"outdoorpvp",
"Creating capture point %u", entry);
113 SF_LOG_ERROR(
"outdoorpvp",
"OutdoorPvP: GO %u is not capture point!", entry);
117 m_capturePointGUID =
sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3);
134 SF_LOG_DEBUG(
"outdoorpvp",
"opvp creature type %u was already deleted", type);
145 SF_LOG_DEBUG(
"outdoorpvp",
"deleting opvp creature type %u", type);
205 for (std::map<uint32, uint64>::iterator i =
m_Objects.begin(); i !=
m_Objects.end(); ++i)
216 itr->second->DeleteSpawns();
238 itr->second->HandlePlayerLeave(player);
243 SF_LOG_DEBUG(
"outdoorpvp",
"Player %s left an outdoorpvp zone", player->
GetName().c_str());
250 bool objective_changed =
false;
253 if (itr->second->Update(diff))
254 objective_changed =
true;
256 return objective_changed;
264 float radius = (float)
m_capturePoint->GetGOInfo()->capturePoint.radius;
266 for (
uint32 team = 0; team < 2; ++team)
274 if (!
m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
279 std::list<Player*> players;
284 for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
286 Player*
const player = *itr;
308 if (fact_diff < -maxDiff)
309 fact_diff = -maxDiff;
319 if (fact_diff > maxDiff)
346 else if (oldValue *
m_value <= 0)
352 else if (Challenger ==
HORDE)
384 for (
int i = 0; i < 2; ++i)
385 for (PlayerSet::iterator itr =
m_players[i].begin(); itr !=
m_players[i].end(); ++itr)
387 player->SendUpdateWorldState(field, value);
392 for (
uint32 team = 0; team < 2; ++team)
397 player->SendUpdateWorldState(field, value);
419 player->KilledMonsterCredit(
id, guid);
428 Player* groupGuy = itr->GetSource();
454 if (itr->second->IsInsideObjective(player))
463 return plSet.find(player->
GetGUID()) != plSet.end();
469 if (itr->second->HandleCustomSpell(player, spellId, go))
485 if (itr->second->HandleOpenGo(player, guid) >= 0)
494 if (itr->second->HandleGossipOption(player, guid,
id))
503 if (itr->second->CanTalkTo(player, c, gso))
512 if (itr->second->HandleDropFlag(player,
id))
535 std::map<uint64, uint32>::iterator itr =
m_ObjectTypes.find(guid);
551 for (
uint32 team = 0; team < 2; ++team)
552 for (PlayerSet::const_iterator itr =
m_players[team].begin(); itr !=
m_players[team].end(); ++itr)
554 player->GetSession()->SendPacket(&data);
565 return plSet.find(player->
GetGUID()) != plSet.end();
572 for (PlayerSet::iterator itr =
m_players[team].begin(); itr !=
m_players[team].end(); ++itr)
574 player->CastSpell(player, (
uint32)spellId,
true);
578 for (PlayerSet::iterator itr =
m_players[team].begin(); itr !=
m_players[team].end(); ++itr)
580 player->RemoveAura((
uint32)-spellId);
596 cp->m_capturePoint = go;
605 cp->m_capturePoint = NULL;
@ CHAR_DEL_CREATURE_RESPAWN
#define SF_LOG_DEBUG(filterType__,...)
#define SF_LOG_ERROR(filterType__,...)
uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h)
std::set< uint64 > PlayerSet
@ OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE
@ OBJECTIVESTATE_ALLIANCE
@ OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE
@ OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE
@ OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE
#define OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL
@ GAMEOBJECT_TYPE_CAPTURE_POINT
T CalculatePct(T base, U pct)
uint32 GetDBTableGUIDLow() const
void SetRespawnTime(uint32 respawn)
void RemoveCorpse(bool setSpawnTime=true)
uint32 GetDBTableGUIDLow() const
void SetRespawnTime(int32 respawn)
GameobjectTypes GetGoType() const
static T * Find(uint64 guid)
OPvPCapturePoint(OutdoorPvP *pvp)
bool AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
std::map< uint32, uint64 > m_Creatures
std::map< uint32, uint64 > m_Objects
std::map< uint64, uint32 > m_ObjectTypes
bool AddCreature(uint32 type, uint32 entry, uint32 teamval, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay=0)
virtual int32 HandleOpenGo(Player *player, uint64 guid)
void AddCre(uint32 type, uint32 guid, uint32 entry=0)
virtual void ChangeState()=0
virtual bool HandleCustomSpell(Player *player, uint32 spellId, GameObject *go)
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)
ObjectiveStates m_OldState
virtual bool Update(uint32 diff)
virtual void DeleteSpawns()
PlayerSet m_activePlayers[2]
virtual bool CanTalkTo(Player *player, Creature *c, GossipMenuItems const &gso)
void SendUpdateWorldState(uint32 field, uint32 value)
virtual void HandlePlayerLeave(Player *player)
GameObject * m_capturePoint
virtual bool HandleGossipOption(Player *player, uint64 guid, uint32 gossipid)
virtual bool HandleDropFlag(Player *player, uint32 spellId)
void SendObjectiveComplete(uint32 id, uint64 guid)
virtual bool HandlePlayerEnter(Player *player)
virtual void ChangeTeam(TeamId)
bool DelCreature(uint32 type)
std::map< uint64, uint32 > m_CreatureTypes
void AddGO(uint32 type, uint32 guid, uint32 entry=0)
bool DelObject(uint32 type)
bool IsInsideObjective(Player *player) const
virtual void SendChangePhase()
uint32 m_capturePointGUID
static Player * FindPlayer(uint64)
virtual void HandlePlayerEnterZone(Player *player, uint32 zone)
void OnGameObjectCreate(GameObject *go)
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)
virtual bool HandleGossipOption(Player *player, uint64 guid, uint32 gossipid)
void RegisterZone(uint32 zoneid)
virtual void SendRemoveWorldStates(Player *)
virtual bool HandleOpenGo(Player *player, uint64 guid)
void OnGameObjectRemove(GameObject *go)
virtual bool HandleCustomSpell(Player *player, uint32 spellId, GameObject *go)
virtual void HandlePlayerLeaveZone(Player *player, uint32 zone)
OPvPCapturePoint * GetCapturePoint(uint32 lowguid) const
void TeamCastSpell(TeamId team, int32 spellId)
virtual void HandlePlayerResurrects(Player *player, uint32 zone)
void SendUpdateWorldState(uint32 field, uint32 value)
virtual bool CanTalkTo(Player *player, Creature *c, GossipMenuItems const &gso)
bool IsInsideObjective(Player *player) const
virtual void HandleKillImpl(Player *, Unit *)
void BroadcastPacket(WorldPacket &data) const
virtual void HandleKill(Player *killer, Unit *killed)
virtual bool HandleDropFlag(Player *player, uint32 spellId)
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
void SendUpdateWorldState(uint32 Field, uint32 Value)
WorldSession * GetSession() const
bool IsOutdoorPvPActive()
void setUInt16(const uint8 index, const uint16 value)
void setUInt32(const uint8 index, const uint32 value)
std::string const & GetName() const
void AddObjectToRemoveList()
bool PlayerLogout() const
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@155125343144143170177322306114162367114353163373 capturePoint