You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 06:56:19 +00:00
feat(communication): FurnitureDataReload incoming event + parser (header 10047)
This commit is contained in:
@@ -22,6 +22,7 @@ export * from './messages/incoming/crafting';
|
||||
export * from './messages/incoming/desktop';
|
||||
export * from './messages/incoming/friendlist';
|
||||
export * from './messages/incoming/furnieditor';
|
||||
export * from './messages/incoming/furniture';
|
||||
export * from './messages/incoming/game';
|
||||
export * from './messages/incoming/game/directory';
|
||||
export * from './messages/incoming/game/lobby';
|
||||
@@ -181,6 +182,7 @@ export * from './messages/parser/crafting';
|
||||
export * from './messages/parser/desktop';
|
||||
export * from './messages/parser/friendlist';
|
||||
export * from './messages/parser/furnieditor';
|
||||
export * from './messages/parser/furniture';
|
||||
export * from './messages/parser/game';
|
||||
export * from './messages/parser/game/directory';
|
||||
export * from './messages/parser/game/lobby';
|
||||
|
||||
@@ -493,6 +493,7 @@ export class IncomingHeader
|
||||
public static FURNI_EDITOR_DETAIL_RESULT = 10041;
|
||||
public static FURNI_EDITOR_INTERACTIONS_RESULT = 10043;
|
||||
public static FURNI_EDITOR_RESULT = 10044;
|
||||
public static FURNITURE_DATA_RELOAD = 10047;
|
||||
|
||||
// Catalog Admin
|
||||
public static CATALOG_ADMIN_RESULT = 10059;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IMessageEvent } from '@nitrots/api';
|
||||
import { MessageEvent } from '@nitrots/events';
|
||||
import { FurnitureDataReloadParser } from '../../parser/furniture/FurnitureDataReloadParser';
|
||||
|
||||
export class FurnitureDataReloadEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, FurnitureDataReloadParser);
|
||||
}
|
||||
|
||||
public getParser(): FurnitureDataReloadParser
|
||||
{
|
||||
return this.parser as FurnitureDataReloadParser;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './FurnitureDataReloadEvent';
|
||||
@@ -14,6 +14,7 @@ export * from './crafting';
|
||||
export * from './desktop';
|
||||
export * from './friendlist';
|
||||
export * from './furnieditor';
|
||||
export * from './furniture';
|
||||
export * from './game';
|
||||
export * from './game/directory';
|
||||
export * from './game/lobby';
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export interface FurnidataDeltaEntry
|
||||
{
|
||||
type: string; // "S" floor | "I" wall
|
||||
id: number;
|
||||
classname: string;
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export class FurnitureDataReloadParser implements IMessageParser
|
||||
{
|
||||
private static readonly MAX_ENTRIES = 100000;
|
||||
|
||||
private _mode: number;
|
||||
private _entries: FurnidataDeltaEntry[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._mode = 0;
|
||||
this._entries = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._mode = wrapper.readInt();
|
||||
this._entries = [];
|
||||
|
||||
if(this._mode === 0)
|
||||
{
|
||||
let count = wrapper.readInt();
|
||||
if(count < 0) count = 0;
|
||||
if(count > FurnitureDataReloadParser.MAX_ENTRIES) count = FurnitureDataReloadParser.MAX_ENTRIES;
|
||||
|
||||
for(let i = 0; i < count; i++)
|
||||
{
|
||||
this._entries.push({
|
||||
type: wrapper.readString(),
|
||||
id: wrapper.readInt(),
|
||||
classname: wrapper.readString(),
|
||||
name: wrapper.readString(),
|
||||
description: wrapper.readString()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get mode(): number { return this._mode; }
|
||||
public get entries(): FurnidataDeltaEntry[] { return this._entries; }
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './FurnitureDataReloadParser';
|
||||
@@ -13,6 +13,7 @@ export * from './crafting';
|
||||
export * from './desktop';
|
||||
export * from './friendlist';
|
||||
export * from './furnieditor';
|
||||
export * from './furniture';
|
||||
export * from './game';
|
||||
export * from './game/directory';
|
||||
export * from './game/lobby';
|
||||
|
||||
Reference in New Issue
Block a user