Skip to content

Commit

Permalink
billsonnn#28 - UserClassificationMessageEvent added
Browse files Browse the repository at this point in the history
  • Loading branch information
oobjectt committed Dec 25, 2022
1 parent 26741b7 commit 0ad6974
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/nitro/communication/NitroMessages.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export class IncomingHeader
public static USER_SETTINGS = 513;
public static USER_SUBSCRIPTION = 954;
public static USER_WARDROBE_PAGE = 3315;
public static USER_CLASSIFICATION = 966;
public static GET_USER_TAGS = 1255;
public static WIRED_ACTION = 1434;
public static WIRED_CONDITION = 1108;
Expand Down
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 @@ -69,3 +69,4 @@ export * from './user/inventory';
export * from './user/inventory/currency';
export * from './user/inventory/subscription';
export * from './user/wardrobe';
export * from './userclassification';
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../events';
import { UserClassificationMessageParser } from '../../parser';

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

public getParser(): UserClassificationMessageParser
{
return this.parser as UserClassificationMessageParser;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './UserClassificationMessageEvent';
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 @@ -71,3 +71,4 @@ export * from './user/inventory';
export * from './user/inventory/currency';
export * from './user/inventory/subscription';
export * from './user/wardrobe';
export * from './userclassification';
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';

export class UserClassificationMessageParser implements IMessageParser
{
private _classifiedUsersNames: Map<number, string>;
private _classifiedUsersClass: Map<number, string>;

public flush(): boolean
{
if(this._classifiedUsersNames)
{
this._classifiedUsersNames = new Map();
}
if(this._classifiedUsersClass)
{
this._classifiedUsersClass = new Map();
}

return true;
}

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

let _local_3: number;
let _local_4: string;
let _local_5: string;

const _local_2: number = wrapper.readInt();

this._classifiedUsersNames = new Map();
this._classifiedUsersClass = new Map();

let _local_6: number;

while(_local_6 < _local_2)
{
_local_3 = wrapper.readInt();
_local_4 = wrapper.readString();
_local_5 = wrapper.readString();
this._classifiedUsersNames.set(_local_3, _local_4);
this._classifiedUsersClass.set(_local_3, _local_5);
_local_6++;
}

return true;
}

public get classifiedUsernameMap(): Map<number, string>
{
return this._classifiedUsersNames;
}

public get classifiedUserTypeMap(): Map<number, string>
{
return this._classifiedUsersClass;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './UserClassificationMessageParser';

0 comments on commit 0ad6974

Please sign in to comment.