#9 - GroupMembershipRequestedMessageEvent added

This commit is contained in:
oobjectt 2022-12-24 12:50:06 +01:00
parent 26741b78a7
commit 7c3f3ec9e8
7 changed files with 128 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -71,6 +71,7 @@ export class IncomingHeader
public static GROUP_PURCHASED = 2808; public static GROUP_PURCHASED = 2808;
public static GROUP_SETTINGS = 3965; public static GROUP_SETTINGS = 3965;
public static GROUP_BADGE_PARTS = 2238; public static GROUP_BADGE_PARTS = 2238;
public static GROUP_MEMBERSHIP_REQUESTED = 1180;
public static ITEM_DIMMER_SETTINGS = 2710; public static ITEM_DIMMER_SETTINGS = 2710;
public static ITEM_STACK_HELPER = 2816; public static ITEM_STACK_HELPER = 2816;
public static ITEM_WALL = 1369; public static ITEM_WALL = 1369;

View File

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

View File

@ -0,0 +1,70 @@
import { IMessageDataWrapper } from '../../../../../api';
export class MemberData
{
private static readonly TYPE_OWNER: number = 0;
private static readonly TYPE_ADMIN: number = 1;
private static readonly TYPE_PENDING: number = 2;
private static readonly TYPE_MEMBER: number = 3;
private static readonly TYPE_BLOCKED: number = 4;
private _type: number;
private _userId: number;
private _userName: string;
private _figure: string;
private _memberSince: string;
constructor(wrapper: IMessageDataWrapper)
{
this._type = wrapper.readInt();
this._userId = wrapper.readInt();
this._userName = wrapper.readString();
this._figure = wrapper.readString();
this._memberSince = wrapper.readString();
}
public get userId(): number
{
return this._userId;
}
public get userName(): string
{
return this._userName;
}
public get admin(): boolean
{
return this._type == MemberData.TYPE_ADMIN;
}
public get owner(): boolean
{
return this._type == MemberData.TYPE_OWNER;
}
public get pending(): boolean
{
return this._type == MemberData.TYPE_PENDING;
}
public get member(): boolean
{
return this._type != MemberData.TYPE_MEMBER;
}
public get blocked(): boolean
{
return this._type == MemberData.TYPE_BLOCKED;
}
public get figure(): string
{
return this._figure;
}
public get memberSince(): string
{
return this._memberSince;
}
}

View File

@ -1,6 +1,7 @@
export * from './access'; export * from './access';
export * from './ApproveNameMessageEvent'; export * from './ApproveNameMessageEvent';
export * from './data'; export * from './data';
export * from './GroupMembershipRequestedMessageEvent';
export * from './GuildMembershipsMessageEvent'; export * from './GuildMembershipsMessageEvent';
export * from './HabboGroupBadgesMessageEvent'; export * from './HabboGroupBadgesMessageEvent';
export * from './IgnoredUsersEvent'; export * from './IgnoredUsersEvent';
@ -9,6 +10,7 @@ export * from './InClientLinkEvent';
export * from './inventory'; export * from './inventory';
export * from './inventory/currency'; export * from './inventory/currency';
export * from './inventory/subscription'; export * from './inventory/subscription';
export * from './MemberData';
export * from './PetRespectNoficationEvent'; export * from './PetRespectNoficationEvent';
export * from './PetSupplementedNotificationEvent'; export * from './PetSupplementedNotificationEvent';
export * from './RespectReceivedEvent'; export * from './RespectReceivedEvent';

View File

@ -0,0 +1,36 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
import { MemberData } from '../../incoming';
export class GroupMembershipRequestedMessageParser implements IMessageParser
{
private _groupId: number;
private _requester: MemberData;
public flush(): boolean
{
this._groupId = -1;
this._requester = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._groupId = wrapper.readInt();
this._requester = new MemberData(wrapper);
return true;
}
public get groupId(): number
{
return this._groupId;
}
public get requester(): MemberData
{
return this._requester;
}
}

View File

@ -1,6 +1,7 @@
export * from './access'; export * from './access';
export * from './ApproveNameResultParser'; export * from './ApproveNameResultParser';
export * from './data'; export * from './data';
export * from './GroupMembershipRequestedMessageParser';
export * from './GuildMembershipsMessageParser'; export * from './GuildMembershipsMessageParser';
export * from './HabboGroupBadgesMessageParser'; export * from './HabboGroupBadgesMessageParser';
export * from './HabboGroupEntryData'; export * from './HabboGroupEntryData';