Core/DBC Move WorldSafeLocs.dbc storage to DB (#932)

This commit is contained in:
Kargatum
2019-01-08 13:37:31 +07:00
committed by Viste(Кирилл)
parent 3d416de893
commit 1a9f8dfc0c
38 changed files with 1262 additions and 414 deletions

View File

@@ -32,6 +32,7 @@
#include "BattlegroundRV.h"
#include "Transport.h"
#include "ScriptMgr.h"
#include "GameGraveyard.h"
#ifdef ELUNA
#include "LuaEngine.h"
#endif
@@ -1434,7 +1435,7 @@ void Battleground::RelocateDeadPlayers(uint64 queueIndex)
std::vector<uint64>& ghostList = m_ReviveQueue[queueIndex];
if (!ghostList.empty())
{
WorldSafeLocsEntry const* closestGrave = NULL;
GraveyardStruct const* closestGrave = NULL;
for (std::vector<uint64>::const_iterator itr = ghostList.begin(); itr != ghostList.end(); ++itr)
{
Player* player = ObjectAccessor::FindPlayer(*itr);
@@ -1914,9 +1915,9 @@ void Battleground::SetBgRaid(TeamId teamId, Group* bg_raid)
old_raid = bg_raid;
}
WorldSafeLocsEntry const* Battleground::GetClosestGraveyard(Player* player)
GraveyardStruct const* Battleground::GetClosestGraveyard(Player* player)
{
return sObjectMgr->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetBgTeamId());
return sGraveyard->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetBgTeamId());
}
void Battleground::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)

View File

