feat(character): the editor level is the account's GM level, and the client is told it

A character's editor level is its account's GM level for accounts at editor_gm_level
or above, and 0 for everyone else (it was 1 or 0). It is written as the save's edit
attribute, sent with the character after the GM level (the editor flag, then the
level) and given in answer to the GetEditorLevel game message.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 19:11:29 -06:00
parent ca7d166c0b
commit dbe0722095
9 changed files with 139 additions and 35 deletions

View File

@@ -1,5 +1,7 @@
#include "PlayerMessages.h"
#include "PlayerManager.h"
#include "Logger.h"
#include "BitStreamUtils.h"
#include "Character.h"
@@ -265,4 +267,28 @@ namespace GameMessages {
bool DisplayGuildCreateBox::Deserialize(RakNet::BitStream& bitStream) {
return bitStream.Read(bShow);
}
void GetEditorLevel::Serialize(RakNet::BitStream& bitStream) const {
bitStream.Write(editorEnabled);
bitStream.Write(editorLevel);
}
bool GetEditorLevel::Deserialize(RakNet::BitStream& bitStream) {
// A question: whatever it carries is not needed to answer it
if (bitStream.GetNumberOfUnreadBits() < 33) return true;
return bitStream.Read(editorEnabled) && bitStream.Read(editorLevel);
}
void GetEditorLevel::Handle(Entity& entity, const SystemAddress& sysAddr) {
// Only about the asker's own character
auto* const player = PlayerManager::GetPlayer(sysAddr);
if (!player || player != &entity) return;
const auto* const character = entity.GetComponent<CharacterComponent>();
if (!character) return;
GetEditorLevel answer;
answer.target = entity.GetObjectID();
answer.editorEnabled = character->GetEditorEnabled();
answer.editorLevel = character->GetEditorLevel();
answer.SendToClient(sysAddr);
}
}