Trust system
MadROM tracks an optional "trust" level that can temporarily raise a player's privileges above their natural level. The value lives on every character record in src/merc.h
and is stored in player files when it is non-zero.
Data storage
The CHAR_DATA
structure defines sh_int trust;
so implementers can grant elevated access without permanently changing a character's level. During save and load the player-file code writes the field as Tru
(or the legacy Trust
) only when it holds a non-zero value, which keeps ordinary characters from carrying extra clutter in their files.
Determining effective trust
The helper get_trust
in src/handler.c
resolves a character's effective permission level before any command checks run. It first collapses switched descriptors back to their original bodies, then:
- Returns the explicit
trust
value when it is set. - Falls back to
LEVEL_HERO - 1
for high-level NPCs that lack an explicit trust. - Otherwise returns the character's current level.
This logic allows implementers to grant temporary power without permanently altering leveling data.
Setting or clearing trust
Immortals adjust trust with the trust
command in src/act_wiz.c
. The handler requires the target to be in the same room, validates that the supplied number is between 0 and MAX_LEVEL
, and prevents an immortal from granting more trust than they personally hold. Passing 0
clears the field. Other administrative commands such as advance
explicitly reset victim->trust
to 0
after changing the player's level so stale trust does not linger.
Saving to player files
Because the field is only persisted when non-zero, trusted characters display a Tru <level>
line in their save files while others omit it entirely. Either the long (Trust
) or short (Tru
) key restores the value when a player logs in, keeping compatibility with earlier saves.
Summary
The trust system gives implementers a reversible way to raise or lower a character's authority. trust
manages the value, get_trust
consults it during permission checks, and the save system adds or omits the Tru
field based on whether trust is currently granted.