#9 - ConfirmBreedingRequestEvent added

This commit is contained in:
oobjectt 2022-12-24 02:22:32 +01:00
parent 473f3ab12c
commit 13b9047ab5
6 changed files with 56 additions and 20 deletions

View File

@ -1,4 +1,5 @@
import { IRoomSession } from '../../api'; import { IRoomSession } from '../../api';
import { BreedingPetInfo, RarityCategoryData } from '../../nitro';
import { RoomSessionEvent } from './RoomSessionEvent'; import { RoomSessionEvent } from './RoomSessionEvent';
export class RoomSessionConfirmPetBreedingEvent extends RoomSessionEvent export class RoomSessionConfirmPetBreedingEvent extends RoomSessionEvent
@ -6,25 +7,20 @@ export class RoomSessionConfirmPetBreedingEvent extends RoomSessionEvent
public static CONFIRM_PET_BREEDING: string = 'RSPFUE_CONFIRM_PET_BREEDING'; public static CONFIRM_PET_BREEDING: string = 'RSPFUE_CONFIRM_PET_BREEDING';
private _nestId: number; private _nestId: number;
private _pet1: any; private _pet1: BreedingPetInfo;
private _pet2: any; private _pet2: BreedingPetInfo;
private _rarityCategories: any[]; private _rarityCategories: RarityCategoryData[];
private _resultPetTypeId: number; private _resultPetTypeId: number;
constructor(k: IRoomSession, _arg_2: number, _arg_3: any, _arg_4: any, _arg_5: any[], _arg_6: number) constructor(session: IRoomSession, nestId: number, pet1: BreedingPetInfo, pet2: BreedingPetInfo, rarityCategories: RarityCategoryData[], resultPetTypeId: number)
{ {
super(RoomSessionConfirmPetBreedingEvent.CONFIRM_PET_BREEDING, k); super(RoomSessionConfirmPetBreedingEvent.CONFIRM_PET_BREEDING, session);
this._nestId = _arg_2; this._nestId = nestId;
this._pet1 = _arg_3; this._pet1 = pet1;
this._pet2 = _arg_4; this._pet2 = pet2;
this._rarityCategories = _arg_5; this._rarityCategories = rarityCategories;
this._resultPetTypeId = _arg_6; this._resultPetTypeId = resultPetTypeId;
}
public get rarityCategories(): any[]
{
return this._rarityCategories;
} }
public get nestId(): number public get nestId(): number
@ -32,16 +28,21 @@ export class RoomSessionConfirmPetBreedingEvent extends RoomSessionEvent
return this._nestId; return this._nestId;
} }
public get pet1(): any public get pet1(): BreedingPetInfo
{ {
return this._pet1; return this._pet1;
} }
public get pet2(): any public get pet2(): BreedingPetInfo
{ {
return this._pet2; return this._pet2;
} }
public get rarityCategories(): RarityCategoryData[]
{
return this._rarityCategories;
}
public get resultPetTypeId(): number public get resultPetTypeId(): number
{ {
return this._resultPetTypeId; return this._resultPetTypeId;

File diff suppressed because one or more lines are too long

View File

@ -124,6 +124,7 @@ export class IncomingHeader
public static PET_SCRATCH_FAILED = 1130; public static PET_SCRATCH_FAILED = 1130;
public static PET_OPEN_PACKAGE_REQUESTED = 2380; public static PET_OPEN_PACKAGE_REQUESTED = 2380;
public static PET_OPEN_PACKAGE_RESULT = 546; public static PET_OPEN_PACKAGE_RESULT = 546;
public static PET_CONFIRM_BREEDING_REQUEST = 634;
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 { ConfirmBreedingRequestParser } from '../../../parser';
export class ConfirmBreedingRequestEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, ConfirmBreedingRequestParser);
}
public getParser(): ConfirmBreedingRequestParser
{
return this.parser as ConfirmBreedingRequestParser;
}
}

View File

@ -1,3 +1,4 @@
export * from './ConfirmBreedingRequestEvent';
export * from './PetAddedToInventoryEvent'; export * from './PetAddedToInventoryEvent';
export * from './PetInventoryEvent'; export * from './PetInventoryEvent';
export * from './PetReceivedMessageEvent'; export * from './PetReceivedMessageEvent';

View File

