From 093509baa9835ac769f5e3ab0185d70e2efa1e70 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 18 Apr 2020 19:46:19 -0500 Subject: [PATCH] Few adjustments [skip ci[ --- common/database_instances.cpp | 5 +++-- world/main.cpp | 2 ++ zone/client.cpp | 2 +- zone/client_process.cpp | 8 ++++---- zone/command.cpp | 22 +++++++++++----------- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/common/database_instances.cpp b/common/database_instances.cpp index 064cf6db4..02fa2e82b 100644 --- a/common/database_instances.cpp +++ b/common/database_instances.cpp @@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #define strcasecmp _stricmp #else #include "unix.h" +#include "../zone/zonedb.h" #include #include #endif @@ -319,10 +320,10 @@ uint16 Database::GetInstanceID(const char* zone, uint32 character_id, int16 vers "AND instance_list.id = instance_list_player.id " "AND instance_list_player.charid = %u " "LIMIT 1 ", - GetZoneID(zone), + content_db.GetZoneID(zone), version, character_id - ); + ); auto results = QueryDatabase(query); if (!results.Success()) diff --git a/world/main.cpp b/world/main.cpp index f4707e43f..3fd3ef555 100644 --- a/world/main.cpp +++ b/world/main.cpp @@ -327,6 +327,8 @@ int main(int argc, char** argv) { database.PurgeAllDeletedDataBuckets(); LogInfo("Loading zones"); + // Load to both context for now... this needs to be cleaned up + database.LoadZoneNames(); content_db.LoadZoneNames(); LogInfo("Clearing groups"); database.ClearGroup(); diff --git a/zone/client.cpp b/zone/client.cpp index 822ea7e4f..ee48252f1 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -9298,7 +9298,7 @@ void Client::SetBotOption(BotOwnerOption boo, bool flag) { void Client::SendToGuildHall() { std::string zone_short_name = "guildhall"; - uint32 zone_id = database.GetZoneID(zone_short_name.c_str()); + uint32 zone_id = content_db.GetZoneID(zone_short_name.c_str()); if (zone_id == 0) { return; } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 9b7a0ecce..b380ae497 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -258,7 +258,7 @@ bool Client::Process() { if (mob_close_scan_timer.Check()) { entity_list.ScanCloseMobs(close_mobs, this); } - + bool may_use_attacks = false; /* Things which prevent us from attacking: @@ -757,7 +757,7 @@ void Client::BulkSendInventoryItems() if (ob.tellp() == last_pos) LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id); - + last_pos = ob.tellp(); } @@ -836,7 +836,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { else { cur_fac_level = GetModCharacterFactionLevel(fac); } - + if (cur_fac_level < ml.faction_required) continue; @@ -1170,7 +1170,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app) { return; } - + // could just do a range, but this is clearer and explicit if ( diff --git a/zone/command.cpp b/zone/command.cpp index dcf60de0d..317667168 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -24,7 +24,7 @@ 2. Add the function in this file. 3. In the command_init function you must add a call to command_add for your function. - + Notes: If you want an alias for your command, add an entry to the `command_settings` table in your database. The access level you set with command_add is the default setting if the command isn't @@ -497,7 +497,7 @@ int command_init(void) working_cl_iter.first.c_str() ); } - + continue; } @@ -507,7 +507,7 @@ int command_init(void) working_cl_iter.first.c_str(), cs_iter->second.first ); - + if (cs_iter->second.second.empty()) { continue; } @@ -522,7 +522,7 @@ int command_init(void) "command_init(): Warning: Alias [{}] already exists as a command - skipping!", alias_iter.c_str() ); - + continue; } @@ -1289,7 +1289,7 @@ void command_peqzone(Client *c, const Seperator *sep) if (sep->IsNumber(1)) { zoneid = atoi(sep->arg[1]); - destzone = database.GetPEQZone(zoneid, 0); + destzone = content_db.GetPEQZone(zoneid, 0); if(destzone == 0){ c->Message(Chat::Red, "You cannot use this command to enter that zone!"); return; @@ -1307,7 +1307,7 @@ void command_peqzone(Client *c, const Seperator *sep) } else { zoneid = content_db.GetZoneID(sep->arg[1]); - destzone = database.GetPEQZone(zoneid, 0); + destzone = content_db.GetPEQZone(zoneid, 0); if(zoneid == 0) { c->Message(Chat::White, "Unable to locate zone '%s'", sep->arg[1]); return; @@ -4245,7 +4245,7 @@ void command_reloadworld(Client *c, const Seperator *sep) c->Message(Chat::White, "Reloading quest cache worldwide."); else c->Message(Chat::White, "Reloading quest cache and repopping zones worldwide."); - + auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct)); ReloadWorld_Struct* RW = (ReloadWorld_Struct*) pack->pBuffer; RW->Option = world_repop; @@ -6578,7 +6578,7 @@ void command_editmassrespawn(Client* c, const Seperator* sep) if (change_respawn_seconds > 0) { if (change_apply) { - + results = database.QueryDatabase( fmt::format( SQL( @@ -7949,7 +7949,7 @@ void command_npceditmass(Client *c, const Seperator *sep) c->Message(Chat::White, "#npceditmass search_column [exact_match: =]search_value change_column change_value (apply)"); return; } - + std::string query = SQL( SELECT COLUMN_NAME @@ -8070,7 +8070,7 @@ void command_npceditmass(Client *c, const Seperator *sep) continue; } } - + c->Message( Chat::Yellow, fmt::format( @@ -13413,7 +13413,7 @@ void command_bot(Client *c, const Seperator *sep) bot_message = bot_message.substr(bot_message.find_first_not_of("#bot")); bot_message[0] = BOT_COMMAND_CHAR; } - + if (bot_command_dispatch(c, bot_message.c_str()) == -2) { if (parse->PlayerHasQuestSub(EVENT_BOT_COMMAND)) { int i = parse->EventPlayer(EVENT_BOT_COMMAND, c, bot_message, 0);