mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-02-17 02:22:36 +01:00
added crafting packets
This commit is contained in:
parent
37f5bf6a10
commit
e87cf83f4a
@ -24,6 +24,10 @@ import { MarketplaceOwnItemsEvent } from './messages/incoming/catalog/marketplac
|
||||
import { MarketplaceConfigEvent } from './messages/incoming/catalog/MarketplaceConfigEvent';
|
||||
import { MarketplaceItemStatsEvent } from './messages/incoming/catalog/MarketplaceItemStatsEvent';
|
||||
import { ClientPingEvent } from './messages/incoming/client/ClientPingEvent';
|
||||
import { CraftableProductsEvent } from './messages/incoming/crafting/CraftableProductsEvent';
|
||||
import { CraftingRecipeEvent } from './messages/incoming/crafting/CraftingRecipeEvent';
|
||||
import { CraftingRecipesAvailableEvent } from './messages/incoming/crafting/CraftingRecipesAvailableEvent';
|
||||
import { CraftingResultEvent } from './messages/incoming/crafting/CraftingResultEvent';
|
||||
import { DesktopViewEvent } from './messages/incoming/desktop/DesktopViewEvent';
|
||||
import { AcceptFriendResultEvent } from './messages/incoming/friendlist/AcceptFriendResultEvent';
|
||||
import { FindFriendsProcessResultEvent } from './messages/incoming/friendlist/FindFriendsProcessResultEvent';
|
||||
@ -244,6 +248,11 @@ import { RedeemItemClothingComposer } from './messages/outgoing/catalog/RedeemIt
|
||||
import { CatalogRedeemVoucherComposer } from './messages/outgoing/catalog/RedeemVoucherComposer';
|
||||
import { ClientPongComposer } from './messages/outgoing/client/ClientPongComposer';
|
||||
import { ClientReleaseVersionComposer } from './messages/outgoing/client/ClientReleaseVersionComposer';
|
||||
import { CraftComposer } from './messages/outgoing/crafting/CraftComposer';
|
||||
import { CraftSecretComposer } from './messages/outgoing/crafting/CraftSecretComposer';
|
||||
import { GetCraftableProductsComposer } from './messages/outgoing/crafting/GetCraftableProductsComposer';
|
||||
import { GetCraftingRecipeComposer } from './messages/outgoing/crafting/GetCraftingRecipeComposer';
|
||||
import { GetCraftingRecipesAvailableComposer } from './messages/outgoing/crafting/GetCraftingRecipesAvailableComposer';
|
||||
import { DesktopViewComposer } from './messages/outgoing/desktop/DesktopViewComposer';
|
||||
import { AcceptFriendComposer } from './messages/outgoing/friendlist/AcceptFriendComposer';
|
||||
import { DeclineFriendComposer } from './messages/outgoing/friendlist/DeclineFriendComposer';
|
||||
@ -795,6 +804,12 @@ export class NitroMessages implements IMessageConfiguration
|
||||
this._events.set(IncomingHeader.SEASONAL_QUESTS, SeasonalQuestsMessageEvent);
|
||||
this._events.set(IncomingHeader.QUESTS, QuestsMessageEvent);
|
||||
this._events.set(IncomingHeader.QUEST, QuestMessageEvent);
|
||||
|
||||
// CRAFTING
|
||||
this._events.set(IncomingHeader.CRAFTABLE_PRODUCTS, CraftableProductsEvent);
|
||||
this._events.set(IncomingHeader.CRAFTING_RECIPE, CraftingRecipeEvent);
|
||||
this._events.set(IncomingHeader.CRAFTING_RECIPES_AVAILABLE, CraftingRecipesAvailableEvent);
|
||||
this._events.set(IncomingHeader.CRAFTING_RESULT, CraftingResultEvent);
|
||||
}
|
||||
|
||||
private registerComposers(): void
|
||||
@ -1133,6 +1148,13 @@ export class NitroMessages implements IMessageConfiguration
|
||||
this._composers.set(OutgoingHeader.REDEEM_COMMUNITY_GOAL_PRIZE, RedeemCommunityGoalPrizeMessageComposer);
|
||||
this._composers.set(OutgoingHeader.REJECT_QUEST, RejectQuestMessageComposer);
|
||||
this._composers.set(OutgoingHeader.START_CAMPAIGN, StartCampaignMessageComposer);
|
||||
|
||||
// CRAFTING
|
||||
this._composers.set(OutgoingHeader.CRAFT, CraftComposer);
|
||||
this._composers.set(OutgoingHeader.CRAFT_SECRET, CraftSecretComposer);
|
||||
this._composers.set(OutgoingHeader.GET_CRAFTABLE_PRODUCTS, GetCraftableProductsComposer);
|
||||
this._composers.set(OutgoingHeader.GET_CRAFTING_RECIPE, GetCraftingRecipeComposer);
|
||||
this._composers.set(OutgoingHeader.GET_CRAFTING_RECIPES_AVAILABLE, GetCraftingRecipesAvailableComposer);
|
||||
}
|
||||
|
||||
public get events(): Map<number, Function>
|
||||
|
@ -266,4 +266,8 @@ export class IncomingHeader
|
||||
public static QUESTS = 3625;
|
||||
public static QUEST = 230;
|
||||
public static BONUS_RARE_INFO = 1533;
|
||||
public static CRAFTABLE_PRODUCTS = 1000;
|
||||
public static CRAFTING_RECIPE = 2774;
|
||||
public static CRAFTING_RECIPES_AVAILABLE = 2124;
|
||||
public static CRAFTING_RESULT = 618;
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
|
||||
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
|
||||
import { CraftableProductsMessageParser } from '../../parser/crafting/CraftableProductsMessageParser';
|
||||
|
||||
export class CraftableProductsEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, CraftableProductsMessageParser);
|
||||
}
|
||||
|
||||
public getParser(): CraftableProductsMessageParser
|
||||
{
|
||||
return this.parser as CraftableProductsMessageParser;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
|
||||
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
|
||||
import { CraftingRecipeMessageParser } from '../../parser/crafting/CraftingRecipeMessageParser';
|
||||
|
||||
export class CraftingRecipeEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, CraftingRecipeMessageParser);
|
||||
}
|
||||
|
||||
public getParser(): CraftingRecipeMessageParser
|
||||
{
|
||||
return this.parser as CraftingRecipeMessageParser;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
|
||||
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
|
||||
import { CraftingRecipesAvailableMessageParser } from '../../parser/crafting/CraftingRecipesAvailableMessageParser';
|
||||
|
||||
export class CraftingRecipesAvailableEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, CraftingRecipesAvailableMessageParser);
|
||||
}
|
||||
|
||||
public getParser(): CraftingRecipesAvailableMessageParser
|
||||
{
|
||||
return this.parser as CraftingRecipesAvailableMessageParser;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
|
||||
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
|
||||
import { CraftingResultMessageParser } from '../../parser/crafting/CraftingResultMessageParser';
|
||||
|
||||
export class CraftingResultEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, CraftingResultMessageParser);
|
||||
}
|
||||
|
||||
public getParser(): CraftingResultMessageParser
|
||||
{
|
||||
return this.parser as CraftingResultMessageParser;
|
||||
}
|
||||
}
|
@ -264,5 +264,10 @@ export class OutgoingHeader
|
||||
public static REDEEM_COMMUNITY_GOAL_PRIZE = 90;
|
||||
public static REJECT_QUEST = 2397;
|
||||
public static START_CAMPAIGN = 1697;
|
||||
public static GET_BONUS_RARE_INFO = 957;
|
||||
public static GET_BONUS_RARE_INFO = 957;
|
||||
public static CRAFT = 3591;
|
||||
public static CRAFT_SECRET = 1251;
|
||||
public static GET_CRAFTABLE_PRODUCTS = 633;
|
||||
public static GET_CRAFTING_RECIPE = 1173;
|
||||
public static GET_CRAFTING_RECIPES_AVAILABLE = 3086;
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
|
||||
|
||||
export class CraftComposer implements IMessageComposer<ConstructorParameters<typeof CraftComposer>>
|
||||
{
|
||||
private _data: ConstructorParameters<typeof CraftComposer>;
|
||||
|
||||
constructor(k: number, _arg_2: string)
|
||||
{
|
||||
this._data = [k, _arg_2];
|
||||
}
|
||||
|
||||
public getMessageArray()
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
|
||||
|
||||
export class CraftSecretComposer implements IMessageComposer<number[]>
|
||||
{
|
||||
private _data: number[];
|
||||
|
||||
constructor(k: number, _arg_2:number[])
|
||||
{
|
||||
this._data = [k, _arg_2.length].concat(_arg_2);
|
||||
}
|
||||
|
||||
public getMessageArray()
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
|
||||
|
||||
export class GetCraftableProductsComposer implements IMessageComposer<ConstructorParameters<typeof GetCraftableProductsComposer>>
|
||||
{
|
||||
private _data: ConstructorParameters<typeof GetCraftableProductsComposer>;
|
||||
|
||||
constructor(k: string)
|
||||
{
|
||||
this._data = [k];
|
||||
}
|
||||
|
||||
public getMessageArray()
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
|
||||
|
||||
export class GetCraftingRecipeComposer implements IMessageComposer<ConstructorParameters<typeof GetCraftingRecipeComposer>>
|
||||
{
|
||||
private _data: ConstructorParameters<typeof GetCraftingRecipeComposer>;
|
||||
|
||||
constructor(k: number)
|
||||
{
|
||||
this._data = [k];
|
||||
}
|
||||
|
||||
public getMessageArray()
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
|
||||
|
||||
export class GetCraftingRecipesAvailableComposer implements IMessageComposer<number[]>
|
||||
{
|
||||
private _data: number[];
|
||||
|
||||
constructor(k: number, _arg_2:number[])
|
||||
{
|
||||
this._data = [k, _arg_2.length].concat(_arg_2);
|
||||
}
|
||||
|
||||
public getMessageArray()
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
import { IMessageParser } from './../../../../../core/communication/messages/IMessageParser';
|
||||
import { CraftingResultObjectParser } from './CraftingResultObjectParser';
|
||||
|
||||
export class CraftableProductsMessageParser implements IMessageParser
|
||||
{
|
||||
private _recipes: CraftingResultObjectParser[];
|
||||
private _ingredients: string[];
|
||||
|
||||
constructor()
|
||||
{
|
||||
this._recipes = [];
|
||||
this._ingredients = [];
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._recipes = [];
|
||||
this._ingredients = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
const craftingResultCount = wrapper.readInt();
|
||||
for(let i = 0; i < craftingResultCount; i++)
|
||||
{
|
||||
this._recipes.push(new CraftingResultObjectParser(wrapper));
|
||||
}
|
||||
const ingredientCount = wrapper.readInt();
|
||||
for(let i = 0; i < ingredientCount; i++)
|
||||
{
|
||||
this._ingredients.push(wrapper.readString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public get recipes(): CraftingResultObjectParser[]
|
||||
{
|
||||
return this._recipes;
|
||||
}
|
||||
|
||||
public get ingredients(): string[]
|
||||
{
|
||||
return this._ingredients;
|
||||
}
|
||||
|
||||
public isActive(): boolean
|
||||
{
|
||||
return (this._recipes.length > 0) || (this._ingredients.length > 0);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
|
||||
export class CraftingRecipeIngredientParser
|
||||
{
|
||||
private _count: number;
|
||||
private _itemName: string;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._count = wrapper.readInt();
|
||||
this._itemName = wrapper.readString();
|
||||
}
|
||||
|
||||
public get count(): number
|
||||
{
|
||||
return this._count;
|
||||
}
|
||||
|
||||
public get itemName(): string
|
||||
{
|
||||
return this._itemName;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
import { IMessageParser } from './../../../../../core/communication/messages/IMessageParser';
|
||||
import { CraftingRecipeIngredientParser } from './CraftingRecipeIngredientParser';
|
||||
|
||||
export class CraftingRecipeMessageParser implements IMessageParser
|
||||
{
|
||||
private _ingredients: CraftingRecipeIngredientParser[];
|
||||
|
||||
constructor()
|
||||
{
|
||||
this._ingredients = [];
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
const ingredientCount = wrapper.readInt();
|
||||
for(let i = 0; i < ingredientCount; i++)
|
||||
{
|
||||
this._ingredients.push(new CraftingRecipeIngredientParser(wrapper));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._ingredients = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
public get ingredients(): CraftingRecipeIngredientParser[]
|
||||
{
|
||||
return this._ingredients;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
import { IMessageParser } from './../../../../../core/communication/messages/IMessageParser';
|
||||
|
||||
export class CraftingRecipesAvailableMessageParser implements IMessageParser
|
||||
{
|
||||
private _hasRecipes: boolean;
|
||||
private _count: number;
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
this._count = wrapper.readInt();
|
||||
this._hasRecipes = wrapper.readBoolean();
|
||||
return true;
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._count = 0;
|
||||
this._hasRecipes = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public get count(): number
|
||||
{
|
||||
return this._count;
|
||||
}
|
||||
|
||||
public get hasRecipes(): boolean
|
||||
{
|
||||
return this._hasRecipes;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
import { IMessageParser } from './../../../../../core/communication/messages/IMessageParser';
|
||||
import { CraftingResultObjectParser } from './CraftingResultObjectParser';
|
||||
|
||||
export class CraftingResultMessageParser implements IMessageParser
|
||||
{
|
||||
private _success: boolean;
|
||||
private _result: CraftingResultObjectParser;
|
||||
|
||||
public parse(wrapper:IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
this._success = wrapper.readBoolean();
|
||||
if(this._success)
|
||||
{
|
||||
this._result = new CraftingResultObjectParser(wrapper);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._success = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public get success(): boolean
|
||||
{
|
||||
return this._success;
|
||||
}
|
||||
|
||||
public get result():CraftingResultObjectParser
|
||||
{
|
||||
return this._result;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
|
||||
export class CraftingResultObjectParser
|
||||
{
|
||||
private _recipeName: string;
|
||||
private _itemName: string;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._recipeName = wrapper.readString();
|
||||
this._itemName = wrapper.readString();
|
||||
}
|
||||
|
||||
public get recipeName(): string
|
||||
{
|
||||
return this._recipeName;
|
||||
}
|
||||
|
||||
public get itemName(): string
|
||||
{
|
||||
return this._itemName;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user