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

@@ -18,6 +18,7 @@ EndScriptData */
#include "Chat.h"
#include "Language.h"
#include "Player.h"
#include "GameGraveyard.h"
class go_commandscript : public CommandScript
{
@@ -171,7 +172,7 @@ public:
if (!graveyardId)
return false;
WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(graveyardId);
GraveyardStruct const* gy = sGraveyard->GetGraveyard(graveyardId);
if (!gy)
{
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
@@ -179,9 +180,9 @@ public:
return false;
}
if (!MapManager::IsValidMapCoord(gy->map_id, gy->x, gy->y, gy->z))
if (!MapManager::IsValidMapCoord(gy->Map, gy->x, gy->y, gy->z))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, gy->x, gy->y, gy->map_id);
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, gy->x, gy->y, gy->Map);
handler->SetSentErrorMessage(true);
return false;
}
@@ -196,7 +197,7 @@ public:
else
player->SaveRecallPosition();
player->TeleportTo(gy->map_id, gy->x, gy->y, gy->z, player->GetOrientation());
player->TeleportTo(gy->Map, gy->x, gy->y, gy->z, player->GetOrientation());
return true;
}

View File

@@ -27,6 +27,7 @@
#include "GroupMgr.h"
#include "BattlegroundMgr.h"
#include "MapManager.h"
#include "GameGraveyard.h"
class misc_commandscript : public CommandScript
{
@@ -1268,7 +1269,7 @@ public:
else
return false;
WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId);
GraveyardStruct const* graveyard = sGraveyard->GetGraveyard(graveyardId);
if (!graveyard)
{
@@ -1289,7 +1290,7 @@ public:
return false;
}
if (sObjectMgr->AddGraveyardLink(graveyardId, zoneId, teamId))
if (sGraveyard->AddGraveyardLink(graveyardId, zoneId, teamId))
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId);
else
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId);
@@ -1315,13 +1316,13 @@ public:
Player* player = handler->GetSession()->GetPlayer();
uint32 zone_id = player->GetZoneId();
WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), teamId);
GraveyardStruct const* graveyard = sGraveyard->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), teamId);
if (graveyard)
{
uint32 graveyardId = graveyard->ID;
GraveyardData const* data = sObjectMgr->FindGraveyardData(graveyardId, zone_id);
GraveyardData const* data = sGraveyard->FindGraveyardData(graveyardId, zone_id);
if (!data)
{
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);

View File

@@ -29,6 +29,7 @@ EndScriptData */
#include "TicketMgr.h"
#include "WardenCheckMgr.h"
#include "WaypointManager.h"
#include "GameGraveyard.h"
class reload_commandscript : public CommandScript
{
@@ -80,6 +81,7 @@ public:
{ "disenchant_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesDisenchantCommand, "" },
{ "event_scripts", SEC_ADMINISTRATOR, true, &HandleReloadEventScriptsCommand, "" },
{ "fishing_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesFishingCommand, "" },
{ "game_graveyard", SEC_ADMINISTRATOR, true, &HandleReloadGameGraveyardCommand, "" },
{ "game_graveyard_zone", SEC_ADMINISTRATOR, true, &HandleReloadGameGraveyardZoneCommand, "" },
{ "game_tele", SEC_ADMINISTRATOR, true, &HandleReloadGameTeleCommand, "" },
{ "gameobject_questender", SEC_ADMINISTRATOR, true, &HandleReloadGOQuestEnderCommand, "" },
@@ -1022,7 +1024,7 @@ public:
{
sLog->outString("Re-Loading Graveyard-zone links...");
sObjectMgr->LoadGraveyardZones();
sGraveyard->LoadGraveyardZones();
handler->SendGlobalGMSysMessage("DB table `game_graveyard_zone` reloaded.");
@@ -1203,6 +1205,14 @@ public:
handler->SendGlobalGMSysMessage("Vehicle template accessories reloaded.");
return true;
}
static bool HandleReloadGameGraveyardCommand(ChatHandler* handler, const char* /*args*/)
{
sLog->outString("Reloading game_graveyard table...");
sGraveyard->LoadGraveyardFromDB();
handler->SendGlobalGMSysMessage("DB table `game_graveyard` reloaded.");
return true;
}
};
void AddSC_reload_commandscript()