#9 - PetScratchFailedEvent added

This commit is contained in:
oobjectt 2022-12-23 21:12:13 +01:00
parent c9307102f6
commit 7b89ab9d9f
7 changed files with 63 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -120,6 +120,7 @@ export class IncomingHeader
public static PET_FIGURE_UPDATE = 1924; public static PET_FIGURE_UPDATE = 1924;
public static PET_INFO = 2901; public static PET_INFO = 2901;
public static PET_TRAINING_PANEL = 1164; public static PET_TRAINING_PANEL = 1164;
public static PET_SCRATCH_FAILED = 1130;
public static RECYCLER_PRIZES = 3164; public static RECYCLER_PRIZES = 3164;
public static ROOM_BAN_LIST = 1869; public static ROOM_BAN_LIST = 1869;
public static ROOM_BAN_REMOVE = 3429; public static ROOM_BAN_REMOVE = 3429;

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../events';
import { PetScratchFailedMessageParser } from './../../parser';
export class PetScratchFailedMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, PetScratchFailedMessageParser);
}
public getParser(): PetScratchFailedMessageParser
{
return this.parser as PetScratchFailedMessageParser;
}
}

View File

@ -1 +1,2 @@
export * from './PetScratchFailedMessageEvent';
export * from './PetTrainingPanelMessageEvent'; export * from './PetTrainingPanelMessageEvent';

View File

@ -0,0 +1,33 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
export class PetScratchFailedMessageParser implements IMessageParser
{
private _currentAge: number;
private _requiredAge: number;
flush(): boolean
{
this._currentAge = -1;
this._requiredAge = -1;
return true;
}
parse(wrapper: IMessageDataWrapper): boolean
{
this._currentAge = wrapper.readInt();
this._requiredAge = wrapper.readInt();
return true;
}
public get currentAge(): number
{
return this._currentAge;
}
public get requiredAge(): number
{
return this._requiredAge;
}
}

View File

@ -1 +1,2 @@
export * from './PetScratchFailedMessageParser';
export * from './PetTrainingMessageParser'; export * from './PetTrainingMessageParser';

View File

@ -2,7 +2,7 @@ import { Resource, Texture } from '@pixi/core';
import { GetAssetManager, IFurnitureData, IFurnitureDataListener, IGroupInformationManager, IMessageComposer, INitroCommunicationManager, INitroEvent, IProductData, IProductDataListener, ISessionDataManager, NitroConfiguration, NoobnessLevelEnum, SecurityLevel } from '../../api'; import { GetAssetManager, IFurnitureData, IFurnitureDataListener, IGroupInformationManager, IMessageComposer, INitroCommunicationManager, INitroEvent, IProductData, IProductDataListener, ISessionDataManager, NitroConfiguration, NoobnessLevelEnum, SecurityLevel } from '../../api';
import { NitroManager } from '../../core'; import { NitroManager } from '../../core';
import { MysteryBoxKeysUpdateEvent, NitroSettingsEvent, SessionDataPreferencesEvent, UserNameUpdateEvent } from '../../events'; import { MysteryBoxKeysUpdateEvent, NitroSettingsEvent, SessionDataPreferencesEvent, UserNameUpdateEvent } from '../../events';
import { AvailabilityStatusMessageEvent, ChangeUserNameResultMessageEvent, FigureUpdateEvent, GetUserTagsComposer, InClientLinkEvent, MysteryBoxKeysEvent, NoobnessLevelMessageEvent, PetRespectComposer, RoomReadyMessageEvent, RoomUnitChatComposer, UserInfoEvent, UserNameChangeMessageEvent, UserPermissionsEvent, UserRespectComposer, UserTagsMessageEvent } from '../communication'; import { AvailabilityStatusMessageEvent, ChangeUserNameResultMessageEvent, FigureUpdateEvent, GetUserTagsComposer, InClientLinkEvent, MysteryBoxKeysEvent, NoobnessLevelMessageEvent, PetRespectComposer, PetScratchFailedMessageEvent, RoomReadyMessageEvent, RoomUnitChatComposer, UserInfoEvent, UserNameChangeMessageEvent, UserPermissionsEvent, UserRespectComposer, UserTagsMessageEvent } from '../communication';
import { Nitro } from '../Nitro'; import { Nitro } from '../Nitro';
import { HabboWebTools } from '../utils/HabboWebTools'; import { HabboWebTools } from '../utils/HabboWebTools';
import { BadgeImageManager } from './badge/BadgeImageManager'; import { BadgeImageManager } from './badge/BadgeImageManager';
@ -108,6 +108,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this._communication.registerMessageEvent(new UserInfoEvent(this.onUserInfoEvent.bind(this))); this._communication.registerMessageEvent(new UserInfoEvent(this.onUserInfoEvent.bind(this)));
this._communication.registerMessageEvent(new UserPermissionsEvent(this.onUserPermissionsEvent.bind(this))); this._communication.registerMessageEvent(new UserPermissionsEvent(this.onUserPermissionsEvent.bind(this)));
this._communication.registerMessageEvent(new AvailabilityStatusMessageEvent(this.onAvailabilityStatusMessageEvent.bind(this))); this._communication.registerMessageEvent(new AvailabilityStatusMessageEvent(this.onAvailabilityStatusMessageEvent.bind(this)));
this._communication.registerMessageEvent(new PetScratchFailedMessageEvent(this.onPetRespectFailed.bind(this)));
this._communication.registerMessageEvent(new ChangeUserNameResultMessageEvent(this.onChangeNameUpdateEvent.bind(this))); this._communication.registerMessageEvent(new ChangeUserNameResultMessageEvent(this.onChangeNameUpdateEvent.bind(this)));
this._communication.registerMessageEvent(new UserNameChangeMessageEvent(this.onUserNameChangeMessageEvent.bind(this))); this._communication.registerMessageEvent(new UserNameChangeMessageEvent(this.onUserNameChangeMessageEvent.bind(this)));
this._communication.registerMessageEvent(new UserTagsMessageEvent(this.onUserTags.bind(this))); this._communication.registerMessageEvent(new UserTagsMessageEvent(this.onUserTags.bind(this)));
@ -285,6 +286,13 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
this._isAuthenticHabbo = parser.isAuthenticUser; this._isAuthenticHabbo = parser.isAuthenticUser;
} }
private onPetRespectFailed(event: PetScratchFailedMessageEvent): void
{
if(!event || !event.connection) return;
this._respectsPetLeft++;
}
private onChangeNameUpdateEvent(event: ChangeUserNameResultMessageEvent): void private onChangeNameUpdateEvent(event: ChangeUserNameResultMessageEvent): void
{ {
if(!event || !event.connection) return; if(!event || !event.connection) return;