Merge branch 'incoming-pet-breeding-resultt' of https://github.com/oobjectt/nitro-renderer into oobjectt-incoming-pet-breeding-resultt

This commit is contained in:
dank074 2023-01-04 00:33:08 -06:00
commit fcfd69cc86
9 changed files with 87 additions and 16 deletions

View File

@ -8,12 +8,12 @@ export class RoomSessionPetBreedingResultEvent extends RoomSessionEvent
private _resultData: IPetBreedingResultData;
private _otherResultData: IPetBreedingResultData;
constructor(k: IRoomSession, _arg_2: IPetBreedingResultData, _arg_3: IPetBreedingResultData)
constructor(session: IRoomSession, resultData: IPetBreedingResultData, otherResultData: IPetBreedingResultData)
{
super(RoomSessionPetBreedingResultEvent.PET_BREEDING_RESULT, k);
super(RoomSessionPetBreedingResultEvent.PET_BREEDING_RESULT, session);
this._resultData = _arg_2;
this._otherResultData = _arg_3;
this._resultData = resultData;
this._otherResultData = otherResultData;
}
public get resultData(): IPetBreedingResultData

File diff suppressed because one or more lines are too long

View File

@ -135,6 +135,7 @@ export class IncomingHeader
public static PET_GO_TO_BREEDING_NEST_FAILURE = 2621;
public static PET_NEST_BREEDING_SUCCESS = 2527;
public static PET_CONFIRM_BREEDING_REQUEST = 634;
public static PET_BREEDING_RESULT = 1553;
public static RECYCLER_PRIZES = 3164;
public static RECYCLER_STATUS = 3433;
public static RECYCLER_FINISHED = 468;

View File

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

View File

@ -1,3 +1,4 @@
export * from './PetBreedingResultEvent';
export * from './PetExperienceEvent';
export * from './PetFigureUpdateEvent';
export * from './PetInfoEvent';

View File

