Merge branch 'oobjectt-rentable-space-status'

This commit is contained in:
dank074 2023-01-03 02:31:58 -06:00
commit 0a3b6762e8
6 changed files with 102 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -440,4 +440,5 @@ export class IncomingHeader
public static HANDSHAKE_INIT_DIFFIE = 1347;
public static HANDSHAKE_COMPLETE_DIFFIE = 3885;
public static RENTABLE_SPACE_RENT_OK = 2046;
public static RENTABLE_SPACE_STATUS = 3559;
}

View File

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

View File

@ -11,6 +11,7 @@ export * from './LoveLockFurniFriendConfirmedEvent';
export * from './LoveLockFurniStartEvent';
export * from './OneWayDoorStatusMessageEvent';
export * from './RentableSpaceRentOkMessageEvent';
export * from './RentableSpaceStatusMessageEvent';
export * from './RequestSpamWallPostItMessageEvent';
export * from './RoomDimmerPresetsMessageEvent';
export * from './RoomMessageNotificationMessageEvent';

View File

@ -0,0 +1,81 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../api';
export class RentableSpaceStatusMessageParser implements IMessageParser
{
private _rented: boolean;
private _renterId: number;
private _renterName: string;
private _canRent: boolean;
private _canRentErrorCode: number;
private _timeRemaining: number;
private _price: number;
public flush(): boolean
{
this._rented = false;
this._renterId = -1;
this._renterName = null;
this._canRent = false;
this._canRentErrorCode = -1;
this._timeRemaining = -1;
this._price = -1;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._rented = wrapper.readBoolean();
this._canRentErrorCode = wrapper.readInt();
this._canRent = (this._canRentErrorCode === 0);
this._renterId = wrapper.readInt();
this._renterName = wrapper.readString();
this._timeRemaining = wrapper.readInt();
this._price = wrapper.readInt();
if(!this._rented)
{
this._renterId = -1;
this._renterName = '';
}
return true;
}
public get rented(): boolean
{
return this._rented;
}
public get renterId(): number
{
return this._renterId;
}
public get renterName(): string
{
return this._renterName;
}
public get canRent(): boolean
{
return this._canRent;
}
public get price(): number
{
return this._price;
}
public get timeRemaining(): number
{
return this._timeRemaining;
}
public get canRentErrorCode(): number
{
return this._canRentErrorCode;
}
}

View File

@ -11,6 +11,7 @@ export * from './LoveLockFurniFriendConfirmedParser';
export * from './LoveLockFurniStartParser';
export * from './OneWayDoorStatusMessageParser';
export * from './RentableSpaceRentOkMessageParser';
export * from './RentableSpaceStatusMessageParser';
export * from './RequestSpamWallPostItMessageParser';
export * from './RoomDimmerPresetsMessageData';
export * from './RoomDimmerPresetsMessageParser';