Add incoming competition

This commit is contained in:
Bill 2021-08-26 00:07:33 -04:00
parent 08ed11f2d3
commit da733cdaa0
18 changed files with 395 additions and 8 deletions

View File

@ -11,6 +11,12 @@ import { ThumbnailStatusMessageEvent } from './messages/incoming/camera/Thumbnai
import { CampaignCalendarDataMessageEvent, CampaignCalendarDoorOpenedMessageEvent } from './messages/incoming/campaign';
import { CatalogPageExpirationEvent, CatalogPageMessageEvent, CatalogPagesListEvent, CatalogPageWithEarliestExpiryMessageEvent, CatalogPublishedMessageEvent, ClubGiftInfoEvent, ClubGiftSelectedEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, VoucherRedeemErrorMessageEvent, VoucherRedeemOkMessageEvent } from './messages/incoming/catalog';
import { ClientPingEvent } from './messages/incoming/client/ClientPingEvent';
import { CompetitionEntrySubmitResultEvent } from './messages/incoming/competition/CompetitionEntrySubmitResultEvent';
import { CompetitionVotingInfoMessageEvent } from './messages/incoming/competition/CompetitionVotingInfoMessageEvent';
import { CurrentTimingCodeMessageEvent } from './messages/incoming/competition/CurrentTimingCodeMessageEvent';
import { IsUserPartOfCompetitionMessageEvent } from './messages/incoming/competition/IsUserPartOfCompetitionMessageEvent';
import { NoOwnedRoomsAlertMessageEvent } from './messages/incoming/competition/NoOwnedRoomsAlertMessageEvent';
import { SecondsUntilMessageEvent } from './messages/incoming/competition/SecondsUntilMessageEvent';
import { CraftableProductsEvent } from './messages/incoming/crafting/CraftableProductsEvent';
import { CraftingRecipeEvent } from './messages/incoming/crafting/CraftingRecipeEvent';
import { CraftingRecipesAvailableEvent } from './messages/incoming/crafting/CraftingRecipesAvailableEvent';
@ -486,6 +492,14 @@ export class NitroMessages implements IMessageConfiguration
this._events.set(IncomingHeader.CFH_TOPICS, CfhTopicsInitEvent);
this._events.set(IncomingHeader.CFH_SANCTION_STATUS, SanctionStatusEvent);
// CAMERA
this._events.set(IncomingHeader.CAMERA_PUBLISH_STATUS, CameraPublishStatusMessageEvent);
this._events.set(IncomingHeader.CAMERA_PURCHASE_OK, CameraPurchaseOKMessageEvent);
this._events.set(IncomingHeader.CAMERA_STORAGE_URL, CameraStorageUrlMessageEvent);
this._events.set(IncomingHeader.COMPETITION_STATUS, CompetitionStatusMessageEvent);
this._events.set(IncomingHeader.INIT_CAMERA, InitCameraMessageEvent);
this._events.set(IncomingHeader.THUMBNAIL_STATUS, ThumbnailStatusMessageEvent);
// CAMPAIGN
this._events.set(IncomingHeader.CAMPAIGN_CALENDAR_DATA, CampaignCalendarDataMessageEvent);
this._events.set(IncomingHeader.CAMPAIGN_CALENDAR_DOOR_OPENED, CampaignCalendarDoorOpenedMessageEvent);
@ -527,6 +541,14 @@ export class NitroMessages implements IMessageConfiguration
this._events.set(IncomingHeader.GROUP_LIST, GuildMembershipsMessageEvent);
this._events.set(IncomingHeader.CATALOG_APPROVE_NAME_RESULT, ApproveNameMessageEvent);
// COMPETITION
this._events.set(IncomingHeader.COMPETITION_ENTRY_SUBMIT, CompetitionEntrySubmitResultEvent);
this._events.set(IncomingHeader.COMPETITION_VOTING_INFO, CompetitionVotingInfoMessageEvent);
this._events.set(IncomingHeader.COMPETITION_TIMING_CODE, CurrentTimingCodeMessageEvent);
this._events.set(IncomingHeader.COMPETITION_USER_PART_OF, IsUserPartOfCompetitionMessageEvent);
this._events.set(IncomingHeader.COMPETITION_NO_OWNED_ROOMS, NoOwnedRoomsAlertMessageEvent);
this._events.set(IncomingHeader.COMPETITION_SECONDS_UNTIL, SecondsUntilMessageEvent);
// CLIENT
this._events.set(IncomingHeader.CLIENT_PING, ClientPingEvent);
@ -834,14 +856,6 @@ export class NitroMessages implements IMessageConfiguration
this._events.set(IncomingHeader.CRAFTING_RECIPES_AVAILABLE, CraftingRecipesAvailableEvent);
this._events.set(IncomingHeader.CRAFTING_RESULT, CraftingResultEvent);
// CAMERA
this._events.set(IncomingHeader.CAMERA_PUBLISH_STATUS, CameraPublishStatusMessageEvent);
this._events.set(IncomingHeader.CAMERA_PURCHASE_OK, CameraPurchaseOKMessageEvent);
this._events.set(IncomingHeader.CAMERA_STORAGE_URL, CameraStorageUrlMessageEvent);
this._events.set(IncomingHeader.COMPETITION_STATUS, CompetitionStatusMessageEvent);
this._events.set(IncomingHeader.INIT_CAMERA, InitCameraMessageEvent);
this._events.set(IncomingHeader.THUMBNAIL_STATUS, ThumbnailStatusMessageEvent);
// SOUNDS
this._events.set(IncomingHeader.JUKEBOX_PLAYLIST_FULL, JukeboxPlayListFullMessageEvent);
this._events.set(IncomingHeader.JUKEBOX_SONG_DISKS, JukeboxSongDisksMessageEvent);

