#9 - PetBreedingEvent added (#14)

* #9 - PetBreedingEvent added
This commit is contained in:
object 2022-12-24 02:26:33 +01:00 committed by GitHub
parent 473f3ab12c
commit 4687bfacf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 44 additions and 8 deletions

View File

@ -9,13 +9,13 @@ export class RoomSessionPetBreedingEvent extends RoomSessionEvent
private _ownPetId: number;
private _otherPetId: number;
constructor(k: IRoomSession, _arg_2: number, _arg_3: number, _arg_4: number)
constructor(session: IRoomSession, state: number, ownPetId: number, otherPetId: number)
{
super(RoomSessionPetBreedingEvent.PET_BREEDING, k);
super(RoomSessionPetBreedingEvent.PET_BREEDING, session);
this._state = _arg_2;
this._ownPetId = _arg_3;
this._otherPetId = _arg_4;
this._state = state;
this._ownPetId = ownPetId;
this._otherPetId = otherPetId;
}
public get state(): number

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_OPEN_PACKAGE_REQUESTED = 2380;
public static PET_OPEN_PACKAGE_RESULT = 546;
public static PET_BREEDING = 1746;
public static RECYCLER_PRIZES = 3164;
public static ROOM_BAN_LIST = 1869;
public static ROOM_BAN_REMOVE = 3429;

View File

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

View File

@ -0,0 +1 @@
export * from './PetBreedingMessageEvent';

View File

@ -1,3 +1,4 @@
export * from './breeding';
export * from './OpenPetPackageRequestedMessageEvent';
export * from './OpenPetPackageResultMessageEvent';
export * from './PetLevelUpdateMessageEvent';

View File

@ -1,6 +1,6 @@
import { IConnection, IRoomHandlerListener, IRoomUserData } from '../../../api';
import { 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 { RoomSessionDanceEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionFavoriteGroupUpdateEvent, RoomSessionFriendRequestEvent, RoomSessionPetBreedingEvent, RoomSessionPetFigureUpdateEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPetLevelUpdateEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserBadgesEvent, RoomSessionUserDataUpdateEvent, RoomSessionUserFigureUpdateEvent } from '../../../events';
import { BotErrorEvent, DoorbellMessageEvent, FavoriteMembershipUpdateMessageEvent, NewFriendRequestEvent, PetBreedingMessageEvent, 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';
@ -21,6 +21,7 @@ export class RoomUsersHandler extends BaseHandler
connection.addMessageEvent(new NewFriendRequestEvent(this.onNewFriendRequestEvent.bind(this)));
connection.addMessageEvent(new PetInfoEvent(this.onPetInfoEvent.bind(this)));
connection.addMessageEvent(new PetStatusUpdateEvent(this.onPetStatusUpdateEvent.bind(this)));
connection.addMessageEvent(new PetBreedingMessageEvent(this.onPetBreedingMessageEvent.bind(this)));
connection.addMessageEvent(new PetLevelUpdateMessageEvent(this.onPetLevelUpdateMessageEvent.bind(this)));
connection.addMessageEvent(new PetFigureUpdateEvent(this.onPetFigureUpdateEvent.bind(this)));
connection.addMessageEvent(new PetPlacingErrorEvent(this.onPetPlacingError.bind(this)));
@ -255,6 +256,21 @@ export class RoomUsersHandler extends BaseHandler
this.listener.events.dispatchEvent(new RoomSessionPetStatusUpdateEvent(session, parser.petId, parser.canBreed, parser.canHarvest, parser.canRevive, parser.hasBreedingPermission));
}
private onPetBreedingMessageEvent(event: PetBreedingMessageEvent): 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 RoomSessionPetBreedingEvent(session, parser.state, parser.ownPetId, parser.otherPetId));
}
private onPetLevelUpdateMessageEvent(event: PetLevelUpdateMessageEvent): void
{
if(!this.listener) return;