Core/OutdoorPvP: Move remaining outdoorpvp spawns to db

Port From (https://github.com/TrinityCore/TrinityCore/commit/195341c807fa98e76608fb9449979f6be8b5362e)
This commit is contained in:
hondacrx
2022-07-19 11:47:09 -04:00
parent 9961b71f17
commit 2f1b3dae37
3 changed files with 59 additions and 31 deletions
+21 -6
View File
@@ -392,7 +392,7 @@ namespace Game.PvP
return false;
}
public bool SetCapturePointData(uint entry, uint map, Position pos, Quaternion rot)
public bool SetCapturePointData(uint entry)
{
Log.outDebug(LogFilter.Outdoorpvp, "Creating capture point {0}", entry);
@@ -404,19 +404,34 @@ namespace Game.PvP
return false;
}
m_capturePointSpawnId = Global.ObjectMgr.AddGameObjectData(entry, map, pos, rot, 0);
if (m_capturePointSpawnId == 0)
return false;
// get the needed values from goinfo
m_maxValue = goinfo.ControlZone.maxTime;
m_maxSpeed = m_maxValue / (goinfo.ControlZone.minTime != 0 ? goinfo.ControlZone.minTime : 60);
m_neutralValuePct = goinfo.ControlZone.neutralPercent;
m_minValue = MathFunctions.CalculatePct(m_maxValue, m_neutralValuePct);
return true;
}
public bool SetCapturePointData(uint entry, uint map, Position pos, Quaternion rot)
{
Log.outDebug(LogFilter.Outdoorpvp, $"Creating capture point {entry}");
// check info existence
GameObjectTemplate goinfo = Global.ObjectMgr.GetGameObjectTemplate(entry);
if (goinfo == null || goinfo.type != GameObjectTypes.ControlZone)
{
Log.outError(LogFilter.Outdoorpvp, $"OutdoorPvP: GO {entry} is not capture point!");
return false;
}
m_capturePointSpawnId = Global.ObjectMgr.AddGameObjectData(entry, map, pos, rot, 0);
if (m_capturePointSpawnId == 0)
return false;
SetCapturePointData(entry);
return true;
}
public bool DelCreature(uint type)
{
if (!m_Creatures.ContainsKey(type))