View File

@ -307,4 +307,10 @@ export class IncomingHeader
public static IS_OFFER_GIFTABLE = 761;
public static CLUB_EXTENDED_OFFER = 3964;
public static SEASONAL_CALENDAR_OFFER = 1889;
public static COMPETITION_ENTRY_SUBMIT = 1177;
public static COMPETITION_VOTING_INFO = 3506;
public static COMPETITION_TIMING_CODE = 1745;
public static COMPETITION_USER_PART_OF = 3841;
public static COMPETITION_NO_OWNED_ROOMS = 2064;
public static COMPETITION_SECONDS_UNTIL = 3926;
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CompetitionEntrySubmitResultMessageParser } from '../../parser';
export class CompetitionEntrySubmitResultEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, CompetitionEntrySubmitResultMessageParser);
}
public getParser(): CompetitionEntrySubmitResultMessageParser
{
return this.parser as CompetitionEntrySubmitResultMessageParser;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CompetitionVotingInfoMessageParser } from '../../parser';
export class CompetitionVotingInfoMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, CompetitionVotingInfoMessageParser);
}
public getParser(): CompetitionVotingInfoMessageParser
{
return this.parser as CompetitionVotingInfoMessageParser;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CurrentTimingCodeMessageParser } from '../../parser';
export class CurrentTimingCodeMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, CurrentTimingCodeMessageParser);
}
public getParser(): CurrentTimingCodeMessageParser
{
return this.parser as CurrentTimingCodeMessageParser;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { IsUserPartOfCompetitionMessageParser } from '../../parser';
export class IsUserPartOfCompetitionMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, IsUserPartOfCompetitionMessageParser);
}
public getParser(): IsUserPartOfCompetitionMessageParser
{
return this.parser as IsUserPartOfCompetitionMessageParser;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { NoOwnedRoomsAlertMessageParser } from '../../parser';
export class NoOwnedRoomsAlertMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, NoOwnedRoomsAlertMessageParser);
}
public getParser(): NoOwnedRoomsAlertMessageParser
{
return this.parser as NoOwnedRoomsAlertMessageParser;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { SecondsUntilMessageParser } from '../../parser';
export class SecondsUntilMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, SecondsUntilMessageParser);
}
public getParser(): SecondsUntilMessageParser
{
return this.parser as SecondsUntilMessageParser;
}
}

View File

@ -0,0 +1,6 @@
export * from './CompetitionEntrySubmitResultEvent';
export * from './CompetitionVotingInfoMessageEvent';
export * from './CurrentTimingCodeMessageEvent';
export * from './IsUserPartOfCompetitionMessageEvent';
export * from './NoOwnedRoomsAlertMessageEvent';
export * from './SecondsUntilMessageEvent';

View File

