mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-31 11:12:35 +01:00
Add MysteryBoxKeysEvent
This commit is contained in:
parent
ec85047bd3
commit
3f025a030e
@ -1,5 +1,5 @@
|
||||
import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration';
|
||||
import { ApproveNameMessageComposer, CatalogApproveNameResultEvent, FurnitureGuildInfoComposer, PetMountComposer, PetSupplementComposer, RemovePetSaddleComposer, RoomUnitGiveHandItemPetComposer, RoomWidgetCameraPublishedEvent, RoomWidgetCameraPurchaseComposer, SellablePetPalettesEvent, TogglePetBreedingComposer, TogglePetRidingComposer, UsePetProductComposer } from './messages';
|
||||
import { ApproveNameMessageComposer, CatalogApproveNameResultEvent, FurnitureGuildInfoComposer, MysteryBoxKeysEvent, PetMountComposer, PetSupplementComposer, RemovePetSaddleComposer, RoomUnitGiveHandItemPetComposer, RoomWidgetCameraPublishedEvent, RoomWidgetCameraPurchaseComposer, SellablePetPalettesEvent, TogglePetBreedingComposer, TogglePetRidingComposer, UsePetProductComposer } from './messages';
|
||||
import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent';
|
||||
import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent';
|
||||
import { CatalogClubGiftsEvent } from './messages/incoming/catalog/CatalogClubGiftsEvent';
|
||||
@ -541,6 +541,9 @@ export class NitroMessages implements IMessageConfiguration
|
||||
this._events.set(IncomingHeader.MODTOOL_USER_CHATLOG, ModtoolUserChatlogEvent);
|
||||
this._events.set(IncomingHeader.MODTOOL_ROOM_CHATLOG, ModtoolRoomChatlogEvent);
|
||||
|
||||
// MYSTERY BOX
|
||||
this._events.set(IncomingHeader.MYSTERY_BOX_KEYS, MysteryBoxKeysEvent);
|
||||
|
||||
// NAVIGATOR
|
||||
this._events.set(IncomingHeader.NAVIGATOR_CATEGORIES, NavigatorCategoriesEvent);
|
||||
this._events.set(IncomingHeader.NAVIGATOR_COLLAPSED, NavigatorCollapsedEvent);
|
||||
|
@ -141,7 +141,7 @@ export class IncomingHeader
|
||||
public static ROOM_THICKNESS = 3547;
|
||||
public static SECURITY_DEBUG = 3284;
|
||||
public static SECURITY_MACHINE = 1488;
|
||||
public static SECURITY_UNKNOWN2 = 2833;
|
||||
public static MYSTERY_BOX_KEYS = 2833;
|
||||
public static TRADE_ACCEPTED = 2568;
|
||||
public static TRADE_CLOSED = 1373;
|
||||
public static TRADE_COMPLETED = 1001;
|
||||
|
@ -24,6 +24,7 @@ export * from './inventory/pets';
|
||||
export * from './inventory/trading';
|
||||
export * from './moderation';
|
||||
export * from './modtool';
|
||||
export * from './mysterybox';
|
||||
export * from './navigator';
|
||||
export * from './notifications';
|
||||
export * from './room';
|
||||
|
@ -0,0 +1,16 @@
|
||||
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
|
||||
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
|
||||
import { MysteryBoxKeysParser } from '../../parser';
|
||||
|
||||
export class MysteryBoxKeysEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, MysteryBoxKeysParser);
|
||||
}
|
||||
|
||||
public getParser(): MysteryBoxKeysParser
|
||||
{
|
||||
return this.parser as MysteryBoxKeysParser;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
export * from './MysteryBoxKeysEvent';
|
@ -11,6 +11,7 @@ export * from './help';
|
||||
export * from './inventory';
|
||||
export * from './moderation';
|
||||
export * from './modtool';
|
||||
export * from './mysterybox';
|
||||
export * from './navigator';
|
||||
export * from './notifications';
|
||||
export * from './room';
|
||||
|
@ -0,0 +1,36 @@
|
||||
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
|
||||
|
||||
export class MysteryBoxKeysParser implements IMessageParser
|
||||
{
|
||||
private _boxColor: string;
|
||||
private _keyColor: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._boxColor = null;
|
||||
this._keyColor = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._boxColor = wrapper.readString();
|
||||
this._keyColor = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get boxColor(): string
|
||||
{
|
||||
return this._boxColor;
|
||||
}
|
||||
|
||||
public get keyColor(): string
|
||||
{
|
||||
return this._keyColor;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
export * from './MysteryBoxKeysParser';
|
@ -2,6 +2,7 @@ import { Texture } from 'pixi.js';
|
||||
import { NitroManager } from '../../core/common/NitroManager';
|
||||
import { IMessageComposer } from '../../core/communication/messages/IMessageComposer';
|
||||
import { NitroEvent } from '../../core/events/NitroEvent';
|
||||
import { MysteryBoxKeysEvent } from '../communication';
|
||||
import { INitroCommunicationManager } from '../communication/INitroCommunicationManager';
|
||||
import { AvailabilityStatusMessageEvent } from '../communication/messages/incoming/availability/AvailabilityStatusMessageEvent';
|
||||
import { ChangeUserNameResultMessageEvent } from '../communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent';
|
||||
@ -20,6 +21,7 @@ import { Nitro } from '../Nitro';
|
||||
import { HabboWebTools } from '../utils/HabboWebTools';
|
||||
import { BadgeImageManager } from './BadgeImageManager';
|
||||
import { SecurityLevel } from './enum/SecurityLevel';
|
||||
import { MysteryBoxKeysUpdateEvent } from './events';
|
||||
import { SessionDataPreferencesEvent } from './events/SessionDataPreferencesEvent';
|
||||
import { UserNameUpdateEvent } from './events/UserNameUpdateEvent';
|
||||
import { FurnitureDataLoader } from './furniture/FurnitureDataLoader';
|
||||
@ -127,6 +129,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
|
||||
this._communication.registerMessageEvent(new UserNameChangeMessageEvent(this.onUserNameChangeMessageEvent.bind(this)));
|
||||
this._communication.registerMessageEvent(new RoomModelNameEvent(this.onRoomModelNameEvent.bind(this)));
|
||||
this._communication.registerMessageEvent(new InClientLinkEvent(this.onInClientLinkEvent.bind(this)));
|
||||
this._communication.registerMessageEvent(new MysteryBoxKeysEvent(this.onMysteryBoxKeysEvent.bind(this)));
|
||||
|
||||
Nitro.instance.events.addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onNitroSettingsEvent);
|
||||
}
|
||||
@ -372,6 +375,17 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
|
||||
Nitro.instance.createLinkEvent(parser.link);
|
||||
}
|
||||
|
||||
private onMysteryBoxKeysEvent(event: MysteryBoxKeysEvent): void
|
||||
{
|
||||
if(!event) return;
|
||||
|
||||
const parser = event.getParser();
|
||||
|
||||
if(!parser) return;
|
||||
|
||||
this.events.dispatchEvent(new MysteryBoxKeysUpdateEvent(parser.boxColor, parser.keyColor));
|
||||
}
|
||||
|
||||
private onNitroSettingsEvent(event: NitroSettingsEvent): void
|
||||
{
|
||||
this._isRoomCameraFollowDisabled = event.cameraFollow;
|
||||
|
@ -7,12 +7,12 @@ export class MysteryBoxKeysUpdateEvent extends NitroEvent
|
||||
private _boxColor: string;
|
||||
private _keyColor: string;
|
||||
|
||||
constructor(k: string, _arg_2: string)
|
||||
constructor(boxColor: string, keyColor: string)
|
||||
{
|
||||
super(MysteryBoxKeysUpdateEvent.MYSTERY_BOX_KEYS_UPDATE);
|
||||
|
||||
this._boxColor = k;
|
||||
this._keyColor = _arg_2;
|
||||
this._boxColor = boxColor;
|
||||
this._keyColor = keyColor;
|
||||
}
|
||||
|
||||
public get boxColor(): string
|
||||
|
Loading…
x
Reference in New Issue
Block a user