Decouple zone calls, cleanup logic

This commit is contained in:
Akkadius 2020-04-19 04:36:39 -05:00
parent ebda1cf601
commit 373fb3f0e7
57 changed files with 705 additions and 467 deletions

View File

@ -1082,50 +1082,6 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon
return true; return true;
} }
bool Database::LoadZoneNames() {
std::string query("SELECT zoneidnumber, short_name FROM zone");
auto results = QueryDatabase(query);
if (!results.Success())
{
return false;
}
for (auto row= results.begin();row != results.end();++row)
{
uint32 zoneid = atoi(row[0]);
std::string zonename = row[1];
zonename_array.insert(std::pair<uint32,std::string>(zoneid,zonename));
}
return true;
}
uint32 Database::GetZoneID(const char* zonename) {
if (zonename == nullptr)
return 0;
for (auto & iter : zonename_array)
if (strcasecmp(iter.second.c_str(), zonename) == 0)
return iter.first;
return 0;
}
const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) {
auto iter = zonename_array.find(zoneID);
if (iter != zonename_array.end())
return iter->second.c_str();
if (ErrorUnknown)
return "UNKNOWN";
return 0;
}
uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){ uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){
std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version); std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version);
@ -1342,29 +1298,31 @@ uint8 Database::GetServerType() {
return atoi(row[0]); return atoi(row[0]);
} }
bool Database::MoveCharacterToZone(const char* charname, const char* zonename, uint32 zoneid) { bool Database::MoveCharacterToZone(uint32 character_id, uint32 zone_id)
if(zonename == nullptr || strlen(zonename) == 0) {
return false; std::string query = StringFormat(
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i",
zone_id,
character_id
);
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'", zoneid, charname);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
return false; return false;
} }
if (results.RowsAffected() == 0) return results.RowsAffected() != 0;
return false;
return true;
} }
bool Database::MoveCharacterToZone(const char* charname, const char* zonename) { bool Database::MoveCharacterToZone(const char *charname, uint32 zone_id)
return MoveCharacterToZone(charname, zonename, GetZoneID(zonename)); {
} std::string query = StringFormat(
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'",
zone_id,
charname
);
bool Database::MoveCharacterToZone(uint32 iCharID, const char* iZonename) {
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i", GetZoneID(iZonename), iCharID);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {

View File

@ -108,9 +108,8 @@ public:
bool AddToNameFilter(const char* name); bool AddToNameFilter(const char* name);
bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face); bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face);
bool DeleteCharacter(char* character_name); bool DeleteCharacter(char* character_name);
bool MoveCharacterToZone(const char* charname, const char* zonename); bool MoveCharacterToZone(const char* charname, uint32 zone_id);
bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid); bool MoveCharacterToZone(uint32 character_id, uint32 zone_id);
bool MoveCharacterToZone(uint32 iCharID, const char* iZonename);
bool ReserveName(uint32 account_id, char* name); bool ReserveName(uint32 account_id, char* name);
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp); bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked); bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
@ -155,7 +154,6 @@ public:
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id); bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id); bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version); uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
uint16 GetInstanceVersion(uint16 instance_id); uint16 GetInstanceVersion(uint16 instance_id);
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma); uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
@ -243,16 +241,11 @@ public:
/* General Queries */ /* General Queries */
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr); bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, flag_needed); }
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0); bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0); bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
bool LoadPTimers(uint32 charid, PTimerList &into); bool LoadPTimers(uint32 charid, PTimerList &into);
bool LoadZoneNames();
const char* GetZoneName(uint32 zone_id, bool ErrorUnknown = false);
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version); uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
uint32 GetZoneID(const char* zonename);
uint8 GetPEQZone(uint32 zoneID, uint32 version); uint8 GetPEQZone(uint32 zoneID, uint32 version);
uint8 GetRaceSkill(uint8 skillid, uint8 in_race); uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
@ -275,8 +268,6 @@ public:
/* EQEmuLogSys */ /* EQEmuLogSys */
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings); void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
std::map<uint32,std::string> zonename_array;
private: private:
Mutex Mvarcache; Mutex Mvarcache;

View File

@ -306,36 +306,6 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
return true; return true;
} }
uint16 Database::GetInstanceID(const char* zone, uint32 character_id, int16 version) {
std::string query = StringFormat(
"SELECT "
"instance_list.id "
"FROM "
"instance_list, "
"instance_list_player "
"WHERE "
"instance_list.zone = %u "
"AND instance_list.version = %u "
"AND instance_list.id = instance_list_player.id "
"AND instance_list_player.charid = %u "
"LIMIT 1 ",
GetZoneID(zone),
version,
character_id
);
auto results = QueryDatabase(query);
if (!results.Success())
return 0;
if (results.RowCount() == 0)
return 0;
auto row = results.begin();
return atoi(row[0]);
}
uint16 Database::GetInstanceID(uint32 zone, uint32 character_id, int16 version) uint16 Database::GetInstanceID(uint32 zone, uint32 character_id, int16 version)
{ {
if (!zone) if (!zone)

View File

@ -24,6 +24,7 @@ SET(world_sources
world_console_connection.cpp world_console_connection.cpp
world_server_command_handler.cpp world_server_command_handler.cpp
worlddb.cpp worlddb.cpp
world_store.cpp
zonelist.cpp zonelist.cpp
zoneserver.cpp zoneserver.cpp
) )
@ -54,6 +55,7 @@ SET(world_headers
world_tcp_connection.h world_tcp_connection.h
world_server_command_handler.h world_server_command_handler.h
worlddb.h worlddb.h
world_store.h
zonelist.h zonelist.h
zoneserver.h zoneserver.h
) )

View File

