mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-26 17:30:52 +01:00
Update pet packets
This commit is contained in:
parent
503a06e414
commit
f0651a3a33
@ -881,6 +881,7 @@ export class NitroMessages implements IMessageConfiguration
|
||||
this._events.set(IncomingHeader.USER_WARDROBE_PAGE, UserWardrobePageEvent);
|
||||
this._events.set(IncomingHeader.SCR_SEND_KICKBACK_INFO, ScrSendKickbackInfoMessageEvent);
|
||||
this._events.set(IncomingHeader.PET_RESPECTED, PetRespectNoficationEvent);
|
||||
this._events.set(IncomingHeader.PET_SUPPLEMENT, PetSupplementComposer);
|
||||
|
||||
this._events.set(IncomingHeader.GENERIC_ERROR, GenericErrorEvent);
|
||||
this._events.set(IncomingHeader.GROUP_LIST, GuildMembershipsMessageEvent);
|
||||
|
@ -366,4 +366,5 @@ export class IncomingHeader
|
||||
public static PET_STATUS = 1907;
|
||||
public static GROUP_DEACTIVATE = 3129;
|
||||
public static PET_RESPECTED = 2788;
|
||||
public static PET_SUPPLEMENT = 3441;
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
export class PetSupplementTypeEnum
|
||||
{
|
||||
public static WATER: number = 0;
|
||||
public static LIGHT: number = 1;
|
||||
public static REVIVE: number = 2;
|
||||
public static REBREED_FERTILIZER: number = 3;
|
||||
public static SPEED_FERTILIZER: number = 4;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { PetSupplementedNotificationParser } from '../..';
|
||||
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
|
||||
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
|
||||
|
||||
export class PetSupplementedNotificationEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, PetSupplementedNotificationParser);
|
||||
}
|
||||
|
||||
public getParser(): PetSupplementedNotificationParser
|
||||
{
|
||||
return this.parser as PetSupplementedNotificationParser;
|
||||
}
|
||||
}
|
@ -6,6 +6,8 @@ export * from './IgnoredUsersEvent';
|
||||
export * from './IgnoreResultEvent';
|
||||
export * from './InClientLinkEvent';
|
||||
export * from './inventory';
|
||||
export * from './PetSupplementedNotificationEvent';
|
||||
export * from './PetSupplementTypeEnum';
|
||||
export * from './RespectReceivedEvent';
|
||||
export * from './ScrKickbackData';
|
||||
export * from './ScrSendKickbackInfoMessageEvent';
|
||||
|
@ -0,0 +1,43 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
|
||||
|
||||
export class PetSupplementedNotificationParser implements IMessageParser
|
||||
{
|
||||
private _petId: number;
|
||||
private _userId: number;
|
||||
private _supplementType: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._petId = 0;
|
||||
this._userId = 0;
|
||||
this._supplementType = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._petId = wrapper.readInt();
|
||||
this._userId = wrapper.readInt();
|
||||
this._supplementType = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get petId(): number
|
||||
{
|
||||
return this._petId;
|
||||
}
|
||||
|
||||
public get userId(): number
|
||||
{
|
||||
return this._userId;
|
||||
}
|
||||
|
||||
public get supplementType(): number
|
||||
{
|
||||
return this._supplementType;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ export * from './IgnoreResultParser';
|
||||
export * from './InClientLinkParser';
|
||||
export * from './inventory';
|
||||
export * from './PetRespectNotificationParser';
|
||||
export * from './PetSupplementedNotificationParser';
|
||||
export * from './RespectReceivedParser';
|
||||
export * from './RoomEntryData';
|
||||
export * from './ScrSendKickbackInfoMessageParser';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { PetSupplementedNotificationEvent, PetSupplementTypeEnum } from '../..';
|
||||
import { IConnection } from '../../../core/communication/connections/IConnection';
|
||||
import { FloodControlEvent } from '../../communication/messages/incoming/room/unit/chat/FloodControlEvent';
|
||||
import { RemainingMuteEvent } from '../../communication/messages/incoming/room/unit/chat/RemainingMuteEvent';
|
||||
@ -5,6 +6,7 @@ import { RoomUnitChatEvent } from '../../communication/messages/incoming/room/un
|
||||
import { RoomUnitChatShoutEvent } from '../../communication/messages/incoming/room/unit/chat/RoomUnitChatShoutEvent';
|
||||
import { RoomUnitChatWhisperEvent } from '../../communication/messages/incoming/room/unit/chat/RoomUnitChatWhisperEvent';
|
||||
import { RoomUnitHandItemReceivedEvent } from '../../communication/messages/incoming/room/unit/RoomUnitHandItemReceivedEvent';
|
||||
import { PetRespectNoficationEvent } from '../../communication/messages/incoming/user/PetRespectNoficationEvent';
|
||||
import { RespectReceivedEvent } from '../../communication/messages/incoming/user/RespectReceivedEvent';
|
||||
import { SystemChatStyleEnum } from '../../ui/widget/enums/SystemChatStyleEnum';
|
||||
import { RoomSessionChatEvent } from '../events/RoomSessionChatEvent';
|
||||
@ -22,6 +24,8 @@ export class RoomChatHandler extends BaseHandler
|
||||
connection.addMessageEvent(new RoomUnitChatWhisperEvent(this.onRoomUnitChatEvent.bind(this)));
|
||||
connection.addMessageEvent(new RoomUnitHandItemReceivedEvent(this.onRoomUnitHandItemReceivedEvent.bind(this)));
|
||||
connection.addMessageEvent(new RespectReceivedEvent(this.onRespectReceivedEvent.bind(this)));
|
||||
connection.addMessageEvent(new PetRespectNoficationEvent(this.onPetRespectNoficationEvent.bind(this)));
|
||||
connection.addMessageEvent(new PetSupplementedNotificationEvent(this.onPetSupplementedNotificationEvent.bind(this)));
|
||||
connection.addMessageEvent(new FloodControlEvent(this.onFloodControlEvent.bind(this)));
|
||||
connection.addMessageEvent(new RemainingMuteEvent(this.onRemainingMuteEvent.bind(this)));
|
||||
}
|
||||
@ -82,6 +86,69 @@ export class RoomChatHandler extends BaseHandler
|
||||
this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, userData.roomIndex, '', RoomSessionChatEvent.CHAT_TYPE_RESPECT, SystemChatStyleEnum.GENERIC));
|
||||
}
|
||||
|
||||
private onPetRespectNoficationEvent(event: PetRespectNoficationEvent): void
|
||||
{
|
||||
if(!this.listener) return;
|
||||
|
||||
const session = this.listener.getSession(this.roomId);
|
||||
|
||||
if(!session) return;
|
||||
|
||||
const parser = event.getParser();
|
||||
|
||||
if(!parser) return;
|
||||
|
||||
const petData = session.userDataManager.getPetData(parser.petData.id);
|
||||
|
||||
if(!petData) return;
|
||||
|
||||
let chatType = RoomSessionChatEvent.CHAT_TYPE_PETRESPECT;
|
||||
|
||||
if(parser.isTreat) chatType = RoomSessionChatEvent.CHAT_TYPE_PETTREAT;
|
||||
|
||||
this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, petData.roomIndex, '', chatType, SystemChatStyleEnum.GENERIC));
|
||||
}
|
||||
|
||||
private onPetSupplementedNotificationEvent(event: PetSupplementedNotificationEvent): void
|
||||
{
|
||||
if(!this.listener) return;
|
||||
|
||||
const session = this.listener.getSession(this.roomId);
|
||||
|
||||
if(!session) return;
|
||||
|
||||
const parser = event.getParser();
|
||||
|
||||
if(!parser) return;
|
||||
|
||||
const petData = session.userDataManager.getPetData(parser.petId);
|
||||
|
||||
if(!petData) return;
|
||||
|
||||
let userRoomIndex = -1;
|
||||
|
||||
const userData = session.userDataManager.getUserData(parser.userId);
|
||||
|
||||
if(userData) userRoomIndex = userData.roomIndex;
|
||||
|
||||
let chatType = RoomSessionChatEvent.CHAT_TYPE_PETREVIVE;
|
||||
|
||||
switch(parser.supplementType)
|
||||
{
|
||||
case PetSupplementTypeEnum.REVIVE:
|
||||
chatType = RoomSessionChatEvent.CHAT_TYPE_PETREVIVE;
|
||||
break;
|
||||
case PetSupplementTypeEnum.REBREED_FERTILIZER:
|
||||
chatType = RoomSessionChatEvent.CHAT_TYPE_PET_REBREED_FERTILIZE;
|
||||
break;
|
||||
case PetSupplementTypeEnum.SPEED_FERTILIZER:
|
||||
chatType = RoomSessionChatEvent.CHAT_TYPE_PET_SPEED_FERTILIZE;
|
||||
break;
|
||||
}
|
||||
|
||||
this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, petData.roomIndex, '', chatType, SystemChatStyleEnum.GENERIC, null, userRoomIndex));
|
||||
}
|
||||
|
||||
private onFloodControlEvent(event: FloodControlEvent): void
|
||||
{
|
||||
if(!this.listener) return;
|
||||
|
Loading…
Reference in New Issue
Block a user