This commit is contained in:
Bill 2022-07-18 20:50:29 -04:00
parent 1b935f9345
commit d4f1028265
4 changed files with 377 additions and 374 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,9 +28,9 @@ export interface IRoomSession extends IDisposable
sendBanMessage(userId: number, type: string): void;
sendGiveRightsMessage(userId: number): void;
sendTakeRightsMessage(userId: number): void;
sendPollStartMessage(pollId:number):void;
sendPollRejectMessage(pollId:number):void;
sendPollAnswerMessage(pollId:number, questionId:number, answers:string[]):void;
sendPollStartMessage(pollId: number): void;
sendPollRejectMessage(pollId: number): void;
sendPollAnswerMessage(pollId: number, questionId: number, answers: string[]): void;
updateMoodlightData(id: number, effectId: number, color: number, brightness: number, apply: boolean): void;
toggleMoodlightState(): void;
pickupPet(id: number): void;
@ -50,7 +50,7 @@ export interface IRoomSession extends IDisposable
roomId: number;
state: string;
tradeMode: number;
_Str_7411: boolean;
isPrivateRoom: boolean;
doorMode: number;
allowPets: boolean;
controllerLevel: number;

View File

@ -76,7 +76,7 @@ export class RoomSession extends Disposable implements IRoomSession
protected onDispose(): void
{
if(this._userData)
if (this._userData)
{
this._userData.dispose();
@ -88,16 +88,16 @@ export class RoomSession extends Disposable implements IRoomSession
public setConnection(connection: IConnection): void
{
if(this._connection || !connection) return;
if (this._connection || !connection) return;
this._connection = connection;
if(this._userData) this._userData.setConnection(connection);
if (this._userData) this._userData.setConnection(connection);
}
public setControllerLevel(level: number): void
{
if((level >= RoomControllerLevel.NONE) && (level <= RoomControllerLevel.MODERATOR))
if ((level >= RoomControllerLevel.NONE) && (level <= RoomControllerLevel.MODERATOR))
{
this._controllerLevel = level;
@ -119,7 +119,7 @@ export class RoomSession extends Disposable implements IRoomSession
public start(): boolean
{
if(this._state !== RoomSessionEvent.CREATED || !this._connection) return false;
if (this._state !== RoomSessionEvent.CREATED || !this._connection) return false;
this._state = RoomSessionEvent.STARTED;
@ -128,7 +128,7 @@ export class RoomSession extends Disposable implements IRoomSession
private enterRoom(): boolean
{
if(!this._connection) return false;
if (!this._connection) return false;
this._connection.send(new RoomEnterComposer(this._roomId, this._password));
@ -137,7 +137,7 @@ export class RoomSession extends Disposable implements IRoomSession
public reset(roomId: number): void
{
if(roomId === this._roomId) return;
if (roomId === this._roomId) return;
this._roomId = roomId;
}
@ -159,7 +159,7 @@ export class RoomSession extends Disposable implements IRoomSession
public sendChatTypingMessage(isTyping: boolean): void
{
if(isTyping) this._connection.send(new RoomUnitTypingStartComposer());
if (isTyping) this._connection.send(new RoomUnitTypingStartComposer());
else this._connection.send(new RoomUnitTypingStopComposer());
}
@ -180,7 +180,7 @@ export class RoomSession extends Disposable implements IRoomSession
public sendSignMessage(sign: number): void
{
if((sign < 0) || (sign > 17)) return;
if ((sign < 0) || (sign > 17)) return;
this._connection.send(new RoomUnitSignComposer(sign));
}
@ -192,7 +192,7 @@ export class RoomSession extends Disposable implements IRoomSession
public sendDoorbellApprovalMessage(userName: string, flag: boolean): void
{
this._connection.send(new RoomDoorbellAccessComposer(userName,flag));
this._connection.send(new RoomDoorbellAccessComposer(userName, flag));
}
public sendAmbassadorAlertMessage(userId: number): void
@ -225,17 +225,17 @@ export class RoomSession extends Disposable implements IRoomSession
this._connection.send(new RoomTakeRightsComposer(userId));
}
public sendPollStartMessage(pollId:number):void
public sendPollStartMessage(pollId: number): void
{
this._connection.send(new PollStartComposer(pollId));
}
public sendPollRejectMessage(pollId:number):void
public sendPollRejectMessage(pollId: number): void
{
this._connection.send(new PollRejectComposer(pollId));
}
public sendPollAnswerMessage(pollId:number, questionId:number, answers:string[]):void
public sendPollAnswerMessage(pollId: number, questionId: number, answers: string[]): void
{
this._connection.send(new PollAnswerComposer(pollId, questionId, answers));
}
@ -255,21 +255,21 @@ export class RoomSession extends Disposable implements IRoomSession
public pickupPet(id: number): void
{
if(!this._connection) return;
if (!this._connection) return;
this._connection.send(new PetRemoveComposer(id));
}
public pickupBot(id: number): void
{
if(!this._connection) return;
if (!this._connection) return;
this._connection.send(new BotRemoveComposer(id));
}
public requestMoodlightSettings(): void
{
if(!this._connection) return;
if (!this._connection) return;
this._connection.send(new MoodlightSettingsComposer());
}
@ -359,7 +359,7 @@ export class RoomSession extends Disposable implements IRoomSession
return this._state;
}
public get _Str_7411(): boolean
public get isPrivateRoom(): boolean
{
return true;
}

View File

@ -51,21 +51,21 @@ export class RoomUsersHandler extends BaseHandler
private onRoomUnitEvent(event: RoomUnitEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
const users = event.getParser().users;
const usersToAdd: RoomUserData[] = [];
if(users && users.length)
if (users && users.length)
{
for(const user of users)
for (const user of users)
{
if(!user) continue;
if (!user) continue;
const userData = new RoomUserData(user.roomIndex);
@ -92,7 +92,7 @@ export class RoomUsersHandler extends BaseHandler
userData.botSkills = user.botSkills;
userData.isModerator = user.isModerator;
if(!session.userDataManager.getUserData(user.roomIndex)) usersToAdd.push(userData);
if (!session.userDataManager.getUserData(user.roomIndex)) usersToAdd.push(userData);
session.userDataManager.updateUserData(userData);
}
@ -103,15 +103,15 @@ export class RoomUsersHandler extends BaseHandler
private onRoomUnitInfoEvent(event: RoomUnitInfoEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
const parser = event.getParser();
if(!parser) return;
if (!parser) return;
session.userDataManager.updateFigure(parser.unitId, parser.figure, parser.gender, false, false);
session.userDataManager.updateMotto(parser.unitId, parser.motto);
@ -123,41 +123,41 @@ export class RoomUsersHandler extends BaseHandler
private onRoomUnitRemoveEvent(event: RoomUnitRemoveEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
session.userDataManager.removeUserData(event.getParser().unitId);
}
private onRoomUnitDanceEvent(event: RoomUnitDanceEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const parser = event.getParser();
if(!parser) return;
if (!parser) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
this.listener.events.dispatchEvent(new RoomSessionDanceEvent(session, parser.unitId, parser.danceId));
}
private onUserCurrentBadgesEvent(event: UserCurrentBadgesEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const parser = event.getParser();
if(!parser) return;
if (!parser) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
session.userDataManager.setUserBadges(parser.userId, parser.badges);
@ -166,49 +166,49 @@ export class RoomUsersHandler extends BaseHandler
private onRoomDoorbellEvent(event: DoorbellMessageEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const parser = event.getParser();
if(!parser) return;
if (!parser) return;
const username = parser.userName;
if(!username || !username.length) return;
if (!username || !username.length) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
this.listener.events.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.DOORBELL, session, username));
}
private onUserNameChangeMessageEvent(event: UserNameChangeMessageEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const parser = event.getParser();
if(!parser) return;
if (!parser) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
session.userDataManager.updateName(parser.id, parser.newName);
}
private onNewFriendRequestEvent(event: NewFriendRequestEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const parser = event.getParser();
if(!parser) return;
if (!parser) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
const request = parser.request;
@ -217,15 +217,15 @@ export class RoomUsersHandler extends BaseHandler
private onPetInfoEvent(event: PetInfoEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const parser = event.getParser();
if(!parser) return;
if (!parser) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
const petData = new RoomPetData();
@ -261,15 +261,15 @@ export class RoomUsersHandler extends BaseHandler
private onPetStatusUpdateEvent(event: PetStatusUpdateEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const parser = event.getParser();
if(!parser) return;
if (!parser) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
session.userDataManager.updatePetBreedingStatus(parser.roomIndex, parser.canBreed, parser.canHarvest, parser.canRevive, parser.hasBreedingPermission);
@ -278,15 +278,15 @@ export class RoomUsersHandler extends BaseHandler
private onPetFigureUpdateEvent(event: PetFigureUpdateEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const parser = event.getParser();
if(!parser) return;
if (!parser) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
const figure = parser.figureData.figuredata;
@ -297,21 +297,21 @@ export class RoomUsersHandler extends BaseHandler
private onPetPlacingError(event: PetPlacingErrorEvent): void
{
if(!event) return;
if (!event) return;
if(!this.listener) return;
if (!this.listener) return;
const parser = event.getParser();
if(!parser) return;
if (!parser) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
let type: string = null;
switch(parser.errorCode)
switch (parser.errorCode)
{
case 0:
type = RoomSessionErrorMessageEvent.RSEME_PETS_FORBIDDEN_IN_HOTEL;
@ -333,28 +333,28 @@ export class RoomUsersHandler extends BaseHandler
break;
}
if(!type || type.length == 0) return;
if (!type || type.length == 0) return;
this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, session));
}
private onBotError(event: BotErrorEvent): void
{
if(!event) return;
if (!event) return;
if(!this.listener) return;
if (!this.listener) return;
const parser = event.getParser();
if(!parser) return;
if (!parser) return;
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
let type: string = null;
switch(parser.errorCode)
switch (parser.errorCode)
{
case 0:
type = RoomSessionErrorMessageEvent.RSEME_BOTS_FORBIDDEN_IN_HOTEL;
@ -373,23 +373,23 @@ export class RoomUsersHandler extends BaseHandler
break;
}
if(!type || type.length == 0) return;
if (!type || type.length == 0) return;
this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, session));
}
private onFavoriteMembershipUpdateMessageEvent(event: FavoriteMembershipUpdateMessageEvent): void
{
if(!this.listener) return;
if (!this.listener) return;
const parser = event.getParser();
const session = this.listener.getSession(this.roomId);
if(!session) return;
if (!session) return;
const userData = session.userDataManager.getUserDataByIndex(parser.roomIndex);
if(!userData) return;
if (!userData) return;
userData.groupId = parser.groupId;
userData.groupName = parser.groupName;