aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-07-18 20:21:58 +0200
committerShauren <shauren.trinity@gmail.com>2022-07-18 20:21:58 +0200
commitc42e52f1719f3d5a59d51e4a32e266852395cf7e (patch)
tree44d133818817f7cfb838b015c6851a93929799da /src/server/game
parentcd4e0c592933295fe224d1fb3db2cb5cda83f21f (diff)
Core/OutdoorPvP: Move Halaa spawns to db using worldstate conditions
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/Maps/Map.cpp2
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvP.cpp25
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvP.h1
3 files changed, 22 insertions, 6 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 15e6a09b2b3..9b4313b0e33 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -3703,7 +3703,7 @@ void Map::UpdateSpawnGroupConditions()
if (shouldBeActive)
SpawnGroupSpawn(spawnGroupId);
else if (ASSERT_NOTNULL(GetSpawnGroupData(spawnGroupId))->flags & SPAWNGROUP_FLAG_DESPAWN_ON_CONDITION_FAILURE)
- SpawnGroupDespawn(spawnGroupId);
+ SpawnGroupDespawn(spawnGroupId, true);
else
SetSpawnGroupInactive(spawnGroupId);
}
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index 9e3d02b2d8c..8308280ac96 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -133,7 +133,7 @@ bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 map, Positi
return false;
}
-bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, Position const& pos, QuaternionData const& rot)
+bool OPvPCapturePoint::SetCapturePointData(uint32 entry)
{
TC_LOG_DEBUG("outdoorpvp", "Creating capture point %u", entry);
@@ -145,16 +145,31 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, Position co
return false;
}
- m_capturePointSpawnId = sObjectMgr->AddGameObjectData(entry, map, pos, rot, 0);
- if (!m_capturePointSpawnId)
- return false;
-
// get the needed values from goinfo
m_maxValue = (float)goinfo->controlZone.maxTime;
m_maxSpeed = m_maxValue / (goinfo->controlZone.minTime ? goinfo->controlZone.minTime : 60);
m_neutralValuePct = goinfo->controlZone.neutralPercent;
m_minValue = CalculatePct(m_maxValue, m_neutralValuePct);
+ return true;
+}
+
+bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, Position const& pos, QuaternionData const& rot)
+{
+ TC_LOG_DEBUG("outdoorpvp", "Creating capture point %u", entry);
+
+ // check info existence
+ GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
+ if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CONTROL_ZONE)
+ {
+ TC_LOG_ERROR("outdoorpvp", "OutdoorPvP: GO %u is not capture point!", entry);
+ return false;
+ }
+
+ m_capturePointSpawnId = sObjectMgr->AddGameObjectData(entry, map, pos, rot, 0);
+ if (!m_capturePointSpawnId)
+ return false;
+ SetCapturePointData(entry);
return true;
}
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h
index e271cdd595f..c051a39d6fd 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.h
@@ -128,6 +128,7 @@ class TC_GAME_API OPvPCapturePoint
void AddGO(uint32 type, ObjectGuid::LowType guid);
void AddCre(uint32 type, ObjectGuid::LowType guid);
+ bool SetCapturePointData(uint32 entry);
bool SetCapturePointData(uint32 entry, uint32 map, Position const& pos, QuaternionData const& rot);
protected: