Core/DataStores: Updated db2 structures to 8.2.5

Port From (https://github.com/TrinityCore/TrinityCore/commit/3ac790287aba5f7d7c3bccf79e608de9119e461a)
This commit is contained in:
hondacrx
2019-10-29 13:09:23 -04:00
parent c6e53b2ba7
commit e95115dc94
54 changed files with 4589 additions and 349 deletions
+6 -6
View File
@@ -966,9 +966,9 @@ namespace Game.BattleGrounds
public void TeleportPlayerToExploitLocation(Player player)
{
WorldSafeLocsRecord loc = GetExploitTeleportLocation(player.GetBGTeam());
WorldSafeLocsEntry loc = GetExploitTeleportLocation(player.GetBGTeam());
if (loc != null)
player.TeleportTo(loc.MapID, loc.Loc.X, loc.Loc.Y, loc.Loc.Z, loc.Facing);
player.TeleportTo(loc.Loc);
}
public virtual void AddPlayer(Player player)
@@ -1292,7 +1292,7 @@ namespace Game.BattleGrounds
List<ObjectGuid> ghostList = m_ReviveQueue[guideGuid];
if (!ghostList.Empty())
{
WorldSafeLocsRecord closestGrave = null;
WorldSafeLocsEntry closestGrave = null;
foreach (var guid in ghostList)
{
Player player = Global.ObjAccessor.FindPlayer(guid);
@@ -1303,7 +1303,7 @@ namespace Game.BattleGrounds
closestGrave = GetClosestGraveYard(player);
if (closestGrave != null)
player.TeleportTo(GetMapId(), closestGrave.Loc.X, closestGrave.Loc.Y, closestGrave.Loc.Z, player.GetOrientation());
player.TeleportTo(closestGrave.Loc);
}
ghostList.Clear();
}
@@ -1735,7 +1735,7 @@ namespace Game.BattleGrounds
m_BgRaids[GetTeamIndexByTeamId(team)] = bg_raid;
}
public virtual WorldSafeLocsRecord GetClosestGraveYard(Player player)
public virtual WorldSafeLocsEntry GetClosestGraveYard(Player player)
{
return Global.ObjectMgr.GetClosestGraveYard(player, player.GetTeam(), player);
}
@@ -1926,7 +1926,7 @@ namespace Game.BattleGrounds
public virtual void HandlePlayerResurrect(Player player) { }
public virtual WorldSafeLocsRecord GetExploitTeleportLocation(Team team) { return null; }
public virtual WorldSafeLocsEntry GetExploitTeleportLocation(Team team) { return null; }
public virtual bool HandlePlayerUnderMap(Player player) { return false; }
@@ -451,10 +451,10 @@ namespace Game.BattleGrounds
if (bgTemplate.Id != BattlegroundTypeId.AA && bgTemplate.Id != BattlegroundTypeId.RB)
{
uint startId = result.Read<uint>(5);
if (CliDB.WorldSafeLocsStorage.ContainsKey(startId))
WorldSafeLocsEntry start = Global.ObjectMgr.GetWorldSafeLoc(startId);
if (start != null)
{
WorldSafeLocsRecord start = CliDB.WorldSafeLocsStorage.LookupByKey(startId);
bgTemplate.StartLocation[TeamId.Alliance] = new Position(start.Loc.X, start.Loc.Y, start.Loc.Z, (start.Facing + MathFunctions.PI) / 180);
bgTemplate.StartLocation[TeamId.Alliance] = start.Loc;
}
else
{
@@ -462,11 +462,11 @@ namespace Game.BattleGrounds
continue;
}
startId = result.Read<uint>(6);
if (CliDB.WorldSafeLocsStorage.ContainsKey(startId))
startId = result.Read<uint>(6);
start = Global.ObjectMgr.GetWorldSafeLoc(startId);
if (start != null)
{
WorldSafeLocsRecord start = CliDB.WorldSafeLocsStorage.LookupByKey(startId);
bgTemplate.StartLocation[TeamId.Horde] = new Position(start.Loc.X, start.Loc.Y, start.Loc.Z, result.Read<float>(8));
bgTemplate.StartLocation[TeamId.Horde] = start.Loc;
}
else
{
@@ -631,7 +631,7 @@ namespace Game.BattleGrounds.Zones
base.EndBattleground(winner);
}
public override WorldSafeLocsRecord GetClosestGraveYard(Player player)
public override WorldSafeLocsEntry GetClosestGraveYard(Player player)
{
int teamIndex = GetTeamIndexByTeamId(player.GetTeam());
@@ -641,7 +641,7 @@ namespace Game.BattleGrounds.Zones
if (m_Nodes[i] == ABNodeStatus.Occupied + teamIndex)
nodes.Add(i);
WorldSafeLocsRecord good_entry = null;
WorldSafeLocsEntry good_entry = null;
// If so, select the closest node to place ghost on
if (!nodes.Empty())
{
@@ -651,10 +651,10 @@ namespace Game.BattleGrounds.Zones
float mindist = 999999.0f;
for (byte i = 0; i < nodes.Count; ++i)
{
WorldSafeLocsRecord entry = CliDB.WorldSafeLocsStorage.LookupByKey(GraveyardIds[nodes[i]]);
WorldSafeLocsEntry entry = Global.ObjectMgr.GetWorldSafeLoc(GraveyardIds[nodes[i]]);
if (entry == null)
continue;
float dist = (entry.Loc.X - plr_x) * (entry.Loc.X - plr_x) + (entry.Loc.Y - plr_y) * (entry.Loc.Y - plr_y);
float dist = (entry.Loc.GetPositionX() - plr_x) * (entry.Loc.GetPositionX() - plr_x) + (entry.Loc.GetPositionY() - plr_y) * (entry.Loc.GetPositionY() - plr_y);
if (mindist > dist)
{
mindist = dist;
@@ -665,14 +665,14 @@ namespace Game.BattleGrounds.Zones
}
// If not, place ghost on starting location
if (good_entry == null)
good_entry = CliDB.WorldSafeLocsStorage.LookupByKey(GraveyardIds[teamIndex + 5]);
good_entry = Global.ObjectMgr.GetWorldSafeLoc(GraveyardIds[teamIndex + 5]);
return good_entry;
}
public override WorldSafeLocsRecord GetExploitTeleportLocation(Team team)
public override WorldSafeLocsEntry GetExploitTeleportLocation(Team team)
{
return CliDB.WorldSafeLocsStorage.LookupByKey(team == Team.Alliance ? ExploitTeleportLocationAlliance : ExploitTeleportLocationHorde);
return Global.ObjectMgr.GetWorldSafeLoc(team == Team.Alliance ? ExploitTeleportLocationAlliance : ExploitTeleportLocationHorde);
}
public override bool UpdatePlayerScore(Player player, ScoreType type, uint value, bool doAddHonor = true)
@@ -757,8 +757,8 @@ namespace Game.BattleGrounds.Zones
public const int WarningNearVictoryScore = 1400;
public const int MaxTeamScore = 1600;
public const int ExploitTeleportLocationAlliance = 3705;
public const int ExploitTeleportLocationHorde = 3706;
public const uint ExploitTeleportLocationAlliance = 3705;
public const uint ExploitTeleportLocationHorde = 3706;
public static Position[] NodePositions =
{
+15 -15
View File
@@ -510,15 +510,15 @@ namespace Game.BattleGrounds.Zones
Log.outError(LogFilter.Battleground, "BattlegroundEY: Could not spawn Speedbuff Fel Reaver.");
}
WorldSafeLocsRecord sg = CliDB.WorldSafeLocsStorage.LookupByKey(EotSGaveyardIds.MainAlliance);
if (sg == null || !AddSpiritGuide(EotSCreaturesTypes.SpiritMainAlliance, sg.Loc.X, sg.Loc.Y, sg.Loc.Z, 3.124139f, TeamId.Alliance))
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(EotSGaveyardIds.MainAlliance);
if (sg == null || !AddSpiritGuide(EotSCreaturesTypes.SpiritMainAlliance, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.124139f, TeamId.Alliance))
{
Log.outError(LogFilter.Sql, "BatteGroundEY: Failed to spawn spirit guide. The battleground was not created.");
return false;
}
sg = CliDB.WorldSafeLocsStorage.LookupByKey(EotSGaveyardIds.MainHorde);
if (sg == null || !AddSpiritGuide(EotSCreaturesTypes.SpiritMainHorde, sg.Loc.X, sg.Loc.Y, sg.Loc.Z, 3.193953f, TeamId.Horde))
sg = Global.ObjectMgr.GetWorldSafeLoc(EotSGaveyardIds.MainHorde);
if (sg == null || !AddSpiritGuide(EotSCreaturesTypes.SpiritMainHorde, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.193953f, TeamId.Horde))
{
Log.outError(LogFilter.Sql, "BatteGroundEY: Failed to spawn spirit guide. The battleground was not created.");
return false;
@@ -752,8 +752,8 @@ namespace Game.BattleGrounds.Zones
if (!BgCreatures[Point].IsEmpty())
DelCreature(Point);
WorldSafeLocsRecord sg = CliDB.WorldSafeLocsStorage.LookupByKey(EotSMisc.m_CapturingPointTypes[Point].GraveYardId);
if (sg == null || !AddSpiritGuide(Point, sg.Loc.X, sg.Loc.Y, sg.Loc.Z, 3.124139f, GetTeamIndexByTeamId(Team)))
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(EotSMisc.m_CapturingPointTypes[Point].GraveYardId);
if (sg == null || !AddSpiritGuide(Point, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.124139f, GetTeamIndexByTeamId(Team)))
Log.outError(LogFilter.Battleground, "BatteGroundEY: Failed to spawn spirit guide. point: {0}, team: {1}, graveyard_id: {2}",
Point, Team, EotSMisc.m_CapturingPointTypes[Point].GraveYardId);
@@ -869,7 +869,7 @@ namespace Game.BattleGrounds.Zones
packet.AddState(0xC0D, 0x17B);
}
public override WorldSafeLocsRecord GetClosestGraveYard(Player player)
public override WorldSafeLocsEntry GetClosestGraveYard(Player player)
{
uint g_id = 0;
@@ -884,9 +884,9 @@ namespace Game.BattleGrounds.Zones
default: return null;
}
WorldSafeLocsRecord entry = null;
WorldSafeLocsRecord nearestEntry = null;
entry = CliDB.WorldSafeLocsStorage.LookupByKey(g_id);
WorldSafeLocsEntry entry = null;
WorldSafeLocsEntry nearestEntry = null;
entry = Global.ObjectMgr.GetWorldSafeLoc(g_id);
nearestEntry = entry;
if (entry == null)
@@ -899,19 +899,19 @@ namespace Game.BattleGrounds.Zones
float plr_y = player.GetPositionY();
float plr_z = player.GetPositionZ();
float distance = (entry.Loc.X - plr_x) * (entry.Loc.X - plr_x) + (entry.Loc.Y - plr_y) * (entry.Loc.Y - plr_y) + (entry.Loc.Z - plr_z) * (entry.Loc.Z - plr_z);
float distance = (entry.Loc.GetPositionX() - plr_x) * (entry.Loc.GetPositionX() - plr_x) + (entry.Loc.GetPositionY() - plr_y) * (entry.Loc.GetPositionY() - plr_y) + (entry.Loc.GetPositionZ() - plr_z) * (entry.Loc.GetPositionZ() - plr_z);
float nearestDistance = distance;
for (byte i = 0; i < EotSPoints.PointsMax; ++i)
{
if (m_PointOwnedByTeam[i] == player.GetTeam() && m_PointState[i] == EotSPointState.UnderControl)
{
entry = CliDB.WorldSafeLocsStorage.LookupByKey(EotSMisc.m_CapturingPointTypes[i].GraveYardId);
entry = Global.ObjectMgr.GetWorldSafeLoc(EotSMisc.m_CapturingPointTypes[i].GraveYardId);
if (entry == null)
Log.outError(LogFilter.Battleground, "BattlegroundEY: Graveyard {0} could not be found.", EotSMisc.m_CapturingPointTypes[i].GraveYardId);
else
{
distance = (entry.Loc.X - plr_x) * (entry.Loc.X - plr_x) + (entry.Loc.Y - plr_y) * (entry.Loc.Y - plr_y) + (entry.Loc.Z - plr_z) * (entry.Loc.Z - plr_z);
distance = (entry.Loc.GetPositionX() - plr_x) * (entry.Loc.GetPositionX() - plr_x) + (entry.Loc.GetPositionY() - plr_y) * (entry.Loc.GetPositionY() - plr_y) + (entry.Loc.GetPositionZ() - plr_z) * (entry.Loc.GetPositionZ() - plr_z);
if (distance < nearestDistance)
{
nearestDistance = distance;
@@ -924,9 +924,9 @@ namespace Game.BattleGrounds.Zones
return nearestEntry;
}
public override WorldSafeLocsRecord GetExploitTeleportLocation(Team team)
public override WorldSafeLocsEntry GetExploitTeleportLocation(Team team)
{
return CliDB.WorldSafeLocsStorage.LookupByKey(team == Team.Alliance ? EotSMisc.ExploitTeleportLocationAlliance : EotSMisc.ExploitTeleportLocationHorde);
return Global.ObjectMgr.GetWorldSafeLoc(team == Team.Alliance ? EotSMisc.ExploitTeleportLocationAlliance : EotSMisc.ExploitTeleportLocationHorde);
}
public override bool IsAllNodesControlledByTeam(Team team)
@@ -180,7 +180,7 @@ namespace Game.BattleGrounds.Zones
//Graveyards
for (byte i = 0; i < SAGraveyards.Max; i++)
{
WorldSafeLocsRecord sg = CliDB.WorldSafeLocsStorage.LookupByKey(SAMiscConst.GYEntries[i]);
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(SAMiscConst.GYEntries[i]);
if (sg == null)
{
Log.outError(LogFilter.Battleground, "SOTA: Can't find GY entry %u", SAMiscConst.GYEntries[i]);
@@ -190,12 +190,12 @@ namespace Game.BattleGrounds.Zones
if (i == SAGraveyards.BeachGy)
{
GraveyardStatus[i] = Attackers;
AddSpiritGuide(i + SACreatureTypes.Max, sg.Loc.X, sg.Loc.Y, sg.Loc.Z, SAMiscConst.GYOrientation[i], Attackers);
AddSpiritGuide(i + SACreatureTypes.Max, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), SAMiscConst.GYOrientation[i], Attackers);
}
else
{
GraveyardStatus[i] = ((Attackers == TeamId.Horde) ? TeamId.Alliance : TeamId.Horde);
if (!AddSpiritGuide(i + SACreatureTypes.Max, sg.Loc.X, sg.Loc.Y, sg.Loc.Z, SAMiscConst.GYOrientation[i], Attackers == TeamId.Horde ? TeamId.Alliance : TeamId.Horde))
if (!AddSpiritGuide(i + SACreatureTypes.Max, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), SAMiscConst.GYOrientation[i], Attackers == TeamId.Horde ? TeamId.Alliance : TeamId.Horde))
Log.outError(LogFilter.Battleground, "SOTA: couldn't spawn GY: %u", i);
}
}
@@ -700,7 +700,7 @@ namespace Game.BattleGrounds.Zones
{
}
public override WorldSafeLocsRecord GetClosestGraveYard(Player player)
public override WorldSafeLocsEntry GetClosestGraveYard(Player player)
{
uint safeloc = 0;
@@ -709,16 +709,16 @@ namespace Game.BattleGrounds.Zones
else
safeloc = SAMiscConst.GYEntries[SAGraveyards.DefenderLastGy];
WorldSafeLocsRecord closest = CliDB.WorldSafeLocsStorage.LookupByKey(safeloc);
float nearest = player.GetExactDistSq(closest.Loc.X, closest.Loc.Y, closest.Loc.Z);
WorldSafeLocsEntry closest = Global.ObjectMgr.GetWorldSafeLoc(safeloc);
float nearest = player.GetExactDistSq(closest.Loc);
for (byte i = SAGraveyards.RightCapturableGy; i < SAGraveyards.Max; i++)
{
if (GraveyardStatus[i] != player.GetTeamId())
continue;
WorldSafeLocsRecord ret = CliDB.WorldSafeLocsStorage.LookupByKey(SAMiscConst.GYEntries[i]);
float dist = player.GetExactDistSq(ret.Loc.X, ret.Loc.Y, ret.Loc.Z);
WorldSafeLocsEntry ret = Global.ObjectMgr.GetWorldSafeLoc(SAMiscConst.GYEntries[i]);
float dist = player.GetExactDistSq(ret.Loc);
if (dist < nearest)
{
closest = ret;
@@ -812,14 +812,14 @@ namespace Game.BattleGrounds.Zones
DelCreature(SACreatureTypes.Max + i);
GraveyardStatus[i] = Source.GetTeamId();
WorldSafeLocsRecord sg = CliDB.WorldSafeLocsStorage.LookupByKey(SAMiscConst.GYEntries[i]);
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(SAMiscConst.GYEntries[i]);
if (sg == null)
{
Log.outError(LogFilter.Battleground, "CaptureGraveyard: non-existant GY entry: %u", SAMiscConst.GYEntries[i]);
Log.outError(LogFilter.Battleground, $"CaptureGraveyard: non-existant GY entry: {SAMiscConst.GYEntries[i]}");
return;
}
AddSpiritGuide(i + SACreatureTypes.Max, sg.Loc.X, sg.Loc.Y, sg.Loc.Z, SAMiscConst.GYOrientation[i], GraveyardStatus[i]);
AddSpiritGuide(i + SACreatureTypes.Max, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), SAMiscConst.GYOrientation[i], GraveyardStatus[i]);
uint npc = 0;
int flag = 0;
+11 -11
View File
@@ -703,15 +703,15 @@ namespace Game.BattleGrounds.Zones
return false;
}
WorldSafeLocsRecord sg = CliDB.WorldSafeLocsStorage.LookupByKey(WSGGraveyards.MainAlliance);
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainAlliance, sg.Loc.X, sg.Loc.Y, sg.Loc.Z, 3.124139f, TeamId.Alliance))
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainAlliance);
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainAlliance, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.124139f, TeamId.Alliance))
{
Log.outError(LogFilter.Sql, "BgWarsongGluch: Failed to spawn Alliance spirit guide! Battleground not created!");
return false;
}
sg = CliDB.WorldSafeLocsStorage.LookupByKey(WSGGraveyards.MainHorde);
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainHorde, sg.Loc.X, sg.Loc.Y, sg.Loc.Z, 3.193953f, TeamId.Horde))
sg = Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainHorde);
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainHorde, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.193953f, TeamId.Horde))
{
Log.outError(LogFilter.Sql, "BgWarsongGluch: Failed to spawn Horde spirit guide! Battleground not created!");
return false;
@@ -800,7 +800,7 @@ namespace Game.BattleGrounds.Zones
return true;
}
public override WorldSafeLocsRecord GetClosestGraveYard(Player player)
public override WorldSafeLocsEntry GetClosestGraveYard(Player player)
{
//if status in progress, it returns main graveyards with spiritguides
//else it will return the graveyard in the flagroom - this is especially good
@@ -810,22 +810,22 @@ namespace Game.BattleGrounds.Zones
if (player.GetTeam() == Team.Alliance)
{
if (GetStatus() == BattlegroundStatus.InProgress)
return CliDB.WorldSafeLocsStorage.LookupByKey(WSGGraveyards.MainAlliance);
return Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainAlliance);
else
return CliDB.WorldSafeLocsStorage.LookupByKey(WSGGraveyards.FlagRoomAlliance);
return Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.FlagRoomAlliance);
}
else
{
if (GetStatus() == BattlegroundStatus.InProgress)
return CliDB.WorldSafeLocsStorage.LookupByKey(WSGGraveyards.MainHorde);
return Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainHorde);
else
return CliDB.WorldSafeLocsStorage.LookupByKey(WSGGraveyards.FlagRoomHorde);
return Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.FlagRoomHorde);
}
}
public override WorldSafeLocsRecord GetExploitTeleportLocation(Team team)
public override WorldSafeLocsEntry GetExploitTeleportLocation(Team team)
{
return CliDB.WorldSafeLocsStorage.LookupByKey(team == Team.Alliance ? ExploitTeleportLocationAlliance : ExploitTeleportLocationHorde);
return Global.ObjectMgr.GetWorldSafeLoc(team == Team.Alliance ? ExploitTeleportLocationAlliance : ExploitTeleportLocationHorde);
}
public override void FillInitialWorldStates(InitWorldStates packet)