You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 23:16:20 +00:00
feat(session): rank metadata in UserPermissions snapshot
Extend the `UserPermissionsEvent` parser and `IUserDataSnapshot` with rank metadata mirrored from the Arcturus `permission_ranks` table: rankId, rankName, rankBadge, rankPrefix, rankPrefixColor. The new fields are appended to the wire payload AFTER the existing [clubLevel, securityLevel, isAmbassador] triple. The parser guards the trailing block with `if(!wrapper.bytesAvailable) return true;` so older emulators (that don't write the extension) keep working — the snapshot just exposes the defaults (rankId=0, empty strings) in that case. `SessionDataManager.onUserPermissionsEvent` stores the values; the snapshot builder includes them; existing `invalidateUserDataSnapshot()` semantics flow through unchanged, so a runtime promote/demote (via `HabboManager.setRank` → `UserPermissionsComposer`) auto-flips the React-side `useUserRank()` / `useHasRankLevel()` / `useIsRank()` consumers in the Nitro-V3 client. Companion changes: - Arcturus-Morningstar-Extended: `UserPermissionsComposer.composeInternal()` now appends the 5 extra fields (pending operator commit; see ../Arcturus-Morningstar-Extended/Emulator/src/main/java/ com/eu/habbo/messages/outgoing/users/UserPermissionsComposer.java). - Nitro-V3: `useSessionSnapshots.ts` exposes the new family (useUserRank / useHasRankLevel / useIsRank), replacing the SecurityLevel-based wrappers (useIsModerator etc.) that hardcoded the renderer enum names — those don't match the operator's `permission_ranks.rank_name` column. Verification: tsgo clean, vitest 138/138.
This commit is contained in:
@@ -19,4 +19,13 @@ export interface IUserDataSnapshot
|
||||
isSystemShutdown: boolean;
|
||||
uiFlags: number;
|
||||
tags: ReadonlyArray<string>;
|
||||
// Rank metadata mirrored from `permission_ranks` (Arcturus emulator
|
||||
// ≥ 4.2.10 ships these via `UserPermissionsComposer`). Older
|
||||
// emulators leave them at the defaults (rankId=0, empty strings)
|
||||
// because the renderer-side parser short-circuits on bytesAvailable.
|
||||
rankId: number;
|
||||
rankName: string;
|
||||
rankBadge: string;
|
||||
rankPrefix: string;
|
||||
rankPrefixColor: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user