Merge branch 'oobjectt-incoming-game2-directory-status'

This commit is contained in:
dank074 2023-01-04 00:50:07 -06:00
commit d983b38eb8
6 changed files with 82 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -38,6 +38,7 @@ export class IncomingHeader
public static GAME_CENTER_IN_ARENA_QUEUE = 872; public static GAME_CENTER_IN_ARENA_QUEUE = 872;
public static GAME_CENTER_STOP_COUNTER = 3191; public static GAME_CENTER_STOP_COUNTER = 3191;
public static GAME_CENTER_USER_LEFT_GAME = 3138; public static GAME_CENTER_USER_LEFT_GAME = 3138;
public static GAME_CENTER_DIRECTORY_STATUS = 2246;
public static GAMESTATUSMESSAGE = 3805; public static GAMESTATUSMESSAGE = 3805;
public static GAMEACHIEVEMENTS = 1689; public static GAMEACHIEVEMENTS = 1689;
public static GAMEINVITE = 904; public static GAMEINVITE = 904;

View File

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

View File

@ -1,4 +1,5 @@
export * from './Game2AccountGameStatusMessageEvent'; export * from './Game2AccountGameStatusMessageEvent';
export * from './Game2GameDirectoryStatusMessageEvent';
export * from './Game2InArenaQueueMessageEvent'; export * from './Game2InArenaQueueMessageEvent';
export * from './Game2StopCounterMessageEvent'; export * from './Game2StopCounterMessageEvent';
export * from './Game2UserLeftGameMessageEvent'; export * from './Game2UserLeftGameMessageEvent';

View File

@ -0,0 +1,61 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../api';
export class Game2GameDirectoryStatusMessageParser implements IMessageParser
{
public static readonly STATUS_OK: number = 0;
public static readonly STATUS_FAILED_REASON_UNKNOWN: number = 1;
public static readonly STATUS_FAILED_REASON_GAME_DIRECTORY_IS_NOT_AVAILABLE: number = 2;
public static readonly STATUS_FAILED_REASON_HOTEL_IS_CLOSED: number = 3;
private _status: number;
private _blockLength: number;
private _gamesPlayed: number;
private _freeGamesLeft: number;
public flush(): boolean
{
this._status = -1;
this._blockLength = -1;
this._gamesPlayed = -1;
this._freeGamesLeft = -1;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._status = wrapper.readInt();
this._blockLength = wrapper.readInt();
this._gamesPlayed = wrapper.readInt();
this._freeGamesLeft = wrapper.readInt();
return true;
}
public get status(): number
{
return this._status;
}
public get blockLength(): number
{
return this._blockLength;
}
public get gamesPlayed(): number
{
return this._gamesPlayed;
}
public get freeGamesLeft(): number
{
return this._freeGamesLeft;
}
public get hasUnlimitedGames(): boolean
{
return this._freeGamesLeft == -1;
}
}

View File

@ -1,4 +1,5 @@
export * from './Game2AccountGameStatusMessageParser'; export * from './Game2AccountGameStatusMessageParser';
export * from './Game2GameDirectoryStatusMessageParser';
export * from './Game2InArenaQueueMessageParser'; export * from './Game2InArenaQueueMessageParser';
export * from './Game2StopCounterMessageParser'; export * from './Game2StopCounterMessageParser';
export * from './Game2UserLeftGameMessageParser'; export * from './Game2UserLeftGameMessageParser';