@ -11,6 +11,7 @@
#include "zonelist.h" #include "zonelist.h"
#include "clientlist.h" #include "clientlist.h"
#include "cliententry.h" #include "cliententry.h"
#include "world_store.h"
extern ZSList zoneserver_list; extern ZSList zoneserver_list;
extern ClientList client_list; extern ClientList client_list;
@ -143,7 +144,7 @@ bool Adventure::Process()
bool Adventure::CreateInstance() bool Adventure::CreateInstance()
{ {
uint32 zone_id = content_db.GetZoneID(adventure_template->zone); uint32 zone_id = ZoneID(adventure_template->zone);
if(!zone_id) if(!zone_id)
{ {
return false; return false;

View File

@ -10,6 +10,7 @@
#include "zonelist.h" #include "zonelist.h"
#include "clientlist.h" #include "clientlist.h"
#include "cliententry.h" #include "cliententry.h"
#include "world_store.h"
#include <sstream> #include <sstream>
#include <stdio.h> #include <stdio.h>
@ -771,7 +772,7 @@ void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int do
sizeof(ServerPlayerClickedAdventureDoorReply_Struct)); sizeof(ServerPlayerClickedAdventureDoorReply_Struct));
ServerPlayerClickedAdventureDoorReply_Struct *sr = (ServerPlayerClickedAdventureDoorReply_Struct*)pack->pBuffer; ServerPlayerClickedAdventureDoorReply_Struct *sr = (ServerPlayerClickedAdventureDoorReply_Struct*)pack->pBuffer;
strcpy(sr->player, player); strcpy(sr->player, player);
sr->zone_id = content_db.GetZoneID(t->zone); sr->zone_id = ZoneID(t->zone);
sr->instance_id = (*iter)->GetInstanceID(); sr->instance_id = (*iter)->GetInstanceID();
sr->x = t->dest_x; sr->x = t->dest_x;
sr->y = t->dest_y; sr->y = t->dest_y;

View File

@ -46,6 +46,7 @@
#include "clientlist.h" #include "clientlist.h"
#include "wguild_mgr.h" #include "wguild_mgr.h"
#include "sof_char_create_data.h" #include "sof_char_create_data.h"
#include "world_store.h"
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
@ -785,7 +786,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
if (tutorial_enabled) { if (tutorial_enabled) {
zone_id = RuleI(World, TutorialZoneID); zone_id = RuleI(World, TutorialZoneID);
database.MoveCharacterToZone(charid, content_db.GetZoneName(zone_id)); database.MoveCharacterToZone(charid, zone_id);
} }
else { else {
LogInfo("[{}] is trying to go to tutorial but are not allowed", char_name); LogInfo("[{}] is trying to go to tutorial but are not allowed", char_name);
@ -796,9 +797,9 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
} }
} }
if (zone_id == 0 || !content_db.GetZoneName(zone_id)) { if (zone_id == 0 || !ZoneName(zone_id)) {
// This is to save people in an invalid zone, once it's removed from the DB // This is to save people in an invalid zone, once it's removed from the DB
database.MoveCharacterToZone(charid, "arena"); database.MoveCharacterToZone(charid, ZoneID("arena"));
LogInfo("Zone not found in database zone_id=[{}], moveing char to arena character:[{}]", zone_id, char_name); LogInfo("Zone not found in database zone_id=[{}], moveing char to arena character:[{}]", zone_id, char_name);
} }
@ -1154,7 +1155,7 @@ void Client::EnterWorld(bool TryBootup) {
else else
zone_server = zoneserver_list.FindByZoneID(zone_id); zone_server = zoneserver_list.FindByZoneID(zone_id);
const char *zone_name = content_db.GetZoneName(zone_id, true); const char *zone_name = ZoneName(zone_id, true);
if (zone_server) { if (zone_server) {
if (false == enter_world_triggered) { if (false == enter_world_triggered) {
//Drop any clients we own in other zones. //Drop any clients we own in other zones.
@ -1267,7 +1268,7 @@ void Client::Clearance(int8 response)
return; return;
} }
const char* zonename = content_db.GetZoneName(zone_id); const char* zonename = ZoneName(zone_id);
if (zonename == 0) { if (zonename == 0) {
LogInfo("zonename is nullptr in Client::Clearance!!"); LogInfo("zonename is nullptr in Client::Clearance!!");
TellClientZoneUnavailable(); TellClientZoneUnavailable();
@ -1322,7 +1323,7 @@ void Client::Clearance(int8 response)
void Client::TellClientZoneUnavailable() { void Client::TellClientZoneUnavailable() {
auto outapp = new EQApplicationPacket(OP_ZoneUnavail, sizeof(ZoneUnavail_Struct)); auto outapp = new EQApplicationPacket(OP_ZoneUnavail, sizeof(ZoneUnavail_Struct));
ZoneUnavail_Struct* ua = (ZoneUnavail_Struct*)outapp->pBuffer; ZoneUnavail_Struct* ua = (ZoneUnavail_Struct*)outapp->pBuffer;
const char* zonename = content_db.GetZoneName(zone_id); const char* zonename = ZoneName(zone_id);
if (zonename) if (zonename)
strcpy(ua->zonename, zonename); strcpy(ua->zonename, zonename);
QueuePacket(outapp); QueuePacket(outapp);
@ -1568,7 +1569,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
/* Overrides if we have the tutorial flag set! */ /* Overrides if we have the tutorial flag set! */
if (cc->tutorial && RuleB(World, EnableTutorialButton)) { if (cc->tutorial && RuleB(World, EnableTutorialButton)) {
pp.zone_id = RuleI(World, TutorialZoneID); pp.zone_id = RuleI(World, TutorialZoneID);
content_db.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); content_db.GetSafePoints(ZoneName(pp.zone_id), 0, &pp.x, &pp.y, &pp.z);
} }
/* Will either be the same as home or tutorial if enabled. */ /* Will either be the same as home or tutorial if enabled. */
@ -1581,11 +1582,11 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
} }
Log(Logs::Detail, Logs::WorldServer, "Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", Log(Logs::Detail, Logs::WorldServer, "Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f",
content_db.GetZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading); ZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading);
Log(Logs::Detail, Logs::WorldServer, "Bind location: %s (%d) %0.2f, %0.2f, %0.2f", Log(Logs::Detail, Logs::WorldServer, "Bind location: %s (%d) %0.2f, %0.2f, %0.2f",
content_db.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z); ZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
Log(Logs::Detail, Logs::WorldServer, "Home location: %s (%d) %0.2f, %0.2f, %0.2f", Log(Logs::Detail, Logs::WorldServer, "Home location: %s (%d) %0.2f, %0.2f, %0.2f",
content_db.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z); ZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
/* Starting Items inventory */ /* Starting Items inventory */
content_db.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin()); content_db.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin());
@ -2090,7 +2091,7 @@ bool Client::StoreCharacter(
return false; return false;
} }
const char *zone_name = content_db.GetZoneName(p_player_profile_struct->zone_id); const char *zone_name = ZoneName(p_player_profile_struct->zone_id);
if (zone_name == nullptr) { if (zone_name == nullptr) {
/* Zone not in the DB, something to prevent crash... */ /* Zone not in the DB, something to prevent crash... */
strn0cpy(zone, "qeynos", 49); strn0cpy(zone, "qeynos", 49);

View File

@ -33,6 +33,7 @@
#include "../common/event_sub.h" #include "../common/event_sub.h"
#include "web_interface.h" #include "web_interface.h"
#include "wguild_mgr.h" #include "wguild_mgr.h"
#include "world_store.h"
#include <set> #include <set>
extern WebInterfaceList web_interface; extern WebInterfaceList web_interface;
@ -293,7 +294,7 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
if (cle->LSID()) if (cle->LSID())
AppendAnyLenString(&output, &outsize, &outlen, "%s LSID: %i LSName: %s WorldAdmin: %i", newline, cle->LSID(), cle->LSName(), cle->WorldAdmin()); AppendAnyLenString(&output, &outsize, &outlen, "%s LSID: %i LSName: %s WorldAdmin: %i", newline, cle->LSID(), cle->LSName(), cle->WorldAdmin());
if (cle->CharID()) if (cle->CharID())
AppendAnyLenString(&output, &outsize, &outlen, "%s CharID: %i CharName: %s Zone: %s (%i)", newline, cle->CharID(), cle->name(), content_db.GetZoneName(cle->zone()), cle->zone()); AppendAnyLenString(&output, &outsize, &outlen, "%s CharID: %i CharName: %s Zone: %s (%i)", newline, cle->CharID(), cle->name(), ZoneName(cle->zone()), cle->zone());
if (outlen >= 3072) { if (outlen >= 3072) {
connection->SendEmoteMessageRaw(to, 0, 0, 10, output); connection->SendEmoteMessageRaw(to, 0, 0, 10, output);
safe_delete(output); safe_delete(output);
@ -500,7 +501,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
countclients.Reset(); countclients.Reset();
while(countclients.MoreElements()){ while(countclients.MoreElements()){
countcle = countclients.GetData(); countcle = countclients.GetData();
const char* tmpZone = content_db.GetZoneName(countcle->zone()); const char* tmpZone = ZoneName(countcle->zone());
if ( if (
(countcle->Online() >= CLE_Status::Zoning) && (countcle->Online() >= CLE_Status::Zoning) &&
(!countcle->GetGM() || countcle->Anon() != 1 || admin >= countcle->Admin()) && (!countcle->GetGM() || countcle->Anon() != 1 || admin >= countcle->Admin()) &&
@ -580,7 +581,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
while(iterator.MoreElements()) { while(iterator.MoreElements()) {
cle = iterator.GetData(); cle = iterator.GetData();
const char* tmpZone = content_db.GetZoneName(cle->zone()); const char* tmpZone = ZoneName(cle->zone());
if ( if (
(cle->Online() >= CLE_Status::Zoning) && (cle->Online() >= CLE_Status::Zoning) &&
(!cle->GetGM() || cle->Anon() != 1 || admin >= cle->Admin()) && (!cle->GetGM() || cle->Anon() != 1 || admin >= cle->Admin()) &&
@ -965,7 +966,7 @@ void ClientList::ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct*
iterator.Reset(); iterator.Reset();
while (iterator.MoreElements()) { while (iterator.MoreElements()) {
cle = iterator.GetData(); cle = iterator.GetData();
const char* tmpZone = content_db.GetZoneName(cle->zone()); const char* tmpZone = ZoneName(cle->zone());
if ( if (
(cle->Online() >= CLE_Status::Zoning) (cle->Online() >= CLE_Status::Zoning)
&& (whom == 0 || ( && (whom == 0 || (
@ -1282,7 +1283,7 @@ void ClientList::GetClients(const char *zone_name, std::vector<ClientListEntry *
iterator.Advance(); iterator.Advance();
} }
} else { } else {
uint32 zoneid = content_db.GetZoneID(zone_name); uint32 zoneid = ZoneID(zone_name);
while(iterator.MoreElements()) { while(iterator.MoreElements()) {
ClientListEntry* tmp = iterator.GetData(); ClientListEntry* tmp = iterator.GetData();
if(tmp->zone() == zoneid) if(tmp->zone() == zoneid)

View File

@ -30,6 +30,7 @@
#include "../common/string_util.h" #include "../common/string_util.h"
#include "../common/md5.h" #include "../common/md5.h"
#include "eqemu_api_world_data_service.h" #include "eqemu_api_world_data_service.h"
#include "world_store.h"
#include <fmt/format.h> #include <fmt/format.h>
extern ClientList client_list; extern ClientList client_list;
@ -541,7 +542,7 @@ void ConsoleZoneShutdown(
s->ZoneServerID = atoi(args[0].c_str()); s->ZoneServerID = atoi(args[0].c_str());
} }
else { else {
s->zoneid = content_db.GetZoneID(args[0].c_str()); s->zoneid = ZoneID(args[0].c_str());
} }
ZoneServer *zs = 0; ZoneServer *zs = 0;
@ -549,7 +550,7 @@ void ConsoleZoneShutdown(
zs = zoneserver_list.FindByID(s->ZoneServerID); zs = zoneserver_list.FindByID(s->ZoneServerID);
} }
else if (s->zoneid != 0) { else if (s->zoneid != 0) {
zs = zoneserver_list.FindByName(content_db.GetZoneName(s->zoneid)); zs = zoneserver_list.FindByName(ZoneName(s->zoneid));
} }
else { else {
connection->SendLine("Error: ZoneShutdown: neither ID nor name specified"); connection->SendLine("Error: ZoneShutdown: neither ID nor name specified");
@ -633,10 +634,10 @@ void ConsoleZoneLock(
return; return;
} }
uint16 tmp = content_db.GetZoneID(args[1].c_str()); uint16 tmp = ZoneID(args[1].c_str());
if (tmp) { if (tmp) {
if (zoneserver_list.SetLockedZone(tmp, true)) { if (zoneserver_list.SetLockedZone(tmp, true)) {
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", content_db.GetZoneName(tmp)); zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", ZoneName(tmp));
} }
else { else {
connection->SendLine("Failed to change lock"); connection->SendLine("Failed to change lock");
@ -651,10 +652,10 @@ void ConsoleZoneLock(
return; return;
} }
uint16 tmp = content_db.GetZoneID(args[1].c_str()); uint16 tmp = ZoneID(args[1].c_str());
if (tmp) { if (tmp) {
if (zoneserver_list.SetLockedZone(tmp, false)) { if (zoneserver_list.SetLockedZone(tmp, false)) {
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", content_db.GetZoneName(tmp)); zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", ZoneName(tmp));
} }
else { else {
connection->SendLine("Failed to change lock"); connection->SendLine("Failed to change lock");

View File

@ -616,7 +616,7 @@ void Console::ProcessCommand(const char* command) {
if(sep.arg[1][0]==0 || sep.arg[2][0] == 0) if(sep.arg[1][0]==0 || sep.arg[2][0] == 0)
SendMessage(1, "Usage: movechar [charactername] [zonename]"); SendMessage(1, "Usage: movechar [charactername] [zonename]");
else { else {
if (!content_db.GetZoneID(sep.arg[2])) if (!ZoneID(sep.arg[2]))
SendMessage(1, "Error: Zone '%s' not found", sep.arg[2]); SendMessage(1, "Error: Zone '%s' not found", sep.arg[2]);
else if (!database.CheckUsedName((char*) sep.arg[1])) { else if (!database.CheckUsedName((char*) sep.arg[1])) {
if (!database.MoveCharacterToZone((char*) sep.arg[1], (char*) sep.arg[2])) if (!database.MoveCharacterToZone((char*) sep.arg[1], (char*) sep.arg[2]))
@ -711,13 +711,13 @@ void Console::ProcessCommand(const char* command) {
if (sep.arg[1][0] >= '0' && sep.arg[1][0] <= '9') if (sep.arg[1][0] >= '0' && sep.arg[1][0] <= '9')
s->ZoneServerID = atoi(sep.arg[1]); s->ZoneServerID = atoi(sep.arg[1]);
else else
s->zoneid = content_db.GetZoneID(sep.arg[1]); s->zoneid = ZoneID(sep.arg[1]);
ZoneServer* zs = 0; ZoneServer* zs = 0;
if (s->ZoneServerID != 0) if (s->ZoneServerID != 0)
zs = zoneserver_list.FindByID(s->ZoneServerID); zs = zoneserver_list.FindByID(s->ZoneServerID);
else if (s->zoneid != 0) else if (s->zoneid != 0)
zs = zoneserver_list.FindByName(content_db.GetZoneName(s->zoneid)); zs = zoneserver_list.FindByName(ZoneName(s->zoneid));
else else
SendMessage(1, "Error: ZoneShutdown: neither ID nor name specified"); SendMessage(1, "Error: ZoneShutdown: neither ID nor name specified");
@ -828,10 +828,10 @@ void Console::ProcessCommand(const char* command) {
zoneserver_list.ListLockedZones(0, this); zoneserver_list.ListLockedZones(0, this);
} }
else if (strcasecmp(sep.arg[1], "lock") == 0 && admin >= 101) { else if (strcasecmp(sep.arg[1], "lock") == 0 && admin >= 101) {
uint16 tmp = content_db.GetZoneID(sep.arg[2]); uint16 tmp = ZoneID(sep.arg[2]);
if (tmp) { if (tmp) {
if (zoneserver_list.SetLockedZone(tmp, true)) if (zoneserver_list.SetLockedZone(tmp, true))
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", content_db.GetZoneName(tmp)); zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", ZoneName(tmp));
else else
SendMessage(1, "Failed to change lock"); SendMessage(1, "Failed to change lock");
} }
@ -839,10 +839,10 @@ void Console::ProcessCommand(const char* command) {
SendMessage(1, "Usage: #zonelock lock [zonename]"); SendMessage(1, "Usage: #zonelock lock [zonename]");
} }
else if (strcasecmp(sep.arg[1], "unlock") == 0 && admin >= 101) { else if (strcasecmp(sep.arg[1], "unlock") == 0 && admin >= 101) {
uint16 tmp = content_db.GetZoneID(sep.arg[2]); uint16 tmp = ZoneID(sep.arg[2]);
if (tmp) { if (tmp) {
if (zoneserver_list.SetLockedZone(tmp, false)) if (zoneserver_list.SetLockedZone(tmp, false))
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", content_db.GetZoneName(tmp)); zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", ZoneName(tmp));
else else
SendMessage(1, "Failed to change lock"); SendMessage(1, "Failed to change lock");
} }

View File

@ -21,6 +21,7 @@
#include "launcher_link.h" #include "launcher_link.h"
#include "launcher_list.h" #include "launcher_list.h"
#include "../common/string_util.h" #include "../common/string_util.h"
#include "world_store.h"
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
@ -156,7 +157,7 @@ void EQLConfig::StartZone(Const_char *zone_ref) {
bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) { bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) {
//make sure the short name is valid. //make sure the short name is valid.
if(content_db.GetZoneID(short_name) == 0) if(ZoneID(short_name) == 0)
return false; return false;
//database update //database update
@ -191,7 +192,7 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) {
bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
//make sure the short name is valid. //make sure the short name is valid.
if(content_db.GetZoneID(short_name) == 0) if(ZoneID(short_name) == 0)
return false; return false;
//check internal state //check internal state

View File

@ -188,7 +188,7 @@ std::map<std::string,std::string> EQW::GetPlayerDetails(Const_char *char_name) {
res["character"] = cle->name(); res["character"] = cle->name();
res["account"] = cle->AccountName(); res["account"] = cle->AccountName();
res["account_id"] = itoa(cle->AccountID()); res["account_id"] = itoa(cle->AccountID());
res["location_short"] = cle->zone()?content_db.GetZoneName(cle->zone()):"No Zone"; res["location_short"] = cle->zone()?ZoneName(cle->zone()):"No Zone";
res["location_long"] = res["location_short"]; res["location_long"] = res["location_short"];
res["location_id"] = itoa(cle->zone()); res["location_id"] = itoa(cle->zone());
res["ip"] = long2ip(cle->GetIP()); res["ip"] = long2ip(cle->GetIP());

View File

@ -94,7 +94,9 @@ union semun {
#include "world_server_command_handler.h" #include "world_server_command_handler.h"
#include "../common/content/world_content_service.h" #include "../common/content/world_content_service.h"
#include "../common/repositories/merchantlist_temp_repository.h" #include "../common/repositories/merchantlist_temp_repository.h"
#include "world_store.h"
WorldStore world_store;
ClientList client_list; ClientList client_list;
GroupLFPList LFPGroupList; GroupLFPList LFPGroupList;
ZSList zoneserver_list; ZSList zoneserver_list;
@ -329,9 +331,7 @@ int main(int argc, char** argv) {
LogInfo("Loading zones"); LogInfo("Loading zones");
// Load to both context for now... this needs to be cleaned up as this has always been cludgy world_store.LoadZones();
content_db.LoadZoneNames();
database.zonename_array = content_db.zonename_array;
LogInfo("Clearing groups"); LogInfo("Clearing groups");
database.ClearGroup(); database.ClearGroup();

132
world/world_store.cpp Normal file
View File

@ -0,0 +1,132 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "world_store.h"
WorldStore::WorldStore() = default;
WorldStore::~WorldStore()= default;
void WorldStore::LoadZones()
{
zones = ZoneRepository::All();
}
uint32 WorldStore::GetZoneID(const char *in_zone_name)
{
if (in_zone_name == nullptr) {
return 0;
}
std::string zone_name = in_zone_name;
return GetZoneID(zone_name);
}
uint32 WorldStore::GetZoneID(std::string zone_name)
{
for (auto &z: zones) {
if (z.short_name == zone_name) {
return z.zoneidnumber;
}
}
return 0;
}
/**
* @param zone_id
* @param error_unknown
* @return
*/
const char *WorldStore::GetZoneName(uint32 zone_id, bool error_unknown)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id) {
return z.short_name.c_str();
}
}
if (error_unknown) {
return "UNKNOWN";
}
return nullptr;
}
/**
* @param zone_id
* @return
*/
std::string WorldStore::GetZoneName(uint32 zone_id)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id) {
return z.short_name;
}
}
return std::string();
}
/**
* @param zone_id
* @return
*/
std::string WorldStore::GetZoneLongName(uint32 zone_id)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id) {
return z.long_name;
}
}
return std::string();
}
/**
* @param zone_id
* @param version
* @return
*/
ZoneRepository::Zone WorldStore::GetZone(uint32 zone_id, int version)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id && z.version == version) {
return z;
}
}
return ZoneRepository::Zone();
}
/**
* @param in_zone_name
* @return
*/
ZoneRepository::Zone WorldStore::GetZone(const char *in_zone_name)
{
for (auto &z: zones) {
if (z.short_name == in_zone_name) {
return z;
}
}
return ZoneRepository::Zone();
}

64
world/world_store.h Normal file
View File

@ -0,0 +1,64 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_WORLD_STORE_H
#define EQEMU_WORLD_STORE_H
#include "worlddb.h"
#include "../common/repositories/zone_repository.h"
class WorldStore {
public:
WorldStore();
virtual ~WorldStore();
std::vector<ZoneRepository::Zone> zones{};
void LoadZones();
ZoneRepository::Zone GetZone(uint32 zone_id, int version = 0);
ZoneRepository::Zone GetZone(const char *in_zone_name);
uint32 GetZoneID(const char *in_zone_name);
uint32 GetZoneID(std::string zone_name);
std::string GetZoneName(uint32 zone_id);
std::string GetZoneLongName(uint32 zone_id);
const char *GetZoneName(uint32 zone_id, bool error_unknown = false);
};
extern WorldStore world_store;
/**
* Global helpers
*/
inline uint32 ZoneID(const char *in_zone_name) { return world_store.GetZoneID(in_zone_name); }
inline uint32 ZoneID(std::string zone_name) { return world_store.GetZoneID(zone_name); }
inline const char *ZoneName(uint32 zone_id, bool error_unknown = false)
{
return world_store.GetZoneName(
zone_id,
error_unknown
);
}
inline const char *ZoneLongName(uint32 zone_id) { return world_store.GetZoneLongName(zone_id).c_str(); }
inline ZoneRepository::Zone GetZone(uint32 zone_id, int version = 0) { return world_store.GetZone(zone_id, version); };
inline ZoneRepository::Zone GetZone(const char *in_zone_name) { return world_store.GetZone(in_zone_name); };
#endif //EQEMU_WORLD_STORE_H

View File

@ -26,6 +26,7 @@
#include <vector> #include <vector>
#include "sof_char_create_data.h" #include "sof_char_create_data.h"
#include "../common/repositories/criteria/content_filter_criteria.h" #include "../common/repositories/criteria/content_filter_criteria.h"
#include "world_store.h"
WorldDatabase database; WorldDatabase database;
WorldDatabase content_db; WorldDatabase content_db;
@ -209,7 +210,13 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
/* If a bind_id is specified, make them start there */ /* If a bind_id is specified, make them start there */
if (atoi(row_d[1]) != 0) { if (atoi(row_d[1]) != 0) {
player_profile_struct.binds[4].zoneId = (uint32) atoi(row_d[1]); player_profile_struct.binds[4].zoneId = (uint32) atoi(row_d[1]);
GetSafePoints(player_profile_struct.binds[4].zoneId, 0, &player_profile_struct.binds[4].x, &player_profile_struct.binds[4].y, &player_profile_struct.binds[4].z); content_db.GetSafePoints(
ZoneName(player_profile_struct.binds[4].zoneId),
0,
&player_profile_struct.binds[4].x,
&player_profile_struct.binds[4].y,
&player_profile_struct.binds[4].z
);
} }
/* Otherwise, use the zone and coordinates given */ /* Otherwise, use the zone and coordinates given */
else { else {
@ -217,7 +224,15 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
float x = atof(row_d[2]); float x = atof(row_d[2]);
float y = atof(row_d[3]); float y = atof(row_d[3]);
float z = atof(row_d[4]); float z = atof(row_d[4]);
if (x == 0 && y == 0 && z == 0) { content_db.GetSafePoints(player_profile_struct.binds[4].zoneId, 0, &x, &y, &z); } if (x == 0 && y == 0 && z == 0) {
content_db.GetSafePoints(
ZoneName(player_profile_struct.binds[4].zoneId),
0,
&x,
&y,
&z
);
}
player_profile_struct.binds[4].x = x; player_profile_struct.binds[4].x = x;
player_profile_struct.binds[4].y = y; player_profile_struct.binds[4].y = y;
player_profile_struct.binds[4].z = z; player_profile_struct.binds[4].z = z;
@ -459,11 +474,24 @@ bool WorldDatabase::GetStartZone(
} }
if (p_player_profile_struct->x == 0 && p_player_profile_struct->y == 0 && p_player_profile_struct->z == 0) { if (p_player_profile_struct->x == 0 && p_player_profile_struct->y == 0 && p_player_profile_struct->z == 0) {
content_db.GetSafePoints(p_player_profile_struct->zone_id, 0, &p_player_profile_struct->x, &p_player_profile_struct->y, &p_player_profile_struct->z); content_db.GetSafePoints(
ZoneName(p_player_profile_struct->zone_id),
0,
&p_player_profile_struct->x,
&p_player_profile_struct->y,
&p_player_profile_struct->z
);
} }
if (p_player_profile_struct->binds[0].x == 0 && p_player_profile_struct->binds[0].y == 0 && p_player_profile_struct->binds[0].z == 0) { if (p_player_profile_struct->binds[0].x == 0 && p_player_profile_struct->binds[0].y == 0 &&
content_db.GetSafePoints(p_player_profile_struct->binds[0].zoneId, 0, &p_player_profile_struct->binds[0].x, &p_player_profile_struct->binds[0].y, &p_player_profile_struct->binds[0].z); p_player_profile_struct->binds[0].z == 0) {
content_db.GetSafePoints(
ZoneName(p_player_profile_struct->binds[0].zoneId),
0,
&p_player_profile_struct->binds[0].x,
&p_player_profile_struct->binds[0].y,
&p_player_profile_struct->binds[0].z
);
} }
return true; return true;

View File

@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/json/json.h" #include "../common/json/json.h"
#include "../common/event_sub.h" #include "../common/event_sub.h"
#include "web_interface.h" #include "web_interface.h"
#include "world_store.h"
extern uint32 numzones; extern uint32 numzones;
extern bool holdzones; extern bool holdzones;
@ -263,7 +264,7 @@ void ZSList::ListLockedZones(const char* to, WorldTCPConnection* connection) {
int x = 0; int x = 0;
for (auto &zone : pLockedZones) { for (auto &zone : pLockedZones) {
if (zone) { if (zone) {
connection->SendEmoteMessageRaw(to, 0, 0, 0, content_db.GetZoneName(zone, true)); connection->SendEmoteMessageRaw(to, 0, 0, 0, ZoneName(zone, true));
x++; x++;
} }
} }
@ -529,7 +530,7 @@ void ZSList::SOPZoneBootup(const char* adminname, uint32 ZoneServerID, const cha
ZoneServer* zs = 0; ZoneServer* zs = 0;
ZoneServer* zs2 = 0; ZoneServer* zs2 = 0;
uint32 zoneid; uint32 zoneid;
if (!(zoneid = content_db.GetZoneID(zonename))) if (!(zoneid = ZoneID(zonename)))
SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zone '%s' not found in 'zone' table. Typo protection=ON.", zonename); SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zone '%s' not found in 'zone' table. Typo protection=ON.", zonename);
else { else {
if (ZoneServerID != 0) if (ZoneServerID != 0)

View File

@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "adventure_manager.h" #include "adventure_manager.h"
#include "ucs.h" #include "ucs.h"
#include "queryserv.h" #include "queryserv.h"
#include "world_store.h"
extern ClientList client_list; extern ClientList client_list;
extern GroupLFPList LFPGroupList; extern GroupLFPList LFPGroupList;
@ -86,7 +87,7 @@ ZoneServer::~ZoneServer() {
bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
is_booting_up = false; is_booting_up = false;
const char* zn = MakeLowerString(content_db.GetZoneName(iZoneID)); const char* zn = MakeLowerString(ZoneName(iZoneID));
char* longname; char* longname;
if (iZoneID) if (iZoneID)
@ -566,7 +567,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
SetZone_Struct* szs = (SetZone_Struct*)pack->pBuffer; SetZone_Struct* szs = (SetZone_Struct*)pack->pBuffer;
if (szs->zoneid != 0) { if (szs->zoneid != 0) {
if (content_db.GetZoneName(szs->zoneid)) if (ZoneName(szs->zoneid))
SetZone(szs->zoneid, szs->instanceid, szs->staticzone); SetZone(szs->zoneid, szs->instanceid, szs->staticzone);
else else
SetZone(0); SetZone(0);
@ -648,7 +649,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
if (s->ZoneServerID != 0) if (s->ZoneServerID != 0)
zs = zoneserver_list.FindByID(s->ZoneServerID); zs = zoneserver_list.FindByID(s->ZoneServerID);
else if (s->zoneid != 0) else if (s->zoneid != 0)
zs = zoneserver_list.FindByName(content_db.GetZoneName(s->zoneid)); zs = zoneserver_list.FindByName(ZoneName(s->zoneid));
else else
zoneserver_list.SendEmoteMessage(s->adminname, 0, 0, 0, "Error: SOP_ZoneShutdown: neither ID nor name specified"); zoneserver_list.SendEmoteMessage(s->adminname, 0, 0, 0, "Error: SOP_ZoneShutdown: neither ID nor name specified");
@ -660,7 +661,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
} }
case ServerOP_ZoneBootup: { case ServerOP_ZoneBootup: {
ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *)pack->pBuffer; ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *)pack->pBuffer;
zoneserver_list.SOPZoneBootup(s->adminname, s->ZoneServerID, content_db.GetZoneName(s->zoneid), s->makestatic); zoneserver_list.SOPZoneBootup(s->adminname, s->ZoneServerID, ZoneName(s->zoneid), s->makestatic);
break; break;
} }
case ServerOP_ZoneStatus: { case ServerOP_ZoneStatus: {
@ -1018,13 +1019,13 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
break; break;
case 1: case 1:
if (zoneserver_list.SetLockedZone(s->zoneID, true)) if (zoneserver_list.SetLockedZone(s->zoneID, true))
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", content_db.GetZoneName(s->zoneID)); zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", ZoneName(s->zoneID));
else else
this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock"); this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock");
break; break;
case 2: case 2:
if (zoneserver_list.SetLockedZone(s->zoneID, false)) if (zoneserver_list.SetLockedZone(s->zoneID, false))
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", content_db.GetZoneName(s->zoneID)); zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", ZoneName(s->zoneID));
else else
this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock"); this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock");
break; break;

View File

@ -33,6 +33,7 @@ Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
#include "string_ids.h" #include "string_ids.h"
#include "titles.h" #include "titles.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
extern QueryServ* QServ; extern QueryServ* QServ;

View File

@ -22,6 +22,7 @@
#include "../common/net/websocket_server.h" #include "../common/net/websocket_server.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "client.h" #include "client.h"
#include "entity.h" #include "entity.h"
#include "corpse.h" #include "corpse.h"

View File

@ -1893,7 +1893,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQEmu::skills::Sk
dead_timer.Start(5000, true); dead_timer.Start(5000, true);
m_pp.zone_id = m_pp.binds[0].zoneId; m_pp.zone_id = m_pp.binds[0].zoneId;
m_pp.zoneInstance = m_pp.binds[0].instance_id; m_pp.zoneInstance = m_pp.binds[0].instance_id;
database.MoveCharacterToZone(this->CharacterID(), content_db.GetZoneName(m_pp.zone_id)); database.MoveCharacterToZone(this->CharacterID(), m_pp.zone_id);
Save(); Save();
GoToDeath(); GoToDeath();
} }

View File

@ -29,6 +29,7 @@
#include "groups.h" #include "groups.h"
#include "corpse.h" #include "corpse.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "string_ids.h" #include "string_ids.h"
#include "../common/misc_functions.h" #include "../common/misc_functions.h"
#include "../common/global_define.h" #include "../common/global_define.h"

View File

@ -60,6 +60,7 @@
#include "bot_command.h" #include "bot_command.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "guild_mgr.h" #include "guild_mgr.h"
#include "map.h" #include "map.h"
#include "doors.h" #include "doors.h"

View File

@ -24,6 +24,7 @@
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "bot.h" #include "bot.h"
#include "client.h" #include "client.h"

View File

@ -43,6 +43,7 @@ extern volatile bool RunLoops;
#include "position.h" #include "position.h"
#include "worldserver.h" #include "worldserver.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "petitions.h" #include "petitions.h"
#include "command.h" #include "command.h"
#include "water_map.h" #include "water_map.h"
@ -4005,7 +4006,7 @@ void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) {
PendingTranslocateData.heading = m_pp.binds[0].heading; PendingTranslocateData.heading = m_pp.binds[0].heading;
} }
else { else {
PendingTranslocateData.zone_id = ts->ZoneID = content_db.GetZoneID(Spell.teleport_zone); PendingTranslocateData.zone_id = ts->ZoneID = ZoneID(Spell.teleport_zone);
PendingTranslocateData.instance_id = 0; PendingTranslocateData.instance_id = 0;
PendingTranslocateData.y = ts->y = Spell.base[0]; PendingTranslocateData.y = ts->y = Spell.base[0];
PendingTranslocateData.x = ts->x = Spell.base[1]; PendingTranslocateData.x = ts->x = Spell.base[1];
@ -5287,7 +5288,7 @@ void Client::SetStartZone(uint32 zoneid, float x, float y, float z)
} }
// check to make sure the zone is valid // check to make sure the zone is valid
const char *target_zone_name = content_db.GetZoneName(zoneid); const char *target_zone_name = ZoneName(zoneid);
if(target_zone_name == nullptr) if(target_zone_name == nullptr)
return; return;
@ -5297,7 +5298,7 @@ void Client::SetStartZone(uint32 zoneid, float x, float y, float z)
} }
if (x == 0 && y == 0 && z == 0) { if (x == 0 && y == 0 && z == 0) {
content_db.GetSafePoints(m_pp.binds[4].zoneId, 0, &m_pp.binds[4].x, &m_pp.binds[4].y, &m_pp.binds[4].z); content_db.GetSafePoints(ZoneName(m_pp.binds[4].zoneId), 0, &m_pp.binds[4].x, &m_pp.binds[4].y, &m_pp.binds[4].z);
} }
else { else {
m_pp.binds[4].x = x; m_pp.binds[4].x = x;
@ -9298,7 +9299,7 @@ void Client::SetBotOption(BotOwnerOption boo, bool flag) {
void Client::SendToGuildHall() void Client::SendToGuildHall()
{ {
std::string zone_short_name = "guildhall"; std::string zone_short_name = "guildhall";
uint32 zone_id = content_db.GetZoneID(zone_short_name.c_str()); uint32 zone_id = ZoneID(zone_short_name.c_str());
if (zone_id == 0) { if (zone_id == 0) {
return; return;
} }

View File

@ -58,6 +58,7 @@ namespace EQEmu
#include "questmgr.h" #include "questmgr.h"
#include "zone.h" #include "zone.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#ifdef _WINDOWS #ifdef _WINDOWS
// since windows defines these within windef.h (which windows.h include) // since windows defines these within windef.h (which windows.h include)

View File

@ -790,7 +790,7 @@ void Client::CompleteConnect()
//enforce some rules.. //enforce some rules..
if (!CanBeInZone()) { if (!CanBeInZone()) {
LogDebug("[CLIENT] Kicking char from zone, not allowed here"); LogDebug("[CLIENT] Kicking char from zone, not allowed here");
GoToSafeCoords(content_db.GetZoneID("arena"), 0); GoToSafeCoords(ZoneID("arena"), 0);
return; return;
} }
@ -6419,7 +6419,7 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
uint16 zid = gmzr->zone_id; uint16 zid = gmzr->zone_id;
if (gmzr->zone_id == 0) if (gmzr->zone_id == 0)
zid = zonesummon_id; zid = zonesummon_id;
const char * zname = content_db.GetZoneName(zid); const char * zname = ZoneName(zid);
if (zname == nullptr) if (zname == nullptr)
tarzone[0] = 0; tarzone[0] = 0;
else else
@ -12441,7 +12441,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app)
{ {
// if the character has a start city, don't let them use the command // if the character has a start city, don't let them use the command
if (m_pp.binds[4].zoneId != 0 && m_pp.binds[4].zoneId != 189) { if (m_pp.binds[4].zoneId != 0 && m_pp.binds[4].zoneId != 189) {
Message(Chat::Yellow, "Your home city has already been set.", m_pp.binds[4].zoneId, content_db.GetZoneName(m_pp.binds[4].zoneId)); Message(Chat::Yellow, "Your home city has already been set.", m_pp.binds[4].zoneId, ZoneName(m_pp.binds[4].zoneId));
return; return;
} }
@ -12507,7 +12507,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app)
zoneid = atoi(row[0]); zoneid = atoi(row[0]);
char* name = nullptr; char* name = nullptr;
content_db.GetZoneLongName(content_db.GetZoneName(zoneid), &name); content_db.GetZoneLongName(ZoneName(zoneid), &name);
Message(Chat::Yellow, "%d - %s", zoneid, name); Message(Chat::Yellow, "%d - %s", zoneid, name);
} }

View File

@ -53,6 +53,7 @@
#include "worldserver.h" #include "worldserver.h"
#include "zone.h" #include "zone.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
extern QueryServ* QServ; extern QueryServ* QServ;
extern Zone* zone; extern Zone* zone;
@ -129,7 +130,7 @@ bool Client::Process() {
CheckManaEndUpdate(); CheckManaEndUpdate();
if (dead && dead_timer.Check()) { if (dead && dead_timer.Check()) {
database.MoveCharacterToZone(GetName(), content_db.GetZoneName(m_pp.binds[0].zoneId)); database.MoveCharacterToZone(GetName(), m_pp.binds[0].zoneId);
m_pp.zone_id = m_pp.binds[0].zoneId; m_pp.zone_id = m_pp.binds[0].zoneId;
m_pp.zoneInstance = m_pp.binds[0].instance_id; m_pp.zoneInstance = m_pp.binds[0].instance_id;
@ -2087,7 +2088,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
m_pp.zone_id = chosen->zone_id; m_pp.zone_id = chosen->zone_id;
m_pp.zoneInstance = chosen->instance_id; m_pp.zoneInstance = chosen->instance_id;
database.MoveCharacterToZone(CharacterID(), content_db.GetZoneName(chosen->zone_id)); database.MoveCharacterToZone(CharacterID(), chosen->zone_id);
Save(); Save();

View File

@ -1171,7 +1171,7 @@ void command_zone(Client *c, const Seperator *sep)
return; return;
} }
zoneid = content_db.GetZoneID(sep->arg[1]); zoneid = ZoneID(sep->arg[1]);
if(zoneid == 0) { if(zoneid == 0) {
c->Message(Chat::White, "Unable to locate zone '%s'", sep->arg[1]); c->Message(Chat::White, "Unable to locate zone '%s'", sep->arg[1]);
return; return;
@ -1306,7 +1306,7 @@ void command_peqzone(Client *c, const Seperator *sep)
return; return;
} }
else { else {
zoneid = content_db.GetZoneID(sep->arg[1]); zoneid = ZoneID(sep->arg[1]);
destzone = content_db.GetPEQZone(zoneid, 0); destzone = content_db.GetPEQZone(zoneid, 0);
if(zoneid == 0) { if(zoneid == 0) {
c->Message(Chat::White, "Unable to locate zone '%s'", sep->arg[1]); c->Message(Chat::White, "Unable to locate zone '%s'", sep->arg[1]);
@ -1344,7 +1344,7 @@ void command_movechar(Client *c, const Seperator *sep)
if (tmp) if (tmp)
{ {
if (c->Admin() >= commandMovecharSelfOnly || tmp == c->AccountID()) if (c->Admin() >= commandMovecharSelfOnly || tmp == c->AccountID())
if (!database.MoveCharacterToZone((char*) sep->arg[1], (char*) sep->arg[2])) if (!database.MoveCharacterToZone((char*) sep->arg[1], ZoneID(sep->arg[2])))
c->Message(Chat::White, "Character Move Failed!"); c->Message(Chat::White, "Character Move Failed!");
else else
c->Message(Chat::White, "Character has been moved."); c->Message(Chat::White, "Character has been moved.");
@ -2105,7 +2105,7 @@ void command_zheader(Client *c, const Seperator *sep)
if(sep->arg[1][0]==0) { if(sep->arg[1][0]==0) {
c->Message(Chat::White, "Usage: #zheader <zone name>"); c->Message(Chat::White, "Usage: #zheader <zone name>");
} }
else if(content_db.GetZoneID(sep->argplus[1])==0) else if(ZoneID(sep->argplus[1])==0)
c->Message(Chat::White, "Invalid Zone Name: %s", sep->argplus[1]); c->Message(Chat::White, "Invalid Zone Name: %s", sep->argplus[1]);
else { else {
@ -4290,7 +4290,7 @@ void command_zoneshutdown(Client *c, const Seperator *sep)
if (sep->arg[1][0] >= '0' && sep->arg[1][0] <= '9') if (sep->arg[1][0] >= '0' && sep->arg[1][0] <= '9')
s->ZoneServerID = atoi(sep->arg[1]); s->ZoneServerID = atoi(sep->arg[1]);
else else
s->zoneid = content_db.GetZoneID(sep->arg[1]); s->zoneid = ZoneID(sep->arg[1]);
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
safe_delete(pack); safe_delete(pack);
} }
@ -4308,7 +4308,7 @@ void command_zonebootup(Client *c, const Seperator *sep)
ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer; ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer;
s->ZoneServerID = atoi(sep->arg[1]); s->ZoneServerID = atoi(sep->arg[1]);
strcpy(s->adminname, c->GetName()); strcpy(s->adminname, c->GetName());
s->zoneid = content_db.GetZoneID(sep->arg[2]); s->zoneid = ZoneID(sep->arg[2]);
s->makestatic = (bool) (strcasecmp(sep->arg[3], "static") == 0); s->makestatic = (bool) (strcasecmp(sep->arg[3], "static") == 0);
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
safe_delete(pack); safe_delete(pack);
@ -4491,7 +4491,7 @@ void command_zonelock(Client *c, const Seperator *sep)
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
} }
else if (strcasecmp(sep->arg[1], "lock") == 0 && c->Admin() >= commandLockZones) { else if (strcasecmp(sep->arg[1], "lock") == 0 && c->Admin() >= commandLockZones) {
uint16 tmp = content_db.GetZoneID(sep->arg[2]); uint16 tmp = ZoneID(sep->arg[2]);
if (tmp) { if (tmp) {
s->op = 1; s->op = 1;
s->zoneID = tmp; s->zoneID = tmp;
@ -4501,7 +4501,7 @@ void command_zonelock(Client *c, const Seperator *sep)
c->Message(Chat::White, "Usage: #zonelock lock [zonename]"); c->Message(Chat::White, "Usage: #zonelock lock [zonename]");
} }
else if (strcasecmp(sep->arg[1], "unlock") == 0 && c->Admin() >= commandLockZones) { else if (strcasecmp(sep->arg[1], "unlock") == 0 && c->Admin() >= commandLockZones) {
uint16 tmp = content_db.GetZoneID(sep->arg[2]); uint16 tmp = ZoneID(sep->arg[2]);
if (tmp) { if (tmp) {
s->op = 2; s->op = 2;
s->zoneID = tmp; s->zoneID = tmp;
@ -4908,7 +4908,7 @@ void command_gmzone(Client *c, const Seperator *sep)
const char *zone_short_name = sep->arg[1]; const char *zone_short_name = sep->arg[1];
auto zone_version = static_cast<uint32>(sep->arg[2] ? atoi(sep->arg[2]) : 0); auto zone_version = static_cast<uint32>(sep->arg[2] ? atoi(sep->arg[2]) : 0);
std::string identifier = "gmzone"; std::string identifier = "gmzone";
uint32 zone_id = content_db.GetZoneID(zone_short_name); uint32 zone_id = ZoneID(zone_short_name);
uint32 duration = 100000000; uint32 duration = 100000000;
uint16 instance_id = 0; uint16 instance_id = 0;
@ -9206,7 +9206,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
if(sep->arg[2][0] != '\0') { if(sep->arg[2][0] != '\0') {
zoneid = atoi(sep->arg[2]); zoneid = atoi(sep->arg[2]);
if(zoneid < 1) { if(zoneid < 1) {
zoneid = content_db.GetZoneID(sep->arg[2]); zoneid = ZoneID(sep->arg[2]);
} }
} }
if(zoneid < 1) { if(zoneid < 1) {
@ -9231,7 +9231,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
return; return;
} }
c->Message(Chat::Yellow, "Success! Zone %s now requires a flag, named %s", content_db.GetZoneName(zoneid), flag_name); c->Message(Chat::Yellow, "Success! Zone %s now requires a flag, named %s", ZoneName(zoneid), flag_name);
return; return;
} }
@ -9240,7 +9240,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
if(sep->arg[2][0] != '\0') { if(sep->arg[2][0] != '\0') {
zoneid = atoi(sep->arg[2]); zoneid = atoi(sep->arg[2]);
if(zoneid < 1) { if(zoneid < 1) {
zoneid = content_db.GetZoneID(sep->arg[2]); zoneid = ZoneID(sep->arg[2]);
} }
} }
@ -9258,7 +9258,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
return; return;
} }
c->Message(Chat::Yellow, "Success! Zone %s no longer requires a flag.", content_db.GetZoneName(zoneid)); c->Message(Chat::Yellow, "Success! Zone %s no longer requires a flag.", ZoneName(zoneid));
return; return;
} }
@ -9282,7 +9282,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
if(sep->arg[2][0] != '\0') { if(sep->arg[2][0] != '\0') {
zoneid = atoi(sep->arg[2]); zoneid = atoi(sep->arg[2]);
if(zoneid < 1) { if(zoneid < 1) {
zoneid = content_db.GetZoneID(sep->arg[2]); zoneid = ZoneID(sep->arg[2]);
} }
} }
if(zoneid < 1) { if(zoneid < 1) {
@ -9305,7 +9305,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
if(sep->arg[2][0] != '\0') { if(sep->arg[2][0] != '\0') {
zoneid = atoi(sep->arg[2]); zoneid = atoi(sep->arg[2]);
if(zoneid < 1) { if(zoneid < 1) {
zoneid = content_db.GetZoneID(sep->arg[2]); zoneid = ZoneID(sep->arg[2]);
} }
} }
if(zoneid < 1) { if(zoneid < 1) {
@ -9770,7 +9770,7 @@ void command_setgraveyard(Client *c, const Seperator *sep)
return; return;
} }
zoneid = content_db.GetZoneID(sep->arg[1]); zoneid = ZoneID(sep->arg[1]);
if(zoneid > 0) { if(zoneid > 0) {
graveyard_id = content_db.CreateGraveyardRecord(zoneid, t->GetPosition()); graveyard_id = content_db.CreateGraveyardRecord(zoneid, t->GetPosition());
@ -9806,7 +9806,7 @@ void command_deletegraveyard(Client *c, const Seperator *sep)
return; return;
} }
zoneid = content_db.GetZoneID(sep->arg[1]); zoneid = ZoneID(sep->arg[1]);
graveyard_id = content_db.GetZoneGraveyardID(zoneid, 0); graveyard_id = content_db.GetZoneGraveyardID(zoneid, 0);
if(zoneid > 0 && graveyard_id > 0) { if(zoneid > 0 && graveyard_id > 0) {
@ -10211,12 +10211,12 @@ void command_instance(Client *c, const Seperator *sep)
} }
else else
{ {
zone_id = content_db.GetZoneID(sep->arg[2]); zone_id = ZoneID(sep->arg[2]);
} }
uint32 version = atoi(sep->arg[3]); uint32 version = atoi(sep->arg[3]);
uint32 duration = atoi(sep->arg[4]); uint32 duration = atoi(sep->arg[4]);
zn = content_db.GetZoneName(zone_id); zn = ZoneName(zone_id);
if(!zn) if(!zn)
{ {
@ -10371,7 +10371,7 @@ void command_setstartzone(Client *c, const Seperator *sep)
startzone = 0; startzone = 0;
} }
else { else {
startzone = content_db.GetZoneID(sep->arg[1]); startzone = ZoneID(sep->arg[1]);
if(startzone == 0) { if(startzone == 0) {
c->Message(Chat::White, "Unable to locate zone '%s'", sep->arg[1]); c->Message(Chat::White, "Unable to locate zone '%s'", sep->arg[1]);
return; return;

View File

@ -837,7 +837,7 @@ bool Corpse::Process() {
spc->zone_id = zone->graveyard_zoneid(); spc->zone_id = zone->graveyard_zoneid();
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
safe_delete(pack); safe_delete(pack);
LogDebug("Moved [{}] player corpse to the designated graveyard in zone [{}]", this->GetName(), content_db.GetZoneName(zone->graveyard_zoneid())); LogDebug("Moved [{}] player corpse to the designated graveyard in zone [{}]", this->GetName(), ZoneName(zone->graveyard_zoneid()));
corpse_db_id = 0; corpse_db_id = 0;
} }

View File

@ -2,6 +2,7 @@
#include <utility> #include <utility>
#include "../common/string_util.h" #include "../common/string_util.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include <ctime> #include <ctime>
#include <cctype> #include <cctype>
#include <algorithm> #include <algorithm>

View File

@ -28,6 +28,7 @@
#include "string_ids.h" #include "string_ids.h"
#include "worldserver.h" #include "worldserver.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/criteria/content_filter_criteria.h" #include "../common/repositories/criteria/content_filter_criteria.h"
#include <iostream> #include <iostream>
@ -452,7 +453,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
if (!disable_add_to_key_ring) { if (!disable_add_to_key_ring) {
sender->KeyRingAdd(player_key); sender->KeyRingAdd(player_key);
} }
if (content_db.GetZoneID(destination_zone_name) == zone->GetZoneID()) { if (ZoneID(destination_zone_name) == zone->GetZoneID()) {
sender->MovePC( sender->MovePC(
zone->GetZoneID(), zone->GetZoneID(),
zone->GetInstanceID(), zone->GetInstanceID(),
@ -463,7 +464,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
); );
} else { } else {
sender->MovePC( sender->MovePC(
content_db.GetZoneID(destination_zone_name), ZoneID(destination_zone_name),
static_cast<uint32>(destination_instance_id), static_cast<uint32>(destination_instance_id),
m_Destination.x, m_Destination.x,
m_Destination.y, m_Destination.y,
@ -474,7 +475,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
} }
if ((!IsDoorOpen() || open_type == 58) && (!required_key_item)) { if ((!IsDoorOpen() || open_type == 58) && (!required_key_item)) {
if (content_db.GetZoneID(destination_zone_name) == zone->GetZoneID()) { if (ZoneID(destination_zone_name) == zone->GetZoneID()) {
sender->MovePC( sender->MovePC(
zone->GetZoneID(), zone->GetZoneID(),
zone->GetInstanceID(), zone->GetInstanceID(),
@ -485,7 +486,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
); );
} else { } else {
sender->MovePC( sender->MovePC(
content_db.GetZoneID(destination_zone_name), ZoneID(destination_zone_name),
static_cast<uint32>(this->destination_instance_id), static_cast<uint32>(this->destination_instance_id),
m_Destination.x, m_Destination.x,
m_Destination.y, m_Destination.y,

View File

@ -28,6 +28,7 @@
#include "string_ids.h" #include "string_ids.h"
#include "worldserver.h" #include "worldserver.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "position.h" #include "position.h"
float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard) float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard)

View File

@ -30,6 +30,7 @@
#include "titles.h" #include "titles.h"
#include "water_map.h" #include "water_map.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/criteria/content_filter_criteria.h" #include "../common/repositories/criteria/content_filter_criteria.h"
#include <iostream> #include <iostream>

View File

@ -24,6 +24,7 @@
#include "guild_mgr.h" #include "guild_mgr.h"
#include "worldserver.h" #include "worldserver.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
ZoneGuildManager guild_mgr; ZoneGuildManager guild_mgr;
GuildBankManager *GuildBanks; GuildBankManager *GuildBanks;

View File

@ -23,6 +23,7 @@
#include "quest_parser_collection.h" #include "quest_parser_collection.h"
#include "worldserver.h" #include "worldserver.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
extern WorldServer worldserver; extern WorldServer worldserver;

View File

@ -26,6 +26,7 @@
#include "mob.h" #include "mob.h"
#include "npc.h" #include "npc.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "global_loot_manager.h" #include "global_loot_manager.h"
#include "../common/repositories/criteria/content_filter_criteria.h" #include "../common/repositories/criteria/content_filter_criteria.h"

View File

@ -56,6 +56,7 @@
#include "bot_command.h" #include "bot_command.h"
#endif #endif
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "zone_config.h" #include "zone_config.h"
#include "titles.h" #include "titles.h"
#include "guild_mgr.h" #include "guild_mgr.h"
@ -318,11 +319,7 @@ int main(int argc, char** argv) {
LogInfo("Loading zone names"); LogInfo("Loading zone names");
// Load to both context for now... this needs to be cleaned up as this has always been cludgy zone_store.LoadZones();
content_db.LoadZoneNames();
database.zonename_array = content_db.zonename_array;
zone_store.LoadZonesStore();
LogInfo("Loading items"); LogInfo("Loading items");
if (!database.LoadItems(hotfix_name)) { if (!database.LoadItems(hotfix_name)) {
@ -474,7 +471,7 @@ int main(int argc, char** argv) {
} }
else if (!Zone::Bootup(ZoneID(zone_name), instance_id, true)) { else if (!Zone::Bootup(ZoneID(zone_name), instance_id, true)) {
LogError("Zone Bootup failed :: Zone::Bootup"); LogError("Zone Bootup failed :: Zone::Bootup");
zone = 0; zone = nullptr;
} }
//register all the patches we have avaliable with the stream identifier. //register all the patches we have avaliable with the stream identifier.

View File

@ -27,6 +27,7 @@
#include "mob.h" #include "mob.h"
#include "quest_parser_collection.h" #include "quest_parser_collection.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#ifdef BOTS #ifdef BOTS
#include "bot.h" #include "bot.h"

View File

@ -8,6 +8,7 @@
#include "zone.h" #include "zone.h"
#include "spawngroup.h" #include "spawngroup.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "npc.h" #include "npc.h"
#include "mob.h" #include "mob.h"
#include "client.h" #include "client.h"

View File

@ -23,6 +23,7 @@
#include "mob.h" #include "mob.h"
#include "qglobals.h" #include "qglobals.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "zonedump.h" #include "zonedump.h"
#include <deque> #include <deque>

View File

@ -26,6 +26,7 @@
#include "quest_parser_collection.h" #include "quest_parser_collection.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/criteria/content_filter_criteria.h" #include "../common/repositories/criteria/content_filter_criteria.h"
#include <iostream> #include <iostream>

View File

@ -25,6 +25,7 @@
#include "client.h" #include "client.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
class Client; class Client;

View File

@ -27,6 +27,7 @@
#include "pets.h" #include "pets.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include <string> #include <string>

View File

@ -19,6 +19,7 @@
#define __QUEST_H__ #define __QUEST_H__
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
typedef struct _tag_quest_entry{ typedef struct _tag_quest_entry{
char *m_pQuestName; char *m_pQuestName;

View File

@ -35,6 +35,7 @@
#include "worldserver.h" #include "worldserver.h"
#include "zone.h" #include "zone.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include <iostream> #include <iostream>
#include <limits.h> #include <limits.h>
@ -397,7 +398,7 @@ void QuestManager::Zone(const char *zone_name) {
ztz->response = 0; ztz->response = 0;
ztz->current_zone_id = zone->GetZoneID(); ztz->current_zone_id = zone->GetZoneID();
ztz->current_instance_id = zone->GetInstanceID(); ztz->current_instance_id = zone->GetInstanceID();
ztz->requested_zone_id = content_db.GetZoneID(zone_name); ztz->requested_zone_id = ZoneID(zone_name);
ztz->admin = initiator->Admin(); ztz->admin = initiator->Admin();
strcpy(ztz->name, initiator->GetName()); strcpy(ztz->name, initiator->GetName());
ztz->guild_id = initiator->GuildID(); ztz->guild_id = initiator->GuildID();
@ -2753,7 +2754,7 @@ uint16 QuestManager::CreateInstance(const char *zone, int16 version, uint32 dura
QuestManagerCurrentQuestVars(); QuestManagerCurrentQuestVars();
if(initiator) if(initiator)
{ {
uint32 zone_id = content_db.GetZoneID(zone); uint32 zone_id = ZoneID(zone);
if(zone_id == 0) if(zone_id == 0)
return 0; return 0;
@ -2823,13 +2824,13 @@ uint16 QuestManager::GetInstanceID(const char *zone, int16 version)
QuestManagerCurrentQuestVars(); QuestManagerCurrentQuestVars();
if (initiator) if (initiator)
{ {
return database.GetInstanceID(zone, initiator->CharacterID(), version); return database.GetInstanceID(ZoneID(zone), initiator->CharacterID(), version);
} }
return 0; return 0;
} }
uint16 QuestManager::GetInstanceIDByCharID(const char *zone, int16 version, uint32 char_id) { uint16 QuestManager::GetInstanceIDByCharID(const char *zone, int16 version, uint32 char_id) {
return database.GetInstanceID(zone, char_id, version); return database.GetInstanceID(ZoneID(zone), char_id, version);
} }
void QuestManager::AssignToInstance(uint16 instance_id) void QuestManager::AssignToInstance(uint16 instance_id)
@ -3181,7 +3182,7 @@ uint16 QuestManager::CreateDoor(const char* model, float x, float y, float z, fl
} }
int32 QuestManager::GetZoneID(const char *zone) { int32 QuestManager::GetZoneID(const char *zone) {
return static_cast<int32>(content_db.GetZoneID(zone)); return static_cast<int32>(ZoneID(zone));
} }
const char* QuestManager::GetZoneLongName(const char *zone) { const char* QuestManager::GetZoneLongName(const char *zone) {

View File

@ -26,6 +26,7 @@
#include "worldserver.h" #include "worldserver.h"
#include "zone.h" #include "zone.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
extern EntityList entity_list; extern EntityList entity_list;
extern Zone* zone; extern Zone* zone;
@ -461,7 +462,7 @@ bool ZoneDatabase::PopulateZoneSpawnListClose(uint32 zoneid, LinkedList<Spawn2*>
} }
} }
const char *zone_name = content_db.GetZoneName(zoneid); const char *zone_name = ZoneName(zoneid);
std::string query = StringFormat( std::string query = StringFormat(
"SELECT " "SELECT "
"id, " "id, "
@ -565,7 +566,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
} }
} }
const char *zone_name = content_db.GetZoneName(zoneid); const char *zone_name = ZoneName(zoneid);
std::string query = StringFormat( std::string query = StringFormat(
"SELECT " "SELECT "
"id, " "id, "
@ -1217,7 +1218,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
auto pack = new ServerPacket(ServerOP_SpawnCondition, sizeof(ServerSpawnCondition_Struct)); auto pack = new ServerPacket(ServerOP_SpawnCondition, sizeof(ServerSpawnCondition_Struct));
ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*)pack->pBuffer; ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*)pack->pBuffer;
ssc->zoneID = content_db.GetZoneID(zone_short); ssc->zoneID = ZoneID(zone_short);
ssc->instanceID = instance_id; ssc->instanceID = instance_id;
ssc->condition_id = condition_id; ssc->condition_id = condition_id;
ssc->value = new_value; ssc->value = new_value;
@ -1349,7 +1350,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
auto pack = new ServerPacket(ServerOP_SpawnEvent, sizeof(ServerSpawnEvent_Struct)); auto pack = new ServerPacket(ServerOP_SpawnEvent, sizeof(ServerSpawnEvent_Struct));
ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*)pack->pBuffer; ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*)pack->pBuffer;
sse->zoneID = content_db.GetZoneID(zone_short_name.c_str()); sse->zoneID = ZoneID(zone_short_name.c_str());
sse->event_id = event_id; sse->event_id = event_id;
worldserver.SendPacket(pack); worldserver.SendPacket(pack);

View File

@ -24,6 +24,7 @@
#include "spawngroup.h" #include "spawngroup.h"
#include "zone.h" #include "zone.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/criteria/content_filter_criteria.h" #include "../common/repositories/criteria/content_filter_criteria.h"
extern EntityList entity_list; extern EntityList entity_list;

View File

@ -31,6 +31,7 @@ Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
#include "../common/string_util.h" #include "../common/string_util.h"
#include "../common/say_link.h" #include "../common/say_link.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/goallists_repository.h" #include "../common/repositories/goallists_repository.h"
#include "client.h" #include "client.h"
#include "entity.h" #include "entity.h"

View File

@ -33,6 +33,7 @@
#include "string_ids.h" #include "string_ids.h"
#include "titles.h" #include "titles.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/character_recipe_list_repository.h" #include "../common/repositories/character_recipe_list_repository.h"
#include "../common/repositories/tradeskill_recipe_repository.h" #include "../common/repositories/tradeskill_recipe_repository.h"

View File

@ -583,7 +583,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
case ServerOP_ZonePlayer: { case ServerOP_ZonePlayer: {
ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*)pack->pBuffer; ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*)pack->pBuffer;
Client* client = entity_list.GetClientByName(szp->name); Client* client = entity_list.GetClientByName(szp->name);
printf("Zoning %s to %s(%u) - %u\n", client != nullptr ? client->GetCleanName() : "Unknown", szp->zone, content_db.GetZoneID(szp->zone), szp->instance_id); printf("Zoning %s to %s(%u) - %u\n", client != nullptr ? client->GetCleanName() : "Unknown", szp->zone, ZoneID(szp->zone), szp->instance_id);
if (client != 0) { if (client != 0) {
if (strcasecmp(szp->adminname, szp->name) == 0) if (strcasecmp(szp->adminname, szp->name) == 0)
client->Message(Chat::White, "Zoning to: %s", szp->zone); client->Message(Chat::White, "Zoning to: %s", szp->zone);
@ -593,17 +593,17 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
SendEmoteMessage(szp->adminname, 0, 0, "Summoning %s to %s %1.1f, %1.1f, %1.1f", szp->name, szp->zone, szp->x_pos, szp->y_pos, szp->z_pos); SendEmoteMessage(szp->adminname, 0, 0, "Summoning %s to %s %1.1f, %1.1f, %1.1f", szp->name, szp->zone, szp->x_pos, szp->y_pos, szp->z_pos);
} }
if (!szp->instance_id) { if (!szp->instance_id) {
client->MovePC(content_db.GetZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon); client->MovePC(ZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon);
} }
else { else {
if (database.GetInstanceID(client->CharacterID(), content_db.GetZoneID(szp->zone)) == 0) { if (database.GetInstanceID(client->CharacterID(), ZoneID(szp->zone)) == 0) {
client->AssignToInstance(szp->instance_id); client->AssignToInstance(szp->instance_id);
client->MovePC(content_db.GetZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon); client->MovePC(ZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon);
} }
else { else {
client->RemoveFromInstance(database.GetInstanceID(client->CharacterID(), content_db.GetZoneID(szp->zone))); client->RemoveFromInstance(database.GetInstanceID(client->CharacterID(), ZoneID(szp->zone)));
client->AssignToInstance(szp->instance_id); client->AssignToInstance(szp->instance_id);
client->MovePC(content_db.GetZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon); client->MovePC(ZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon);
} }
} }
} }

View File

@ -84,7 +84,7 @@ Zone* zone = 0;
void UpdateWindowTitle(char* iNewTitle); void UpdateWindowTitle(char* iNewTitle);
bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
const char* zonename = content_db.GetZoneName(iZoneID); const char* zonename = ZoneName(iZoneID);
if (iZoneID == 0 || zonename == 0) if (iZoneID == 0 || zonename == 0)
return false; return false;
@ -190,7 +190,7 @@ bool Zone::LoadZoneObjects()
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
if (atoi(row[9]) == 0) { if (atoi(row[9]) == 0) {
// Type == 0 - Static Object // Type == 0 - Static Object
const char *shortname = content_db.GetZoneName(atoi(row[1]), false); // zoneid -> zone_shortname const char *shortname = ZoneName(atoi(row[1]), false); // zoneid -> zone_shortname
if (!shortname) if (!shortname)
continue; continue;
@ -1158,7 +1158,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id)
map_name = nullptr; map_name = nullptr;
if (!content_db.GetZoneCFG( if (!content_db.GetZoneCFG(
content_db.GetZoneID(filename), ZoneID(filename),
instance_id, instance_id,
&newzone_data, &newzone_data,
can_bind, can_bind,
@ -1177,7 +1177,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id)
if (instance_id != 0) { if (instance_id != 0) {
safe_delete_array(map_name); safe_delete_array(map_name);
if (!content_db.GetZoneCFG( if (!content_db.GetZoneCFG(
content_db.GetZoneID(filename), ZoneID(filename),
0, 0,
&newzone_data, &newzone_data,
can_bind, can_bind,
@ -1799,7 +1799,7 @@ ZonePoint* Zone::GetClosestZonePoint(const glm::vec3& location, uint32 to, Clien
ZonePoint* Zone::GetClosestZonePoint(const glm::vec3& location, const char* to_name, Client* client, float max_distance) { ZonePoint* Zone::GetClosestZonePoint(const glm::vec3& location, const char* to_name, Client* client, float max_distance) {
if(to_name == nullptr) if(to_name == nullptr)
return GetClosestZonePointWithoutZone(location.x, location.y, location.z, client, max_distance); return GetClosestZonePointWithoutZone(location.x, location.y, location.z, client, max_distance);
return GetClosestZonePoint(location, content_db.GetZoneID(to_name), client, max_distance); return GetClosestZonePoint(location, ZoneID(to_name), client, max_distance);
} }
ZonePoint* Zone::GetClosestZonePointWithoutZone(float x, float y, float z, Client* client, float max_distance) { ZonePoint* Zone::GetClosestZonePointWithoutZone(float x, float y, float z, Client* client, float max_distance) {

View File

@ -25,6 +25,7 @@
#include "../common/random.h" #include "../common/random.h"
#include "../common/string_util.h" #include "../common/string_util.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/grid_repository.h" #include "../common/repositories/grid_repository.h"
#include "../common/repositories/grid_entries_repository.h" #include "../common/repositories/grid_entries_repository.h"
#include "qglobals.h" #include "qglobals.h"

View File

@ -23,7 +23,7 @@
ZoneStore::ZoneStore() = default; ZoneStore::ZoneStore() = default;
ZoneStore::~ZoneStore() = default; ZoneStore::~ZoneStore() = default;
void ZoneStore::LoadZonesStore() void ZoneStore::LoadZones()
{ {
zones = ZoneRepository::All(); zones = ZoneRepository::All();
} }
@ -50,6 +50,11 @@ uint32 ZoneStore::GetZoneID(std::string zone_name)
return 0; return 0;
} }
/**
* @param zone_id
* @param error_unknown
* @return
*/
const char *ZoneStore::GetZoneName(uint32 zone_id, bool error_unknown) const char *ZoneStore::GetZoneName(uint32 zone_id, bool error_unknown)
{ {
for (auto &z: zones) { for (auto &z: zones) {
@ -65,6 +70,10 @@ const char *ZoneStore::GetZoneName(uint32 zone_id, bool error_unknown)
return nullptr; return nullptr;
} }
/**
* @param zone_id
* @return
*/
std::string ZoneStore::GetZoneName(uint32 zone_id) std::string ZoneStore::GetZoneName(uint32 zone_id)
{ {
for (auto &z: zones) { for (auto &z: zones) {
@ -75,3 +84,49 @@ std::string ZoneStore::GetZoneName(uint32 zone_id)
return std::string(); return std::string();
} }
/**
* @param zone_id
* @return
*/
std::string ZoneStore::GetZoneLongName(uint32 zone_id)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id) {
return z.long_name;
}
}
return std::string();
}
/**
* @param zone_id
* @param version
* @return
*/
ZoneRepository::Zone ZoneStore::GetZone(uint32 zone_id, int version)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id && z.version == version) {
return z;
}
}
return ZoneRepository::Zone();
}
/**
* @param in_zone_name
* @return
*/
ZoneRepository::Zone ZoneStore::GetZone(const char *in_zone_name)
{
for (auto &z: zones) {
if (z.short_name == in_zone_name) {
return z;
}
}
return ZoneRepository::Zone();
}

View File

@ -31,12 +31,15 @@ public:
std::vector<ZoneRepository::Zone> zones; std::vector<ZoneRepository::Zone> zones;
void LoadZonesStore(); void LoadZones();
ZoneRepository::Zone GetZone(uint32 zone_id, int version = 0);
ZoneRepository::Zone GetZone(const char *in_zone_name);
uint32 GetZoneID(const char *in_zone_name); uint32 GetZoneID(const char *in_zone_name);
uint32 GetZoneID(std::string zone_name); uint32 GetZoneID(std::string zone_name);
std::string GetZoneName(uint32 zone_id); std::string GetZoneName(uint32 zone_id);
const char *GetZoneName(uint32 zone_id, bool error_unknown); std::string GetZoneLongName(uint32 zone_id);
const char *GetZoneName(uint32 zone_id, bool error_unknown = false);
}; };
extern ZoneStore zone_store; extern ZoneStore zone_store;
@ -46,14 +49,15 @@ extern ZoneStore zone_store;
*/ */
inline uint32 ZoneID(const char *in_zone_name) { return zone_store.GetZoneID(in_zone_name); } inline uint32 ZoneID(const char *in_zone_name) { return zone_store.GetZoneID(in_zone_name); }
inline uint32 ZoneID(std::string zone_name) { return zone_store.GetZoneID(zone_name); } inline uint32 ZoneID(std::string zone_name) { return zone_store.GetZoneID(zone_name); }
inline std::string ZoneName(uint32 zone_id) { return zone_store.GetZoneName(zone_id); } inline const char *ZoneName(uint32 zone_id, bool error_unknown = false)
inline const char *ZoneName(uint32 zone_id, bool error_unknown)
{ {
return zone_store.GetZoneName( return zone_store.GetZoneName(
zone_id, zone_id,
error_unknown error_unknown
); );
} }
inline const char *ZoneLongName(uint32 zone_id) { return zone_store.GetZoneLongName(zone_id).c_str(); }
inline ZoneRepository::Zone GetZone(uint32 zone_id, int version = 0) { return zone_store.GetZone(zone_id, version); };
inline ZoneRepository::Zone GetZone(const char *in_zone_name) { return zone_store.GetZone(in_zone_name); };
#endif //EQEMU_ZONE_STORE_H #endif //EQEMU_ZONE_STORE_H

View File

@ -11,6 +11,7 @@
#include "merc.h" #include "merc.h"
#include "zone.h" #include "zone.h"
#include "zonedb.h" #include "zonedb.h"
#include "zone_store.h"
#include "aura.h" #include "aura.h"
#include "../common/repositories/criteria/content_filter_criteria.h" #include "../common/repositories/criteria/content_filter_criteria.h"
@ -3566,7 +3567,7 @@ void ZoneDatabase::ListAllInstances(Client* client, uint32 charid)
client->Message(Chat::White, "%s is part of the following instances:", name); client->Message(Chat::White, "%s is part of the following instances:", name);
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
client->Message(Chat::White, "%s - id: %lu, version: %lu", content_db.GetZoneName(atoi(row[1])), client->Message(Chat::White, "%s - id: %lu, version: %lu", ZoneName(atoi(row[1])),
(unsigned long)atoi(row[0]), (unsigned long)atoi(row[2])); (unsigned long)atoi(row[0]), (unsigned long)atoi(row[2]));
} }
} }

View File

@ -159,7 +159,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
} }
/* Check for Valid Zone */ /* Check for Valid Zone */
const char *target_zone_name = content_db.GetZoneName(target_zone_id); const char *target_zone_name = ZoneName(target_zone_id);
if(target_zone_name == nullptr) { if(target_zone_name == nullptr) {
//invalid zone... //invalid zone...
Message(Chat::Red, "Invalid target zone ID."); Message(Chat::Red, "Invalid target zone ID.");
@ -376,7 +376,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc
if(this->GetPet()) if(this->GetPet())
entity_list.RemoveFromHateLists(this->GetPet()); entity_list.RemoveFromHateLists(this->GetPet());
LogInfo("Zoning [{}] to: [{}] ([{}]) - ([{}]) x [{}] y [{}] z [{}]", m_pp.name, content_db.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); LogInfo("Zoning [{}] to: [{}] ([{}]) - ([{}]) x [{}] y [{}] z [{}]", m_pp.name, ZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z);
//set the player's coordinates in the new zone so they have them //set the player's coordinates in the new zone so they have them
//when they zone into it //when they zone into it
@ -430,7 +430,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc
} }
void Client::MovePC(const char* zonename, float x, float y, float z, float heading, uint8 ignorerestrictions, ZoneMode zm) { void Client::MovePC(const char* zonename, float x, float y, float z, float heading, uint8 ignorerestrictions, ZoneMode zm) {
ProcessMovePC(content_db.GetZoneID(zonename), 0, x, y, z, heading, ignorerestrictions, zm); ProcessMovePC(ZoneID(zonename), 0, x, y, z, heading, ignorerestrictions, zm);
} }
//designed for in zone moving //designed for in zone moving
@ -510,7 +510,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
const char* pShortZoneName = nullptr; const char* pShortZoneName = nullptr;
char* pZoneName = nullptr; char* pZoneName = nullptr;
pShortZoneName = content_db.GetZoneName(zoneID); pShortZoneName = ZoneName(zoneID);
content_db.GetZoneLongName(pShortZoneName, &pZoneName); content_db.GetZoneLongName(pShortZoneName, &pZoneName);
if(!pZoneName) { if(!pZoneName) {
@ -856,7 +856,7 @@ void Client::SendZoneFlagInfo(Client *to) const {
for(; cur != end; ++cur) { for(; cur != end; ++cur) {
uint32 zoneid = *cur; uint32 zoneid = *cur;
const char *short_name = content_db.GetZoneName(zoneid); const char *short_name = ZoneName(zoneid);
char *long_name = nullptr; char *long_name = nullptr;
content_db.GetZoneLongName(short_name, &long_name); content_db.GetZoneLongName(short_name, &long_name);