diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Battlefield/Battlefield.cpp | 24 | ||||
-rw-r--r-- | src/server/game/Battlefield/Battlefield.h | 11 | ||||
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.h | 4 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.h | 4 | ||||
-rw-r--r-- | src/server/game/OutdoorPvP/OutdoorPvP.cpp | 49 | ||||
-rw-r--r-- | src/server/game/OutdoorPvP/OutdoorPvP.h | 23 |
7 files changed, 62 insertions, 59 deletions
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 54c43673411..c9f2492617a 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -450,6 +450,25 @@ void Battlefield::SendUpdateWorldState(uint32 variable, uint32 value, bool hidde BroadcastPacketToZone(worldstate.Write()); } +void Battlefield::AddCapturePoint(BfCapturePoint* cp) +{ + Battlefield::BfCapturePointMap::iterator i = m_capturePoints.find(cp->GetCapturePointEntry()); + if (i != m_capturePoints.end()) + { + TC_LOG_ERROR("bg.battlefield", "Battlefield::AddCapturePoint: CapturePoint %s already exists!", cp->GetCapturePointEntry()); + delete i->second; + } + m_capturePoints[cp->GetCapturePointEntry()] = cp; +} + +BfCapturePoint* Battlefield::GetCapturePoint(uint32 entry) const +{ + Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(entry); + if (itr != m_capturePoints.end()) + return itr->second; + return nullptr; +} + void Battlefield::RegisterZone(uint32 zoneId) { sBattlefieldMgr->AddZone(zoneId, this); @@ -913,10 +932,11 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) TC_LOG_DEBUG("bg.battlefield", "Creating capture point %u", capturePoint->GetEntry()); m_capturePointGUID = capturePoint->GetGUID(); + m_capturePointEntry = capturePoint->GetEntry(); // check info existence GameObjectTemplate const* goinfo = capturePoint->GetGOInfo(); - if (goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) + if (goinfo->type != GAMEOBJECT_TYPE_CONTROL_ZONE) { TC_LOG_ERROR("misc", "OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry()); return false; @@ -927,7 +947,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) m_maxSpeed = m_maxValue / (goinfo->controlZone.minTime ? goinfo->controlZone.minTime : 60); m_neutralValuePct = goinfo->controlZone.neutralPercent; m_minValue = m_maxValue * goinfo->controlZone.neutralPercent / 100; - m_capturePointEntry = capturePoint->GetEntry(); + if (m_team == TEAM_ALLIANCE) { m_value = m_maxValue; diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 2ea1f100ee2..3fcfc22b941 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -402,15 +402,8 @@ class Battlefield : public ZoneScript void BroadcastPacketToWar(WorldPacket const* data) const; // CapturePoint system - void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints[cp->GetCapturePointEntry()] = cp; } - - BfCapturePoint* GetCapturePoint(uint32 lowguid) const - { - Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid); - if (itr != m_capturePoints.end()) - return itr->second; - return NULL; - } + void AddCapturePoint(BfCapturePoint* cp); + BfCapturePoint* GetCapturePoint(uint32 entry) const; void RegisterZone(uint32 zoneid); bool HasPlayer(Player* player) const; diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 239324c572d..ff89e3f7cc0 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -776,11 +776,11 @@ union GameObjectValue { uint32 MaxOpens; } FishingHole; - //29 GAMEOBJECT_TYPE_CAPTURE_POINT + //29 GAMEOBJECT_TYPE_CONTROL_ZONE struct { OPvPCapturePoint *OPvPObj; - } CapturePoint; + } ControlZone; //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING struct { diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index d588d048d3d..202165ffd57 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -156,11 +156,11 @@ bool normalizePlayerName(std::string& name) } // Extracts player and realm names delimited by - -ExtendedPlayerName ExtractExtendedPlayerName(std::string& name) +ExtendedPlayerName ExtractExtendedPlayerName(std::string const& name) { size_t pos = name.find('-'); if (pos != std::string::npos) - return ExtendedPlayerName(name.substr(0, pos), name.substr(pos+1)); + return ExtendedPlayerName(name.substr(0, pos), name.substr(pos + 1)); else return ExtendedPlayerName(name, ""); } @@ -1869,7 +1869,7 @@ ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, fl data.spawnMask = 1; data.go_state = GO_STATE_READY; data.phaseMask = PHASEMASK_NORMAL; - data.artKit = goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT ? 21 : 0; + data.artKit = goinfo->type == GAMEOBJECT_TYPE_CONTROL_ZONE ? 21 : 0; data.dbData = false; AddGameobjectToGrid(guid, &data); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 579cc7a5d4e..428d234fdb6 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -636,12 +636,12 @@ bool normalizePlayerName(std::string& name); struct ExtendedPlayerName { - ExtendedPlayerName(std::string const& name, std::string const& realm) : Name(name), Realm(realm) {} + ExtendedPlayerName(std::string const& name, std::string const& realm) : Name(name), Realm(realm) { } std::string Name; std::string Realm; }; -ExtendedPlayerName ExtractExtendedPlayerName(std::string& name); +ExtendedPlayerName ExtractExtendedPlayerName(std::string const& name); struct LanguageDesc { diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index a23d71e0fe8..089bba92c38 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -141,7 +141,7 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl // check info existence GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); - if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) + if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CONTROL_ZONE) { TC_LOG_ERROR("outdoorpvp", "OutdoorPvP: GO %u is not capture point!", entry); return false; @@ -548,21 +548,6 @@ bool OutdoorPvP::HandleDropFlag(Player* player, uint32 id) return false; } -bool OPvPCapturePoint::HandleGossipOption(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*id*/) -{ - return false; -} - -bool OPvPCapturePoint::CanTalkTo(Player* /*player*/, Creature* /*c*/, GossipMenuItems const& /*gso*/) -{ - return false; -} - -bool OPvPCapturePoint::HandleDropFlag(Player* /*player*/, uint32 /*id*/) -{ - return false; -} - int32 OPvPCapturePoint::HandleOpenGo(Player* /*player*/, ObjectGuid guid) { std::map<ObjectGuid, uint32>::iterator itr = m_ObjectTypes.find(guid); @@ -573,18 +558,32 @@ int32 OPvPCapturePoint::HandleOpenGo(Player* /*player*/, ObjectGuid guid) return -1; } -bool OutdoorPvP::HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/) -{ - return false; -} - -void OutdoorPvP::BroadcastPacket(WorldPacket &data) const +void OutdoorPvP::BroadcastPacket(WorldPacket const* data) const { // This is faster than sWorld->SendZoneMessage for (uint32 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) if (Player* const player = ObjectAccessor::FindPlayer(*itr)) - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(data); +} + +void OutdoorPvP::AddCapturePoint(OPvPCapturePoint* cp) +{ + OPvPCapturePointMap::iterator i = m_capturePoints.find(cp->m_capturePointGUID); + if (i != m_capturePoints.end()) + { + TC_LOG_ERROR("outdoorpvp", "OutdoorPvP::AddCapturePoint: CapturePoint %s already exists!", cp->m_capturePointGUID); + delete i->second; + } + m_capturePoints[cp->m_capturePointGUID] = cp; +} + +OPvPCapturePoint* OutdoorPvP::GetCapturePoint(ObjectGuid guid) const +{ + OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.find(guid); + if (itr != m_capturePoints.end()) + return itr->second; + return nullptr; } void OutdoorPvP::RegisterZone(uint32 zoneId) @@ -622,7 +621,7 @@ void OutdoorPvP::TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2) void OutdoorPvP::OnGameObjectCreate(GameObject* go) { - if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT) + if (go->GetGoType() != GAMEOBJECT_TYPE_CONTROL_ZONE) return; if (OPvPCapturePoint *cp = GetCapturePoint(go->GetGUID())) @@ -631,7 +630,7 @@ void OutdoorPvP::OnGameObjectCreate(GameObject* go) void OutdoorPvP::OnGameObjectRemove(GameObject* go) { - if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT) + if (go->GetGoType() != GAMEOBJECT_TYPE_CONTROL_ZONE) return; if (OPvPCapturePoint *cp = GetCapturePoint(go->GetGUID())) diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index 8f4475bce13..f550a35aff0 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -119,11 +119,11 @@ class OPvPCapturePoint virtual void SendChangePhase(); - virtual bool HandleGossipOption(Player* player, ObjectGuid guid, uint32 gossipid); + virtual bool HandleGossipOption(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*gossipId*/) { return false; } - virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso); + virtual bool CanTalkTo(Player* /*player*/, Creature* /*creature*/, GossipMenuItems const& /*gso*/) { return false; } - virtual bool HandleDropFlag(Player* player, uint32 spellId); + virtual bool HandleDropFlag(Player* /*player*/, uint32 /*spellId*/) { return false; } virtual void DeleteSpawns(); @@ -204,7 +204,7 @@ class OutdoorPvP : public ZoneScript virtual void FillInitialWorldStates(WorldPacket & /*data*/) { } // called when a player triggers an areatrigger - virtual bool HandleAreaTrigger(Player* player, uint32 trigger); + virtual bool HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/) { return false; } // called on custom spell virtual bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go); @@ -274,25 +274,16 @@ class OutdoorPvP : public ZoneScript // world state stuff virtual void SendRemoveWorldStates(Player* /*player*/) { } - void BroadcastPacket(WorldPacket & data) const; + void BroadcastPacket(WorldPacket const* data) const; virtual void HandlePlayerEnterZone(Player* player, uint32 zone); virtual void HandlePlayerLeaveZone(Player* player, uint32 zone); virtual void HandlePlayerResurrects(Player* player, uint32 zone); - void AddCapturePoint(OPvPCapturePoint* cp) - { - m_capturePoints[cp->m_capturePointGUID] = cp; - } + void AddCapturePoint(OPvPCapturePoint* cp); - OPvPCapturePoint * GetCapturePoint(ObjectGuid guid) const - { - OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.find(guid); - if (itr != m_capturePoints.end()) - return itr->second; - return NULL; - } + OPvPCapturePoint * GetCapturePoint(ObjectGuid guid) const; void RegisterZone(uint32 zoneid); |