Authentication Packets

This commit is contained in:
MyNameIsBatman 2021-06-21 02:00:09 -03:00
parent 815a1d8730
commit 4cef3ab86b
9 changed files with 88 additions and 0 deletions

View File

@ -49,6 +49,7 @@ import { GroupConfirmMemberRemoveEvent } from './messages/incoming/group/GroupCo
import { GroupInformationEvent } from './messages/incoming/group/GroupInformationEvent';
import { GroupMembersEvent } from './messages/incoming/group/GroupMembersEvent';
import { GroupSettingsEvent } from './messages/incoming/group/GroupSettingsEvent';
import { AuthenticationEvent } from './messages/incoming/handshake/AuthenticationEvent';
import { CallForHelpResultMessageEvent } from './messages/incoming/help/CallForHelpResultMessageEvent';
import { IncomingHeader } from './messages/incoming/IncomingHeader';
import { AchievementEvent } from './messages/incoming/inventory/achievements/AchievementEvent';
@ -263,6 +264,7 @@ import { GroupSaveColorsComposer } from './messages/outgoing/group/GroupSaveColo
import { GroupSaveInformationComposer } from './messages/outgoing/group/GroupSaveInformationComposer';
import { GroupSavePreferencesComposer } from './messages/outgoing/group/GroupSavePreferencesComposer';
import { GroupSettingsComposer } from './messages/outgoing/group/GroupSettingsComposer';
import { AuthenticationMessageComposer } from './messages/outgoing/handshake/AuthenticationMessageComposer';
import { InfoRetrieveBaseMessageComposer } from './messages/outgoing/handshake/InfoRetrieveBaseMessageComposer';
import { SecurityTicketComposer } from './messages/outgoing/handshake/SecurityTicketComposer';
import { RequestBadgesComposer } from './messages/outgoing/inventory/badges/RequestBadgesComposer';
@ -426,6 +428,9 @@ export class NitroMessages implements IMessageConfiguration
private registerEvents(): void
{
// AUTHENTICATION
this._events.set(IncomingHeader.AUTHENTICATION, AuthenticationEvent);
// AVAILABILITY
this._events.set(IncomingHeader.AVAILABILITY_STATUS, AvailabilityStatusMessageEvent);
this._events.set(IncomingHeader.GENERIC_ERROR, GenericErrorEvent);
@ -740,6 +745,9 @@ export class NitroMessages implements IMessageConfiguration
private registerComposers(): void
{
// AUTHENTICATION
this._composers.set(OutgoingHeader.AUTHENTICATION, AuthenticationMessageComposer);
// CATALOG
this._composers.set(OutgoingHeader.CATALOG_MODE, CatalogModeComposer);
this._composers.set(OutgoingHeader.CATALOG_PAGE, CatalogPageComposer);

View File

@ -2,6 +2,7 @@ export class IncomingHeader
{
public static ACHIEVEMENT_LIST = 305;
public static AUTHENTICATED = 2491;
public static AUTHENTICATION = -1;
public static AVAILABILITY_STATUS = 2033;
public static BUILDERS_CLUB_EXPIRED = 1452;
public static CAMERA_PRICE = 3878;

View File

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

View File

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

View File

@ -1,6 +1,7 @@
export class OutgoingHeader
{
public static ACHIEVEMENT_LIST = 219;
public static AUTHENTICATION = -1;
public static BOT_CONFIGURATION = 1986;
public static BOT_PICKUP = 3323;
public static BOT_PLACE = 1592;

View File

@ -0,0 +1,32 @@
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
export class AuthenticationMessageComposer implements IMessageComposer<string[]>
{
private _type: string;
private _data: string[];
constructor(type: string, keys: string[], values: string[])
{
this._type = type;
if(keys.length !== values.length) return;
this._data = [];
for(let i = 0; i < keys.length; i++)
{
this._data.push(keys[i]);
this._data.push(values[i]);
}
}
public getMessageArray()
{
return this._data;
}
public dispose(): void
{
return;
}
}

View File

@ -1,2 +1,3 @@
export * from './AuthenticationMessageComposer';
export * from './InfoRetrieveBaseMessageComposer';
export * from './SecurityTicketComposer';

View File

@ -0,0 +1,27 @@
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
export class AuthenticationParser implements IMessageParser
{
private _sso: string;
public flush(): boolean
{
this._sso = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._sso = wrapper.readString();
return true;
}
public get sso(): string
{
return this._sso;
}
}

View File

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