Skip to content

Commit

Permalink
billsonnn#28 - PhoneCollectionStateMessageEvent, TryPhoneNumberResult…
Browse files Browse the repository at this point in the history
…MessageEvent and TryVerificationCodeResultMessageEvent added
  • Loading branch information
oobjectt committed Dec 25, 2022
1 parent 26741b7 commit 80322b4
Show file tree
Hide file tree
Showing 12 changed files with 173 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/nitro/communication/NitroMessages.ts

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/nitro/communication/messages/incoming/IncomingHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,4 +414,7 @@ export class IncomingHeader
public static SHOW_ENFORCE_ROOM_CATEGORY = 3896;
public static CUSTOM_USER_NOTIFICATION = 909;
public static NEW_USER_EXPERIENCE_GIFT_OFFER = 3575;
public static PHONE_COLLECTION_STATE = 2890;
public static PHONE_TRY_NUMBER_RESULT = 800;
public static PHONE_TRY_VERIFICATION_CODE_RESULT = 91;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../events';
import { PhoneCollectionStateParser } from '../../parser';

export class PhoneCollectionStateMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, PhoneCollectionStateParser);
}

public getParser(): PhoneCollectionStateParser
{
return this.parser as PhoneCollectionStateParser;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../events';
import { TryPhoneNumberResultParser } from '../../parser';

export class TryPhoneNumberResultMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, TryPhoneNumberResultParser);
}

public getParser(): TryPhoneNumberResultParser
{
return this.parser as TryPhoneNumberResultParser;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../events';
import { TryVerificationCodeResultParser } from '../../parser';

export class TryVerificationCodeResultMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, TryVerificationCodeResultParser);
}

public getParser(): TryVerificationCodeResultParser
{
return this.parser as TryVerificationCodeResultParser;
}
}
3 changes: 3 additions & 0 deletions src/nitro/communication/messages/incoming/gifts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './PhoneCollectionStateMessageEvent';
export * from './TryPhoneNumberResultMessageEvent';
export * from './TryVerificationCodeResultMessageEvent';
1 change: 1 addition & 0 deletions src/nitro/communication/messages/incoming/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export * from './game';
export * from './game/directory';
export * from './game/lobby';
export * from './generic';
export * from './gifts';
export * from './group';
export * from './groupforums';
export * from './handshake';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';

export class PhoneCollectionStateParser implements IMessageParser
{
private _phoneStatusCode: number;
private _collectionStatusCode: number;
private _millisecondsToAllowProcessReset: number;

public flush(): boolean
{
this._phoneStatusCode = -1;
this._millisecondsToAllowProcessReset = -1;
return true;
}

public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;

this._phoneStatusCode = wrapper.readInt();
this._collectionStatusCode = wrapper.readInt();
this._millisecondsToAllowProcessReset = wrapper.readInt();

return true;
}

public get phoneStatusCode(): number
{
return this._phoneStatusCode;
}

public get collectionStatusCode(): number
{
return this._collectionStatusCode;
}

public get millisecondsToAllowProcessReset(): number
{
return this._millisecondsToAllowProcessReset;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';

export class TryPhoneNumberResultParser implements IMessageParser
{
private _resultCode: number;
private _millisToAllowProcessReset: number;

public flush(): boolean
{
this._resultCode = -1;
return true;
}

public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;

this._resultCode = wrapper.readInt();
this._millisToAllowProcessReset = wrapper.readInt();

return true;
}

public get resultCode(): number
{
return this._resultCode;
}

public get millisToAllowProcessReset(): number
{
return this._millisToAllowProcessReset;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';

export class TryVerificationCodeResultParser implements IMessageParser
{
private _resultCode: number;
private _millisecondsToAllowProcessReset: number;

public flush(): boolean
{
this._resultCode = -1;
this._millisecondsToAllowProcessReset = -1;
return true;
}

public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;

this._resultCode = wrapper.readInt();
this._millisecondsToAllowProcessReset = wrapper.readInt();

return true;
}

public get resultCode(): number
{
return this._resultCode;
}

public get millisToAllowProcessReset(): number
{
return this._millisecondsToAllowProcessReset;
}
}
3 changes: 3 additions & 0 deletions src/nitro/communication/messages/parser/gifts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './PhoneCollectionStateParser';
export * from './TryPhoneNumberResultParser';
export * from './TryVerificationCodeResultParser';
1 change: 1 addition & 0 deletions src/nitro/communication/messages/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export * from './game/directory';
export * from './game/lobby';
export * from './game/score';
export * from './generic';
export * from './gifts';
export * from './group';
export * from './group/utils';
export * from './groupforums';
Expand Down

0 comments on commit 80322b4

Please sign in to comment.