Core/DataStores: Updated db2 structures to 8.2.5

This commit is contained in:
Shauren
2019-10-26 23:58:29 +02:00
parent ee2e49429f
commit 3ac790287a
51 changed files with 4750 additions and 483 deletions

View File

@@ -1257,23 +1257,24 @@ public:
float z = player->GetPositionZ();
float distNearest = std::numeric_limits<float>::max();
for (uint32 i = 0; i < sWorldSafeLocsStore.GetNumRows(); ++i)
for (auto&& kvp : sObjectMgr->GetWorldSafeLocs())
{
WorldSafeLocsEntry const* loc = sWorldSafeLocsStore.LookupEntry(i);
if (loc && loc->MapID == player->GetMapId())
if (kvp.second.Loc.GetMapId() == player->GetMapId())
{
float dist = (loc->Loc.X - x) * (loc->Loc.X - x) + (loc->Loc.Y - y) * (loc->Loc.Y - y) + (loc->Loc.Z - z) * (loc->Loc.Z - z);
float dist = (kvp.second.Loc.GetPositionX() - x) * (kvp.second.Loc.GetPositionX() - x)
+ (kvp.second.Loc.GetPositionY() - y) * (kvp.second.Loc.GetPositionY() - y)
+ (kvp.second.Loc.GetPositionZ() - z) * (kvp.second.Loc.GetPositionZ() - z);
if (dist < distNearest)
{
distNearest = dist;
nearestLoc = loc;
nearestLoc = &kvp.second;
}
}
}
}
if (nearestLoc)
handler->PSendSysMessage(LANG_COMMAND_NEARGRAVEYARD, nearestLoc->ID, nearestLoc->Loc.X, nearestLoc->Loc.Y, nearestLoc->Loc.Z);
handler->PSendSysMessage(LANG_COMMAND_NEARGRAVEYARD, nearestLoc->ID, nearestLoc->Loc.GetPositionX(), nearestLoc->Loc.GetPositionY(), nearestLoc->Loc.GetPositionZ());
else
handler->PSendSysMessage(LANG_COMMAND_NEARGRAVEYARD_NOTFOUND);

View File

@@ -180,7 +180,7 @@ public:
if (!graveyardId)
return false;
WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(graveyardId);
WorldSafeLocsEntry const* gy = sObjectMgr->GetWorldSafeLoc(graveyardId);
if (!gy)
{
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
@@ -188,9 +188,9 @@ public:
return false;
}
if (!MapManager::IsValidMapCoord(gy->MapID, gy->Loc.X, gy->Loc.Y, gy->Loc.Z))
if (!MapManager::IsValidMapCoord(gy->Loc))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, gy->Loc.X, gy->Loc.Y, gy->MapID);
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, gy->Loc.GetPositionX(), gy->Loc.GetPositionY(), gy->Loc.GetMapId());
handler->SetSentErrorMessage(true);
return false;
}
@@ -205,7 +205,7 @@ public:
else
player->SaveRecallPosition();
player->TeleportTo(gy->MapID, gy->Loc.X, gy->Loc.Y, gy->Loc.Z, (gy->Facing * M_PI) / 180); // Orientation is initially in degrees
player->TeleportTo(gy->Loc);
return true;
}

View File

@@ -1077,7 +1077,7 @@ public:
else
return false;
WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId);
WorldSafeLocsEntry const* graveyard = sObjectMgr->GetWorldSafeLoc(graveyardId);
if (!graveyard)
{

View File

@@ -20,6 +20,7 @@
#include "BattlefieldMgr.h"
#include "BattlefieldTB.h"
#include "DB2Stores.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
@@ -83,8 +84,8 @@ class npc_tb_spirit_guide : public CreatureScript
return;
}
if (WorldSafeLocsEntry const* safeLoc = sWorldSafeLocsStore.LookupEntry(areaId))
player->TeleportTo(safeLoc->MapID, safeLoc->Loc.X, safeLoc->Loc.Y, safeLoc->Loc.Z, 0);
if (WorldSafeLocsEntry const* safeLoc = sObjectMgr->GetWorldSafeLoc(areaId))
player->TeleportTo(safeLoc->Loc);
}
};

View File

@@ -218,8 +218,8 @@ class npc_wg_spirit_guide : public CreatureScript
GraveyardVect gy = wintergrasp->GetGraveyardVector();
for (uint8 i = 0; i < gy.size(); i++)
if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId())
if (WorldSafeLocsEntry const* safeLoc = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveyardId()))
player->TeleportTo(safeLoc->MapID, safeLoc->Loc.X, safeLoc->Loc.Y, safeLoc->Loc.Z, 0);
if (WorldSafeLocsEntry const* safeLoc = sObjectMgr->GetWorldSafeLoc(gy[i]->GetGraveyardId()))
player->TeleportTo(safeLoc->Loc);
}
return true;
}