@ -1,6 +1,6 @@
import { IConnection, IRoomHandlerListener, IRoomUserData } from '../../../api'; import { IConnection, IRoomHandlerListener, IRoomUserData } from '../../../api';
import { RoomSessionDanceEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionFavoriteGroupUpdateEvent, RoomSessionFriendRequestEvent, RoomSessionPetFigureUpdateEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPetLevelUpdateEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserBadgesEvent, RoomSessionUserDataUpdateEvent, RoomSessionUserFigureUpdateEvent } from '../../../events'; import { RoomSessionConfirmPetBreedingEvent, RoomSessionDanceEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionFavoriteGroupUpdateEvent, RoomSessionFriendRequestEvent, RoomSessionPetFigureUpdateEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPetLevelUpdateEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserBadgesEvent, RoomSessionUserDataUpdateEvent, RoomSessionUserFigureUpdateEvent } from '../../../events';
import { BotErrorEvent, DoorbellMessageEvent, FavoriteMembershipUpdateMessageEvent, NewFriendRequestEvent, PetFigureUpdateEvent, PetInfoEvent, PetLevelUpdateMessageEvent, PetPlacingErrorEvent, PetStatusUpdateEvent, RoomUnitDanceEvent, RoomUnitEvent, RoomUnitInfoEvent, RoomUnitRemoveEvent, UserCurrentBadgesEvent, UserNameChangeMessageEvent } from '../../communication'; import { BotErrorEvent, ConfirmBreedingRequestEvent, DoorbellMessageEvent, FavoriteMembershipUpdateMessageEvent, NewFriendRequestEvent, PetFigureUpdateEvent, PetInfoEvent, PetLevelUpdateMessageEvent, PetPlacingErrorEvent, PetStatusUpdateEvent, RoomUnitDanceEvent, RoomUnitEvent, RoomUnitInfoEvent, RoomUnitRemoveEvent, UserCurrentBadgesEvent, UserNameChangeMessageEvent } from '../../communication';
import { RoomPetData } from '../RoomPetData'; import { RoomPetData } from '../RoomPetData';
import { RoomUserData } from '../RoomUserData'; import { RoomUserData } from '../RoomUserData';
import { BaseHandler } from './BaseHandler'; import { BaseHandler } from './BaseHandler';
@ -22,6 +22,7 @@ export class RoomUsersHandler extends BaseHandler
connection.addMessageEvent(new PetInfoEvent(this.onPetInfoEvent.bind(this))); connection.addMessageEvent(new PetInfoEvent(this.onPetInfoEvent.bind(this)));
connection.addMessageEvent(new PetStatusUpdateEvent(this.onPetStatusUpdateEvent.bind(this))); connection.addMessageEvent(new PetStatusUpdateEvent(this.onPetStatusUpdateEvent.bind(this)));
connection.addMessageEvent(new PetLevelUpdateMessageEvent(this.onPetLevelUpdateMessageEvent.bind(this))); connection.addMessageEvent(new PetLevelUpdateMessageEvent(this.onPetLevelUpdateMessageEvent.bind(this)));
connection.addMessageEvent(new ConfirmBreedingRequestEvent(this.onConfirmBreedingRequestEvent.bind(this)));
connection.addMessageEvent(new PetFigureUpdateEvent(this.onPetFigureUpdateEvent.bind(this))); connection.addMessageEvent(new PetFigureUpdateEvent(this.onPetFigureUpdateEvent.bind(this)));
connection.addMessageEvent(new PetPlacingErrorEvent(this.onPetPlacingError.bind(this))); connection.addMessageEvent(new PetPlacingErrorEvent(this.onPetPlacingError.bind(this)));
connection.addMessageEvent(new BotErrorEvent(this.onBotError.bind(this))); connection.addMessageEvent(new BotErrorEvent(this.onBotError.bind(this)));
@ -272,6 +273,21 @@ export class RoomUsersHandler extends BaseHandler
this.listener.events.dispatchEvent(new RoomSessionPetLevelUpdateEvent(session, parser.petId, parser.level)); this.listener.events.dispatchEvent(new RoomSessionPetLevelUpdateEvent(session, parser.petId, parser.level));
} }
private onConfirmBreedingRequestEvent(event: ConfirmBreedingRequestEvent): void
{
if(!this.listener) return;
const parser = event.getParser();
if(!parser) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
this.listener.events.dispatchEvent(new RoomSessionConfirmPetBreedingEvent(session, parser.nestId, parser.pet1, parser.pet2, parser.rarityCategories, parser.resultPetType));
}
private onPetFigureUpdateEvent(event: PetFigureUpdateEvent): void private onPetFigureUpdateEvent(event: PetFigureUpdateEvent): void
{ {
if(!this.listener) return; if(!this.listener) return;