示例#1
0
        //摊位出售道具
        public void SellItem(PlayerObject play, uint item_id, byte type, int price)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) == null) return;
            uint ptich_obj_id = GetPtichObjectTypeID(play.GetCurrentPtichID());
            GameStruct.RoleItemInfo item = null;
            if (ptich_obj_id == 0) return;
            if (item_id >= IDManager.eudemon_start_id)
            {

                RoleData_Eudemon eudemon = play.GetEudemonSystem().FindEudemon(item_id);
                if (eudemon == null) return;
                item = play.GetItemSystem().FindItem(eudemon.itemid);
                if (item == null) return;
            }
            else
            {
                item = play.GetItemSystem().FindItem(item_id);
                if (item == null) return;
            }

            if (ptich_obj_id == 0) return;
            //判断是否已经在出售摊位列表中- 反作弊
            int nPtichId = play.GetCurrentPtichID();
            for (int i = 0; i < mListPtichInfo[nPtichId].mSellItemList.Count; i++)
            {
                if (mListPtichInfo[nPtichId].mSellItemList[i].item_id == item_id)
                {
                    return;
                }
            }
            //摆摊出售道具已满
            if (mListPtichInfo[nPtichId].mSellItemList.Count >= GameBase.Config.Define.PTICH_SELL_MAX_COUNT)
            {
                return;
            }
            PacketOut outpack = new PacketOut();
            outpack.WriteInt16(28);
            outpack.WriteInt16(1009);
            outpack.WriteUInt32(item_id);
            outpack.WriteInt32(price);
            outpack.WriteInt32(type);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            play.SendData(outpack.Flush(), true);
            //移到摊位状态
            item.postion = NetMsg.MsgItemInfo.ITEMPOSTION_PTICH_PACK;

            PtichSellItemInfo info = new PtichSellItemInfo();
            info.item_id = item_id;
            info.price = price;
            info.sell_type = type;
            mListPtichInfo[nPtichId].mSellItemList.Add(info);
            // {28,0,241,3,8,127,205,7,111,0,0,0,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
        }
示例#2
0
        //摊位出售道具
        public void SellItem(PlayerObject play, uint item_id, byte type, int price)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) == null)
            {
                return;
            }
            uint ptich_obj_id = GetPtichObjectTypeID(play.GetCurrentPtichID());

            GameStruct.RoleItemInfo item = null;
            if (ptich_obj_id == 0)
            {
                return;
            }
            if (item_id >= IDManager.eudemon_start_id)
            {
                RoleData_Eudemon eudemon = play.GetEudemonSystem().FindEudemon(item_id);
                if (eudemon == null)
                {
                    return;
                }
                item = play.GetItemSystem().FindItem(eudemon.itemid);
                if (item == null)
                {
                    return;
                }
            }
            else
            {
                item = play.GetItemSystem().FindItem(item_id);
                if (item == null)
                {
                    return;
                }
            }

            if (ptich_obj_id == 0)
            {
                return;
            }
            //判断是否已经在出售摊位列表中- 反作弊
            int nPtichId = play.GetCurrentPtichID();

            for (int i = 0; i < mListPtichInfo[nPtichId].mSellItemList.Count; i++)
            {
                if (mListPtichInfo[nPtichId].mSellItemList[i].item_id == item_id)
                {
                    return;
                }
            }
            //摆摊出售道具已满
            if (mListPtichInfo[nPtichId].mSellItemList.Count >= GameBase.Config.Define.PTICH_SELL_MAX_COUNT)
            {
                return;
            }
            PacketOut outpack = new PacketOut();

            outpack.WriteInt16(28);
            outpack.WriteInt16(1009);
            outpack.WriteUInt32(item_id);
            outpack.WriteInt32(price);
            outpack.WriteInt32(type);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            play.SendData(outpack.Flush(), true);
            //移到摊位状态
            item.postion = NetMsg.MsgItemInfo.ITEMPOSTION_PTICH_PACK;


            PtichSellItemInfo info = new PtichSellItemInfo();

            info.item_id   = item_id;
            info.price     = price;
            info.sell_type = type;
            mListPtichInfo[nPtichId].mSellItemList.Add(info);
            // {28,0,241,3,8,127,205,7,111,0,0,0,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
        }