From 2da70c69da99848237e8debe6765bbd59f4ff075 Mon Sep 17 00:00:00 2001 From: Uleat Date: Wed, 7 Mar 2018 22:45:05 -0500 Subject: [PATCH] Added command '#ucs' to force re-connect after ucs server unavailability (must manually re-join channels for now) --- changelog.txt | 5 ++ common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + zone/command.cpp | 85 ++++++++++++++++++++++++++++++++ zone/command.h | 1 + 5 files changed, 93 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 360f61082..f2f200fa6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 03/07/2018 == +Uleat: Added command '#ucs' to force a reconnect to UCS server. + - Works in place of client auto-reconnect packet in zones where feature is unsupported + - Currently, you will need to manually re-join channels + == 03/04/2018 == Uleat: Updated UCS versioning - SoF and higher clients have a new opcode identified (update your *.conf files) diff --git a/common/version.h b/common/version.h index d1afd9744..e003dc33f 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9121 +#define CURRENT_BINARY_DATABASE_VERSION 9122 #ifdef BOTS #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9018 #else diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 2a0b12fd2..db0a04ca8 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -375,6 +375,7 @@ 9119|2018_02_10_GlobalLoot.sql|SHOW TABLES LIKE 'global_loot'|empty| 9120|2018_02_13_Heading.sql|SELECT value FROM variables WHERE varname = 'fixed_heading'|empty| 9121|2018_02_18_bug_reports.sql|SHOW TABLES LIKE 'bug_reports'|empty| +9122|2018_03_07_ucs_command.sql|SELECT * FROM `command_settings` WHERE `command` LIKE 'ucs'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/zone/command.cpp b/zone/command.cpp index 1fee0e26d..a97e04d96 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -389,6 +389,7 @@ int command_init(void) command_add("traindisc", "[level] - Trains all the disciplines usable by the target, up to level specified. (may freeze client for a few seconds)", 150, command_traindisc) || command_add("trapinfo", "- Gets infomation about the traps currently spawned in the zone.", 81, command_trapinfo) || command_add("tune", "Calculate ideal statical values related to combat.", 100, command_tune) || + command_add("ucs", "- Attempts to reconnect to the UCS server", 0, command_ucs) || command_add("undyeme", "- Remove dye from all of your armor slots", 0, command_undyeme) || command_add("unfreeze", "- Unfreeze your target", 80, command_unfreeze) || command_add("unlock", "- Unlock the worldserver", 150, command_unlock) || @@ -7158,6 +7159,90 @@ void command_undye(Client *c, const Seperator *sep) } } +void command_ucs(Client *c, const Seperator *sep) +{ + if (!c) + return; + + Log(Logs::Detail, Logs::UCS_Server, "Character %s attempting ucs reconnect while ucs server is %savailable", + c->GetName(), (zone->IsUCSServerAvailable() ? "" : "un")); + + if (zone->IsUCSServerAvailable()) { + EQApplicationPacket* outapp = nullptr; + std::string buffer; + + std::string MailKey = database.GetMailKey(c->CharacterID(), true); + EQEmu::versions::UCSVersion ConnectionType = EQEmu::versions::ucsUnknown; + + // chat server packet + switch (c->ClientVersion()) { + case EQEmu::versions::ClientVersion::Titanium: + ConnectionType = EQEmu::versions::ucsTitaniumChat; + break; + case EQEmu::versions::ClientVersion::SoF: + ConnectionType = EQEmu::versions::ucsSoFCombined; + break; + case EQEmu::versions::ClientVersion::SoD: + ConnectionType = EQEmu::versions::ucsSoDCombined; + break; + case EQEmu::versions::ClientVersion::UF: + ConnectionType = EQEmu::versions::ucsUFCombined; + break; + case EQEmu::versions::ClientVersion::RoF: + ConnectionType = EQEmu::versions::ucsRoFCombined; + break; + case EQEmu::versions::ClientVersion::RoF2: + ConnectionType = EQEmu::versions::ucsRoF2Combined; + break; + default: + ConnectionType = EQEmu::versions::ucsUnknown; + break; + } + + buffer = StringFormat("%s,%i,%s.%s,%c%s", + Config->ChatHost.c_str(), + Config->ChatPort, + Config->ShortName.c_str(), + c->GetName(), + ConnectionType, + MailKey.c_str() + ); + + outapp = new EQApplicationPacket(OP_SetChatServer, (buffer.length() + 1)); + memcpy(outapp->pBuffer, buffer.c_str(), buffer.length()); + outapp->pBuffer[buffer.length()] = '\0'; + + c->QueuePacket(outapp); + safe_delete(outapp); + + // mail server packet + switch (c->ClientVersion()) { + case EQEmu::versions::ClientVersion::Titanium: + ConnectionType = EQEmu::versions::ucsTitaniumMail; + break; + default: + // retain value from previous switch + break; + } + + buffer = StringFormat("%s,%i,%s.%s,%c%s", + Config->MailHost.c_str(), + Config->MailPort, + Config->ShortName.c_str(), + c->GetName(), + ConnectionType, + MailKey.c_str() + ); + + outapp = new EQApplicationPacket(OP_SetChatServer2, (buffer.length() + 1)); + memcpy(outapp->pBuffer, buffer.c_str(), buffer.length()); + outapp->pBuffer[buffer.length()] = '\0'; + + c->QueuePacket(outapp); + safe_delete(outapp); + } +} + void command_undyeme(Client *c, const Seperator *sep) { if(c) { diff --git a/zone/command.h b/zone/command.h index b8d688a54..580dd00ff 100644 --- a/zone/command.h +++ b/zone/command.h @@ -302,6 +302,7 @@ void command_titlesuffix(Client *c, const Seperator *sep); void command_traindisc(Client *c, const Seperator *sep); void command_trapinfo(Client* c, const Seperator *sep); void command_tune(Client *c, const Seperator *sep); +void command_ucs(Client *c, const Seperator *sep); void command_undye(Client *c, const Seperator *sep); void command_undyeme(Client *c, const Seperator *sep); void command_unfreeze(Client *c, const Seperator *sep);