Skip to content

Instantly share code, notes, and snippets.

@sonygod
Created March 11, 2013 10:02
Show Gist options
  • Save sonygod/5133191 to your computer and use it in GitHub Desktop.
Save sonygod/5133191 to your computer and use it in GitHub Desktop.
package proxy;
import haxe.ds.Vector;
import proxy.Utype;
/**
* ...
* @author sonygod
*/
typedef BaseRoleItem = {
var entityId:UInt32;
var itemId:UInt16;
var num:UInt8;
var time:UInt32;
}
typedef CellItem = {
>BaseRoleItem,
var storeType:UInt8;
var cellIndex:UInt8;
}
typedef RoleBag = {
var topCellNum:UInt8;
var cellItems:haxe.ds.Vector<CellItem>;
}
typedef ItemAttribute = {
var type:UInt8;
var value:UInt32;
}
typedef EntityAttribute =
{
var entityId:UInt32 ;
var attributes:haxe.ds.Vector<ItemAttribute >;
}
typedef EntityItem = {
>CellItem,
var attributes:haxe.ds.Vector<ItemAttribute >;
}
typedef EntityNum =
{
var entityId:UInt32;
var storeType:UInt8;
var num:UInt8;
}
typedef ItemSell = {
var itemId:UInt16;
var num:UInt16;
var sellType:UInt8;
var price:UInt32;
}
typedef RefreshItemSell={
var refreshTime:UInt32;
var items:haxe.ds.Vector<ItemSell> ;
}
typedef ShopCanBuyItem={
var itemId:UInt16;
var canBuyNum:UInt16;
}
//黑市剩余物品刷新
typedef BlackShopItemTotal={
var npcId:UInt32;
var itemId:UInt16;
var leftNum:UInt16;
}
interface Bag{
@index(1)
function getRoleBag( type:UInt8):RoleBag;
@index(2)
function getEntityAttributes(type:UInt8):haxe.ds.Vector<EntityAttribute>;
@index(3)
function dropItem( entityId:UInt32):Void;
@index(4)
function exchangeItem(entityId:UInt32 ,dstType:UInt8 , dstCell:UInt8):Void;
@index(5)
function stackItem( entityId:UInt32, dstType:UInt8, dstCell:UInt8):Void;
@index(6)
function sortItem(type:UInt8):haxe.ds.Vector<CellItem>;
//改成分页,并且返回的为EntityItem类型了
@index(7)
function getTempStore( page:UInt8, size:UInt8):haxe.ds.Vector< EntityItem>;
@index(8)
function getItemFromTempStore( entityId:UInt32, toType:UInt8, cellIndex:UInt8):Void ;
@index(9)
function dropFromTempStore( entityId:UInt32):Void ;
@index(10)
function useItem( entityId:UInt32, targetId:UInt32):Void;
@index(11)
function addBagCell( type:UInt8, num:UInt8):Void;
@index(12)
function buyItem( npcId:UInt32,itemId:UInt16 , num:UInt8, cellIndex:UInt8):UInt8;
@index(13)
function sellItem( npcId:UInt32, entityId:UInt32):Void;
@index(14)
function buyBackItem( entityId:UInt32,cellIndex:UInt8 ):Void;
//修改了,返回的内容为EntityItem
@index(15)
function getEntityItemInfo( entityId:UInt32):EntityItem;
//查询黑市商人出售物品列表,这个数据打开黑市商人,只需要查询一次
@index(16)
function getBlackNpcItemSell( npcId:UInt32):RefreshItemSell;
//查询普通NPC可以购买的物品,返回数组中有数值的表示具有数量限制,不在数组中的不包含数量限制
@index(17)
function getNpcShopCanBuy( npcId:UInt32): haxe.ds.Vector< ShopCanBuyItem>;
@index(18)
function clickToMoveItem( entityId:UInt32, type:UInt8):Void;
//移动多个临时背包物品
@index(19)
function moveAllTempItem( entityIds:haxe.ds.Vector< UInt32>):Void;
//是否有临时物品过期通知
@index(20)
function tempItemTimeCheck():Bool;
//获取邮件附件
@index(21)
function add_item_from_mail( mailId:UInt32, entityIds:haxe.ds.Vector< UInt32>):Void;
@index(22)
function openOrCloseShop( type:UInt8):Void ;
//物品拆分,
//@entityId 要拆分的实体ID
//@takeNUm 拆分出来的数量
@index(23)
function takeNumFromEntity( entityId:UInt32, takeNum:UInt8):Void;
//黑市商人合计数量,单个npc下的剩余可购买数量也来源这里
@index(24)
function getBlackShopItemTotal():haxe.ds.Vector< BlackShopItemTotal>;
//-----------------function----------------------------------
//获得新物品,调整了获得的参数,参数1为新增加的实体全部堆叠,entitys则为后面参数,eNums为增加带来的堆叠
@event(1)
function onGetNewItem( entitys:haxe.ds.Vector< EntityItem>, eNums:haxe.ds.Vector< EntityNum>):Void;
//临时背包物品增加,目前放在协议1,获得新物品
//暂时不使用
@event(2)
function onGetTempItem( entitys:haxe.ds.Vector< EntityItem>, eNums:haxe.ds.Vector< EntityNum>):Void;
//背包物品被动变化
//去掉以前的type,type在EntityNum里面有定义
@event(3)
function onBagItemChange( entitys:haxe.ds.Vector< EntityNum>):Void;
//修改了,发送当前临时物品数量(原来是一条临时仓库物品变化协议,原来未使用)
@event(4)
function onTempStoreItemNum( num:UInt16):Void;
//从背包或者仓库或者临时仓库移动过来一个物品
//修改了,去掉了当前的toType,定义到了CellItem 原来为(UInt8 fromType,UInt8 toType,CellItem entity)
@event(5)
function onBagMoveItem( fromType:UInt8, entity:CellItem):Void;
@event(6)
function onGetItem( entity:EntityItem):Void;
//s-c单个物品出售情况
@event(7)
function onBlackShopItemTotal( info:BlackShopItemTotal):Void;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment