You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-20 07:26:18 +00:00
Move to Renderer V2
This commit is contained in:
+83
@@ -0,0 +1,83 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CompetitionEntrySubmitResultMessageParser implements IMessageParser
|
||||
{
|
||||
public static SUBMITTED: number = 0;
|
||||
public static ASK_FOR_SUBMIT: number = 1;
|
||||
public static ASK_FOR_CONFIRM: number = 2;
|
||||
public static PREREQUISITES_NOT_MET: number = 3;
|
||||
public static ROOM_DOOR_NOT_OPEN: number = 4;
|
||||
public static ROOM_TOO_OLD: number = 5;
|
||||
public static ASK_FOR_ACCEPT_RULES: number = 6;
|
||||
|
||||
private _goalId: number;
|
||||
private _goalCode: string;
|
||||
private _result: number;
|
||||
private _requiredFurnis: string[];
|
||||
private _missingFurnis: { [index: string]: string };
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._goalId = 0;
|
||||
this._goalCode = null;
|
||||
this._result = 0;
|
||||
this._requiredFurnis = null;
|
||||
this._missingFurnis = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._goalId = wrapper.readInt();
|
||||
this._goalCode = wrapper.readString();
|
||||
this._result = wrapper.readInt();
|
||||
this._requiredFurnis = [];
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
this._requiredFurnis.push(wrapper.readString());
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
|
||||
count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
this._missingFurnis[wrapper.readString()] = '';
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get goalId(): number
|
||||
{
|
||||
return this._goalId;
|
||||
}
|
||||
|
||||
public get goalCode(): string
|
||||
{
|
||||
return this._goalCode;
|
||||
}
|
||||
|
||||
public get result(): number
|
||||
{
|
||||
return this._result;
|
||||
}
|
||||
|
||||
public get requiredFurnis(): string[]
|
||||
{
|
||||
return this._requiredFurnis;
|
||||
}
|
||||
|
||||
public isMissing(name: string): boolean
|
||||
{
|
||||
return !!this._missingFurnis[name];
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { CompetitionVotingInfoResult } from './CompetitionVotingInfoResult';
|
||||
|
||||
export class CompetitionVotingInfoMessageParser implements IMessageParser
|
||||
{
|
||||
private _goalId: number;
|
||||
private _goalCode: string;
|
||||
private _resultCode: number;
|
||||
private _votesRemaining: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._goalId = 0;
|
||||
this._goalCode = null;
|
||||
this._resultCode = 0;
|
||||
this._votesRemaining = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._goalId = wrapper.readInt();
|
||||
this._goalCode = wrapper.readString();
|
||||
this._resultCode = wrapper.readInt();
|
||||
this._votesRemaining = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get goalId(): number
|
||||
{
|
||||
return this._goalId;
|
||||
}
|
||||
|
||||
public get goalCode(): string
|
||||
{
|
||||
return this._goalCode;
|
||||
}
|
||||
|
||||
public get isVotingAllowedForUser(): boolean
|
||||
{
|
||||
return (this._resultCode === CompetitionVotingInfoResult.ALLOWED);
|
||||
}
|
||||
|
||||
public get votesRemaining(): number
|
||||
{
|
||||
return this._votesRemaining;
|
||||
}
|
||||
|
||||
public get resultCode(): number
|
||||
{
|
||||
return this._resultCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export class CompetitionVotingInfoResult
|
||||
{
|
||||
public static ALLOWED: number = 0;
|
||||
public static REQUIRED_PERK_MISSING: number = 1;
|
||||
public static REQUIRED_BADGE_MISSING: number = 2;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CurrentTimingCodeMessageParser implements IMessageParser
|
||||
{
|
||||
private _schedulingStr: string;
|
||||
private _code: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._schedulingStr = null;
|
||||
this._code = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._schedulingStr = wrapper.readString();
|
||||
this._code = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get schedulingStr(): string
|
||||
{
|
||||
return this._schedulingStr;
|
||||
}
|
||||
|
||||
public get code(): string
|
||||
{
|
||||
return this._code;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class IsUserPartOfCompetitionMessageParser implements IMessageParser
|
||||
{
|
||||
private _isPartOf: boolean;
|
||||
private _targetId: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._isPartOf = false;
|
||||
this._targetId = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._isPartOf = wrapper.readBoolean();
|
||||
this._targetId = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get isPartOf(): boolean
|
||||
{
|
||||
return this._isPartOf;
|
||||
}
|
||||
|
||||
public get targetId(): number
|
||||
{
|
||||
return this._targetId;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class NoOwnedRoomsAlertMessageParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class SecondsUntilMessageParser implements IMessageParser
|
||||
{
|
||||
private _timeStr: string;
|
||||
private _secondsUntil: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._timeStr = null;
|
||||
this._secondsUntil = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._timeStr = wrapper.readString();
|
||||
this._secondsUntil = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get timeStr(): string
|
||||
{
|
||||
return this._timeStr;
|
||||
}
|
||||
|
||||
public get secondsUntil(): number
|
||||
{
|
||||
return this._secondsUntil;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export * from './CompetitionEntrySubmitResultMessageParser';
|
||||
export * from './CompetitionVotingInfoMessageParser';
|
||||
export * from './CompetitionVotingInfoResult';
|
||||
export * from './CurrentTimingCodeMessageParser';
|
||||
export * from './IsUserPartOfCompetitionMessageParser';
|
||||
export * from './NoOwnedRoomsAlertMessageParser';
|
||||
export * from './SecondsUntilMessageParser';
|
||||
Reference in New Issue
Block a user