@ -0,0 +1,83 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class CompetitionEntrySubmitResultMessageParser implements IMessageParser
{
public static SUBMITTED: number = 0;
public static ASK_FOR_SUBMIT: number = 1;
public static ASK_FOR_CONFIRM: number = 2;
public static PREREQUISITES_NOT_MET: number = 3;
public static ROOM_DOOR_NOT_OPEN: number = 4;
public static ROOM_TOO_OLD: number = 5;
public static ASK_FOR_ACCEPT_RULES: number = 6;
private _goalId: number;
private _goalCode: string;
private _result: number;
private _requiredFurnis: string[];
private _missingFurnis: { [index: string]: string };
public flush(): boolean
{
this._goalId = 0;
this._goalCode = null;
this._result = 0;
this._requiredFurnis = null;
this._missingFurnis = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
this._goalId = wrapper.readInt();
this._goalCode = wrapper.readString();
this._result = wrapper.readInt();
this._requiredFurnis = [];
let count = wrapper.readInt();
while(count > 0)
{
this._requiredFurnis.push(wrapper.readString());
count--;
}
count = wrapper.readInt();
while(count > 0)
{
this._missingFurnis[wrapper.readString()] = '';
count--;
}
return true;
}
public get goalId(): number
{
return this._goalId;
}
public get goalCode(): string
{
return this._goalCode;
}
public get result(): number
{
return this._result;
}
public get requiredFurnis(): string[]
{
return this._requiredFurnis;
}
public isMissing(name: string): boolean
{
return !!this._missingFurnis[name];
}
}

View File

@ -0,0 +1,55 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
import { CompetitionVotingInfoResult } from './CompetitionVotingInfoResult';
export class CompetitionVotingInfoMessageParser implements IMessageParser
{
private _goalId: number;
private _goalCode: string;
private _resultCode: number;
private _votesRemaining: number;
public flush(): boolean
{
this._goalId = 0;
this._goalCode = null;
this._resultCode = 0;
this._votesRemaining = 0;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
this._goalId = wrapper.readInt();
this._goalCode = wrapper.readString();
this._resultCode = wrapper.readInt();
this._votesRemaining = wrapper.readInt();
return true;
}
public get goalId(): number
{
return this._goalId;
}
public get goalCode(): string
{
return this._goalCode;
}
public get isVotingAllowedForUser(): boolean
{
return (this._resultCode === CompetitionVotingInfoResult.ALLOWED);
}
public get votesRemaining(): number
{
return this._votesRemaining;
}
public get resultCode(): number
{
return this._resultCode;
}
}

View File

@ -0,0 +1,6 @@
export class CompetitionVotingInfoResult
{
public static ALLOWED: number = 0;
public static REQUIRED_PERK_MISSING: number = 1;
public static REQUIRED_BADGE_MISSING: number = 2;
}

View File

@ -0,0 +1,33 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class CurrentTimingCodeMessageParser implements IMessageParser
{
private _schedulingStr: string;
private _code: string;
public flush(): boolean
{
this._schedulingStr = null;
this._code = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
this._schedulingStr = wrapper.readString();
this._code = wrapper.readString();
return true;
}
public get schedulingStr(): string
{
return this._schedulingStr;
}
public get code(): string
{
return this._code;
}
}

View File

@ -0,0 +1,33 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class IsUserPartOfCompetitionMessageParser implements IMessageParser
{
private _Str_8579: boolean;
private _Str_6987: number;
public flush(): boolean
{
this._Str_8579 = false;
this._Str_6987 = 0;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
this._Str_8579 = wrapper.readBoolean();
this._Str_6987 = wrapper.readInt();
return true;
}
public get _Str_25348(): boolean
{
return this._Str_8579;
}
public get _Str_10760(): number
{
return this._Str_6987;
}
}

View File

@ -0,0 +1,14 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class NoOwnedRoomsAlertMessageParser implements IMessageParser
{
public flush(): boolean
{
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
return true;
}
}

View File

@ -0,0 +1,33 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class SecondsUntilMessageParser implements IMessageParser
{
private _Str_8997: string;
private _Str_21095: number;
public flush(): boolean
{
this._Str_8997 = null;
this._Str_21095 = 0;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
this._Str_8997 = wrapper.readString();
this._Str_21095 = wrapper.readInt();
return true;
}
public get _Str_23288(): string
{
return this._Str_8997;
}
public get _Str_25497(): number
{
return this._Str_21095;
}
}

View File

@ -0,0 +1,7 @@
export * from './CompetitionEntrySubmitResultMessageParser';
export * from './CompetitionVotingInfoMessageParser';
export * from './CompetitionVotingInfoResult';
export * from './CurrentTimingCodeMessageParser';
export * from './IsUserPartOfCompetitionMessageParser';
export * from './NoOwnedRoomsAlertMessageParser';
export * from './SecondsUntilMessageParser';

View File

@ -4,6 +4,7 @@ export * from './avatar';
export * from './camera';
export * from './catalog';
export * from './client';
export * from './competition';
export * from './desktop';
export * from './friendlist';
export * from './game';