#28 - PopularRoomTagsResultEvent added

This commit is contained in:
oobjectt 2022-12-24 17:48:08 +01:00
parent 26741b78a7
commit 029f7b09f6
8 changed files with 120 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -168,6 +168,7 @@ export class IncomingHeader
public static ROOM_SPECTATOR = 1033;
public static ROOM_THICKNESS = 3547;
public static ROOM_GET_FILTER_WORDS = 2937;
public static ROOM_POPULAR_TAGS_RESULT = 2012;
public static INFO_FEED_ENABLE = 3284;
public static SECURITY_MACHINE = 1488;
public static MYSTERY_BOX_KEYS = 2833;

View File

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

View File

@ -18,6 +18,7 @@ export * from './NavigatorOpenRoomCreatorEvent';
export * from './NavigatorSearchesEvent';
export * from './NavigatorSearchEvent';
export * from './NavigatorSettingsEvent';
export * from './PopularRoomTagsResultEvent';
export * from './RoomEventCancelEvent';
export * from './RoomEventEvent';
export * from './RoomFilterSettingsMessageEvent';

View File

@ -0,0 +1,46 @@
import { IMessageDataWrapper } from '../../../../../api';
import { PopularTagData } from './PopularTagData';
export class PopularRoomTagsData
{
private _tags: PopularTagData[];
constructor(wrapper: IMessageDataWrapper)
{
if(!wrapper) throw new Error('invalid_wrapper');
this.flush();
this.parse(wrapper);
}
public flush(): boolean
{
this._tags = [];
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._tags = [];
const totalTags = wrapper.readInt();
let total = 0;
while(total < totalTags)
{
this._tags.push(new PopularTagData(wrapper));
total++;
}
return true;
}
public get tags(): PopularTagData[]
{
return this._tags;
}
}

View File

@ -0,0 +1,28 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
import { PopularRoomTagsData } from './PopularRoomTagsData';
export class PopularRoomTagsResultMessageParser implements IMessageParser
{
private _data: PopularRoomTagsData;
public flush(): boolean
{
this._data = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._data = new PopularRoomTagsData(wrapper);
return true;
}
public get data(): PopularRoomTagsData
{
return this._data;
}
}

View File

@ -0,0 +1,23 @@
import { IMessageDataWrapper } from '../../../../../api';
export class PopularTagData
{
private _tagName: string;
private _userCount: number;
constructor(wrapper: IMessageDataWrapper)
{
this._tagName = wrapper.readString();
this._userCount = wrapper.readInt();
}
public get tagName(): string
{
return this._tagName;
}
public get userCount(): number
{
return this._userCount;
}
}

View File

@ -21,6 +21,9 @@ export * from './NavigatorOpenRoomCreatorParser';
export * from './NavigatorSearchesParser';
export * from './NavigatorSearchParser';
export * from './NavigatorSettingsParser';
export * from './PopularRoomTagsData';
export * from './PopularRoomTagsResultMessageParser';
export * from './PopularTagData';
export * from './RoomEventCancelMessageParser';
export * from './RoomEventMessageParser';
export * from './RoomFilterSettingsMessageParser';