You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-20 07:26:18 +00:00
feat(communication): add housekeeping find-user-by-name packet pair
TS counterparts to Arcturus' new HK packet pair. Adds HousekeepingFindUserByNameComposer (OutgoingHeader 9100) and HousekeepingUserDetailEvent (IncomingHeader 9200) with a parser that wraps an optional HousekeepingUserDetailData. The data class follows the flat optional-trailing-field pattern (isMuted / isTradeLocked read under bytesAvailable guards) so the renderer stays compatible with a server that hasn't surfaced those manager APIs offline yet. The parser exposes `found: boolean` and `user: HousekeepingUserDetailData | null` so a callsite that gets a "user not found" reply can branch without having to read into an unpopulated data object — the composer writes `appendBoolean(false)` and stops, the parser sees the false and leaves `user` null. Headers 9100..9199 / 9200..9299 reserved for the rest of the HK packet surface. Composer + event registered in NitroMessages alongside the existing YouTube-room overrides. `yarn compile:fast` clean, vitest 138/138 green.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class HousekeepingUserDetailData
|
||||
{
|
||||
private _id: number = 0;
|
||||
private _username: string = '';
|
||||
private _motto: string = '';
|
||||
private _figure: string = '';
|
||||
private _rank: number = 0;
|
||||
private _rankName: string = '';
|
||||
private _online: boolean = false;
|
||||
private _lastOnlineAt: number = 0;
|
||||
private _creditsBalance: number = 0;
|
||||
private _ducketsBalance: number = 0;
|
||||
private _diamondsBalance: number = 0;
|
||||
private _email: string = '';
|
||||
private _ipLast: string = '';
|
||||
private _isBanned: boolean = false;
|
||||
private _isMuted: boolean = false;
|
||||
private _isTradeLocked: boolean = false;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_wrapper');
|
||||
|
||||
this._id = wrapper.readInt();
|
||||
this._username = wrapper.readString();
|
||||
this._motto = wrapper.readString();
|
||||
this._figure = wrapper.readString();
|
||||
this._rank = wrapper.readInt();
|
||||
this._rankName = wrapper.readString();
|
||||
this._online = wrapper.readBoolean();
|
||||
this._lastOnlineAt = wrapper.readInt();
|
||||
this._creditsBalance = wrapper.readInt();
|
||||
this._ducketsBalance = wrapper.readInt();
|
||||
this._diamondsBalance = wrapper.readInt();
|
||||
this._email = wrapper.readString();
|
||||
this._ipLast = wrapper.readString();
|
||||
this._isBanned = wrapper.readBoolean();
|
||||
|
||||
if(wrapper.bytesAvailable) this._isMuted = wrapper.readBoolean();
|
||||
if(wrapper.bytesAvailable) this._isTradeLocked = wrapper.readBoolean();
|
||||
}
|
||||
|
||||
public get id(): number { return this._id; }
|
||||
public get username(): string { return this._username; }
|
||||
public get motto(): string { return this._motto; }
|
||||
public get figure(): string { return this._figure; }
|
||||
public get rank(): number { return this._rank; }
|
||||
public get rankName(): string { return this._rankName; }
|
||||
public get online(): boolean { return this._online; }
|
||||
public get lastOnlineAt(): number { return this._lastOnlineAt; }
|
||||
public get creditsBalance(): number { return this._creditsBalance; }
|
||||
public get ducketsBalance(): number { return this._ducketsBalance; }
|
||||
public get diamondsBalance(): number { return this._diamondsBalance; }
|
||||
public get email(): string { return this._email; }
|
||||
public get ipLast(): string { return this._ipLast; }
|
||||
public get isBanned(): boolean { return this._isBanned; }
|
||||
public get isMuted(): boolean { return this._isMuted; }
|
||||
public get isTradeLocked(): boolean { return this._isTradeLocked; }
|
||||
}
|
||||
Reference in New Issue
Block a user