@@ -31,7 +31,7 @@ class BattlegroundRV;
class BattlegroundIC;
struct PvPDifficultyEntry;
struct WorldSafeLocsEntry;
struct GraveyardStruct;
enum BattlegroundDesertionType
{
@@ -541,7 +541,7 @@ class Battleground
virtual void HandlePlayerResurrect(Player* /*player*/) {}
// Death related
virtual WorldSafeLocsEntry const* GetClosestGraveyard(Player* player);
virtual GraveyardStruct const* GetClosestGraveyard(Player* player);
virtual void AddPlayer(Player* player); // must be implemented in BG subclass

View File

@@ -34,6 +34,7 @@
#include "DisableMgr.h"
#include "Opcodes.h"
#include "BattlegroundQueue.h"
#include "GameGraveyard.h"
#ifdef ELUNA
#include "LuaEngine.h"
#endif
@@ -649,7 +650,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
else
{
uint32 startId = fields[5].GetUInt32();
if (WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(startId))
if (GraveyardStruct const* start = sGraveyard->GetGraveyard(startId))
{
data.Team1StartLocX = start->x;
data.Team1StartLocY = start->y;
@@ -658,12 +659,12 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
else
{
sLog->outError("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
sLog->outError("Table `battleground_template` for id %u have non-existed `game_graveyard` table id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
continue;
}
startId = fields[7].GetUInt32();
if (WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(startId))
if (GraveyardStruct const* start = sGraveyard->GetGraveyard(startId))
{
data.Team2StartLocX = start->x;
data.Team2StartLocY = start->y;
@@ -672,7 +673,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
else
{
sLog->outError("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
sLog->outError("Table `battleground_template` for id %u have non-existed `game_graveyard` table id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
continue;
}
}

View File

@@ -13,6 +13,7 @@
#include "Player.h"
#include "Util.h"
#include "WorldSession.h"
#include "GameGraveyard.h"
BattlegroundAB::BattlegroundAB()
{
@@ -424,10 +425,10 @@ void BattlegroundAB::EndBattleground(TeamId winnerTeamId)
_bgEvents.Reset();
}
WorldSafeLocsEntry const* BattlegroundAB::GetClosestGraveyard(Player* player)
GraveyardStruct const* BattlegroundAB::GetClosestGraveyard(Player* player)
{
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[BG_AB_SPIRIT_ALIANCE + player->GetTeamId()]);
WorldSafeLocsEntry const* nearestEntry = entry;
GraveyardStruct const* entry = sGraveyard->GetGraveyard(BG_AB_GraveyardIds[BG_AB_SPIRIT_ALIANCE + player->GetTeamId()]);
GraveyardStruct const* nearestEntry = entry;
float pX = player->GetPositionX();
float pY = player->GetPositionY();
@@ -437,7 +438,7 @@ WorldSafeLocsEntry const* BattlegroundAB::GetClosestGraveyard(Player* player)
for (uint8 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
if (_capturePointInfo[i]._ownerTeamId == player->GetTeamId())
{
entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[i]);
entry = sGraveyard->GetGraveyard(BG_AB_GraveyardIds[i]);
dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY);
if (dist < minDist)
{

View File

@@ -235,7 +235,7 @@ class BattlegroundAB : public Battleground
bool SetupBattleground();
void Init();
void EndBattleground(TeamId winnerTeamId);
WorldSafeLocsEntry const* GetClosestGraveyard(Player* player);
GraveyardStruct const* GetClosestGraveyard(Player* player);
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
void FillInitialWorldStates(WorldPacket& data);

View File

@@ -15,6 +15,7 @@
#include "SpellAuras.h"
#include "GameEventMgr.h"
#include "WorldSession.h"
#include "GameGraveyard.h"
BattlegroundAV::BattlegroundAV()
{
@@ -1174,23 +1175,23 @@ void BattlegroundAV::SendMineWorldStates(uint32 mine)
UpdateWorldState(BG_AV_MineWorldStates[mine][owner], 1);
}
WorldSafeLocsEntry const* BattlegroundAV::GetClosestGraveyard(Player* player)
GraveyardStruct const* BattlegroundAV::GetClosestGraveyard(Player* player)
{
WorldSafeLocsEntry const* pGraveyard = NULL;
WorldSafeLocsEntry const* entry = NULL;
GraveyardStruct const* pGraveyard = NULL;
GraveyardStruct const* entry = NULL;
float dist = 0;
float minDist = 0;
float x, y;
player->GetPosition(x, y);
pGraveyard = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[player->GetTeamId()+7]);
pGraveyard = sGraveyard->GetGraveyard(BG_AV_GraveyardIds[player->GetTeamId()+7]);
minDist = (pGraveyard->x - x)*(pGraveyard->x - x)+(pGraveyard->y - y)*(pGraveyard->y - y);
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
if (m_Nodes[i].OwnerId == player->GetTeamId() && m_Nodes[i].State == POINT_CONTROLED)
{
entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]);
entry = sGraveyard->GetGraveyard(BG_AV_GraveyardIds[i]);
if (entry)
{
dist = (entry->x - x)*(entry->x - x)+(entry->y - y)*(entry->y - y);

View File

@@ -1591,7 +1591,7 @@ class BattlegroundAV : public Battleground
void EndBattleground(TeamId winnerTeamId);
WorldSafeLocsEntry const* GetClosestGraveyard(Player* player);
GraveyardStruct const* GetClosestGraveyard(Player* player);
/* achievement req. */
bool IsBothMinesControlledByTeam(TeamId teamId) const;

View File

@@ -13,6 +13,7 @@
#include "Player.h"
#include "Util.h"
#include "WorldSession.h"
#include "GameGraveyard.h"
BattlegroundEY::BattlegroundEY()
{
@@ -309,11 +310,11 @@ bool BattlegroundEY::SetupBattleground()
AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY);
}
WorldSafeLocsEntry const* sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(BG_EY_GRAVEYARD_MAIN_ALLIANCE);
GraveyardStruct const* sg = NULL;
sg = sGraveyard->GetGraveyard(BG_EY_GRAVEYARD_MAIN_ALLIANCE);
AddSpiritGuide(BG_EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, TEAM_ALLIANCE);
sg = sWorldSafeLocsStore.LookupEntry(BG_EY_GRAVEYARD_MAIN_HORDE);
sg = sGraveyard->GetGraveyard(BG_EY_GRAVEYARD_MAIN_HORDE);
AddSpiritGuide(BG_EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE);
for (uint32 i = BG_EY_OBJECT_DOOR_A; i < BG_EY_OBJECT_MAX; ++i)
@@ -480,7 +481,7 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point)
if (BgCreatures[point])
DelCreature(point);
WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[point].GraveYardId);
GraveyardStruct const* sg = sGraveyard->GetGraveyard(m_CapturingPointTypes[point].GraveYardId);
AddSpiritGuide(point, sg->x, sg->y, sg->z, 3.124139f, teamId);
UpdatePointsIcons(point);
@@ -565,10 +566,10 @@ void BattlegroundEY::FillInitialWorldStates(WorldPacket& data)
data << uint32(PROGRESS_BAR_STATUS) << uint32(0);
}
WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player)
GraveyardStruct const* BattlegroundEY::GetClosestGraveyard(Player* player)
{
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_EY_GRAVEYARD_MAIN_ALLIANCE + player->GetTeamId());
WorldSafeLocsEntry const* nearestEntry = entry;
GraveyardStruct const* entry = sGraveyard->GetGraveyard(BG_EY_GRAVEYARD_MAIN_ALLIANCE + player->GetTeamId());
GraveyardStruct const* nearestEntry = entry;
float pX = player->GetPositionX();
float pY = player->GetPositionY();
@@ -579,7 +580,7 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player)
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
if (_capturePointInfo[i].IsUnderControl(player->GetTeamId()))
{
entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId);
entry = sGraveyard->GetGraveyard(m_CapturingPointTypes[i].GraveYardId);
dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY) + (entry->z - pZ)*(entry->z - pZ);
if (dist < minDist)
{

View File

@@ -336,7 +336,7 @@ class BattlegroundEY : public Battleground
void HandleBuffUse(uint64 buff_guid);
void HandleAreaTrigger(Player* player, uint32 trigger);
void HandleKillPlayer(Player* player, Player* killer);
WorldSafeLocsEntry const* GetClosestGraveyard(Player* player);
GraveyardStruct const* GetClosestGraveyard(Player* player);
bool SetupBattleground();
void Init();
void EndBattleground(TeamId winnerTeamId);

View File

@@ -15,6 +15,7 @@
#include "Transport.h"
#include "WorldSession.h"
#include "ScriptedCreature.h"
#include "GameGraveyard.h"
BattlegroundIC::BattlegroundIC()
{
@@ -950,7 +951,7 @@ void BattlegroundIC::EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/
}
WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player)
GraveyardStruct const* BattlegroundIC::GetClosestGraveyard(Player* player)
{
// Is there any occupied node for this team?
std::vector<uint8> nodes;
@@ -958,7 +959,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player)
if (nodePoint[i].faction == player->GetTeamId() && !nodePoint[i].needChange) // xinef: controlled by faction and not contested!
nodes.push_back(i);
WorldSafeLocsEntry const* good_entry = NULL;
GraveyardStruct const* good_entry = NULL;
// If so, select the closest node to place ghost on
if (!nodes.empty())
{
@@ -968,7 +969,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player)
float mindist = 999999.0f;
for (uint8 i = 0; i < nodes.size(); ++i)
{
WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry(BG_IC_GraveyardIds[nodes[i]]);
GraveyardStruct const*entry = sGraveyard->GetGraveyard(BG_IC_GraveyardIds[nodes[i]]);
if (!entry)
continue;
float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y);
@@ -982,7 +983,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player)
}
// If not, place ghost on starting location
if (!good_entry)
good_entry = sWorldSafeLocsStore.LookupEntry(BG_IC_GraveyardIds[player->GetTeamId()+MAX_NODE_TYPES]);
good_entry = sGraveyard->GetGraveyard(BG_IC_GraveyardIds[player->GetTeamId()+MAX_NODE_TYPES]);
return good_entry;
}

