예제 #1
0
        public static List <string> GetComposition(string equipID, List <ItemInfo> givenList)
        {
            GetCompositEquipPossess getCompositEquipPossess = new GetCompositEquipPossess(equipID, givenList, 3);

            BattleEquipTools_Travers.TraverseEquipTree(equipID, getCompositEquipPossess, 0);
            return(getCompositEquipPossess.Result as List <string>);
        }
예제 #2
0
        public static List <ItemDynData> GetDynItemList(List <ItemInfo> list)
        {
            ItemListToDynItemList itemListToDynItemList = new ItemListToDynItemList();

            BattleEquipTools_Travers.TraverseList <ItemInfo>(list, itemListToDynItemList);
            return(itemListToDynItemList.Result as List <ItemDynData>);
        }
예제 #3
0
        public static List <string> GetComposition(string equipID)
        {
            GetEquipListByLastEquip getEquipListByLastEquip = new GetEquipListByLastEquip(true, 3, null);

            BattleEquipTools_Travers.TraverseEquipTree(equipID, getEquipListByLastEquip, 0);
            return(getEquipListByLastEquip.Result as List <string>);
        }
        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 void SetHeroItems(Units unit, List <ItemInfo> items)
 {
     if (items != null && items != null)
     {
         List <ItemDynData> dynItemList = BattleEquipTools_Travers.GetDynItemList(items);
         ((Hero)unit).EquipPackage.SetEquipList(dynItemList);
     }
 }
예제 #7
0
        public static List <ItemInfo> GetItemList(List <ItemDynData> list)
        {
            DynItemListToItemList dynItemListToItemList = new DynItemListToItemList();

            BattleEquipTools_Travers.TraverseList <ItemDynData>(list, dynItemListToItemList);
            List <ItemInfo> list2 = dynItemListToItemList.Result as List <ItemInfo>;

            return(list2 ?? new List <ItemInfo>());
        }
예제 #8
0
        public static List <string> GetItemListString(List <ItemInfo> list)
        {
            ItemListToIDList itemListToIDList = new ItemListToIDList();

            BattleEquipTools_Travers.TraverseList <ItemInfo>(list, itemListToIDList);
            List <string> list2 = itemListToIDList.Result as List <string>;

            return(list2 ?? new List <string>());
        }
예제 #9
0
        public static List <ItemInfo> CloneItemsList(List <ItemInfo> list)
        {
            CloneItemList cloneItemList = new CloneItemList();

            BattleEquipTools_Travers.TraverseList <ItemInfo>(list, cloneItemList);
            List <ItemInfo> list2 = cloneItemList.Result as List <ItemInfo>;

            return(list2 ?? new List <ItemInfo>());
        }
예제 #10
0
        public static Dictionary <ColumnType, Dictionary <string, SItemData> > GetShopItems_Recommend(Dictionary <ColumnType, Dictionary <string, SItemData> > sItems, List <string> recommendedItems)
        {
            List <string> ids = null;

            if (recommendedItems != null && recommendedItems.Count > 0)
            {
                ids = BattleEquipTools_Travers.GetComposition(recommendedItems[0]);
            }
            BattleEquipTools_config.idsToSItems(ref sItems, ids, BattleEquipType.none);
            return(sItems);
        }
예제 #11
0
        public static bool GetItem_first_most(List <ItemInfo> list, string target, out ItemInfo item, out int index)
        {
            item  = null;
            index = -1;
            FindItem_first_most findItem_first_most = new FindItem_first_most(target);

            BattleEquipTools_Travers.TraverseList <ItemInfo>(list, findItem_first_most);
            index = (int)findItem_first_most.Result;
            if (index >= 0 && index < list.Count)
            {
                item = list[index];
            }
            return(item != null && index != -1);
        }
        public static void AddItem(List <ItemInfo> items, string targetID)
        {
            int              num = -1;
            ItemInfo         itemInfo;
            SysBattleItemsVo vo;

            if (BattleEquipTools_Travers.GetItem_first_most(items, targetID, out itemInfo, out num))
            {
                itemInfo.Num++;
            }
            else if (items != null && items.Count < 6 && BattleEquipTools_config.GetBattleItemVo(targetID, out vo))
            {
                items.Add(new ItemInfo(items.Count, 0, 1, vo));
            }
        }
예제 #13
0
        public static bool GetItem_first(List <ItemInfo> list, string target, out ItemInfo item, out int index)
        {
            item = null;
            FindItem findItem = new FindItem(target, true);

            BattleEquipTools_Travers.TraverseList <ItemInfo>(list, findItem);
            object[]        array = findItem.Result as object[];
            List <ItemInfo> list2 = array[1] as List <ItemInfo>;

            index = (int)array[0];
            if (list2 != null && list2.Count > 0)
            {
                item = list2[0];
            }
            return(item != null);
        }
예제 #14
0
        public static List <string> GetRItems(List <string> recommendList, string newItem, List <ItemInfo> possessItems)
        {
            List <string> itemListString = BattleEquipTools_Travers.GetItemListString(possessItems);
            List <string> list           = new List <string>(recommendList);

            if (list != null && !string.IsNullOrEmpty(newItem))
            {
                List <string> composition = BattleEquipTools_Travers.GetComposition(newItem);
                while (list != null && list.Count != 0)
                {
                    if (!(list[0] == newItem) && !composition.Contains(list[0]) && !itemListString.Contains(list[0]))
                    {
                        break;
                    }
                    list.RemoveAt(0);
                }
            }
            return(list);
        }
예제 #15
0
 private static void TraverseEquipTree(string equipID, ITraversCallback Del, int depth = 0)
 {
     if (Del != null && Del.TraversingCallback != null)
     {
         SysBattleItemsVo sysBattleItemsVo;
         if (BattleEquipTools_config.GetBattleItemVo(equipID, out sysBattleItemsVo))
         {
             if (Del.TraversingCallback(sysBattleItemsVo, depth))
             {
                 string[] array = sysBattleItemsVo.consumption.Split(new char[]
                 {
                     ','
                 });
                 if (array.Length != 0 && !(sysBattleItemsVo.consumption == "[]"))
                 {
                     for (int i = 0; i < array.Length; i++)
                     {
                         BattleEquipTools_Travers.TraverseEquipTree(array[i], Del, depth + 1);
                     }
                 }
             }
         }
     }
 }
        public static List <string> GetHeroItemsString(Units unit)
        {
            List <ItemDynData> heroItems = BattleEquipTools_op.GetHeroItems(unit);

            return(BattleEquipTools_Travers.GetItemListString(heroItems));
        }