mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-19 02:05:28 +00:00
feat(character): the save's edit attribute is 1 for accounts at editor_gm_level
The client takes a non-zero edit as the editor being enabled. A character whose account GM level is at least editor_gm_level (worldconfig.ini, default 9) is saved with edit="1"; everyone else keeps 0. A civilian never gets it, whatever the setting. The setting is in the dashboard's settings catalog. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef CHARACTERCOMPONENT_H
|
||||
#define CHARACTERCOMPONENT_H
|
||||
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "dCommonVars.h"
|
||||
#include "RakNetTypes.h"
|
||||
#include "Character.h"
|
||||
@@ -477,6 +478,22 @@ private:
|
||||
*/
|
||||
bool m_EditorEnabled;
|
||||
|
||||
public:
|
||||
// editor_gm_level when the settings don't have it
|
||||
static constexpr uint32_t DEFAULT_EDITOR_GM_LEVEL = 9;
|
||||
|
||||
/**
|
||||
* The save's edit attribute (the client takes anything but 0 as the editor being on): 1 for an account whose GM
|
||||
* level is at least editorGmLevel, else the editor level when the editor flag is on, else 0
|
||||
*/
|
||||
static uint32_t EditAttribute(const eGameMasterLevel accountLevel, const uint32_t editorGmLevel, const bool editorEnabled, const eGameMasterLevel editorLevel) {
|
||||
// (a civilian never, whatever the setting)
|
||||
if (accountLevel != eGameMasterLevel::CIVILIAN && static_cast<uint32_t>(accountLevel) >= editorGmLevel) return 1;
|
||||
return editorEnabled ? static_cast<uint32_t>(editorLevel) : 0;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* The level of the character in HF
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user