Core/Battlegrounds: Use fields from DB2/battleground_template data in the Battleground Class
Port From (https://github.com/TrinityCore/TrinityCore/commit/d7623adf0e6b8c5cdc1e468b89172ed7db63fe92)
This commit is contained in:
@@ -27,7 +27,7 @@ namespace Game.Arenas
|
|||||||
{
|
{
|
||||||
public class Arena : Battleground
|
public class Arena : Battleground
|
||||||
{
|
{
|
||||||
public Arena()
|
public Arena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate)
|
||||||
{
|
{
|
||||||
StartDelayTimes[BattlegroundConst.EventIdFirst] = BattlegroundStartTimeIntervals.Delay1m;
|
StartDelayTimes[BattlegroundConst.EventIdFirst] = BattlegroundStartTimeIntervals.Delay1m;
|
||||||
StartDelayTimes[BattlegroundConst.EventIdSecond] = BattlegroundStartTimeIntervals.Delay30s;
|
StartDelayTimes[BattlegroundConst.EventIdSecond] = BattlegroundStartTimeIntervals.Delay30s;
|
||||||
|
|||||||
@@ -18,11 +18,14 @@
|
|||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
using Game.Network.Packets;
|
using Game.Network.Packets;
|
||||||
|
using Game.BattleGrounds;
|
||||||
|
|
||||||
namespace Game.Arenas
|
namespace Game.Arenas
|
||||||
{
|
{
|
||||||
public class BladesEdgeArena : Arena
|
public class BladesEdgeArena : Arena
|
||||||
{
|
{
|
||||||
|
public BladesEdgeArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate) { }
|
||||||
|
|
||||||
public override void StartingEventCloseDoors()
|
public override void StartingEventCloseDoors()
|
||||||
{
|
{
|
||||||
for (int i = BladeEdgeObjectTypes.Door1; i <= BladeEdgeObjectTypes.Door4; ++i)
|
for (int i = BladeEdgeObjectTypes.Door1; i <= BladeEdgeObjectTypes.Door4; ++i)
|
||||||
|
|||||||
@@ -19,12 +19,13 @@ using Framework.Constants;
|
|||||||
using Framework.Dynamic;
|
using Framework.Dynamic;
|
||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
using Game.Network.Packets;
|
using Game.Network.Packets;
|
||||||
|
using Game.BattleGrounds;
|
||||||
|
|
||||||
namespace Game.Arenas
|
namespace Game.Arenas
|
||||||
{
|
{
|
||||||
class DalaranSewersArena : Arena
|
class DalaranSewersArena : Arena
|
||||||
{
|
{
|
||||||
public DalaranSewersArena()
|
public DalaranSewersArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate)
|
||||||
{
|
{
|
||||||
_events = new EventMap();
|
_events = new EventMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,14 @@
|
|||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
using Game.Network.Packets;
|
using Game.Network.Packets;
|
||||||
|
using Game.BattleGrounds;
|
||||||
|
|
||||||
namespace Game.Arenas
|
namespace Game.Arenas
|
||||||
{
|
{
|
||||||
public class NagrandArena : Arena
|
public class NagrandArena : Arena
|
||||||
{
|
{
|
||||||
|
public NagrandArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate) { }
|
||||||
|
|
||||||
public override void StartingEventCloseDoors()
|
public override void StartingEventCloseDoors()
|
||||||
{
|
{
|
||||||
for (int i = NagrandArenaObjectTypes.Door1; i <= NagrandArenaObjectTypes.Door4; ++i)
|
for (int i = NagrandArenaObjectTypes.Door1; i <= NagrandArenaObjectTypes.Door4; ++i)
|
||||||
|
|||||||
@@ -19,12 +19,13 @@ using Framework.Constants;
|
|||||||
using Framework.Dynamic;
|
using Framework.Dynamic;
|
||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
using Game.Network.Packets;
|
using Game.Network.Packets;
|
||||||
|
using Game.BattleGrounds;
|
||||||
|
|
||||||
namespace Game.Arenas
|
namespace Game.Arenas
|
||||||
{
|
{
|
||||||
class RingofValorArena : Arena
|
class RingofValorArena : Arena
|
||||||
{
|
{
|
||||||
public RingofValorArena()
|
public RingofValorArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate)
|
||||||
{
|
{
|
||||||
_events = new EventMap();
|
_events = new EventMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,14 @@
|
|||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
using Game.Network.Packets;
|
using Game.Network.Packets;
|
||||||
|
using Game.BattleGrounds;
|
||||||
|
|
||||||
namespace Game.Arenas
|
namespace Game.Arenas
|
||||||
{
|
{
|
||||||
class RuinsofLordaeronArena : Arena
|
class RuinsofLordaeronArena : Arena
|
||||||
{
|
{
|
||||||
|
public RuinsofLordaeronArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate) { }
|
||||||
|
|
||||||
public override bool SetupBattleground()
|
public override bool SetupBattleground()
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|||||||
@@ -35,14 +35,12 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
public class Battleground : IDisposable
|
public class Battleground : IDisposable
|
||||||
{
|
{
|
||||||
public Battleground()
|
public Battleground(BattlegroundTemplate battlegroundTemplate)
|
||||||
{
|
{
|
||||||
m_TypeID = BattlegroundTypeId.None;
|
_battlegroundTemplate = battlegroundTemplate;
|
||||||
m_RandomTypeID = BattlegroundTypeId.None;
|
m_RandomTypeID = BattlegroundTypeId.None;
|
||||||
m_Status = BattlegroundStatus.None;
|
m_Status = BattlegroundStatus.None;
|
||||||
m_BracketId = BattlegroundBracketId.First;
|
|
||||||
_winnerTeamId = BattlegroundTeamId.Neutral;
|
_winnerTeamId = BattlegroundTeamId.Neutral;
|
||||||
m_Name = "";
|
|
||||||
|
|
||||||
m_HonorMode = BGHonorMode.Normal;
|
m_HonorMode = BGHonorMode.Normal;
|
||||||
|
|
||||||
@@ -171,11 +169,11 @@ namespace Game.BattleGrounds
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
Position pos = player.GetPosition();
|
Position pos = player.GetPosition();
|
||||||
Position startPos = GetTeamStartPosition(GetTeamIndexByTeamId(player.GetBGTeam()));
|
WorldSafeLocsEntry startPos = GetTeamStartPosition(GetTeamIndexByTeamId(player.GetBGTeam()));
|
||||||
if (pos.GetExactDistSq(startPos) > maxDist)
|
if (pos.GetExactDistSq(startPos.Loc) > maxDist)
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Battleground, "Battleground: Sending {0} back to start location (map: {1}) (possible exploit)", player.GetName(), GetMapId());
|
Log.outDebug(LogFilter.Battleground, $"Battleground: Sending {player.GetName()} back to start location (map: {GetMapId()}) (possible exploit)");
|
||||||
player.TeleportTo(GetMapId(), startPos.GetPositionX(), startPos.GetPositionY(), startPos.GetPositionZ(), startPos.GetOrientation());
|
player.TeleportTo(startPos.Loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -364,7 +362,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
if (!FindBgMap())
|
if (!FindBgMap())
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Battleground, "Battleground._ProcessJoin: map (map id: {0}, instance id: {1}) is not created!", m_MapId, m_InstanceID);
|
Log.outError(LogFilter.Battleground, $"Battleground._ProcessJoin: map (map id: {GetMapId()}, instance id: {m_InstanceID}) is not created!");
|
||||||
EndNow();
|
EndNow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -418,7 +416,7 @@ namespace Game.BattleGrounds
|
|||||||
if (player)
|
if (player)
|
||||||
{
|
{
|
||||||
// BG Status packet
|
// BG Status packet
|
||||||
BattlegroundQueueTypeId bgQueueTypeId = Global.BattlegroundMgr.BGQueueTypeId(m_TypeID, GetArenaType());
|
BattlegroundQueueTypeId bgQueueTypeId = Global.BattlegroundMgr.BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||||
uint queueSlot = player.GetBattlegroundQueueIndex(bgQueueTypeId);
|
uint queueSlot = player.GetBattlegroundQueueIndex(bgQueueTypeId);
|
||||||
|
|
||||||
BattlefieldStatusActive battlefieldStatus;
|
BattlefieldStatusActive battlefieldStatus;
|
||||||
@@ -493,7 +491,7 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
player = Global.ObjAccessor.FindPlayer(guid);
|
player = Global.ObjAccessor.FindPlayer(guid);
|
||||||
if (!player)
|
if (!player)
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.{0}: player ({1}) not found for BG (map: {1}, instance id: {2})!", context, guid.ToString(), m_MapId, m_InstanceID);
|
Log.outError(LogFilter.Battleground, $"Battleground.{context}: player ({guid}) not found for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
}
|
}
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
@@ -523,12 +521,17 @@ namespace Game.BattleGrounds
|
|||||||
return m_Map;
|
return m_Map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTeamStartPosition(int teamIndex, Position pos)
|
public WorldSafeLocsEntry GetTeamStartPosition(int teamId)
|
||||||
{
|
{
|
||||||
Cypher.Assert(teamIndex < TeamId.Neutral);
|
Cypher.Assert(teamId < TeamId.Neutral);
|
||||||
StartPosition[teamIndex] = pos;
|
return _battlegroundTemplate.StartLocation[teamId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float GetStartMaxDist()
|
||||||
|
{
|
||||||
|
return _battlegroundTemplate.MaxStartDistSq;
|
||||||
|
}
|
||||||
|
|
||||||
void SendPacketToAll(ServerPacket packet)
|
void SendPacketToAll(ServerPacket packet)
|
||||||
{
|
{
|
||||||
foreach (var pair in m_Players)
|
foreach (var pair in m_Players)
|
||||||
@@ -806,6 +809,11 @@ namespace Game.BattleGrounds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint GetScriptId()
|
||||||
|
{
|
||||||
|
return _battlegroundTemplate.ScriptId;
|
||||||
|
}
|
||||||
|
|
||||||
public uint GetBonusHonorFromKill(uint kills)
|
public uint GetBonusHonorFromKill(uint kills)
|
||||||
{
|
{
|
||||||
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
|
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
|
||||||
@@ -937,8 +945,7 @@ namespace Game.BattleGrounds
|
|||||||
m_Events = 0;
|
m_Events = 0;
|
||||||
|
|
||||||
if (m_InvitedAlliance > 0 || m_InvitedHorde > 0)
|
if (m_InvitedAlliance > 0 || m_InvitedHorde > 0)
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.Reset: one of the counters is not 0 (Team.Alliance: {0}, Team.Horde: {1}) for BG (map: {2}, instance id: {3})!",
|
Log.outError(LogFilter.Battleground, $"Battleground.Reset: one of the counters is not 0 (Team.Alliance: {m_InvitedAlliance}, Team.Horde: {m_InvitedHorde}) for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
m_InvitedAlliance, m_InvitedHorde, m_MapId, m_InstanceID);
|
|
||||||
|
|
||||||
m_InvitedAlliance = 0;
|
m_InvitedAlliance = 0;
|
||||||
m_InvitedHorde = 0;
|
m_InvitedHorde = 0;
|
||||||
@@ -1000,7 +1007,7 @@ namespace Game.BattleGrounds
|
|||||||
SendPacketToTeam(team, playerJoined, player);
|
SendPacketToTeam(team, playerJoined, player);
|
||||||
|
|
||||||
// BG Status packet
|
// BG Status packet
|
||||||
BattlegroundQueueTypeId bgQueueTypeId = Global.BattlegroundMgr.BGQueueTypeId(m_TypeID, GetArenaType());
|
BattlegroundQueueTypeId bgQueueTypeId = Global.BattlegroundMgr.BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||||
uint queueSlot = player.GetBattlegroundQueueIndex(bgQueueTypeId);
|
uint queueSlot = player.GetBattlegroundQueueIndex(bgQueueTypeId);
|
||||||
|
|
||||||
BattlefieldStatusActive battlefieldStatus;
|
BattlefieldStatusActive battlefieldStatus;
|
||||||
@@ -1125,7 +1132,7 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
if (!m_InBGFreeSlotQueue && IsBattleground())
|
if (!m_InBGFreeSlotQueue && IsBattleground())
|
||||||
{
|
{
|
||||||
Global.BattlegroundMgr.AddToBGFreeSlotQueue(m_TypeID, this);
|
Global.BattlegroundMgr.AddToBGFreeSlotQueue(GetTypeID(), this);
|
||||||
m_InBGFreeSlotQueue = true;
|
m_InBGFreeSlotQueue = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1135,7 +1142,7 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
if (m_InBGFreeSlotQueue)
|
if (m_InBGFreeSlotQueue)
|
||||||
{
|
{
|
||||||
Global.BattlegroundMgr.RemoveFromBGFreeSlotQueue(m_TypeID, m_InstanceID);
|
Global.BattlegroundMgr.RemoveFromBGFreeSlotQueue(GetTypeID(), m_InstanceID);
|
||||||
m_InBGFreeSlotQueue = false;
|
m_InBGFreeSlotQueue = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1206,6 +1213,16 @@ namespace Game.BattleGrounds
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsArena()
|
||||||
|
{
|
||||||
|
return _battlegroundTemplate.IsArena();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsBattleground()
|
||||||
|
{
|
||||||
|
return !IsArena();
|
||||||
|
}
|
||||||
|
|
||||||
public bool HasFreeSlots()
|
public bool HasFreeSlots()
|
||||||
{
|
{
|
||||||
return GetPlayersSize() < GetMaxPlayers();
|
return GetPlayersSize() < GetMaxPlayers();
|
||||||
@@ -1313,8 +1330,8 @@ namespace Game.BattleGrounds
|
|||||||
// Temporally add safety check for bad spawns and send log (object rotations need to be rechecked in sniff)
|
// Temporally add safety check for bad spawns and send log (object rotations need to be rechecked in sniff)
|
||||||
if (rotation0 == 0 && rotation1 == 0 && rotation2 == 0 && rotation3 == 0)
|
if (rotation0 == 0 && rotation1 == 0 && rotation2 == 0 && rotation3 == 0)
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Battleground, "Battleground.AddObject: gameoobject [entry: {0}, object type: {1}] for BG (map: {2}) has zeroed rotation fields, " +
|
Log.outDebug(LogFilter.Battleground, $"Battleground.AddObject: gameoobject [entry: {entry}, object type: {type}] for BG (map: {GetMapId()}) has zeroed rotation fields, " +
|
||||||
"orientation used temporally, but please fix the spawn", entry, type, m_MapId);
|
"orientation used temporally, but please fix the spawn");
|
||||||
|
|
||||||
rotation = Quaternion.fromEulerAnglesZYX(o, 0.0f, 0.0f);
|
rotation = Quaternion.fromEulerAnglesZYX(o, 0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
@@ -1325,7 +1342,7 @@ namespace Game.BattleGrounds
|
|||||||
GameObject go = GameObject.CreateGameObject(entry, GetBgMap(), new Position(x, y, z, o), rotation, 255, goState);
|
GameObject go = GameObject.CreateGameObject(entry, GetBgMap(), new Position(x, y, z, o), rotation, 255, goState);
|
||||||
if (!go)
|
if (!go)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.AddObject: cannot create gameobject (entry: {0}) for BG (map: {1}, instance id: {2})!", entry, m_MapId, m_InstanceID);
|
Log.outError(LogFilter.Battleground, $"Battleground.AddObject: cannot create gameobject (entry: {entry}) for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1357,8 +1374,7 @@ namespace Game.BattleGrounds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.DoorClose: door gameobject (type: {0}, {1}) not found for BG (map: {2}, instance id: {3})!",
|
Log.outError(LogFilter.Battleground, $"Battleground.DoorClose: door gameobject (type: {type}, {BgObjects[type]}) not found for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
type, BgObjects[type].ToString(), m_MapId, m_InstanceID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoorOpen(int type)
|
public void DoorOpen(int type)
|
||||||
@@ -1370,8 +1386,7 @@ namespace Game.BattleGrounds
|
|||||||
obj.SetGoState(GameObjectState.Active);
|
obj.SetGoState(GameObjectState.Active);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.DoorOpen: door gameobject (type: {0}, {1}) not found for BG (map: {2}, instance id: {3})!",
|
Log.outError(LogFilter.Battleground, $"Battleground.DoorOpen: door gameobject (type: {type}, {BgObjects[type]}) not found for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
type, BgObjects[type].ToString(), m_MapId, m_InstanceID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameObject GetBGObject(int type)
|
public GameObject GetBGObject(int type)
|
||||||
@@ -1381,7 +1396,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
GameObject obj = GetBgMap().GetGameObject(BgObjects[type]);
|
GameObject obj = GetBgMap().GetGameObject(BgObjects[type]);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.GetBGObject: gameobject (type: {0}, {1}) not found for BG (map: {2}, instance id: {3})!", type, BgObjects[type].ToString(), m_MapId, m_InstanceID);
|
Log.outError(LogFilter.Battleground, $"Battleground.GetBGObject: gameobject (type: {type}, {BgObjects[type]}) not found for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@@ -1393,11 +1408,16 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
Creature creature = GetBgMap().GetCreature(BgCreatures[type]);
|
Creature creature = GetBgMap().GetCreature(BgCreatures[type]);
|
||||||
if (!creature)
|
if (!creature)
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.GetBGCreature: creature (type: {0}, {1}) not found for BG (map: {2}, instance id: {3})!", type, BgCreatures[type].ToString(), m_MapId, m_InstanceID);
|
Log.outError(LogFilter.Battleground, $"Battleground.GetBGCreature: creature (type: {type}, {BgCreatures[type]}) not found for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
|
|
||||||
return creature;
|
return creature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint GetMapId()
|
||||||
|
{
|
||||||
|
return _battlegroundTemplate.BattlemasterEntry.MapId[0];
|
||||||
|
}
|
||||||
|
|
||||||
public void SpawnBGObject(int type, uint respawntime)
|
public void SpawnBGObject(int type, uint respawntime)
|
||||||
{
|
{
|
||||||
Map map = FindBgMap();
|
Map map = FindBgMap();
|
||||||
@@ -1428,7 +1448,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
if (Global.ObjectMgr.GetCreatureTemplate(entry) == null)
|
if (Global.ObjectMgr.GetCreatureTemplate(entry) == null)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Battleground, $"Battleground.AddCreature: creature template (entry: {entry}) does not exist for BG (map: {m_MapId}, instance id: {m_InstanceID})!");
|
Log.outError(LogFilter.Battleground, $"Battleground.AddCreature: creature template (entry: {entry}) does not exist for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1450,8 +1470,7 @@ namespace Game.BattleGrounds
|
|||||||
Creature creature = Creature.CreateCreature(entry, map, pos);
|
Creature creature = Creature.CreateCreature(entry, map, pos);
|
||||||
if (!creature)
|
if (!creature)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.AddCreature: cannot create creature (entry: {0}) for BG (map: {1}, instance id: {2})!",
|
Log.outError(LogFilter.Battleground, $"Battleground.AddCreature: cannot create creature (entry: {entry}) for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
entry, m_MapId, m_InstanceID);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1486,8 +1505,7 @@ namespace Game.BattleGrounds
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.DelCreature: creature (type: {0}, {1}) not found for BG (map: {2}, instance id: {3})!",
|
Log.outError(LogFilter.Battleground, $"Battleground.DelCreature: creature (type: {type}, {BgCreatures[type]}) not found for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
type, BgCreatures[type].ToString(), m_MapId, m_InstanceID);
|
|
||||||
BgCreatures[type].Clear();
|
BgCreatures[type].Clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1505,7 +1523,7 @@ namespace Game.BattleGrounds
|
|||||||
BgObjects[type].Clear();
|
BgObjects[type].Clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.DelObject: gameobject (type: {0}, {1}) not found for BG (map: {2}, instance id: {3})!", type, BgObjects[type].ToString(), m_MapId, m_InstanceID);
|
Log.outError(LogFilter.Battleground, $"Battleground.DelObject: gameobject (type: {type}, {BgObjects[type]}) not found for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
BgObjects[type].Clear();
|
BgObjects[type].Clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1528,8 +1546,7 @@ namespace Game.BattleGrounds
|
|||||||
//creature.CastSpell(creature, SPELL_SPIRIT_HEAL_CHANNEL, true);
|
//creature.CastSpell(creature, SPELL_SPIRIT_HEAL_CHANNEL, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.AddSpiritGuide: cannot create spirit guide (type: {0}, entry: {1}) for BG (map: {2}, instance id: {3})!",
|
Log.outError(LogFilter.Battleground, $"Battleground.AddSpiritGuide: cannot create spirit guide (type: {type}, entry: {entry}) for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
type, entry, m_MapId, m_InstanceID);
|
|
||||||
EndNow();
|
EndNow();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1581,8 +1598,7 @@ namespace Game.BattleGrounds
|
|||||||
index--;
|
index--;
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.HandleTriggerBuff: cannot find buff gameobject ({0}, entry: {1}, type: {2}) in internal data for BG (map: {3}, instance id: {4})!",
|
Log.outError(LogFilter.Battleground, $"Battleground.HandleTriggerBuff: cannot find buff gameobject ({goGuid}, entry: {obj.GetEntry()}, type: {obj.GetGoType()}) in internal data for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||||
goGuid.ToString(), obj.GetEntry(), obj.GetGoType(), m_MapId, m_InstanceID);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1714,8 +1730,7 @@ namespace Game.BattleGrounds
|
|||||||
for (int i = 0; i < BgObjects.Length; ++i)
|
for (int i = 0; i < BgObjects.Length; ++i)
|
||||||
if (BgObjects[i] == guid)
|
if (BgObjects[i] == guid)
|
||||||
return i;
|
return i;
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.GetObjectType: player used gameobject ({0}) which is not in internal data for BG (map: {1}, instance id: {2}), cheating?",
|
Log.outError(LogFilter.Battleground, $"Battleground.GetObjectType: player used gameobject ({guid}) which is not in internal data for BG (map: {GetMapId()}, instance id: {m_InstanceID}), cheating?");
|
||||||
guid.ToString(), m_MapId, m_InstanceID);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1746,8 +1761,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
public void SetBracket(PvpDifficultyRecord bracketEntry)
|
public void SetBracket(PvpDifficultyRecord bracketEntry)
|
||||||
{
|
{
|
||||||
m_BracketId = bracketEntry.GetBracketId();
|
_pvpDifficultyEntry = bracketEntry;
|
||||||
SetLevelRange(bracketEntry.MinLevel, bracketEntry.MaxLevel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RewardXPAtKill(Player killer, Player victim)
|
void RewardXPAtKill(Player killer, Player victim)
|
||||||
@@ -1782,11 +1796,82 @@ namespace Game.BattleGrounds
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetName()
|
||||||
|
{
|
||||||
|
return _battlegroundTemplate.BattlemasterEntry.Name[Global.WorldMgr.GetDefaultDbcLocale()];
|
||||||
|
}
|
||||||
|
|
||||||
|
public ulong GetQueueId()
|
||||||
|
{
|
||||||
|
return (ulong)_battlegroundTemplate.Id | 0x1F10000000000000ul;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BattlegroundTypeId GetTypeID(bool getRandom = false)
|
||||||
|
{
|
||||||
|
return getRandom ? m_RandomTypeID : _battlegroundTemplate.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BattlegroundBracketId GetBracketId()
|
||||||
|
{
|
||||||
|
return _pvpDifficultyEntry.GetBracketId();
|
||||||
|
}
|
||||||
|
|
||||||
byte GetUniqueBracketId()
|
byte GetUniqueBracketId()
|
||||||
{
|
{
|
||||||
return (byte)((GetMinLevel() / 5) - 1); // 10 - 1, 15 - 2, 20 - 3, etc.
|
return (byte)((GetMinLevel() / 5) - 1); // 10 - 1, 15 - 2, 20 - 3, etc.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint GetMaxPlayers()
|
||||||
|
{
|
||||||
|
return GetMaxPlayersPerTeam() * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint GetMinPlayers()
|
||||||
|
{
|
||||||
|
return GetMinPlayersPerTeam() * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint GetMinLevel()
|
||||||
|
{
|
||||||
|
if (_pvpDifficultyEntry != null)
|
||||||
|
return _pvpDifficultyEntry.MinLevel;
|
||||||
|
|
||||||
|
return _battlegroundTemplate.GetMinLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint GetMaxLevel()
|
||||||
|
{
|
||||||
|
if (_pvpDifficultyEntry != null)
|
||||||
|
return _pvpDifficultyEntry.MaxLevel;
|
||||||
|
|
||||||
|
return _battlegroundTemplate.GetMaxLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint GetMaxPlayersPerTeam()
|
||||||
|
{
|
||||||
|
if (IsArena())
|
||||||
|
{
|
||||||
|
switch (GetArenaType())
|
||||||
|
{
|
||||||
|
case ArenaTypes.Team2v2:
|
||||||
|
return 2;
|
||||||
|
case ArenaTypes.Team3v3:
|
||||||
|
return 3;
|
||||||
|
case ArenaTypes.Team5v5: // removed
|
||||||
|
return 5;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _battlegroundTemplate.GetMaxPlayersPerTeam();
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint GetMinPlayersPerTeam()
|
||||||
|
{
|
||||||
|
return _battlegroundTemplate.GetMinPlayersPerTeam();
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void StartingEventCloseDoors() { }
|
public virtual void StartingEventCloseDoors() { }
|
||||||
public virtual void StartingEventOpenDoors() { }
|
public virtual void StartingEventOpenDoors() { }
|
||||||
public virtual void ResetBGSubclass() { } // must be implemented in BG subclass
|
public virtual void ResetBGSubclass() { } // must be implemented in BG subclass
|
||||||
@@ -1794,34 +1879,18 @@ namespace Game.BattleGrounds
|
|||||||
public virtual void DestroyGate(Player player, GameObject go) { }
|
public virtual void DestroyGate(Player player, GameObject go) { }
|
||||||
public virtual bool IsAllNodesControlledByTeam(Team team) { return false; }
|
public virtual bool IsAllNodesControlledByTeam(Team team) { return false; }
|
||||||
|
|
||||||
public string GetName() { return m_Name; }
|
|
||||||
public ulong GetQueueId() { return m_queueId; }
|
|
||||||
public BattlegroundTypeId GetTypeID(bool GetRandom = false) { return GetRandom ? m_RandomTypeID : m_TypeID; }
|
|
||||||
public BattlegroundBracketId GetBracketId() { return m_BracketId; }
|
|
||||||
public uint GetInstanceID() { return m_InstanceID; }
|
public uint GetInstanceID() { return m_InstanceID; }
|
||||||
public BattlegroundStatus GetStatus() { return m_Status; }
|
public BattlegroundStatus GetStatus() { return m_Status; }
|
||||||
public uint GetClientInstanceID() { return m_ClientInstanceID; }
|
public uint GetClientInstanceID() { return m_ClientInstanceID; }
|
||||||
public uint GetElapsedTime() { return m_StartTime; }
|
public uint GetElapsedTime() { return m_StartTime; }
|
||||||
public uint GetRemainingTime() { return (uint)m_EndTime; }
|
public uint GetRemainingTime() { return (uint)m_EndTime; }
|
||||||
public uint GetLastResurrectTime() { return m_LastResurrectTime; }
|
public uint GetLastResurrectTime() { return m_LastResurrectTime; }
|
||||||
uint GetMaxPlayers() { return m_MaxPlayers; }
|
|
||||||
uint GetMinPlayers() { return m_MinPlayers; }
|
|
||||||
|
|
||||||
public uint GetMinLevel() { return m_LevelMin; }
|
|
||||||
public uint GetMaxLevel() { return m_LevelMax; }
|
|
||||||
|
|
||||||
public uint GetMaxPlayersPerTeam() { return m_MaxPlayersPerTeam; }
|
|
||||||
public uint GetMinPlayersPerTeam() { return m_MinPlayersPerTeam; }
|
|
||||||
|
|
||||||
int GetStartDelayTime() { return m_StartDelayTime; }
|
int GetStartDelayTime() { return m_StartDelayTime; }
|
||||||
public ArenaTypes GetArenaType() { return m_ArenaType; }
|
public ArenaTypes GetArenaType() { return m_ArenaType; }
|
||||||
BattlegroundTeamId GetWinner() { return _winnerTeamId; }
|
BattlegroundTeamId GetWinner() { return _winnerTeamId; }
|
||||||
uint GetScriptId() { return ScriptId; }
|
|
||||||
public bool IsRandom() { return m_IsRandom; }
|
public bool IsRandom() { return m_IsRandom; }
|
||||||
|
|
||||||
public void SetQueueId(ulong queueId) { m_queueId = queueId; }
|
|
||||||
public void SetName(string Name) { m_Name = Name; }
|
|
||||||
public void SetTypeID(BattlegroundTypeId TypeID) { m_TypeID = TypeID; }
|
|
||||||
public void SetRandomTypeID(BattlegroundTypeId TypeID) { m_RandomTypeID = TypeID; }
|
public void SetRandomTypeID(BattlegroundTypeId TypeID) { m_RandomTypeID = TypeID; }
|
||||||
//here we can count minlevel and maxlevel for players
|
//here we can count minlevel and maxlevel for players
|
||||||
public void SetInstanceID(uint InstanceID) { m_InstanceID = InstanceID; }
|
public void SetInstanceID(uint InstanceID) { m_InstanceID = InstanceID; }
|
||||||
@@ -1830,21 +1899,13 @@ namespace Game.BattleGrounds
|
|||||||
public void SetElapsedTime(uint Time) { m_StartTime = Time; }
|
public void SetElapsedTime(uint Time) { m_StartTime = Time; }
|
||||||
public void SetRemainingTime(uint Time) { m_EndTime = (int)Time; }
|
public void SetRemainingTime(uint Time) { m_EndTime = (int)Time; }
|
||||||
public void SetLastResurrectTime(uint Time) { m_LastResurrectTime = Time; }
|
public void SetLastResurrectTime(uint Time) { m_LastResurrectTime = Time; }
|
||||||
public void SetMaxPlayers(uint MaxPlayers) { m_MaxPlayers = MaxPlayers; }
|
|
||||||
public void SetMinPlayers(uint MinPlayers) { m_MinPlayers = MinPlayers; }
|
|
||||||
public void SetLevelRange(uint min, uint max) { m_LevelMin = min; m_LevelMax = max; }
|
|
||||||
public void SetRated(bool state) { m_IsRated = state; }
|
public void SetRated(bool state) { m_IsRated = state; }
|
||||||
public void SetArenaType(ArenaTypes type) { m_ArenaType = type; }
|
public void SetArenaType(ArenaTypes type) { m_ArenaType = type; }
|
||||||
public void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; }
|
|
||||||
public void SetWinner(BattlegroundTeamId winnerTeamId) { _winnerTeamId = winnerTeamId; }
|
public void SetWinner(BattlegroundTeamId winnerTeamId) { _winnerTeamId = winnerTeamId; }
|
||||||
public void SetScriptId(uint scriptId) { ScriptId = scriptId; }
|
|
||||||
|
|
||||||
void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; }
|
void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; }
|
||||||
void SetStartDelayTime(BattlegroundStartTimeIntervals Time) { m_StartDelayTime = (int)Time; }
|
void SetStartDelayTime(BattlegroundStartTimeIntervals Time) { m_StartDelayTime = (int)Time; }
|
||||||
|
|
||||||
public void SetMaxPlayersPerTeam(uint MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; }
|
|
||||||
public void SetMinPlayersPerTeam(uint MinPlayers) { m_MinPlayersPerTeam = MinPlayers; }
|
|
||||||
|
|
||||||
public void DecreaseInvitedCount(Team team)
|
public void DecreaseInvitedCount(Team team)
|
||||||
{
|
{
|
||||||
if (team == Team.Alliance)
|
if (team == Team.Alliance)
|
||||||
@@ -1863,8 +1924,6 @@ namespace Game.BattleGrounds
|
|||||||
public void SetRandom(bool isRandom) { m_IsRandom = isRandom; }
|
public void SetRandom(bool isRandom) { m_IsRandom = isRandom; }
|
||||||
uint GetInvitedCount(Team team) { return (team == Team.Alliance) ? m_InvitedAlliance : m_InvitedHorde; }
|
uint GetInvitedCount(Team team) { return (team == Team.Alliance) ? m_InvitedAlliance : m_InvitedHorde; }
|
||||||
|
|
||||||
public bool IsArena() { return m_IsArena; }
|
|
||||||
public bool IsBattleground() { return !m_IsArena; }
|
|
||||||
public bool IsRated() { return m_IsRated; }
|
public bool IsRated() { return m_IsRated; }
|
||||||
|
|
||||||
public Dictionary<ObjectGuid, BattlegroundPlayer> GetPlayers() { return m_Players; }
|
public Dictionary<ObjectGuid, BattlegroundPlayer> GetPlayers() { return m_Players; }
|
||||||
@@ -1872,21 +1931,9 @@ namespace Game.BattleGrounds
|
|||||||
uint GetPlayerScoresSize() { return (uint)PlayerScores.Count; }
|
uint GetPlayerScoresSize() { return (uint)PlayerScores.Count; }
|
||||||
uint GetReviveQueueSize() { return (uint)m_ReviveQueue.Count; }
|
uint GetReviveQueueSize() { return (uint)m_ReviveQueue.Count; }
|
||||||
|
|
||||||
public void SetMapId(uint MapID) { m_MapId = MapID; }
|
|
||||||
public uint GetMapId() { return m_MapId; }
|
|
||||||
|
|
||||||
public void SetBgMap(BattlegroundMap map) { m_Map = map; }
|
public void SetBgMap(BattlegroundMap map) { m_Map = map; }
|
||||||
BattlegroundMap FindBgMap() { return m_Map; }
|
BattlegroundMap FindBgMap() { return m_Map; }
|
||||||
|
|
||||||
public Position GetTeamStartPosition(int teamIndex)
|
|
||||||
{
|
|
||||||
Cypher.Assert(teamIndex < TeamId.Neutral);
|
|
||||||
return StartPosition[teamIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; }
|
|
||||||
float GetStartMaxDist() { return m_StartMaxDist; }
|
|
||||||
|
|
||||||
public virtual void FillInitialWorldStates(InitWorldStates data) { }
|
public virtual void FillInitialWorldStates(InitWorldStates data) { }
|
||||||
|
|
||||||
Group GetBgRaid(Team team) { return m_BgRaids[GetTeamIndexByTeamId(team)]; }
|
Group GetBgRaid(Team team) { return m_BgRaids[GetTeamIndexByTeamId(team)]; }
|
||||||
@@ -1927,7 +1974,7 @@ namespace Game.BattleGrounds
|
|||||||
public bool ToBeDeleted() { return m_SetDeleteThis; }
|
public bool ToBeDeleted() { return m_SetDeleteThis; }
|
||||||
void SetDeleteThis() { m_SetDeleteThis = true; }
|
void SetDeleteThis() { m_SetDeleteThis = true; }
|
||||||
|
|
||||||
bool CanAwardArenaPoints() { return m_LevelMin >= 71; }
|
bool CanAwardArenaPoints() { return GetMinLevel() >= 71; }
|
||||||
|
|
||||||
public virtual ObjectGuid GetFlagPickerGUID(int teamIndex = -1) { return ObjectGuid.Empty; }
|
public virtual ObjectGuid GetFlagPickerGUID(int teamIndex = -1) { return ObjectGuid.Empty; }
|
||||||
public virtual void SetDroppedFlagGUID(ObjectGuid guid, int teamIndex = -1) { }
|
public virtual void SetDroppedFlagGUID(ObjectGuid guid, int teamIndex = -1) { }
|
||||||
@@ -1981,7 +2028,6 @@ namespace Game.BattleGrounds
|
|||||||
public uint[] Buff_Entries = { BattlegroundConst.SpeedBuff, BattlegroundConst.RegenBuff, BattlegroundConst.BerserkerBuff };
|
public uint[] Buff_Entries = { BattlegroundConst.SpeedBuff, BattlegroundConst.RegenBuff, BattlegroundConst.BerserkerBuff };
|
||||||
|
|
||||||
// Battleground
|
// Battleground
|
||||||
BattlegroundTypeId m_TypeID;
|
|
||||||
BattlegroundTypeId m_RandomTypeID;
|
BattlegroundTypeId m_RandomTypeID;
|
||||||
uint m_InstanceID; // Battleground Instance's GUID!
|
uint m_InstanceID; // Battleground Instance's GUID!
|
||||||
BattlegroundStatus m_Status;
|
BattlegroundStatus m_Status;
|
||||||
@@ -1992,18 +2038,14 @@ namespace Game.BattleGrounds
|
|||||||
uint m_ValidStartPositionTimer;
|
uint m_ValidStartPositionTimer;
|
||||||
int m_EndTime; // it is set to 120000 when bg is ending and it decreases itself
|
int m_EndTime; // it is set to 120000 when bg is ending and it decreases itself
|
||||||
uint m_LastResurrectTime;
|
uint m_LastResurrectTime;
|
||||||
BattlegroundBracketId m_BracketId;
|
|
||||||
ArenaTypes m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
|
ArenaTypes m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
|
||||||
bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattlegroundMgr.BGFreeSlotQueue[bgTypeId] deque
|
bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattlegroundMgr.BGFreeSlotQueue[bgTypeId] deque
|
||||||
bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
|
bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
|
||||||
bool m_IsArena;
|
|
||||||
BattlegroundTeamId _winnerTeamId;
|
BattlegroundTeamId _winnerTeamId;
|
||||||
int m_StartDelayTime;
|
int m_StartDelayTime;
|
||||||
bool m_IsRated; // is this battle rated?
|
bool m_IsRated; // is this battle rated?
|
||||||
bool m_PrematureCountDown;
|
bool m_PrematureCountDown;
|
||||||
uint m_PrematureCountDownTimer;
|
uint m_PrematureCountDownTimer;
|
||||||
string m_Name;
|
|
||||||
ulong m_queueId;
|
|
||||||
uint m_LastPlayerPositionBroadcast;
|
uint m_LastPlayerPositionBroadcast;
|
||||||
|
|
||||||
// Player lists
|
// Player lists
|
||||||
@@ -2028,20 +2070,12 @@ namespace Game.BattleGrounds
|
|||||||
int[] m_ArenaTeamRatingChanges = new int[SharedConst.BGTeamsCount];
|
int[] m_ArenaTeamRatingChanges = new int[SharedConst.BGTeamsCount];
|
||||||
uint[] m_ArenaTeamMMR = new uint[SharedConst.BGTeamsCount];
|
uint[] m_ArenaTeamMMR = new uint[SharedConst.BGTeamsCount];
|
||||||
|
|
||||||
// Limits
|
|
||||||
uint m_LevelMin;
|
|
||||||
uint m_LevelMax;
|
|
||||||
uint m_MaxPlayersPerTeam;
|
|
||||||
uint m_MaxPlayers;
|
|
||||||
uint m_MinPlayersPerTeam;
|
|
||||||
uint m_MinPlayers;
|
|
||||||
|
|
||||||
// Start location
|
// Start location
|
||||||
uint m_MapId;
|
|
||||||
BattlegroundMap m_Map;
|
BattlegroundMap m_Map;
|
||||||
Position[] StartPosition = new Position[SharedConst.BGTeamsCount];
|
Position[] StartPosition = new Position[SharedConst.BGTeamsCount];
|
||||||
float m_StartMaxDist;
|
|
||||||
uint ScriptId;
|
BattlegroundTemplate _battlegroundTemplate;
|
||||||
|
PvpDifficultyRecord _pvpDifficultyEntry;
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -275,32 +275,9 @@ namespace Game.BattleGrounds
|
|||||||
bg.Reset(); // reset the new bg (set status to status_wait_queue from status_none)
|
bg.Reset(); // reset the new bg (set status to status_wait_queue from status_none)
|
||||||
bg.SetStatus(BattlegroundStatus.WaitJoin); // start the joining of the bg
|
bg.SetStatus(BattlegroundStatus.WaitJoin); // start the joining of the bg
|
||||||
bg.SetArenaType(arenaType);
|
bg.SetArenaType(arenaType);
|
||||||
bg.SetTypeID(originalBgTypeId);
|
|
||||||
bg.SetRandomTypeID(bgTypeId);
|
bg.SetRandomTypeID(bgTypeId);
|
||||||
bg.SetRated(isRated);
|
bg.SetRated(isRated);
|
||||||
bg.SetRandom(isRandom);
|
bg.SetRandom(isRandom);
|
||||||
bg.SetQueueId((ulong)bgTypeId | 0x1F10000000000000);
|
|
||||||
|
|
||||||
// Set up correct min/max player counts for scoreboards
|
|
||||||
if (bg.IsArena())
|
|
||||||
{
|
|
||||||
uint maxPlayersPerTeam = 0;
|
|
||||||
switch (arenaType)
|
|
||||||
{
|
|
||||||
case ArenaTypes.Team2v2:
|
|
||||||
maxPlayersPerTeam = 2;
|
|
||||||
break;
|
|
||||||
case ArenaTypes.Team3v3:
|
|
||||||
maxPlayersPerTeam = 3;
|
|
||||||
break;
|
|
||||||
case ArenaTypes.Team5v5:
|
|
||||||
maxPlayersPerTeam = 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bg.SetMaxPlayersPerTeam(maxPlayersPerTeam);
|
|
||||||
bg.SetMaxPlayers(maxPlayersPerTeam * 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return bg;
|
return bg;
|
||||||
}
|
}
|
||||||
@@ -315,73 +292,59 @@ namespace Game.BattleGrounds
|
|||||||
switch (bgTemplate.Id)
|
switch (bgTemplate.Id)
|
||||||
{
|
{
|
||||||
//case BattlegroundTypeId.AV:
|
//case BattlegroundTypeId.AV:
|
||||||
// bg = new BattlegroundAV();
|
// bg = new BattlegroundAV(bgTemplate);
|
||||||
//break;
|
//break;
|
||||||
case BattlegroundTypeId.WS:
|
case BattlegroundTypeId.WS:
|
||||||
bg = new BgWarsongGluch();
|
bg = new BgWarsongGluch(bgTemplate);
|
||||||
break;
|
break;
|
||||||
case BattlegroundTypeId.AB:
|
case BattlegroundTypeId.AB:
|
||||||
bg = new BgArathiBasin();
|
bg = new BgArathiBasin(bgTemplate);
|
||||||
break;
|
break;
|
||||||
case BattlegroundTypeId.NA:
|
case BattlegroundTypeId.NA:
|
||||||
bg = new NagrandArena();
|
bg = new NagrandArena(bgTemplate);
|
||||||
break;
|
break;
|
||||||
case BattlegroundTypeId.BE:
|
case BattlegroundTypeId.BE:
|
||||||
bg = new BladesEdgeArena();
|
bg = new BladesEdgeArena(bgTemplate);
|
||||||
break;
|
break;
|
||||||
case BattlegroundTypeId.EY:
|
case BattlegroundTypeId.EY:
|
||||||
bg = new BgEyeofStorm();
|
bg = new BgEyeofStorm(bgTemplate);
|
||||||
break;
|
break;
|
||||||
case BattlegroundTypeId.RL:
|
case BattlegroundTypeId.RL:
|
||||||
bg = new RuinsofLordaeronArena();
|
bg = new RuinsofLordaeronArena(bgTemplate);
|
||||||
break;
|
break;
|
||||||
case BattlegroundTypeId.SA:
|
case BattlegroundTypeId.SA:
|
||||||
bg = new BgStrandOfAncients();
|
bg = new BgStrandOfAncients(bgTemplate);
|
||||||
break;
|
break;
|
||||||
case BattlegroundTypeId.DS:
|
case BattlegroundTypeId.DS:
|
||||||
bg = new DalaranSewersArena();
|
bg = new DalaranSewersArena(bgTemplate);
|
||||||
break;
|
break;
|
||||||
case BattlegroundTypeId.RV:
|
case BattlegroundTypeId.RV:
|
||||||
bg = new RingofValorArena();
|
bg = new RingofValorArena(bgTemplate);
|
||||||
break;
|
break;
|
||||||
//case BattlegroundTypeId.IC:
|
//case BattlegroundTypeId.IC:
|
||||||
//bg = new BattlegroundIC();
|
//bg = new BattlegroundIC(bgTemplate);
|
||||||
//break;
|
//break;
|
||||||
case BattlegroundTypeId.AA:
|
case BattlegroundTypeId.AA:
|
||||||
bg = new Battleground();
|
bg = new Battleground(bgTemplate);
|
||||||
break;
|
break;
|
||||||
case BattlegroundTypeId.RB:
|
case BattlegroundTypeId.RB:
|
||||||
bg = new Battleground();
|
bg = new Battleground(bgTemplate);
|
||||||
bg.SetRandom(true);
|
bg.SetRandom(true);
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
case BattlegroundTypeId.TP:
|
case BattlegroundTypeId.TP:
|
||||||
bg = new BattlegroundTP();
|
bg = new BattlegroundTP(bgTemplate);
|
||||||
break;
|
break;
|
||||||
case BattlegroundTypeId.BFG:
|
case BattlegroundTypeId.BFG:
|
||||||
bg = new BattlegroundBFG();
|
bg = new BattlegroundBFG(bgTemplate);
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bg.SetTypeID(bgTemplate.Id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bg.SetMapId((uint)bgTemplate.BattlemasterEntry.MapId[0]);
|
|
||||||
bg.SetName(bgTemplate.BattlemasterEntry.Name[Global.WorldMgr.GetDefaultDbcLocale()]);
|
|
||||||
bg.SetInstanceID(0);
|
bg.SetInstanceID(0);
|
||||||
bg.SetArenaorBGType(bgTemplate.IsArena());
|
|
||||||
bg.SetMinPlayersPerTeam(bgTemplate.MinPlayersPerTeam);
|
|
||||||
bg.SetMaxPlayersPerTeam(bgTemplate.MaxPlayersPerTeam);
|
|
||||||
bg.SetMinPlayers(bgTemplate.MinPlayersPerTeam * 2);
|
|
||||||
bg.SetMaxPlayers(bgTemplate.MaxPlayersPerTeam * 2);
|
|
||||||
bg.SetTeamStartPosition(TeamId.Alliance, bgTemplate.StartLocation[TeamId.Alliance]);
|
|
||||||
bg.SetTeamStartPosition(TeamId.Horde, bgTemplate.StartLocation[TeamId.Horde]);
|
|
||||||
bg.SetStartMaxDist(bgTemplate.StartMaxDist);
|
|
||||||
bg.SetLevelRange(bgTemplate.MinLevel, bgTemplate.MaxLevel);
|
|
||||||
bg.SetScriptId(bgTemplate.scriptId);
|
|
||||||
bg.SetQueueId((ulong)bgTemplate.Id | 0x1F10000000000000);
|
|
||||||
|
|
||||||
if (!bgDataStore.ContainsKey(bg.GetTypeID()))
|
if (!bgDataStore.ContainsKey(bg.GetTypeID()))
|
||||||
bgDataStore[bg.GetTypeID()] = new BattlegroundData();
|
bgDataStore[bg.GetTypeID()] = new BattlegroundData();
|
||||||
@@ -395,11 +358,8 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
uint oldMSTime = Time.GetMSTime();
|
uint oldMSTime = Time.GetMSTime();
|
||||||
|
|
||||||
_BattlegroundMapTemplates.Clear();
|
// 0 1 2 3 4 5
|
||||||
_BattlegroundTemplates.Clear();
|
SQLResult result = DB.World.Query("SELECT ID, AllianceStartLoc, HordeStartLoc, StartMaxDist, Weight, ScriptName FROM battleground_template");
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9
|
|
||||||
SQLResult result = DB.World.Query("SELECT ID, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, HordeStartLoc, StartMaxDist, Weight, ScriptName FROM battleground_template");
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.ServerLoading, "Loaded 0 Battlegrounds. DB table `Battleground_template` is empty.");
|
Log.outError(LogFilter.ServerLoading, "Loaded 0 Battlegrounds. DB table `Battleground_template` is empty.");
|
||||||
@@ -423,65 +383,50 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
BattlegroundTemplate bgTemplate = new BattlegroundTemplate();
|
BattlegroundTemplate bgTemplate = new BattlegroundTemplate();
|
||||||
bgTemplate.Id = bgTypeId;
|
bgTemplate.Id = bgTypeId;
|
||||||
bgTemplate.MinPlayersPerTeam = result.Read<ushort>(1);
|
float dist = result.Read<float>(3);
|
||||||
bgTemplate.MaxPlayersPerTeam = result.Read<ushort>(2);
|
bgTemplate.MaxStartDistSq = dist * dist;
|
||||||
bgTemplate.MinLevel = result.Read<byte>(3);
|
bgTemplate.Weight = result.Read<byte>(4);
|
||||||
bgTemplate.MaxLevel = result.Read<byte>(4);
|
|
||||||
float dist = result.Read<float>(7);
|
|
||||||
bgTemplate.StartMaxDist = dist * dist;
|
|
||||||
bgTemplate.Weight = result.Read<byte>(8);
|
|
||||||
|
|
||||||
bgTemplate.scriptId = Global.ObjectMgr.GetScriptId(result.Read<string>(9));
|
bgTemplate.ScriptId = Global.ObjectMgr.GetScriptId(result.Read<string>(5));
|
||||||
bgTemplate.BattlemasterEntry = bl;
|
bgTemplate.BattlemasterEntry = bl;
|
||||||
|
|
||||||
if (bgTemplate.MaxPlayersPerTeam == 0 || bgTemplate.MinPlayersPerTeam > bgTemplate.MaxPlayersPerTeam)
|
|
||||||
{
|
|
||||||
Log.outError(LogFilter.Sql, "Table `Battleground_template` for Id {0} has bad values for MinPlayersPerTeam ({1}) and MaxPlayersPerTeam({2})",
|
|
||||||
bgTemplate.Id, bgTemplate.MinPlayersPerTeam, bgTemplate.MaxPlayersPerTeam);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bgTemplate.MinLevel == 0 || bgTemplate.MaxLevel == 0 || bgTemplate.MinLevel > bgTemplate.MaxLevel)
|
|
||||||
{
|
|
||||||
Log.outError(LogFilter.Sql, "Table `Battleground_template` for Id {0} has bad values for LevelMin ({1}) and LevelMax({2})",
|
|
||||||
bgTemplate.Id, bgTemplate.MinLevel, bgTemplate.MaxLevel);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bgTemplate.Id != BattlegroundTypeId.AA && bgTemplate.Id != BattlegroundTypeId.RB)
|
if (bgTemplate.Id != BattlegroundTypeId.AA && bgTemplate.Id != BattlegroundTypeId.RB)
|
||||||
{
|
{
|
||||||
uint startId = result.Read<uint>(5);
|
uint startId = result.Read<uint>(1);
|
||||||
WorldSafeLocsEntry start = Global.ObjectMgr.GetWorldSafeLoc(startId);
|
WorldSafeLocsEntry start = Global.ObjectMgr.GetWorldSafeLoc(startId);
|
||||||
if (start != null)
|
if (start != null)
|
||||||
{
|
bgTemplate.StartLocation[TeamId.Alliance] = start;
|
||||||
bgTemplate.StartLocation[TeamId.Alliance] = start.Loc;
|
else if (bgTemplate.StartLocation[TeamId.Alliance] != null) // reload case
|
||||||
}
|
Log.outError(LogFilter.Sql, $"Table `battleground_template` for id {bgTemplate.Id} contains a non-existing WorldSafeLocs.dbc id {startId} in field `AllianceStartLoc`. Ignoring.");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Table `Battleground_template` for Id {0} has a non-existed WorldSafeLocs.dbc id {1} in field `AllianceStartLoc`. BG not created.", bgTemplate.Id, startId);
|
Log.outError(LogFilter.Sql, $"Table `Battleground_template` for Id {bgTemplate.Id} has a non-existed WorldSafeLocs.dbc id {startId} in field `AllianceStartLoc`. BG not created.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
startId = result.Read<uint>(6);
|
startId = result.Read<uint>(2);
|
||||||
start = Global.ObjectMgr.GetWorldSafeLoc(startId);
|
start = Global.ObjectMgr.GetWorldSafeLoc(startId);
|
||||||
if (start != null)
|
if (start != null)
|
||||||
{
|
bgTemplate.StartLocation[TeamId.Horde] = start;
|
||||||
bgTemplate.StartLocation[TeamId.Horde] = start.Loc;
|
else if (bgTemplate.StartLocation[TeamId.Horde] != null) // reload case
|
||||||
}
|
Log.outError(LogFilter.Sql, $"Table `battleground_template` for id {bgTemplate.Id} contains a non-existing WorldSafeLocs.dbc id {startId} in field `HordeStartLoc`. Ignoring.");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Table `Battleground_template` for Id {0} has a non-existed WorldSafeLocs.dbc id {1} in field `HordeStartLoc`. BG not created.", bgTemplate.Id, startId);
|
Log.outError(LogFilter.Sql, $"Table `Battleground_template` for Id {bgTemplate.Id} has a non-existed WorldSafeLocs.dbc id {startId} in field `HordeStartLoc`. BG not created.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CreateBattleground(bgTemplate))
|
if (!CreateBattleground(bgTemplate))
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Battleground, $"Could not create battleground template class ({bgTemplate.Id})!");
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
_BattlegroundTemplates[bgTypeId] = bgTemplate;
|
_battlegroundTemplates[bgTypeId] = bgTemplate;
|
||||||
|
|
||||||
if (bgTemplate.BattlemasterEntry.MapId[1] == -1) // in this case we have only one mapId
|
if (bgTemplate.BattlemasterEntry.MapId[1] == -1) // in this case we have only one mapId
|
||||||
_BattlegroundMapTemplates[(uint)bgTemplate.BattlemasterEntry.MapId[0]] = _BattlegroundTemplates[bgTypeId];
|
_battlegroundMapTemplates[(uint)bgTemplate.BattlemasterEntry.MapId[0]] = _battlegroundTemplates[bgTypeId];
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
@@ -499,8 +444,8 @@ namespace Game.BattleGrounds
|
|||||||
BattlefieldList battlefieldList = new BattlefieldList();
|
BattlefieldList battlefieldList = new BattlefieldList();
|
||||||
battlefieldList.BattlemasterGuid = guid;
|
battlefieldList.BattlemasterGuid = guid;
|
||||||
battlefieldList.BattlemasterListID = (int)bgTypeId;
|
battlefieldList.BattlemasterListID = (int)bgTypeId;
|
||||||
battlefieldList.MinLevel = (byte)bgTemplate.MinLevel;
|
battlefieldList.MinLevel = bgTemplate.GetMinLevel();
|
||||||
battlefieldList.MaxLevel = (byte)bgTemplate.MaxLevel;
|
battlefieldList.MaxLevel = bgTemplate.GetMaxLevel();
|
||||||
battlefieldList.PvpAnywhere = guid.IsEmpty();
|
battlefieldList.PvpAnywhere = guid.IsEmpty();
|
||||||
battlefieldList.HasRandomWinToday = player.GetRandomWinner();
|
battlefieldList.HasRandomWinToday = player.GetRandomWinner();
|
||||||
player.SendPacket(battlefieldList);
|
player.SendPacket(battlefieldList);
|
||||||
@@ -514,12 +459,12 @@ namespace Game.BattleGrounds
|
|||||||
uint mapid = bg.GetMapId();
|
uint mapid = bg.GetMapId();
|
||||||
Team team = player.GetBGTeam();
|
Team team = player.GetBGTeam();
|
||||||
|
|
||||||
Position pos = bg.GetTeamStartPosition(Battleground.GetTeamIndexByTeamId(team));
|
WorldSafeLocsEntry pos = bg.GetTeamStartPosition(Battleground.GetTeamIndexByTeamId(team));
|
||||||
Log.outDebug(LogFilter.Battleground, "BattlegroundMgr.SendToBattleground: Sending {0} to map {1}, {2} (bgType {3})", player.GetName(), mapid, pos.ToString(), bgTypeId);
|
Log.outDebug(LogFilter.Battleground, $"BattlegroundMgr.SendToBattleground: Sending {player.GetName()} to map {mapid}, {pos.Loc} (bgType {bgTypeId})");
|
||||||
player.TeleportTo(mapid, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
|
player.TeleportTo(pos.Loc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Log.outError(LogFilter.Battleground, "BattlegroundMgr.SendToBattleground: Instance {0} (bgType {1}) not found while trying to teleport player {2}", instanceId, bgTypeId, player.GetName());
|
Log.outError(LogFilter.Battleground, $"BattlegroundMgr.SendToBattleground: Instance {instanceId} (bgType {bgTypeId}) not found while trying to teleport player {player.GetName()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAreaSpiritHealerQuery(Player player, Battleground bg, ObjectGuid guid)
|
public void SendAreaSpiritHealerQuery(Player player, Battleground bg, ObjectGuid guid)
|
||||||
@@ -867,19 +812,19 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
BattlegroundTemplate GetBattlegroundTemplateByTypeId(BattlegroundTypeId id)
|
BattlegroundTemplate GetBattlegroundTemplateByTypeId(BattlegroundTypeId id)
|
||||||
{
|
{
|
||||||
return _BattlegroundTemplates.LookupByKey(id);
|
return _battlegroundTemplates.LookupByKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
BattlegroundTemplate GetBattlegroundTemplateByMapId(uint mapId)
|
BattlegroundTemplate GetBattlegroundTemplateByMapId(uint mapId)
|
||||||
{
|
{
|
||||||
return _BattlegroundMapTemplates.LookupByKey(mapId);
|
return _battlegroundMapTemplates.LookupByKey(mapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<BattlegroundTypeId, BattlegroundData> bgDataStore = new Dictionary<BattlegroundTypeId, BattlegroundData>();
|
Dictionary<BattlegroundTypeId, BattlegroundData> bgDataStore = new Dictionary<BattlegroundTypeId, BattlegroundData>();
|
||||||
BattlegroundQueue[] m_BattlegroundQueues = new BattlegroundQueue[(int)BattlegroundQueueTypeId.Max];
|
BattlegroundQueue[] m_BattlegroundQueues = new BattlegroundQueue[(int)BattlegroundQueueTypeId.Max];
|
||||||
Dictionary<uint, BattlegroundTypeId> mBattleMastersMap = new Dictionary<uint, BattlegroundTypeId>();
|
Dictionary<uint, BattlegroundTypeId> mBattleMastersMap = new Dictionary<uint, BattlegroundTypeId>();
|
||||||
Dictionary<BattlegroundTypeId, BattlegroundTemplate> _BattlegroundTemplates = new Dictionary<BattlegroundTypeId, BattlegroundTemplate>();
|
Dictionary<BattlegroundTypeId, BattlegroundTemplate> _battlegroundTemplates = new Dictionary<BattlegroundTypeId, BattlegroundTemplate>();
|
||||||
Dictionary<uint, BattlegroundTemplate> _BattlegroundMapTemplates = new Dictionary<uint, BattlegroundTemplate>();
|
Dictionary<uint, BattlegroundTemplate> _battlegroundMapTemplates = new Dictionary<uint, BattlegroundTemplate>();
|
||||||
List<ulong> m_QueueUpdateScheduler = new List<ulong>();
|
List<ulong> m_QueueUpdateScheduler = new List<ulong>();
|
||||||
uint m_NextRatedArenaUpdate;
|
uint m_NextRatedArenaUpdate;
|
||||||
uint m_UpdateTimer;
|
uint m_UpdateTimer;
|
||||||
@@ -901,19 +846,35 @@ namespace Game.BattleGrounds
|
|||||||
public Battleground Template;
|
public Battleground Template;
|
||||||
}
|
}
|
||||||
|
|
||||||
class BattlegroundTemplate
|
public class BattlegroundTemplate
|
||||||
{
|
{
|
||||||
public BattlegroundTypeId Id;
|
public BattlegroundTypeId Id;
|
||||||
public uint MinPlayersPerTeam;
|
public WorldSafeLocsEntry[] StartLocation = new WorldSafeLocsEntry[SharedConst.BGTeamsCount];
|
||||||
public uint MaxPlayersPerTeam;
|
public float MaxStartDistSq;
|
||||||
public uint MinLevel;
|
|
||||||
public uint MaxLevel;
|
|
||||||
public Position[] StartLocation = new Position[SharedConst.BGTeamsCount];
|
|
||||||
public float StartMaxDist;
|
|
||||||
public byte Weight;
|
public byte Weight;
|
||||||
public uint scriptId;
|
public uint ScriptId;
|
||||||
public BattlemasterListRecord BattlemasterEntry;
|
public BattlemasterListRecord BattlemasterEntry;
|
||||||
|
|
||||||
public bool IsArena() { return BattlemasterEntry.InstanceType == (uint)MapTypes.Arena; }
|
public bool IsArena() { return BattlemasterEntry.InstanceType == (uint)MapTypes.Arena; }
|
||||||
|
|
||||||
|
public ushort GetMinPlayersPerTeam()
|
||||||
|
{
|
||||||
|
return BattlemasterEntry.MinPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ushort GetMaxPlayersPerTeam()
|
||||||
|
{
|
||||||
|
return BattlemasterEntry.MaxPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte GetMinLevel()
|
||||||
|
{
|
||||||
|
return BattlemasterEntry.MinLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte GetMaxLevel()
|
||||||
|
{
|
||||||
|
return BattlemasterEntry.MaxLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
class BgArathiBasin : Battleground
|
class BgArathiBasin : Battleground
|
||||||
{
|
{
|
||||||
public BgArathiBasin()
|
public BgArathiBasin(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate)
|
||||||
{
|
{
|
||||||
m_IsInformedNearVictory = false;
|
m_IsInformedNearVictory = false;
|
||||||
m_BuffChange = true;
|
m_BuffChange = true;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
class BgEyeofStorm : Battleground
|
class BgEyeofStorm : Battleground
|
||||||
{
|
{
|
||||||
public BgEyeofStorm()
|
public BgEyeofStorm(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate)
|
||||||
{
|
{
|
||||||
m_BuffChange = true;
|
m_BuffChange = true;
|
||||||
BgObjects = new ObjectGuid[ABObjectTypes.Max];
|
BgObjects = new ObjectGuid[ABObjectTypes.Max];
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
public class BgStrandOfAncients : Battleground
|
public class BgStrandOfAncients : Battleground
|
||||||
{
|
{
|
||||||
public BgStrandOfAncients()
|
public BgStrandOfAncients(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate)
|
||||||
{
|
{
|
||||||
StartMessageIds[BattlegroundConst.EventIdFourth] = 0;
|
StartMessageIds[BattlegroundConst.EventIdFourth] = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
class BgWarsongGluch : Battleground
|
class BgWarsongGluch : Battleground
|
||||||
{
|
{
|
||||||
public BgWarsongGluch()
|
public BgWarsongGluch(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate)
|
||||||
{
|
{
|
||||||
BgObjects = new ObjectGuid[WSGObjectTypes.Max];
|
BgObjects = new ObjectGuid[WSGObjectTypes.Max];
|
||||||
BgCreatures = new ObjectGuid[WSGCreatureTypes.Max];
|
BgCreatures = new ObjectGuid[WSGCreatureTypes.Max];
|
||||||
|
|||||||
@@ -104,6 +104,20 @@ namespace Game.DataStorage
|
|||||||
foreach (AzeriteUnlockMappingRecord azeriteUnlockMapping in CliDB.AzeriteUnlockMappingStorage.Values)
|
foreach (AzeriteUnlockMappingRecord azeriteUnlockMapping in CliDB.AzeriteUnlockMappingStorage.Values)
|
||||||
azeriteUnlockMappings.Add(azeriteUnlockMapping.AzeriteUnlockMappingSetID, azeriteUnlockMapping);
|
azeriteUnlockMappings.Add(azeriteUnlockMapping.AzeriteUnlockMappingSetID, azeriteUnlockMapping);
|
||||||
|
|
||||||
|
foreach (BattlemasterListRecord battlemaster in CliDB.BattlemasterListStorage.Values)
|
||||||
|
{
|
||||||
|
if (battlemaster.MaxLevel < battlemaster.MinLevel)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.ServerLoading, $"Battlemaster ({battlemaster.Id}) contains bad values for MinLevel ({battlemaster.MinLevel}) and MaxLevel ({battlemaster.MaxLevel}). Swapping values.");
|
||||||
|
MathFunctions.Swap(ref battlemaster.MaxLevel, ref battlemaster.MinLevel);
|
||||||
|
}
|
||||||
|
if (battlemaster.MaxPlayers < battlemaster.MinPlayers)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.ServerLoading, $"Battlemaster ({battlemaster.Id}) contains bad values for MinPlayers ({battlemaster.MinPlayers}) and MaxPlayers ({battlemaster.MaxPlayers}). Swapping values.");
|
||||||
|
MathFunctions.Swap(ref battlemaster.MaxPlayers, ref battlemaster.MinPlayers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (CharacterFacialHairStylesRecord characterFacialStyle in CliDB.CharacterFacialHairStylesStorage.Values)
|
foreach (CharacterFacialHairStylesRecord characterFacialStyle in CliDB.CharacterFacialHairStylesStorage.Values)
|
||||||
_characterFacialHairStyles.Add(Tuple.Create(characterFacialStyle.RaceID, characterFacialStyle.SexID, (uint)characterFacialStyle.VariationID));
|
_characterFacialHairStyles.Add(Tuple.Create(characterFacialStyle.RaceID, characterFacialStyle.SexID, (uint)characterFacialStyle.VariationID));
|
||||||
|
|
||||||
|
|||||||
@@ -90,18 +90,18 @@ namespace Game.DataStorage
|
|||||||
public string ShortDescription;
|
public string ShortDescription;
|
||||||
public string LongDescription;
|
public string LongDescription;
|
||||||
public sbyte InstanceType;
|
public sbyte InstanceType;
|
||||||
public sbyte MinLevel;
|
public byte MinLevel;
|
||||||
public sbyte MaxLevel;
|
public byte MaxLevel;
|
||||||
public sbyte RatedPlayers;
|
public sbyte RatedPlayers;
|
||||||
public sbyte MinPlayers;
|
public byte MinPlayers;
|
||||||
public sbyte MaxPlayers;
|
public byte MaxPlayers;
|
||||||
public sbyte GroupsAllowed;
|
public sbyte GroupsAllowed;
|
||||||
public sbyte MaxGroupSize;
|
public sbyte MaxGroupSize;
|
||||||
public ushort HolidayWorldState;
|
public ushort HolidayWorldState;
|
||||||
public BattlemasterListFlags Flags;
|
public BattlemasterListFlags Flags;
|
||||||
public int IconFileDataID;
|
public int IconFileDataID;
|
||||||
public short RequiredPlayerConditionID;
|
public short RequiredPlayerConditionID;
|
||||||
public short[] MapId = new short[16];
|
public ushort[] MapId = new ushort[16];
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class BroadcastTextRecord
|
public sealed class BroadcastTextRecord
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE `battleground_template`
|
||||||
|
DROP COLUMN `MinPlayersPerTeam`,
|
||||||
|
DROP COLUMN `MaxPlayersPerTeam`,
|
||||||
|
DROP COLUMN `MinLvl`,
|
||||||
|
DROP COLUMN `MaxLvl`;
|
||||||
Reference in New Issue
Block a user