Move to Renderer V2

This commit is contained in:
duckietm
2024-04-03 09:27:56 +02:00
parent 110c3ad393
commit b3134ce50b
4080 changed files with 115593 additions and 66375 deletions
@@ -0,0 +1,93 @@
import { IMessageDataWrapper } from '@nitrots/api';
export class AchievementLevelUpData
{
private _type: number;
private _level: number;
private _points: number;
private _levelRewardPoints: number;
private _levelRewardPointType: number;
private _bonusPoints: number;
private _badgeId: number;
private _badgeCode: string = '';
private _removedBadgeCode: string = '';
private _achievementID: number;
private _category: string;
private _showDialogToUser: boolean;
constructor(wrapper: IMessageDataWrapper)
{
this._type = wrapper.readInt();
this._level = wrapper.readInt();
this._badgeId = wrapper.readInt();
this._badgeCode = wrapper.readString();
this._points = wrapper.readInt();
this._levelRewardPoints = wrapper.readInt();
this._levelRewardPointType = wrapper.readInt();
this._bonusPoints = wrapper.readInt();
this._achievementID = wrapper.readInt();
this._removedBadgeCode = wrapper.readString();
this._category = wrapper.readString();
this._showDialogToUser = wrapper.readBoolean();
}
public get type(): number
{
return this._type;
}
public get level(): number
{
return this._level;
}
public get points(): number
{
return this._points;
}
public get levelRewardPoints(): number
{
return this._levelRewardPoints;
}
public get levelRewardPointType(): number
{
return this._levelRewardPointType;
}
public get bonusPoints(): number
{
return this._bonusPoints;
}
public get badgeId(): number
{
return this._badgeId;
}
public get badgeCode(): string
{
return this._badgeCode;
}
public get removedBadgeCode(): string
{
return this._removedBadgeCode;
}
public get achievementID(): number
{
return this._achievementID;
}
public get category(): string
{
return this._category;
}
public get showDialogToUser(): boolean
{
return this._showDialogToUser;
}
}
@@ -0,0 +1,28 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
import { AchievementLevelUpData } from './AchievementLevelUpData';
export class AchievementNotificationMessageParser implements IMessageParser
{
private _data: AchievementLevelUpData;
public flush(): boolean
{
this._data = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._data = new AchievementLevelUpData(wrapper);
return true;
}
public get data(): AchievementLevelUpData
{
return this._data;
}
}
@@ -0,0 +1,43 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class ActivityPointNotificationParser implements IMessageParser
{
private _amount: number;
private _amountChanged: number;
private _type: number;
public flush(): boolean
{
this._amount = 0;
this._amountChanged = 0;
this._type = -1;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._amount = wrapper.readInt();
this._amountChanged = wrapper.readInt();
this._type = wrapper.readInt();
return true;
}
public get amount(): number
{
return this._amount;
}
public get amountChanged(): number
{
return this._amountChanged;
}
public get type(): number
{
return this._type;
}
}
@@ -0,0 +1,26 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class BotErrorEventParser implements IMessageParser
{
private _errorCode: number;
public flush(): boolean
{
this._errorCode = -1;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._errorCode = wrapper.readInt();
return true;
}
public get errorCode(): number
{
return this._errorCode;
}
}
@@ -0,0 +1,27 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class ClubGiftNotificationParser implements IMessageParser
{
private _numGifts: number;
public flush(): boolean
{
this._numGifts = 0;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._numGifts = wrapper.readInt();
return true;
}
public get numGifts(): number
{
return this._numGifts;
}
}
@@ -0,0 +1,43 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class ConnectionErrorMessageParser implements IMessageParser
{
private _errorCode: number;
private _messageId: number;
private _timestamp: string;
public flush(): boolean
{
this._errorCode = 0;
this._messageId = 0;
this._timestamp = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._messageId = wrapper.readInt();
this._errorCode = wrapper.readInt();
this._timestamp = wrapper.readString();
return true;
}
public get errorCode(): number
{
return this._errorCode;
}
public get messageId(): number
{
return this._messageId;
}
public get timestamp(): string
{
return this._timestamp;
}
}
@@ -0,0 +1,26 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class ElementPointerMessageParser implements IMessageParser
{
private _key: string;
public flush(): boolean
{
this._key = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._key = wrapper.readString();
return true;
}
public get key(): string
{
return this._key;
}
}
@@ -0,0 +1,27 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class HabboBroadcastMessageParser implements IMessageParser
{
private _message: string;
public flush(): boolean
{
this._message = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._message = wrapper.readString();
return true;
}
public get message(): string
{
return this._message;
}
}
@@ -0,0 +1,27 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class HotelWillShutdownParser implements IMessageParser
{
private _minutes: number;
public flush(): boolean
{
this._minutes = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._minutes = wrapper.readInt();
return true;
}
public get minutes(): number
{
return this._minutes;
}
}
@@ -0,0 +1,27 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class InfoFeedEnableMessageParser implements IMessageParser
{
private _enabled: boolean;
public flush(): boolean
{
this._enabled = false;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._enabled = wrapper.readBoolean();
return true;
}
public get enabled(): boolean
{
return this._enabled;
}
}
@@ -0,0 +1,34 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class MOTDNotificationParser implements IMessageParser
{
private _messages: string[];
public flush(): boolean
{
this._messages = [];
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
let totalMessages = wrapper.readInt();
while(totalMessages > 0)
{
this._messages.push(wrapper.readString());
totalMessages--;
}
return true;
}
public get messages(): string[]
{
return this._messages;
}
}
@@ -0,0 +1,43 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class NotificationDialogMessageParser implements IMessageParser
{
private _type: string;
private _parameters: Map<string, string>;
public flush(): boolean
{
this._type = null;
this._parameters = new Map();
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._type = wrapper.readString();
let totalParameters = wrapper.readInt();
while(totalParameters > 0)
{
this._parameters.set(wrapper.readString(), wrapper.readString());
totalParameters--;
}
return true;
}
public get type(): string
{
return this._type;
}
public get parameters(): Map<string, string>
{
return this._parameters;
}
}
@@ -0,0 +1,51 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class OfferRewardDeliveredMessageParser implements IMessageParser
{
private _contentType: string;
private _classId: number;
private _name: string;
private _description: string;
public flush(): boolean
{
this._contentType = null;
this._classId = 0;
this._name = null;
this._description = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._contentType = wrapper.readString();
this._classId = wrapper.readInt();
this._name = wrapper.readString();
this._description = wrapper.readString();
return true;
}
public get contentType(): string
{
return this._contentType;
}
public get classId(): number
{
return this._classId;
}
public get name(): string
{
return this._name;
}
public get description(): string
{
return this._description;
}
}
@@ -0,0 +1,52 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
import { PetFigureDataParser } from '../inventory';
export class PetLevelNotificationParser implements IMessageParser
{
private _petId: number;
private _petName: string;
private _level: number;
private _figureData: PetFigureDataParser;
public flush(): boolean
{
this._petId = -1;
this._petName = null;
this._level = 0;
this._figureData = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._petId = wrapper.readInt();
this._petName = wrapper.readString();
this._level = wrapper.readInt();
this._figureData = new PetFigureDataParser(wrapper);
return true;
}
public get petId(): number
{
return this._petId;
}
public get petName(): string
{
return this._petName;
}
public get level(): number
{
return this._level;
}
public get figureData(): PetFigureDataParser
{
return this._figureData;
}
}
@@ -0,0 +1,26 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class PetPlacingErrorEventParser implements IMessageParser
{
private _errorCode: number;
public flush(): boolean
{
this._errorCode = -1;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._errorCode = wrapper.readInt();
return true;
}
public get errorCode(): number
{
return this._errorCode;
}
}
@@ -0,0 +1,14 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class RestoreClientMessageParser implements IMessageParser
{
public flush(): boolean
{
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
return true;
}
}
@@ -0,0 +1,37 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class SimpleAlertMessageParser implements IMessageParser
{
private _alertMessage: string;
private _titleMessage: string;
public flush(): boolean
{
this._alertMessage = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._alertMessage = wrapper.readString();
if(wrapper.bytesAvailable)
{
this._titleMessage = wrapper.readString();
}
return true;
}
public get alertMessage(): string
{
return this._alertMessage;
}
public get titleMessage(): string
{
return this._titleMessage;
}
}
@@ -0,0 +1,52 @@
import { IAdvancedMap, IMessageDataWrapper, IMessageParser } from '@nitrots/api';
import { AdvancedMap } from '@nitrots/utils';
export class UnseenItemsParser implements IMessageParser
{
private _items: IAdvancedMap<number, number[]>;
public flush(): boolean
{
this._items = new AdvancedMap();
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
let totalUnseen = wrapper.readInt();
while(totalUnseen > 0)
{
const category = wrapper.readInt();
let totalItems = wrapper.readInt();
const itemIds: number[] = [];
while(totalItems > 0)
{
itemIds.push(wrapper.readInt());
totalItems--;
}
this._items.add(category, itemIds);
totalUnseen--;
}
return true;
}
public getItemsByCategory(category: number): number[]
{
return this._items.getValue(category);
}
public get categories(): number[]
{
return this._items.getKeys();
}
}
@@ -0,0 +1,18 @@
export * from './AchievementLevelUpData';
export * from './AchievementNotificationMessageParser';
export * from './ActivityPointNotificationParser';
export * from './BotErrorEventParser';
export * from './ClubGiftNotificationParser';
export * from './ConnectionErrorMessageParser';
export * from './ElementPointerMessageParser';
export * from './HabboBroadcastMessageParser';
export * from './HotelWillShutdownParser';
export * from './InfoFeedEnableMessageParser';
export * from './MOTDNotificationParser';
export * from './NotificationDialogMessageParser';
export * from './OfferRewardDeliveredMessageParser';
export * from './PetLevelNotificationParser';
export * from './PetPlacingErrorEventParser';
export * from './RestoreClientMessageParser';
export * from './SimpleAlertMessageParser';
export * from './UnseenItemsParser';