mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
feat: make the help menu top 5 issues work and configurable (#1293)
* feat: make make the help menu questions work * address feedback * typo * update defaults * fix and address feedback * newline
This commit is contained in:
parent
8b270ca97a
commit
78d8c57752
@ -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;
|
||||
|
@ -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__
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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]));
|
||||
}
|
||||
|
@ -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!<br/><br/><a href="https://github.com/DarkflameUniverse/DarkflameServer"><font color="#0000EE">Click Here to go there!</font></a><br/><br/>
|
||||
help_1_description=Try switching networks, using a VPN, or using your phone's hotspot to resolve the issue.<br/><br/>
|
||||
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.<br/><br/>
|
||||
help_3_description=Skill issue!<br/><br/>
|
||||
help_4_description=Visit Discussions on the DarkflameServer GitHub page<br/>to ask questions and collaborate with other devs!<br/><br/>
|
||||
|
Loading…
Reference in New Issue
Block a user