View File

@@ -911,7 +911,7 @@ class BattlegroundIC : public Battleground
void EventPlayerDamagedGO(Player* /*player*/, GameObject* go, uint32 eventType);
void DestroyGate(Player* player, GameObject* go);
WorldSafeLocsEntry const* GetClosestGraveyard(Player* player);
GraveyardStruct const* GetClosestGraveyard(Player* player);
/* Scorekeeping */
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);

View File

@@ -11,6 +11,7 @@
#include "ObjectMgr.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "GameGraveyard.h"
BattlegroundSA::BattlegroundSA()
{
@@ -163,8 +164,8 @@ bool BattlegroundSA::ResetObjs()
//Graveyards!
for (uint8 i = 0;i < BG_SA_MAX_GY; i++)
{
WorldSafeLocsEntry const* sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
GraveyardStruct const* sg = NULL;
sg = sGraveyard->GetGraveyard(BG_SA_GYEntries[i]);
if (!sg)
{
@@ -761,9 +762,9 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go)
}
}
WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveyard(Player* player)
GraveyardStruct const* BattlegroundSA::GetClosestGraveyard(Player* player)
{
WorldSafeLocsEntry const* closest = NULL;
GraveyardStruct const* closest = NULL;
float mindist = 999999.0f;
float x, y;
@@ -774,7 +775,7 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveyard(Player* player)
if (GraveyardStatus[i] != player->GetTeamId())
continue;
WorldSafeLocsEntry const* ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
GraveyardStruct const* ret = sGraveyard->GetGraveyard(BG_SA_GYEntries[i]);
// if on beach
if (i == BG_SA_BEACH_GY)
@@ -792,7 +793,7 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveyard(Player* player)
}
}
if (!closest && GraveyardStatus[BG_SA_BEACH_GY] == player->GetTeamId())
return sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[BG_SA_BEACH_GY]);
return sGraveyard->GetGraveyard(BG_SA_GYEntries[BG_SA_BEACH_GY]);
return closest;
@@ -883,7 +884,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]];
if (!ghost_list.empty())
{
WorldSafeLocsEntry const* ClosestGrave = NULL;
GraveyardStruct const* ClosestGrave = NULL;
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
{
Player* player = ObjectAccessor::FindPlayer(*itr);
@@ -902,7 +903,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
DelCreature(BG_SA_MAXNPC + i);
WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
GraveyardStruct const* sg = sGraveyard->GetGraveyard(BG_SA_GYEntries[i]);
if (!sg)
{
sLog->outError("BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]);

View File

@@ -445,7 +445,7 @@ class BattlegroundSA : public Battleground
/// Called when a player kill a unit in bg
void HandleKillUnit(Creature* creature, Player* killer);
/// Return the nearest graveyard where player can respawn
WorldSafeLocsEntry const* GetClosestGraveyard(Player* player);
GraveyardStruct const* GetClosestGraveyard(Player* player);
/// Called when a player click on flag (graveyard flag)
void EventPlayerClickedOnFlag(Player* Source, GameObject* gameObject);
/// Called when a player use a gamobject (relic)

View File

@@ -12,6 +12,7 @@
#include "Player.h"
#include "World.h"
#include "WorldPacket.h"
#include "GameGraveyard.h"
BattlegroundWS::BattlegroundWS()
{
@@ -401,10 +402,10 @@ bool BattlegroundWS::SetupBattleground()
AddObject(BG_WS_OBJECT_DOOR_H_4, BG_OBJECT_DOOR_H_4_WS_ENTRY, 950.7952f, 1459.583f, 342.1523f, 0.05235988f, 0, 0, 0.02617695f, 0.9996573f, RESPAWN_IMMEDIATELY);
WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
GraveyardStruct const* sg = sGraveyard->GetGraveyard(WS_GRAVEYARD_MAIN_ALLIANCE);
AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, TEAM_ALLIANCE);
sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
sg = sGraveyard->GetGraveyard(WS_GRAVEYARD_MAIN_HORDE);
AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE);
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i < BG_WS_OBJECT_MAX; ++i)
@@ -495,12 +496,12 @@ void BattlegroundWS::UpdatePlayerScore(Player* player, uint32 type, uint32 value
}
}
WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveyard(Player* player)
GraveyardStruct const* BattlegroundWS::GetClosestGraveyard(Player* player)
{
if (GetStatus() == STATUS_IN_PROGRESS)
return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_MAIN_ALLIANCE : WS_GRAVEYARD_MAIN_HORDE);
return sGraveyard->GetGraveyard(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_MAIN_ALLIANCE : WS_GRAVEYARD_MAIN_HORDE);
else
return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_FLAGROOM_ALLIANCE : WS_GRAVEYARD_FLAGROOM_HORDE);
return sGraveyard->GetGraveyard(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_FLAGROOM_ALLIANCE : WS_GRAVEYARD_FLAGROOM_HORDE);
}
void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)

View File

@@ -176,7 +176,7 @@ class BattlegroundWS : public Battleground
bool SetupBattleground();
void Init();
void EndBattleground(TeamId winnerTeamId);
WorldSafeLocsEntry const* GetClosestGraveyard(Player* player);
GraveyardStruct const* GetClosestGraveyard(Player* player);
void UpdateFlagState(TeamId teamId, uint32 value);
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);