diff --git a/dCommon/dConfig.cpp b/dCommon/dConfig.cpp index f09a44c1..35048d64 100644 --- a/dCommon/dConfig.cpp +++ b/dCommon/dConfig.cpp @@ -38,13 +38,11 @@ const std::string& dConfig::GetValue(std::string key) { } void dConfig::ProcessLine(const std::string& line) { - auto splitLine = GeneralUtils::SplitString(line, '='); - - if (splitLine.size() != 2) return; + auto splitLoc = line.find('='); + auto key = line.substr(0, splitLoc); + auto value = line.substr(splitLoc + 1); //Make sure that on Linux, we remove special characters: - auto& key = splitLine.at(0); - auto& value = splitLine.at(1); if (!value.empty() && value.at(value.size() - 1) == '\r') value.erase(value.size() - 1); if (this->m_ConfigValues.find(key) != this->m_ConfigValues.end()) return; diff --git a/dCommon/dEnums/eWorldMessageType.h b/dCommon/dEnums/eWorldMessageType.h index 2a65fd98..4b3e2a03 100644 --- a/dCommon/dEnums/eWorldMessageType.h +++ b/dCommon/dEnums/eWorldMessageType.h @@ -36,7 +36,8 @@ enum class eWorldMessageType : uint32_t { HANDLE_FUNNESS, FAKE_PRG_CSR_MESSAGE, REQUEST_FREE_TRIAL_REFRESH, - GM_SET_FREE_TRIAL_STATUS + GM_SET_FREE_TRIAL_STATUS, + UI_HELP_TOP_5 = 91 }; #endif //!__EWORLDMESSAGETYPE__H__ diff --git a/dNet/ClientPackets.cpp b/dNet/ClientPackets.cpp index 8059b7af..daf0221a 100644 --- a/dNet/ClientPackets.cpp +++ b/dNet/ClientPackets.cpp @@ -34,6 +34,7 @@ #include "eGameMasterLevel.h" #include "eReplicaComponentType.h" #include "CheatDetection.h" +#include "Amf3.h" void ClientPackets::HandleChatMessage(const SystemAddress& sysAddr, Packet* packet) { User* user = UserManager::Instance()->GetUser(sysAddr); @@ -402,3 +403,40 @@ void ClientPackets::HandleChatModerationRequest(const SystemAddress& sysAddr, Pa user->SetLastChatMessageApproved(bAllClean); WorldPackets::SendChatModerationResponse(sysAddr, bAllClean, requestID, receiver, segments); } + +void ClientPackets::SendTop5HelpIssues(Packet* packet) { + auto* user = UserManager::Instance()->GetUser(packet->systemAddress); + if (!user) return; + auto* character = user->GetLastUsedChar(); + if (!character) return; + auto * entity = character->GetEntity(); + if (!entity) return; + + CINSTREAM_SKIP_HEADER; + int32_t language = 0; + inStream.Read(language); + + // TODO: Handle different languages in a nice way + // 0: en_US + // 1: pl_US + // 2: de_DE + // 3: en_GB + + AMFArrayValue data; + // Summaries + data.Insert("Summary0", Game::config->GetValue("help_0_summary")); + data.Insert("Summary1", Game::config->GetValue("help_1_summary")); + data.Insert("Summary2", Game::config->GetValue("help_2_summary")); + data.Insert("Summary3", Game::config->GetValue("help_3_summary")); + data.Insert("Summary4", Game::config->GetValue("help_4_summary")); + + // Descriptions + data.Insert("Description0", Game::config->GetValue("help_0_description")); + data.Insert("Description1", Game::config->GetValue("help_1_description")); + data.Insert("Description2", Game::config->GetValue("help_2_description")); + data.Insert("Description3", Game::config->GetValue("help_3_description")); + data.Insert("Description4", Game::config->GetValue("help_4_description")); + + GameMessages::SendUIMessageServerToSingleClient(entity, packet->systemAddress, "UIHelpTop5", data); + +} diff --git a/dNet/ClientPackets.h b/dNet/ClientPackets.h index a36384e2..5b9fd76d 100644 --- a/dNet/ClientPackets.h +++ b/dNet/ClientPackets.h @@ -12,6 +12,7 @@ namespace ClientPackets { void HandleChatMessage(const SystemAddress& sysAddr, Packet* packet); void HandleClientPositionUpdate(const SystemAddress& sysAddr, Packet* packet); void HandleChatModerationRequest(const SystemAddress& sysAddr, Packet* packet); + void SendTop5HelpIssues(Packet* packet); }; #endif // CLIENTPACKETS_H diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index 79dce1bf..e8f5915d 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -1297,6 +1297,12 @@ void HandlePacket(Packet* packet) { break; } + + case eWorldMessageType::UI_HELP_TOP_5: { + ClientPackets::SendTop5HelpIssues(packet); + break; + } + default: LOG("Unknown world packet received: %i", int(packet->data[3])); } diff --git a/resources/worldconfig.ini b/resources/worldconfig.ini index c0a0a10a..0072fc51 100644 --- a/resources/worldconfig.ini +++ b/resources/worldconfig.ini @@ -64,3 +64,15 @@ allow_nameplate_off=0 # Turn logging of IP addresses for anti-cheat reporting on (1) or off(0) log_ip_addresses_for_anti_cheat=1 + +help_0_summary=Got an issue? +help_1_summary=Stuck loading? +help_2_summary=Missing features? +help_3_summary=Get smashed? +help_4_summary=Want to contribute? + +help_0_description=Go to the DarkflameServer repository on GitHub to view issues and discussions about the server emulator!

Click Here to go there!

+help_1_description=Try switching networks, using a VPN, or using your phone's hotspot to resolve the issue.

+help_2_description=While DarkflameServer is a mostly complete emulator, there are still some features that aren't implemented. You can track these on the GitHub issues page.

+help_3_description=Skill issue!

+help_4_description=Visit Discussions on the DarkflameServer GitHub page
to ask questions and collaborate with other devs!