@ -1,4 +1,4 @@
import { IPetBreedingResultData } from '../../../../../../api';
import { IMessageDataWrapper, IPetBreedingResultData } from '../../../../../../api';
export class PetBreedingResultData implements IPetBreedingResultData
{
@ -10,15 +10,15 @@ export class PetBreedingResultData implements IPetBreedingResultData
private _rarityLevel: number;
private _hasMutation: boolean;
constructor(stuffId: number, classId: number, productCode: string, userId: number, userName: string, rarityLevel: number, hasMutation: boolean)
constructor(wrapper: IMessageDataWrapper)
{
this._stuffId = stuffId;
this._classId = classId;
this._productCode = productCode;
this._userId = userId;
this._userName = userName;
this._rarityLevel = rarityLevel;
this._hasMutation = hasMutation;
this._stuffId = wrapper.readInt();
this._classId = wrapper.readInt();
this._productCode = wrapper.readString();
this._userId = wrapper.readInt();
this._userName = wrapper.readString();
this._rarityLevel = wrapper.readInt();
this._hasMutation = wrapper.readBoolean();
}
public get stuffId(): number

View File

@ -0,0 +1,35 @@
import { PetBreedingResultData } from '.';
import { IMessageDataWrapper, IMessageParser } from '../../../../../../api';
export class PetBreedingResultParser implements IMessageParser
{
private _resultData: PetBreedingResultData;
private _otherResultData: PetBreedingResultData;
public flush(): boolean
{
this._resultData = null;
this._otherResultData = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._resultData = new PetBreedingResultData(wrapper);
this._otherResultData = new PetBreedingResultData(wrapper);
return true;
}
public get resultData(): PetBreedingResultData
{
return this._resultData;
}
public get otherResultData(): PetBreedingResultData
{
return this._otherResultData;
}
}

View File

@ -1,5 +1,6 @@
export * from './BreedingPetInfo';
export * from './PetBreedingResultData';
export * from './PetBreedingResultParser';
export * from './PetExperienceParser';
export * from './PetFigureUpdateParser';
export * from './PetInfoParser';

View File

@ -1,6 +1,6 @@
import { IConnection, IRoomHandlerListener, IRoomUserData } from '../../../api';
import { RoomSessionConfirmPetBreedingEvent, RoomSessionConfirmPetBreedingResultEvent, RoomSessionDanceEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionFavoriteGroupUpdateEvent, RoomSessionFriendRequestEvent, RoomSessionNestBreedingSuccessEvent, RoomSessionPetBreedingEvent, RoomSessionPetFigureUpdateEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPetLevelUpdateEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserBadgesEvent, RoomSessionUserDataUpdateEvent, RoomSessionUserFigureUpdateEvent } from '../../../events';
import { BotErrorEvent, ConfirmBreedingRequestEvent, ConfirmBreedingResultEvent, DoorbellMessageEvent, FavoriteMembershipUpdateMessageEvent, NestBreedingSuccessEvent, NewFriendRequestEvent, PetBreedingMessageEvent, PetFigureUpdateEvent, PetInfoEvent, PetLevelUpdateMessageEvent, PetPlacingErrorEvent, PetStatusUpdateEvent, RoomUnitDanceEvent, RoomUnitEvent, RoomUnitInfoEvent, RoomUnitRemoveEvent, UserCurrentBadgesEvent, UserNameChangeMessageEvent } from '../../communication';
import { RoomSessionConfirmPetBreedingEvent, RoomSessionConfirmPetBreedingResultEvent, RoomSessionDanceEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionFavoriteGroupUpdateEvent, RoomSessionFriendRequestEvent, RoomSessionNestBreedingSuccessEvent, RoomSessionPetBreedingEvent, RoomSessionPetBreedingResultEvent, RoomSessionPetFigureUpdateEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPetLevelUpdateEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserBadgesEvent, RoomSessionUserDataUpdateEvent, RoomSessionUserFigureUpdateEvent } from '../../../events';
import { BotErrorEvent, ConfirmBreedingRequestEvent, ConfirmBreedingResultEvent, DoorbellMessageEvent, FavoriteMembershipUpdateMessageEvent, NestBreedingSuccessEvent, NewFriendRequestEvent, PetBreedingMessageEvent, PetBreedingResultEvent, PetFigureUpdateEvent, PetInfoEvent, PetLevelUpdateMessageEvent, PetPlacingErrorEvent, PetStatusUpdateEvent, RoomUnitDanceEvent, RoomUnitEvent, RoomUnitInfoEvent, RoomUnitRemoveEvent, UserCurrentBadgesEvent, UserNameChangeMessageEvent } from '../../communication';
import { RoomPetData } from '../RoomPetData';
import { RoomUserData } from '../RoomUserData';
import { BaseHandler } from './BaseHandler';
@ -27,6 +27,7 @@ export class RoomUsersHandler extends BaseHandler
connection.addMessageEvent(new NestBreedingSuccessEvent(this.onNestBreedingSuccessEvent.bind(this)));
connection.addMessageEvent(new ConfirmBreedingRequestEvent(this.onConfirmBreedingRequestEvent.bind(this)));
connection.addMessageEvent(new PetFigureUpdateEvent(this.onPetFigureUpdateEvent.bind(this)));
connection.addMessageEvent(new PetBreedingResultEvent(this.onPetBreedingResultEvent.bind(this)));
connection.addMessageEvent(new PetPlacingErrorEvent(this.onPetPlacingError.bind(this)));
connection.addMessageEvent(new BotErrorEvent(this.onBotError.bind(this)));
connection.addMessageEvent(new FavoriteMembershipUpdateMessageEvent(this.onFavoriteMembershipUpdateMessageEvent.bind(this)));
@ -355,6 +356,21 @@ export class RoomUsersHandler extends BaseHandler
this.listener.events.dispatchEvent(new RoomSessionPetFigureUpdateEvent(session, parser.petId, figure));
}
private onPetBreedingResultEvent(event: PetBreedingResultEvent): 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 RoomSessionPetBreedingResultEvent(session, parser.resultData, parser.otherResultData));
}
private onPetPlacingError(event: PetPlacingErrorEvent): void
{
if(!event) return;