You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 23:16:20 +00:00
Move to Renderer V2
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { BotData } from './BotData';
|
||||
|
||||
export class BotAddedToInventoryParser implements IMessageParser
|
||||
{
|
||||
private _item: BotData;
|
||||
private _openInventory: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._item = null;
|
||||
this._openInventory = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._item = new BotData(wrapper);
|
||||
this._openInventory = wrapper.readBoolean();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get item(): BotData
|
||||
{
|
||||
return this._item;
|
||||
}
|
||||
|
||||
public openInventory(): boolean
|
||||
{
|
||||
return this._openInventory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class BotData
|
||||
{
|
||||
private _id: number;
|
||||
private _name: string;
|
||||
private _motto: string;
|
||||
private _gender: string;
|
||||
private _figure: string;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_parser');
|
||||
|
||||
this._id = wrapper.readInt();
|
||||
this._name = wrapper.readString();
|
||||
this._motto = wrapper.readString();
|
||||
this._gender = wrapper.readString();
|
||||
this._figure = wrapper.readString();
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get motto(): string
|
||||
{
|
||||
return this._motto;
|
||||
}
|
||||
|
||||
public get figure(): string
|
||||
{
|
||||
return this._figure;
|
||||
}
|
||||
|
||||
public get gender(): string
|
||||
{
|
||||
return this._gender;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { BotData } from './BotData';
|
||||
|
||||
export class BotInventoryMessageParser implements IMessageParser
|
||||
{
|
||||
private _items: Map<number, BotData>;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._items = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._items = new Map();
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
const data = new BotData(wrapper);
|
||||
|
||||
this._items.set(data.id, data);
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get items(): Map<number, BotData>
|
||||
{
|
||||
return this._items;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { BotData } from './BotData';
|
||||
|
||||
export class BotReceivedMessageParser implements IMessageParser
|
||||
{
|
||||
private _boughtAsGift: boolean;
|
||||
private _item: BotData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._boughtAsGift = false;
|
||||
this._item = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._boughtAsGift = wrapper.readBoolean();
|
||||
this._item = new BotData(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get boughtAsGift(): boolean
|
||||
{
|
||||
return this._boughtAsGift;
|
||||
}
|
||||
|
||||
public get item(): BotData
|
||||
{
|
||||
return this._item;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class BotRemovedFromInventoryParser implements IMessageParser
|
||||
{
|
||||
private _itemId: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._itemId = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._itemId = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get itemId(): number
|
||||
{
|
||||
return this._itemId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export * from './BotAddedToInventoryParser';
|
||||
export * from './BotData';
|
||||
export * from './BotInventoryMessageParser';
|
||||
export * from './BotReceivedMessageParser';
|
||||
export * from './BotRemovedFromInventoryParser';
|
||||
Reference in New Issue
Block a user