mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-18 14:36:26 +01:00
Update packets, fix group badge loading
This commit is contained in:
parent
e7dcd1da19
commit
3e0f5e3478
File diff suppressed because one or more lines are too long
@ -369,4 +369,5 @@ export class IncomingHeader
|
||||
public static PET_SUPPLEMENT = 3441;
|
||||
public static NOOBNESS_LEVEL = 3738;
|
||||
public static CAN_CREATE_ROOM_EVENT = 2599;
|
||||
public static FAVORITE_GROUP_UDPATE = 3403;
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
|
||||
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
|
||||
import { GroupBadgesParser } from '../../parser/group/GroupBadgesParser';
|
||||
|
||||
export class GroupBadgesEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, GroupBadgesParser);
|
||||
}
|
||||
|
||||
public getParser(): GroupBadgesParser
|
||||
{
|
||||
return this.parser as GroupBadgesParser;
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
export * from './GroupBadgePartsEvent';
|
||||
export * from './GroupBadgesEvent';
|
||||
export * from './GroupBuyDataEvent';
|
||||
export * from './GroupConfirmMemberRemoveEvent';
|
||||
export * from './GroupInformationEvent';
|
||||
|
@ -0,0 +1,16 @@
|
||||
import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent';
|
||||
import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent';
|
||||
import { FavoriteMembershipUpdateMessageParser } from '../../../parser/room/engine/FavoriteMembershipUpdateMessageParser';
|
||||
|
||||
export class FavoriteMembershipUpdateMessageEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, FavoriteMembershipUpdateMessageParser);
|
||||
}
|
||||
|
||||
public getParser(): FavoriteMembershipUpdateMessageParser
|
||||
{
|
||||
return this.parser as FavoriteMembershipUpdateMessageParser;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
|
||||
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
|
||||
import { HabboGroupBadgesMessageParser } from '../../parser/user/HabboGroupBadgesMessageParser';
|
||||
|
||||
export class HabboGroupBadgesMessageEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, HabboGroupBadgesMessageParser);
|
||||
}
|
||||
|
||||
public getParser(): HabboGroupBadgesMessageParser
|
||||
{
|
||||
return this.parser as HabboGroupBadgesMessageParser;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ export * from './access';
|
||||
export * from './ApproveNameMessageEvent';
|
||||
export * from './data';
|
||||
export * from './GuildMembershipsMessageEvent';
|
||||
export * from './HabboGroupBadgesMessageEvent';
|
||||
export * from './IgnoredUsersEvent';
|
||||
export * from './IgnoreResultEvent';
|
||||
export * from './InClientLinkEvent';
|
||||
|
@ -1,7 +1,6 @@
|
||||
export * from './GroupAdminGiveComposer';
|
||||
export * from './GroupAdminTakeComposer';
|
||||
export * from './GroupBadgePartsComposer';
|
||||
export * from './GroupBadgesComposer';
|
||||
export * from './GroupBuyComposer';
|
||||
export * from './GroupBuyDataComposer';
|
||||
export * from './GroupConfirmRemoveMemberComposer';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
|
||||
|
||||
export class GroupBadgesComposer implements IMessageComposer<ConstructorParameters<typeof GroupBadgesComposer>>
|
||||
export class GetHabboGroupBadgesMessageComposer implements IMessageComposer<ConstructorParameters<typeof GetHabboGroupBadgesMessageComposer>>
|
||||
{
|
||||
private _data: ConstructorParameters<typeof GroupBadgesComposer>;
|
||||
private _data: ConstructorParameters<typeof GetHabboGroupBadgesMessageComposer>;
|
||||
|
||||
constructor()
|
||||
{
|
@ -1,6 +1,7 @@
|
||||
export * from './ApproveNameMessageComposer';
|
||||
export * from './CatalogGroupsComposer';
|
||||
export * from './data';
|
||||
export * from './GetHabboGroupBadgesMessageComposer';
|
||||
export * from './inventory';
|
||||
export * from './ScrGetKickbackInfoMessageComposer';
|
||||
export * from './settings';
|
||||
|
@ -1,5 +1,4 @@
|
||||
export * from './GroupBadgePartsParser';
|
||||
export * from './GroupBadgesParser';
|
||||
export * from './GroupBuyDataParser';
|
||||
export * from './GroupConfirmMemberRemoveParser';
|
||||
export * from './GroupInformationParser';
|
||||
|
@ -0,0 +1,51 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '../../../../../../core';
|
||||
|
||||
export class FavoriteMembershipUpdateMessageParser implements IMessageParser
|
||||
{
|
||||
private _roomIndex: number;
|
||||
private _groupId: number;
|
||||
private _status: number;
|
||||
private _groupName: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._roomIndex = -1;
|
||||
this._groupId = -1;
|
||||
this._status = 0;
|
||||
this._groupName = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._roomIndex = wrapper.readInt();
|
||||
this._groupId = wrapper.readInt();
|
||||
this._status = wrapper.readInt();
|
||||
this._groupName = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get roomIndex(): number
|
||||
{
|
||||
return this._roomIndex;
|
||||
}
|
||||
|
||||
public get groupId(): number
|
||||
{
|
||||
return this._groupId;
|
||||
}
|
||||
|
||||
public get status(): number
|
||||
{
|
||||
return this._status;
|
||||
}
|
||||
|
||||
public get groupName(): string
|
||||
{
|
||||
return this._groupName;
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
export * from './FavoriteMembershipUpdateMessageParser';
|
||||
export * from './ObjectsDataUpdateParser';
|
||||
export * from './ObjectsRollingParser';
|
||||
export * from './RoomCreatedParser';
|
||||
|
@ -52,7 +52,7 @@ export class RoomUnitParser implements IMessageParser
|
||||
user.webID = id;
|
||||
user.userType = RoomObjectType.USER;
|
||||
user.sex = this.resolveSex(wrapper.readString());
|
||||
user.groupID = ('' + wrapper.readInt());
|
||||
user.groupID = wrapper.readInt();
|
||||
user.groupStatus = wrapper.readInt();
|
||||
user.groupName = wrapper.readString();
|
||||
|
||||
|
@ -15,7 +15,7 @@ export class UserMessageData
|
||||
private _custom: string = '';
|
||||
private _activityPoints: number = 0;
|
||||
private _webID: number = 0;
|
||||
private _groupID: string = '';
|
||||
private _groupID: number = 0;
|
||||
private _groupStatus: number = 0;
|
||||
private _groupName: string = '';
|
||||
private _subType: string = '';
|
||||
@ -192,16 +192,16 @@ export class UserMessageData
|
||||
}
|
||||
}
|
||||
|
||||
public get groupID(): string
|
||||
public get groupID(): number
|
||||
{
|
||||
return this._groupID;
|
||||
}
|
||||
|
||||
public set groupID(k: string)
|
||||
public set groupID(groupId: number)
|
||||
{
|
||||
if(!this._isReadOnly)
|
||||
{
|
||||
this._groupID = k;
|
||||
this._groupID = groupId;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
|
||||
|
||||
export class GroupBadgesParser implements IMessageParser
|
||||
export class HabboGroupBadgesMessageParser implements IMessageParser
|
||||
{
|
||||
private _badges: Map<number, string>;
|
||||
|
@ -1,6 +1,7 @@
|
||||
export * from './access';
|
||||
export * from './ApproveNameResultParser';
|
||||
export * from './data';
|
||||
export * from './HabboGroupBadgesMessageParser';
|
||||
export * from './HabboGroupEntryData';
|
||||
export * from './IgnoredUsersParser';
|
||||
export * from './IgnoreResultParser';
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { IDisposable } from '../../core/common/disposable/IDisposable';
|
||||
import { IMessageEvent } from '../../core/communication/messages/IMessageEvent';
|
||||
import { GroupBadgesEvent } from '../communication/messages/incoming/group/GroupBadgesEvent';
|
||||
import { GroupBadgesComposer } from '../communication/messages/outgoing/group/GroupBadgesComposer';
|
||||
import { RoomReadyMessageEvent } from '../communication';
|
||||
import { HabboGroupBadgesMessageEvent } from '../communication/messages/incoming/user/HabboGroupBadgesMessageEvent';
|
||||
import { GetHabboGroupBadgesMessageComposer } from '../communication/messages/outgoing/user/GetHabboGroupBadgesMessageComposer';
|
||||
import { SessionDataManager } from './SessionDataManager';
|
||||
|
||||
export class GroupInformationManager implements IDisposable
|
||||
@ -22,7 +23,8 @@ export class GroupInformationManager implements IDisposable
|
||||
if(this._sessionDataManager && this._sessionDataManager.communication)
|
||||
{
|
||||
this._messages = [
|
||||
new GroupBadgesEvent(this.onGroupBadgesEvent.bind(this))
|
||||
new RoomReadyMessageEvent(this.onRoomReadyMessageEvent.bind(this)),
|
||||
new HabboGroupBadgesMessageEvent(this.onGroupBadgesEvent.bind(this))
|
||||
];
|
||||
|
||||
for(const message of this._messages) this._sessionDataManager.communication.registerMessageEvent(message);
|
||||
@ -44,20 +46,16 @@ export class GroupInformationManager implements IDisposable
|
||||
this._sessionDataManager = null;
|
||||
}
|
||||
|
||||
public requestGroupBadges(): void
|
||||
private onRoomReadyMessageEvent(event: RoomReadyMessageEvent): void
|
||||
{
|
||||
this._sessionDataManager.send(new GroupBadgesComposer());
|
||||
this._sessionDataManager.send(new GetHabboGroupBadgesMessageComposer());
|
||||
}
|
||||
|
||||
private onGroupBadgesEvent(event: GroupBadgesEvent): void
|
||||
private onGroupBadgesEvent(event: HabboGroupBadgesMessageEvent): void
|
||||
{
|
||||
if(!event) return;
|
||||
|
||||
const parser = event.getParser();
|
||||
|
||||
if(!parser) return;
|
||||
|
||||
this._groupBadges = parser.badges;
|
||||
for(const [ groupId, badgeId ] of parser.badges.entries()) this._groupBadges.set(groupId, badgeId);
|
||||
}
|
||||
|
||||
public getGroupBadge(groupId: number): string
|
||||
|
@ -36,7 +36,6 @@ export interface ISessionDataManager extends INitroManager
|
||||
userName: string;
|
||||
figure: string;
|
||||
gender: string;
|
||||
isGodMode: boolean;
|
||||
realName: string;
|
||||
ignoredUsersManager: IgnoredUsersManager;
|
||||
groupInformationManager: GroupInformationManager;
|
||||
|
@ -8,7 +8,7 @@ export class RoomUserData
|
||||
private _custom: string = '';
|
||||
private _activityPoints: number;
|
||||
private _webID: number = 0;
|
||||
private _groupID: string = '';
|
||||
private _groupID: number = 0;
|
||||
private _groupStatus: number = 0;
|
||||
private _groupName: string = '';
|
||||
private _ownerId: number = 0;
|
||||
@ -104,14 +104,14 @@ export class RoomUserData
|
||||
this._webID = k;
|
||||
}
|
||||
|
||||
public get guildId(): string
|
||||
public get groupId(): number
|
||||
{
|
||||
return this._groupID;
|
||||
}
|
||||
|
||||
public set guildId(k: string)
|
||||
public set groupId(groupId: number)
|
||||
{
|
||||
this._groupID = k;
|
||||
this._groupID = groupId;
|
||||
}
|
||||
|
||||
public get groupName(): string
|
||||
|
@ -118,7 +118,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
|
||||
this.onProductDataReadyEvent = this.onProductDataReadyEvent.bind(this);
|
||||
this.onNitroSettingsEvent = this.onNitroSettingsEvent.bind(this);
|
||||
}
|
||||
groupInformationManager: GroupInformationManager;
|
||||
|
||||
protected onInit(): void
|
||||
{
|
||||
@ -614,6 +613,11 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
|
||||
return this._ignoredUsersManager;
|
||||
}
|
||||
|
||||
public get groupInformationManager(): GroupInformationManager
|
||||
{
|
||||
return this._groupInformationManager;
|
||||
}
|
||||
|
||||
public get respectsReceived(): number
|
||||
{
|
||||
return this._respectsReceived;
|
||||
@ -679,11 +683,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
|
||||
return (this._securityLevel >= SecurityLevel.MODERATOR);
|
||||
}
|
||||
|
||||
public get isGodMode(): boolean
|
||||
{
|
||||
return this.securityLevel >= SecurityLevel.MODERATOR;
|
||||
}
|
||||
|
||||
public get isCameraFollowDisabled(): boolean
|
||||
{
|
||||
return this._isRoomCameraFollowDisabled;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { IRoomSession } from '../IRoomSession';
|
||||
import { RoomSessionEvent } from './RoomSessionEvent';
|
||||
|
||||
export class RoomSessionFavouriteGroupUpdateEvent extends RoomSessionEvent
|
||||
export class RoomSessionFavoriteGroupUpdateEvent extends RoomSessionEvent
|
||||
{
|
||||
public static FAVOURITE_GROUP_UPDATE: string = 'RSFGUE_FAVOURITE_GROUP_UPDATE';
|
||||
|
||||
@ -10,14 +10,14 @@ export class RoomSessionFavouriteGroupUpdateEvent extends RoomSessionEvent
|
||||
private _habboGroupName: string;
|
||||
private _status: number;
|
||||
|
||||
constructor(k: IRoomSession, _arg_2: number, _arg_3: number, _arg_4: number, _arg_5: string)
|
||||
constructor(session: IRoomSession, roomIndex: number, groupId: number, status: number, groupName: string)
|
||||
{
|
||||
super(RoomSessionFavouriteGroupUpdateEvent.FAVOURITE_GROUP_UPDATE, k);
|
||||
super(RoomSessionFavoriteGroupUpdateEvent.FAVOURITE_GROUP_UPDATE, session);
|
||||
|
||||
this._roomIndex = _arg_2;
|
||||
this._habboGroupId = _arg_3;
|
||||
this._habboGroupName = _arg_5;
|
||||
this._status = _arg_4;
|
||||
this._roomIndex = roomIndex;
|
||||
this._habboGroupId = groupId;
|
||||
this._habboGroupName = groupName;
|
||||
this._status = status;
|
||||
}
|
||||
|
||||
public get roomIndex(): number
|
@ -5,26 +5,26 @@ export class RoomSessionUserFigureUpdateEvent extends RoomSessionEvent
|
||||
{
|
||||
public static USER_FIGURE: string = 'RSUBE_FIGURE';
|
||||
|
||||
private _userId: number = 0;
|
||||
private _roomIndex: number = 0;
|
||||
private _figure: string = '';
|
||||
private _gender: string = '';
|
||||
private _customInfo: string = '';
|
||||
private _achievementScore: number;
|
||||
|
||||
constructor(session: IRoomSession, userId: number, figure: string, gender: string, customInfo: string, achievementScore: number)
|
||||
constructor(session: IRoomSession, roomIndex: number, figure: string, gender: string, customInfo: string, achievementScore: number)
|
||||
{
|
||||
super(RoomSessionUserFigureUpdateEvent.USER_FIGURE, session);
|
||||
|
||||
this._userId = userId;
|
||||
this._roomIndex = roomIndex;
|
||||
this._figure = figure;
|
||||
this._gender = gender;
|
||||
this._customInfo = customInfo;
|
||||
this._achievementScore = achievementScore;
|
||||
}
|
||||
|
||||
public get userId(): number
|
||||
public get roomIndex(): number
|
||||
{
|
||||
return this._userId;
|
||||
return this._roomIndex;
|
||||
}
|
||||
|
||||
public get figure(): string
|
||||
|
@ -10,7 +10,7 @@ export * from './RoomSessionDimmerPresetsEventPresetItem';
|
||||
export * from './RoomSessionDoorbellEvent';
|
||||
export * from './RoomSessionErrorMessageEvent';
|
||||
export * from './RoomSessionEvent';
|
||||
export * from './RoomSessionFavouriteGroupUpdateEvent';
|
||||
export * from './RoomSessionFavoriteGroupUpdateEvent';
|
||||
export * from './RoomSessionFriendRequestEvent';
|
||||
export * from './RoomSessionNestBreedingSuccessEvent';
|
||||
export * from './RoomSessionPetBreedingEvent';
|
||||
|
@ -4,6 +4,7 @@ import { NewFriendRequestEvent } from '../../communication/messages/incoming/fri
|
||||
import { BotErrorEvent } from '../../communication/messages/incoming/notifications/BotErrorEvent';
|
||||
import { PetPlacingErrorEvent } from '../../communication/messages/incoming/notifications/PetPlacingErrorEvent';
|
||||
import { RoomDoorbellEvent } from '../../communication/messages/incoming/room/access/doorbell/RoomDoorbellEvent';
|
||||
import { FavoriteMembershipUpdateMessageEvent } from '../../communication/messages/incoming/room/engine/FavoriteMembershipUpdateMessageEvent';
|
||||
import { PetInfoEvent } from '../../communication/messages/incoming/room/pet/PetInfoEvent';
|
||||
import { PetStatusUpdateEvent } from '../../communication/messages/incoming/room/pet/PetStatusUpdateEvent';
|
||||
import { RoomUnitDanceEvent } from '../../communication/messages/incoming/room/unit/RoomUnitDanceEvent';
|
||||
@ -16,6 +17,7 @@ import { RoomSessionPetFigureUpdateEvent, RoomSessionPetStatusUpdateEvent, RoomS
|
||||
import { RoomSessionDanceEvent } from '../events/RoomSessionDanceEvent';
|
||||
import { RoomSessionDoorbellEvent } from '../events/RoomSessionDoorbellEvent';
|
||||
import { RoomSessionErrorMessageEvent } from '../events/RoomSessionErrorMessageEvent';
|
||||
import { RoomSessionFavoriteGroupUpdateEvent } from '../events/RoomSessionFavoriteGroupUpdateEvent';
|
||||
import { RoomSessionFriendRequestEvent } from '../events/RoomSessionFriendRequestEvent';
|
||||
import { RoomSessionPetInfoUpdateEvent } from '../events/RoomSessionPetInfoUpdateEvent';
|
||||
import { RoomSessionUserBadgesEvent } from '../events/RoomSessionUserBadgesEvent';
|
||||
@ -44,6 +46,7 @@ export class RoomUsersHandler extends BaseHandler
|
||||
connection.addMessageEvent(new PetFigureUpdateEvent(this.onPetFigureUpdateEvent.bind(this)));
|
||||
connection.addMessageEvent(new PetPlacingErrorEvent(this.onPetPlacingError.bind(this)));
|
||||
connection.addMessageEvent(new BotErrorEvent(this.onBotError.bind(this)));
|
||||
connection.addMessageEvent(new FavoriteMembershipUpdateMessageEvent(this.onFavoriteMembershipUpdateMessageEvent.bind(this)));
|
||||
}
|
||||
|
||||
private onRoomUnitEvent(event: RoomUnitEvent): void
|
||||
@ -72,7 +75,7 @@ export class RoomUsersHandler extends BaseHandler
|
||||
userData.figure = user.figure;
|
||||
userData.type = user.userType;
|
||||
userData.webID = user.webID;
|
||||
userData.guildId = user.groupID;
|
||||
userData.groupId = user.groupID;
|
||||
userData.groupName = user.groupName;
|
||||
userData.groupStatus = user.groupStatus;
|
||||
userData.sex = user.sex;
|
||||
@ -374,4 +377,23 @@ export class RoomUsersHandler extends BaseHandler
|
||||
|
||||
this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, session));
|
||||
}
|
||||
|
||||
private onFavoriteMembershipUpdateMessageEvent(event: FavoriteMembershipUpdateMessageEvent): void
|
||||
{
|
||||
if(!this.listener) return;
|
||||
|
||||
const parser = event.getParser();
|
||||
const session = this.listener.getSession(this.roomId);
|
||||
|
||||
if(!session) return;
|
||||
|
||||
const userData = session.userDataManager.getUserDataByIndex(parser.roomIndex);
|
||||
|
||||
if(!userData) return;
|
||||
|
||||
userData.groupId = parser.groupId;
|
||||
userData.groupName = parser.groupName;
|
||||
|
||||
this.listener.events.dispatchEvent(new RoomSessionFavoriteGroupUpdateEvent(session, parser.roomIndex, parser.groupId, parser.status, parser.groupName));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user