public static void DoPveUseItem(Units unit, ItemInfo targetItem, List <ItemInfo> possessItemsP)
        {
            List <ItemInfo> items = new List <ItemInfo>(possessItemsP);

            BattleEquipTools_op.RemoveItem(items, targetItem);
            BattleEquipTools_op.SetHeroItems(unit, items);
        }
        public static void DoPveBuy(ShopInfo shopInfo, Units unit, string targetItemID, List <ItemInfo> possessItemsP, int realPrice)
        {
            List <ItemInfo> list        = new List <ItemInfo>(possessItemsP);
            List <string>   composition = BattleEquipTools_Travers.GetComposition(targetItemID, list);

            if (composition != null || composition.Count > 0)
            {
                for (int i = 0; i < composition.Count; i++)
                {
                    ItemInfo target;
                    int      index;
                    if (BattleEquipTools_Travers.GetItem_last_least(list, composition[i], out target, out index))
                    {
                        BattleEquipTools_op.RemoveItem(list, target, index);
                    }
                }
            }
            BattleEquipTools_op.AddItem(list, targetItemID);
            BattleEquipTools_op.ChangeHeroMoney(unit.unique_id, -realPrice);
            BattleEquipTools_op.SetHeroItems(unit, list);
            byte[] msgParam = SerializeHelper.Serialize <P2CBuyItem>(new P2CBuyItem
            {
                itemoid  = 0,
                retaCode = 0
            });
            MobaMessage message = MobaMessageManager.GetMessage(PvpCode.C2P_BuyItem, msgParam, 0f, null);

            MobaMessageManager.DispatchMsg(message);
        }
        private bool callback(SysBattleItemsVo info, int depth)
        {
            bool result = depth < this._depth;

            if (depth == 0)
            {
                this.equip_need.Clear();
            }
            else if (info != null)
            {
                ItemInfo target;
                int      index;
                if (BattleEquipTools_Travers.GetItem_first(this.equip_has, info.items_id, out target, out index))
                {
                    this.equip_need.Add(info.items_id);
                    BattleEquipTools_op.RemoveItem(this.equip_has, target, index);
                    result = false;
                }
            }
            else
            {
                result = false;
            }
            return(result);
        }
 public static bool RemoveItem(List <ItemInfo> items, ItemInfo target)
 {
     if (items != null || target != null)
     {
         int index = items.IndexOf(target);
         return(BattleEquipTools_op.RemoveItem(items, target, index));
     }
     return(false);
 }
        public static bool RemoveItem(List <ItemInfo> items, ItemInfo target, int index)
        {
            bool result = false;

            if (items != null && target != null)
            {
                if (!(result = BattleEquipTools_op.SubstractItemNum(target)))
                {
                    if (result = BattleEquipTools_op.RemoveItem(items, index))
                    {
                    }
                }
            }
            return(result);
        }
        public static void DoPveSell(ShopInfo shopInfo, Units unit, ItemInfo targetItem, List <ItemInfo> possessItemsP)
        {
            List <ItemInfo> items     = new List <ItemInfo>(possessItemsP);
            int             itemPrice = BattleEquipTools_config.GetItemPrice(targetItem.ID);
            int             delta     = (int)((float)itemPrice * 0.8f);

            BattleEquipTools_op.RemoveItem(items, targetItem);
            BattleEquipTools_op.ChangeHeroMoney(unit.unique_id, delta);
            BattleEquipTools_op.SetHeroItems(unit, items);
            byte[] msgParam = SerializeHelper.Serialize <P2CSellItem>(new P2CSellItem
            {
                itemoid  = 0,
                retaCode = 0
            });
            MobaMessage message = MobaMessageManager.GetMessage(PvpCode.C2P_SellItem, msgParam, 0f, null);

            MobaMessageManager.DispatchMsg(message);
        }