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:
Aaron Kimbrell
2023-11-15 19:30:46 -06:00
committed by GitHub
parent 8b270ca97a
commit 78d8c57752
6 changed files with 62 additions and 6 deletions

View File

@@ -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);
}

View File

@@ -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