Skip to content

Commit

Permalink
billsonnn#9 - GroupMembershipRequestedMessageEvent added
Browse files Browse the repository at this point in the history
  • Loading branch information
oobjectt committed Dec 24, 2022
1 parent 26741b7 commit 7c3f3ec
Show file tree
Hide file tree
Showing 7 changed files with 128 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 @@ -71,6 +71,7 @@ export class IncomingHeader
public static GROUP_PURCHASED = 2808;
public static GROUP_SETTINGS = 3965;
public static GROUP_BADGE_PARTS = 2238;
public static GROUP_MEMBERSHIP_REQUESTED = 1180;
public static ITEM_DIMMER_SETTINGS = 2710;
public static ITEM_STACK_HELPER = 2816;
public static ITEM_WALL = 1369;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
70 changes: 70 additions & 0 deletions src/nitro/communication/messages/incoming/user/MemberData.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}
2 changes: 2 additions & 0 deletions src/nitro/communication/messages/incoming/user/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './access';
export * from './ApproveNameMessageEvent';
export * from './data';
export * from './GroupMembershipRequestedMessageEvent';
export * from './GuildMembershipsMessageEvent';
export * from './HabboGroupBadgesMessageEvent';
export * from './IgnoredUsersEvent';
Expand All @@ -9,6 +10,7 @@ export * from './InClientLinkEvent';
export * from './inventory';
export * from './inventory/currency';
export * from './inventory/subscription';
export * from './MemberData';
export * from './PetRespectNoficationEvent';
export * from './PetSupplementedNotificationEvent';
export * from './RespectReceivedEvent';
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
1 change: 1 addition & 0 deletions src/nitro/communication/messages/parser/user/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './access';
export * from './ApproveNameResultParser';
export * from './data';
export * from './GroupMembershipRequestedMessageParser';
export * from './GuildMembershipsMessageParser';
export * from './HabboGroupBadgesMessageParser';
export * from './HabboGroupEntryData';
Expand Down

0 comments on commit 7c3f3ec

Please sign in to comment.