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:
@@ -0,0 +1,52 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { PerkData } from './common';
|
||||
|
||||
export class PerkAllowancesMessageParser implements IMessageParser
|
||||
{
|
||||
private _perks: PerkData[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._perks = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._perks = [];
|
||||
|
||||
const size: number = wrapper.readInt();
|
||||
|
||||
for(let i = 0; i < size; i++) this._perks.push(new PerkData(
|
||||
wrapper.readString(),
|
||||
wrapper.readString(),
|
||||
wrapper.readBoolean()
|
||||
));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public isAllowed(perkCode: string): boolean
|
||||
{
|
||||
let allowed = false;
|
||||
|
||||
for(const perk of this._perks)
|
||||
{
|
||||
if(perk.code === perkCode)
|
||||
{
|
||||
allowed = perk.isAllowed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return allowed;
|
||||
}
|
||||
|
||||
public get perks(): PerkData[]
|
||||
{
|
||||
return this._perks;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
export class PerkData
|
||||
{
|
||||
private _code: string;
|
||||
private _errorMessage: string;
|
||||
private _isAllowed: boolean;
|
||||
|
||||
constructor(code: string, errorMessage: string, isAllowed: boolean)
|
||||
{
|
||||
this._code = code;
|
||||
this._errorMessage = errorMessage;
|
||||
this._isAllowed = isAllowed;
|
||||
}
|
||||
|
||||
public get code(): string
|
||||
{
|
||||
return this._code;
|
||||
}
|
||||
|
||||
public get errorMessage(): string
|
||||
{
|
||||
return this._errorMessage;
|
||||
}
|
||||
|
||||
public get isAllowed(): boolean
|
||||
{
|
||||
return this._isAllowed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
export class PerkEnum
|
||||
{
|
||||
public static USE_GUIDE_TOOL: string = 'USE_GUIDE_TOOL';
|
||||
public static GIVE_GUIDE_TOUR: string = 'GIVE_GUIDE_TOUR';
|
||||
public static JUDGE_CHAT_REVIEWS: string = 'JUDGE_CHAT_REVIEWS';
|
||||
public static VOTE_IN_COMPETITIONS: string = 'VOTE_IN_COMPETITIONS';
|
||||
public static CALL_ON_HELPERS: string = 'CALL_ON_HELPERS';
|
||||
public static CITIZEN: string = 'CITIZEN';
|
||||
public static TRADE: string = 'TRADE';
|
||||
public static HEIGHTMAP_EDITOR_BETA: string = 'HEIGHTMAP_EDITOR_BETA';
|
||||
public static BUILDER_AT_WORK: string = 'BUILDER_AT_WORK';
|
||||
public static NAVIGATOR_ROOM_THUMBNAIL_CAMERA: string = 'NAVIGATOR_ROOM_THUMBNAIL_CAMERA';
|
||||
public static CAMERA: string = 'CAMERA';
|
||||
public static MOUSE_ZOOM: string = 'MOUSE_ZOOM';
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './PerkData';
|
||||
export * from './PerkEnum';
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './common';
|
||||
export * from './PerkAllowancesMessageParser';
|
||||
Reference in New Issue
Block a user