🆙 Small Fixes

This commit is contained in:
duckietm
2026-04-14 11:19:53 +02:00
parent 399999f23d
commit ca5e754b28
65 changed files with 1717 additions and 125 deletions
@@ -6,6 +6,8 @@ export class BuildersClubSubscriptionStatusMessageParser implements IMessagePars
private _furniLimit: number;
private _maxFurniLimit: number;
private _secondsLeftWithGrace: number;
private _placementBlockedByVisitors: boolean;
private _placementAllowedInCurrentRoom: boolean;
public flush(): boolean
{
@@ -13,6 +15,8 @@ export class BuildersClubSubscriptionStatusMessageParser implements IMessagePars
this._furniLimit = 0;
this._maxFurniLimit = 0;
this._secondsLeftWithGrace = 0;
this._placementBlockedByVisitors = false;
this._placementAllowedInCurrentRoom = false;
return true;
}
@@ -28,6 +32,12 @@ export class BuildersClubSubscriptionStatusMessageParser implements IMessagePars
if(wrapper.bytesAvailable) this._secondsLeftWithGrace = wrapper.readInt();
else this._secondsLeftWithGrace = this._secondsLeft;
if(wrapper.bytesAvailable) this._placementBlockedByVisitors = wrapper.readBoolean();
else this._placementBlockedByVisitors = false;
if(wrapper.bytesAvailable) this._placementAllowedInCurrentRoom = wrapper.readBoolean();
else this._placementAllowedInCurrentRoom = false;
return true;
}
@@ -50,4 +60,14 @@ export class BuildersClubSubscriptionStatusMessageParser implements IMessagePars
{
return this._secondsLeftWithGrace;
}
public get placementBlockedByVisitors(): boolean
{
return this._placementBlockedByVisitors;
}
public get placementAllowedInCurrentRoom(): boolean
{
return this._placementAllowedInCurrentRoom;
}
}
@@ -4,10 +4,12 @@ import { ClubOfferData } from './ClubOfferData';
export class HabboClubOffersMessageParser implements IMessageParser
{
private _offers: ClubOfferData[];
private _windowId = 1;
public flush(): boolean
{
this._offers = [];
this._windowId = 1;
return true;
}
@@ -25,6 +27,8 @@ export class HabboClubOffersMessageParser implements IMessageParser
totalOffers--;
}
if(wrapper.bytesAvailable) this._windowId = wrapper.readInt();
return true;
}
@@ -32,4 +36,9 @@ export class HabboClubOffersMessageParser implements IMessageParser
{
return this._offers;
}
public get windowId(): number
{
return this._windowId;
}
}
@@ -59,6 +59,7 @@ export * from './room/furniture';
export * from './room/furniture/floor';
export * from './room/furniture/wall';
export * from './room/furniture/youtube';
export * from './room/youtube';
export * from './room/mapping';
export * from './room/pet';
export * from './room/session';
@@ -1,16 +1,14 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class BadgeReceivedParser implements IMessageParser
{
private _badgeId: number;
private _badgeCode: string;
private _senderName: string;
public flush(): boolean
{
this._badgeId = 0;
this._badgeCode = null;
this._senderName = '';
return true;
}
@@ -21,10 +19,6 @@ export class BadgeReceivedParser implements IMessageParser
this._badgeId = wrapper.readInt();
this._badgeCode = wrapper.readString();
// Extra field appended by the Arcturus-Nitro fork: sender username for
// badges awarded by a staff member via the `:badge` command. Read
// defensively so older servers that don't send it still parse cleanly.
this._senderName = wrapper.bytesAvailable ? wrapper.readString() : '';
return true;
}
@@ -38,9 +32,4 @@ export class BadgeReceivedParser implements IMessageParser
{
return this._badgeCode;
}
public get senderName(): string
{
return this._senderName;
}
}
@@ -9,6 +9,8 @@ export class AreaHideMessageData
private _width: number;
private _length: number;
private _invert: boolean;
private _wallItems: boolean;
private _invisibility: boolean;
constructor(wrapper: IMessageDataWrapper)
{
@@ -19,6 +21,8 @@ export class AreaHideMessageData
this._width = wrapper.readInt();
this._length = wrapper.readInt();
this._invert = wrapper.readBoolean();
this._wallItems = wrapper.readBoolean();
this._invisibility = wrapper.readBoolean();
}
public get furniId(): number
@@ -55,4 +59,14 @@ export class AreaHideMessageData
{
return this._invert;
}
public get wallItems(): boolean
{
return this._wallItems;
}
public get invisibility(): boolean
{
return this._invisibility;
}
}
@@ -0,0 +1,38 @@
import { IMessageDataWrapper } from '@nitrots/api';
export class ConfInvisStateMessageData
{
private _roomId: number;
private _active: boolean;
private _hiddenItemIds: number[];
constructor(wrapper: IMessageDataWrapper)
{
this._roomId = wrapper.readInt();
this._active = wrapper.readBoolean();
const totalHiddenItems = wrapper.readInt();
this._hiddenItemIds = [];
for(let index = 0; index < totalHiddenItems; index++)
{
this._hiddenItemIds.push(wrapper.readInt());
}
}
public get roomId(): number
{
return this._roomId;
}
public get hiddenItemIds(): number[]
{
return this._hiddenItemIds;
}
public get active(): boolean
{
return this._active;
}
}
@@ -0,0 +1,23 @@
import { IMessageDataWrapper } from '@nitrots/api';
export class HanditemBlockStateMessageData
{
private _roomId: number;
private _blocked: boolean;
constructor(wrapper: IMessageDataWrapper)
{
this._roomId = wrapper.readInt();
this._blocked = wrapper.readBoolean();
}
public get roomId(): number
{
return this._roomId;
}
public get blocked(): boolean
{
return this._blocked;
}
}
@@ -1,4 +1,6 @@
export * from './AreaHideMessageData';
export * from './ConfInvisStateMessageData';
export * from './HanditemBlockStateMessageData';
export * from './FavoriteMembershipUpdateMessageParser';
export * from './ObjectData';
export * from './ObjectsDataUpdateParser';
@@ -0,0 +1,28 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
import { ConfInvisStateMessageData } from '../engine';
export class ConfInvisStateMessageParser implements IMessageParser
{
private _stateData: ConfInvisStateMessageData;
public flush(): boolean
{
this._stateData = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._stateData = new ConfInvisStateMessageData(wrapper);
return true;
}
public get stateData(): ConfInvisStateMessageData
{
return this._stateData;
}
}
@@ -0,0 +1,28 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
import { HanditemBlockStateMessageData } from '../engine';
export class HanditemBlockStateMessageParser implements IMessageParser
{
private _stateData: HanditemBlockStateMessageData;
public flush(): boolean
{
this._stateData = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._stateData = new HanditemBlockStateMessageData(wrapper);
return true;
}
public get stateData(): HanditemBlockStateMessageData
{
return this._stateData;
}
}
@@ -1,4 +1,5 @@
export * from './AreaHideMessageParser';
export * from './ConfInvisStateMessageParser';
export * from './CustomUserNotificationMessageParser';
export * from './DiceValueMessageParser';
export * from './FurniRentOrBuyoutOfferMessageParser';
@@ -6,6 +7,7 @@ export * from './FurnitureAliasesParser';
export * from './FurnitureDataParser';
export * from './FurnitureStackHeightParser';
export * from './GroupFurniContextMenuInfoMessageParser';
export * from './HanditemBlockStateMessageParser';
export * from './ItemDataUpdateMessageParser';
export * from './LoveLockFurniFinishedParser';
export * from './LoveLockFurniFriendConfirmedParser';
@@ -13,4 +13,3 @@ export * from './pet';
export * from './session';
export * from './unit';
export * from './unit/chat';
export * from './youtube';
@@ -0,0 +1,222 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export interface IWiredMonitorLogData
{
amount: number;
latestOccurrenceSeconds: number;
latestReason: string;
latestSourceId: number;
latestSourceLabel: string;
severity: string;
type: string;
}
export interface IWiredMonitorHistoryData
{
occurredAtSeconds: number;
reason: string;
sourceId: number;
sourceLabel: string;
severity: string;
type: string;
}
export class WiredMonitorDataParser implements IMessageParser
{
private _usageCurrentWindow: number;
private _usageLimitPerWindow: number;
private _isHeavy: boolean;
private _delayedEventsPending: number;
private _delayedEventsLimit: number;
private _averageExecutionMs: number;
private _peakExecutionMs: number;
private _recursionDepthCurrent: number;
private _recursionDepthLimit: number;
private _killedRemainingSeconds: number;
private _usageWindowMs: number;
private _overloadAverageThresholdMs: number;
private _overloadPeakThresholdMs: number;
private _heavyUsageThresholdPercent: number;
private _heavyConsecutiveWindowsThreshold: number;
private _overloadConsecutiveWindowsThreshold: number;
private _heavyDelayedThresholdPercent: number;
private _logs: IWiredMonitorLogData[];
private _history: IWiredMonitorHistoryData[];
public flush(): boolean
{
this._usageCurrentWindow = 0;
this._usageLimitPerWindow = 0;
this._isHeavy = false;
this._delayedEventsPending = 0;
this._delayedEventsLimit = 0;
this._averageExecutionMs = 0;
this._peakExecutionMs = 0;
this._recursionDepthCurrent = 0;
this._recursionDepthLimit = 0;
this._killedRemainingSeconds = 0;
this._usageWindowMs = 0;
this._overloadAverageThresholdMs = 0;
this._overloadPeakThresholdMs = 0;
this._heavyUsageThresholdPercent = 0;
this._heavyConsecutiveWindowsThreshold = 0;
this._overloadConsecutiveWindowsThreshold = 0;
this._heavyDelayedThresholdPercent = 0;
this._logs = [];
this._history = [];
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._usageCurrentWindow = wrapper.readInt();
this._usageLimitPerWindow = wrapper.readInt();
this._isHeavy = wrapper.readBoolean();
this._delayedEventsPending = wrapper.readInt();
this._delayedEventsLimit = wrapper.readInt();
this._averageExecutionMs = wrapper.readInt();
this._peakExecutionMs = wrapper.readInt();
this._recursionDepthCurrent = wrapper.readInt();
this._recursionDepthLimit = wrapper.readInt();
this._killedRemainingSeconds = wrapper.readInt();
this._usageWindowMs = wrapper.readInt();
this._overloadAverageThresholdMs = wrapper.readInt();
this._overloadPeakThresholdMs = wrapper.readInt();
this._heavyUsageThresholdPercent = wrapper.readInt();
this._heavyConsecutiveWindowsThreshold = wrapper.readInt();
this._overloadConsecutiveWindowsThreshold = wrapper.readInt();
this._heavyDelayedThresholdPercent = wrapper.readInt();
const totalLogs = wrapper.readInt();
this._logs = [];
this._history = [];
for(let i = 0; i < totalLogs; i++)
{
this._logs.push({
type: wrapper.readString(),
severity: wrapper.readString(),
amount: wrapper.readInt(),
latestOccurrenceSeconds: wrapper.readInt(),
latestReason: wrapper.readString(),
latestSourceLabel: wrapper.readString(),
latestSourceId: wrapper.readInt()
});
}
const totalHistory = wrapper.readInt();
for(let i = 0; i < totalHistory; i++)
{
this._history.push({
type: wrapper.readString(),
severity: wrapper.readString(),
occurredAtSeconds: wrapper.readInt(),
reason: wrapper.readString(),
sourceLabel: wrapper.readString(),
sourceId: wrapper.readInt()
});
}
return true;
}
public get usageCurrentWindow(): number
{
return this._usageCurrentWindow;
}
public get usageLimitPerWindow(): number
{
return this._usageLimitPerWindow;
}
public get isHeavy(): boolean
{
return this._isHeavy;
}
public get delayedEventsPending(): number
{
return this._delayedEventsPending;
}
public get delayedEventsLimit(): number
{
return this._delayedEventsLimit;
}
public get averageExecutionMs(): number
{
return this._averageExecutionMs;
}
public get peakExecutionMs(): number
{
return this._peakExecutionMs;
}
public get recursionDepthCurrent(): number
{
return this._recursionDepthCurrent;
}
public get recursionDepthLimit(): number
{
return this._recursionDepthLimit;
}
public get killedRemainingSeconds(): number
{
return this._killedRemainingSeconds;
}
public get usageWindowMs(): number
{
return this._usageWindowMs;
}
public get overloadAverageThresholdMs(): number
{
return this._overloadAverageThresholdMs;
}
public get overloadPeakThresholdMs(): number
{
return this._overloadPeakThresholdMs;
}
public get heavyUsageThresholdPercent(): number
{
return this._heavyUsageThresholdPercent;
}
public get heavyConsecutiveWindowsThreshold(): number
{
return this._heavyConsecutiveWindowsThreshold;
}
public get overloadConsecutiveWindowsThreshold(): number
{
return this._overloadConsecutiveWindowsThreshold;
}
public get heavyDelayedThresholdPercent(): number
{
return this._heavyDelayedThresholdPercent;
}
public get logs(): IWiredMonitorLogData[]
{
return this._logs;
}
public get history(): IWiredMonitorHistoryData[]
{
return this._history;
}
}
@@ -0,0 +1,67 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class WiredRoomSettingsDataParser implements IMessageParser
{
private _roomId: number;
private _inspectMask: number;
private _modifyMask: number;
private _canInspect: boolean;
private _canModify: boolean;
private _canManageSettings: boolean;
public flush(): boolean
{
this._roomId = 0;
this._inspectMask = 0;
this._modifyMask = 0;
this._canInspect = false;
this._canModify = false;
this._canManageSettings = false;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._roomId = wrapper.readInt();
this._inspectMask = wrapper.readInt();
this._modifyMask = wrapper.readInt();
this._canInspect = wrapper.readBoolean();
this._canModify = wrapper.readBoolean();
this._canManageSettings = wrapper.readBoolean();
return true;
}
public get roomId(): number
{
return this._roomId;
}
public get inspectMask(): number
{
return this._inspectMask;
}
public get modifyMask(): number
{
return this._modifyMask;
}
public get canInspect(): boolean
{
return this._canInspect;
}
public get canModify(): boolean
{
return this._canModify;
}
public get canManageSettings(): boolean
{
return this._canManageSettings;
}
}
@@ -0,0 +1,301 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export interface IWiredUserVariableDefinitionData
{
availability: number;
hasValue: boolean;
isReadOnly: boolean;
isTextConnected: boolean;
itemId: number;
name: string;
}
export interface IWiredUserVariableAssignmentData
{
createdAt: number;
hasValue: boolean;
updatedAt: number;
value: number | null;
variableItemId: number;
}
export interface IWiredUserVariablesUserData
{
assignments: IWiredUserVariableAssignmentData[];
userId: number;
}
export interface IWiredFurniVariableDefinitionData
{
availability: number;
hasValue: boolean;
isReadOnly: boolean;
isTextConnected: boolean;
itemId: number;
name: string;
}
export interface IWiredUserVariablesFurniData
{
assignments: IWiredUserVariableAssignmentData[];
furniId: number;
}
export interface IWiredRoomVariableDefinitionData
{
availability: number;
hasValue: boolean;
isReadOnly: boolean;
isTextConnected: boolean;
itemId: number;
name: string;
}
export interface IWiredRoomVariableAssignmentData
{
createdAt: number;
hasValue: boolean;
updatedAt: number;
value: number | null;
variableItemId: number;
}
export interface IWiredContextVariableDefinitionData
{
availability: number;
hasValue: boolean;
isReadOnly: boolean;
isTextConnected: boolean;
itemId: number;
name: string;
}
export class WiredUserVariablesDataParser implements IMessageParser
{
private _roomId: number;
private _definitions: IWiredUserVariableDefinitionData[];
private _users: IWiredUserVariablesUserData[];
private _furniDefinitions: IWiredFurniVariableDefinitionData[];
private _furnis: IWiredUserVariablesFurniData[];
private _roomDefinitions: IWiredRoomVariableDefinitionData[];
private _roomAssignments: IWiredRoomVariableAssignmentData[];
private _contextDefinitions: IWiredContextVariableDefinitionData[];
public flush(): boolean
{
this._roomId = 0;
this._definitions = [];
this._users = [];
this._furniDefinitions = [];
this._furnis = [];
this._roomDefinitions = [];
this._roomAssignments = [];
this._contextDefinitions = [];
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._roomId = wrapper.readInt();
let totalDefinitions = wrapper.readInt();
this._definitions = [];
this._users = [];
this._furniDefinitions = [];
this._furnis = [];
this._roomDefinitions = [];
this._roomAssignments = [];
this._contextDefinitions = [];
while(totalDefinitions > 0)
{
this._definitions.push({
itemId: wrapper.readInt(),
name: wrapper.readString(),
hasValue: wrapper.readBoolean(),
availability: wrapper.readInt(),
isTextConnected: wrapper.readBoolean(),
isReadOnly: wrapper.readBoolean()
});
totalDefinitions--;
}
let totalUsers = wrapper.readInt();
while(totalUsers > 0)
{
const userId = wrapper.readInt();
let totalAssignments = wrapper.readInt();
const assignments: IWiredUserVariableAssignmentData[] = [];
while(totalAssignments > 0)
{
const variableItemId = wrapper.readInt();
const hasValue = wrapper.readBoolean();
const rawValue = wrapper.readInt();
const createdAt = wrapper.readInt();
const updatedAt = wrapper.readInt();
assignments.push({
variableItemId,
hasValue,
value: (hasValue ? rawValue : null),
createdAt,
updatedAt
});
totalAssignments--;
}
this._users.push({ userId, assignments });
totalUsers--;
}
let totalFurniDefinitions = wrapper.readInt();
while(totalFurniDefinitions > 0)
{
this._furniDefinitions.push({
itemId: wrapper.readInt(),
name: wrapper.readString(),
hasValue: wrapper.readBoolean(),
availability: wrapper.readInt(),
isTextConnected: wrapper.readBoolean(),
isReadOnly: wrapper.readBoolean()
});
totalFurniDefinitions--;
}
let totalFurnis = wrapper.readInt();
while(totalFurnis > 0)
{
const furniId = wrapper.readInt();
let totalAssignments = wrapper.readInt();
const assignments: IWiredUserVariableAssignmentData[] = [];
while(totalAssignments > 0)
{
const variableItemId = wrapper.readInt();
const hasValue = wrapper.readBoolean();
const rawValue = wrapper.readInt();
const createdAt = wrapper.readInt();
const updatedAt = wrapper.readInt();
assignments.push({
variableItemId,
hasValue,
value: (hasValue ? rawValue : null),
createdAt,
updatedAt
});
totalAssignments--;
}
this._furnis.push({ furniId, assignments });
totalFurnis--;
}
let totalRoomDefinitions = wrapper.readInt();
while(totalRoomDefinitions > 0)
{
this._roomDefinitions.push({
itemId: wrapper.readInt(),
name: wrapper.readString(),
hasValue: wrapper.readBoolean(),
availability: wrapper.readInt(),
isTextConnected: wrapper.readBoolean(),
isReadOnly: wrapper.readBoolean()
});
totalRoomDefinitions--;
}
let totalRoomAssignments = wrapper.readInt();
while(totalRoomAssignments > 0)
{
const variableItemId = wrapper.readInt();
const hasValue = wrapper.readBoolean();
const rawValue = wrapper.readInt();
const createdAt = wrapper.readInt();
const updatedAt = wrapper.readInt();
this._roomAssignments.push({
variableItemId,
hasValue,
value: (hasValue ? rawValue : null),
createdAt,
updatedAt
});
totalRoomAssignments--;
}
let totalContextDefinitions = wrapper.readInt();
while(totalContextDefinitions > 0)
{
this._contextDefinitions.push({
itemId: wrapper.readInt(),
name: wrapper.readString(),
hasValue: wrapper.readBoolean(),
availability: wrapper.readInt(),
isTextConnected: wrapper.readBoolean(),
isReadOnly: wrapper.readBoolean()
});
totalContextDefinitions--;
}
return true;
}
public get roomId(): number
{
return this._roomId;
}
public get definitions(): IWiredUserVariableDefinitionData[]
{
return this._definitions;
}
public get users(): IWiredUserVariablesUserData[]
{
return this._users;
}
public get furniDefinitions(): IWiredFurniVariableDefinitionData[]
{
return this._furniDefinitions;
}
public get furnis(): IWiredUserVariablesFurniData[]
{
return this._furnis;
}
public get roomDefinitions(): IWiredRoomVariableDefinitionData[]
{
return this._roomDefinitions;
}
public get roomAssignments(): IWiredRoomVariableAssignmentData[]
{
return this._roomAssignments;
}
public get contextDefinitions(): IWiredContextVariableDefinitionData[]
{
return this._contextDefinitions;
}
}
@@ -5,7 +5,10 @@ export * from './WiredActionDefinition';
export * from './WiredFurniActionParser';
export * from './WiredFurniConditionParser';
export * from './WiredFurniTriggerParser';
export * from './WiredMonitorDataParser';
export * from './WiredRoomSettingsDataParser';
export * from './WiredOpenParser';
export * from './WiredRewardResultMessageParser';
export * from './WiredSaveSuccessParser';
export * from './WiredUserVariablesDataParser';
export * from './WiredValidationErrorParser';