Merge branch 'fix/variable-cleanup' of https://git.krews.org/nitro/nitro-renderer into fix/variable-cleanup

This commit is contained in:
Bill 2021-07-24 23:26:58 -04:00
commit 5d4aeec1ab
9 changed files with 96 additions and 1 deletions

View File

@ -1,5 +1,5 @@
import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration';
import { ApproveNameMessageComposer, BadgeReceivedEvent, CatalogApproveNameResultEvent, ChangeUserNameResultMessageEvent, FurnitureGuildInfoComposer, MysteryBoxKeysEvent, PetExperienceEvent, PetMountComposer, PetSupplementComposer, RemovePetSaddleComposer, RoomUnitGiveHandItemPetComposer, RoomWidgetCameraPublishedEvent, RoomWidgetCameraPurchaseComposer, SellablePetPalettesEvent, TogglePetBreedingComposer, TogglePetRidingComposer, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer } from './messages';
import { ApproveNameMessageComposer, BadgeReceivedEvent, BonusRareInfoMessageEvent, CatalogApproveNameResultEvent, ChangeUserNameResultMessageEvent, FurnitureGuildInfoComposer, GetBonusRareInfoMessageComposer, MysteryBoxKeysEvent, PetExperienceEvent, PetMountComposer, PetSupplementComposer, RemovePetSaddleComposer, RoomUnitGiveHandItemPetComposer, RoomWidgetCameraPublishedEvent, RoomWidgetCameraPurchaseComposer, SellablePetPalettesEvent, TogglePetBreedingComposer, TogglePetRidingComposer, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer } from './messages';
import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent';
import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent';
import { CatalogClubGiftsEvent } from './messages/incoming/catalog/CatalogClubGiftsEvent';
@ -487,6 +487,7 @@ export class NitroMessages implements IMessageConfiguration
this._events.set(IncomingHeader.REDEEM_VOUCHER_OK, CatalogRedeemVoucherOkEvent);
this._events.set(IncomingHeader.CATALOG_RECEIVE_PET_BREEDS, SellablePetPalettesEvent);
this._events.set(IncomingHeader.CATALOG_APPROVE_NAME_RESULT, CatalogApproveNameResultEvent);
this._events.set(IncomingHeader.BONUS_RARE_INFO, BonusRareInfoMessageEvent);
// CAMERA
this._events.set(IncomingHeader.CAMERA_PRICE, RoomWidgetCameraConfigurationEvent);
@ -815,6 +816,7 @@ export class NitroMessages implements IMessageConfiguration
this._composers.set(OutgoingHeader.GIFT_CONFIG, CatalogRequestGiftConfigurationComposer);
this._composers.set(OutgoingHeader.CATALOG_SELECT_VIP_GIFT, CatalogSelectClubGiftComposer);
this._composers.set(OutgoingHeader.CATALOG_REQUESET_PET_BREEDS, CatalogRequestPetBreedsComposer);
this._composers.set(OutgoingHeader.GET_BONUS_RARE_INFO, GetBonusRareInfoMessageComposer);
// CAMERA
this._composers.set(OutgoingHeader.CAMERA_PRICE, RoomWidgetCameraConfigurationComposer);
@ -1114,6 +1116,7 @@ export class NitroMessages implements IMessageConfiguration
this._composers.set(OutgoingHeader.COMMUNITY_GOAL_VOTE_COMPOSER, CommunityGoalVoteMessageComposer);
this._composers.set(OutgoingHeader.GET_PROMO_ARTICLES, GetPromoArticlesComposer);
// QUEST
this._composers.set(OutgoingHeader.ACCEPT_QUEST, AcceptQuestMessageComposer);
this._composers.set(OutgoingHeader.ACTIVATE_QUEST, ActivateQuestMessageComposer);
this._composers.set(OutgoingHeader.CANCEL_QUEST, CancelQuestMessageComposer);

View File

@ -265,4 +265,5 @@ export class IncomingHeader
public static SEASONAL_QUESTS = 1122;
public static QUESTS = 3625;
public static QUEST = 230;
public static BONUS_RARE_INFO = 1533;
}

View File

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

View File

@ -1,3 +1,4 @@
export * from './BonusRareInfoMessageEvent';
export * from './CatalogApproveNameResultEvent';
export * from './CatalogClubEvent';
export * from './CatalogClubGiftsEvent';

View File

@ -264,4 +264,5 @@ export class OutgoingHeader
public static REDEEM_COMMUNITY_GOAL_PRIZE = 90;
public static REJECT_QUEST = 2397;
public static START_CAMPAIGN = 1697;
public static GET_BONUS_RARE_INFO = 957;
}

View File

@ -0,0 +1,21 @@
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
export class GetBonusRareInfoMessageComposer implements IMessageComposer<ConstructorParameters<typeof GetBonusRareInfoMessageComposer>>
{
private _data: ConstructorParameters<typeof GetBonusRareInfoMessageComposer>;
constructor()
{
this._data = [];
}
public getMessageArray()
{
return this._data;
}
public dispose(): void
{
return;
}
}

View File

@ -9,6 +9,7 @@ export * from './CatalogRequestVipGiftsComposer';
export * from './CatalogRequestVipOffersComposer';
export * from './CatalogSearchComposer';
export * from './CatalogSelectClubGiftComposer';
export * from './GetBonusRareInfoMessageComposer';
export * from './marketplace';
export * from './RedeemItemClothingComposer';
export * from './RedeemVoucherComposer';

View File

@ -0,0 +1,50 @@
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from './../../../../../core/communication/messages/IMessageParser';
export class BonusRareInfoMessageParser implements IMessageParser
{
private _productType: string;
private _productClassId: number;
private _totalCoinsForBonus: number;
private _coinsStillRequiredToBuy: number;
public flush(): boolean
{
this._totalCoinsForBonus = -1;
this._coinsStillRequiredToBuy = -1;
this._productType = '';
this._productClassId = -1;
return true;
}
public parse(wrapper:IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._productType = wrapper.readString();
this._productClassId = wrapper.readInt();
this._totalCoinsForBonus = wrapper.readInt();
this._coinsStillRequiredToBuy = wrapper.readInt();
return true;
}
public get totalCoinsForBonus(): number
{
return this._totalCoinsForBonus;
}
public get coinsStillRequiredToBuy(): number
{
return this._coinsStillRequiredToBuy;
}
public get productType(): string
{
return this._productType;
}
public get productClassId(): number
{
return this._productClassId;
}
}

View File

@ -1,3 +1,4 @@
export * from './BonusRareInfoMessageParser';
export * from './CatalogApproveNameResultParser';
export * from './CatalogClubParser';
export * from './CatalogGiftConfigurationParser';