Ejemplo n.º 1
0
        public static List <string> GetRItems(string levelID, string heroID)
        {
            List <string>    result = null;
            SysBattleSceneVo sysBattleSceneVo;

            if (BattleEquipTools_config.GetBattleSceneVo(levelID, out sysBattleSceneVo))
            {
                Dictionary <string, string> rItemsDic = BattleEquipTools_config.GetRItemsDic(heroID);
                string key;
                if (rItemsDic.ContainsKey(sysBattleSceneVo.scene_map_id))
                {
                    key = rItemsDic[sysBattleSceneVo.scene_map_id];
                }
                else
                {
                    if (!rItemsDic.ContainsKey("default"))
                    {
                        return(result);
                    }
                    key = rItemsDic["default"];
                }
                SysRecommendEquipmentVo sysRecommendEquipmentVo;
                if (BattleEquipTools_config.GetRecommendEquipmentVo(key, out sysRecommendEquipmentVo))
                {
                    result = BattleEquipTools_config.StringToStringList(sysRecommendEquipmentVo.equipments, ',', "[]");
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static bool GetShopIDListByScene(string levelID, EBattleShopType type, out Dictionary <EBattleShopType, ShopInfo> shopIDList)
        {
            bool result = false;

            shopIDList = new Dictionary <EBattleShopType, ShopInfo>();
            SysBattleSceneVo sysBattleSceneVo;

            if (BattleEquipTools_config.GetBattleSceneVo(levelID, out sysBattleSceneVo))
            {
                string shop_id = sysBattleSceneVo.shop_id;
                if (!string.IsNullOrEmpty(shop_id))
                {
                    string[] array = shop_id.Split(new char[]
                    {
                        ','
                    });
                    for (int i = 0; i < array.Length; i++)
                    {
                        SysBattleShopVo sysBattleShopVo = null;
                        if (BattleEquipTools_config.GetBattelShopVo(array[i], out sysBattleShopVo))
                        {
                            if ((sysBattleShopVo.type == (int)type || sysBattleShopVo.type == 3 || sysBattleShopVo.type == 5) && !shopIDList.ContainsKey((EBattleShopType)sysBattleShopVo.type))
                            {
                                shopIDList.Add((EBattleShopType)sysBattleShopVo.type, new ShopInfo(sysBattleShopVo, false));
                            }
                        }
                    }
                    result = true;
                }
            }
            return(result);
        }
        public static bool IsWithInShopArea(SysBattleShopVo shopVo, Units player, out float distance)
        {
            bool result = false;

            distance = 0f;
            Vector3 a   = Vector3.zero;
            float   num = 0f;

            if (shopVo != null)
            {
                TeamType  team     = BattleEquipTools_config.ShopType2TeamType((EBattleShopType)shopVo.type);
                Transform spawnPos = MapManager.Instance.GetSpawnPos(team, shopVo.shop_origin);
                if (null != spawnPos)
                {
                    a   = spawnPos.position;
                    num = (float)shopVo.shop_range;
                }
            }
            if (null != player)
            {
                Vector3 position = player.transform.position;
                distance = Vector3.Distance(a, position);
                result   = (distance <= num);
            }
            return(result);
        }
 public static void ApplyEquipsToHero(List <string> equips, Hero hero)
 {
     if (equips != null && hero != null)
     {
         Dictionary <AttrType, float> dictionary;
         Dictionary <AttrType, float> dictionary2;
         BattleEquipTools_config.GetItemsAttri(equips, out dictionary, out dictionary2);
     }
 }
Ejemplo n.º 5
0
 public static Dictionary <ColumnType, Dictionary <string, SItemData> > GetShopItems_common(Dictionary <ColumnType, Dictionary <string, SItemData> > sItems, BattleEquipType menuType, ShopInfo shopInfo)
 {
     if (menuType != BattleEquipType.none && shopInfo != null)
     {
         List <string> shopItems = shopInfo.ShopItems;
         BattleEquipTools_config.idsToSItems(ref sItems, shopItems, menuType);
     }
     return(sItems);
 }
Ejemplo n.º 6
0
        public static void GetItemAttri(string equipID, ref Dictionary <AttrType, float> add, ref Dictionary <AttrType, float> mul)
        {
            SysBattleItemsVo sysBattleItemsVo;

            if (BattleEquipTools_config.GetBattleItemVo(equipID, out sysBattleItemsVo))
            {
                if (!string.IsNullOrEmpty(sysBattleItemsVo.attribute))
                {
                    string[] array = sysBattleItemsVo.attribute.Split(new char[]
                    {
                        ','
                    });
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(array[i]) && !(array[i] == "[]"))
                        {
                            string[] array2 = array[i].Split(new char[]
                            {
                                '|'
                            });
                            int num;
                            if (int.TryParse(array2[0], out num))
                            {
                                AttrType attrType = (AttrType)num;
                                if (array2[1].Contains("%"))
                                {
                                    if (!mul.ContainsKey(attrType))
                                    {
                                        mul.Add(attrType, 0f);
                                    }
                                    string text = array2[1].Trim();
                                    Dictionary <AttrType, float> dictionary;
                                    Dictionary <AttrType, float> expr_CF = dictionary = mul;
                                    AttrType key;
                                    AttrType expr_D4 = key = attrType;
                                    float    num2    = dictionary[key];
                                    expr_CF[expr_D4] = num2 + float.Parse(text.Substring(0, text.Length - 1)) / 100f;
                                }
                                else
                                {
                                    if (!add.ContainsKey(attrType))
                                    {
                                        add.Add(attrType, 0f);
                                    }
                                    Dictionary <AttrType, float> dictionary2;
                                    Dictionary <AttrType, float> expr_129 = dictionary2 = add;
                                    AttrType key;
                                    AttrType expr_12E = key = attrType;
                                    float    num2     = dictionary2[key];
                                    expr_129[expr_12E] = num2 + float.Parse(array2[1]);
                                }
                            }
                        }
                    }
                }
            }
        }
        private bool callback(object obj, int index)
        {
            ItemDynData      itemDynData = obj as ItemDynData;
            SysBattleItemsVo vo;

            if (itemDynData != null && BattleEquipTools_config.GetBattleItemVo(itemDynData.typeId, out vo))
            {
                this.list.Add(new ItemInfo(this.list.Count, itemDynData.itemOid, itemDynData.count, vo));
            }
            return(true);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
 public static void GetItemsAttri(List <string> equipList, out Dictionary <AttrType, float> add, out Dictionary <AttrType, float> mul)
 {
     add = new Dictionary <AttrType, float>();
     mul = new Dictionary <AttrType, float>();
     if (equipList != null)
     {
         for (int i = 0; i < equipList.Count; i++)
         {
             BattleEquipTools_config.GetItemAttri(equipList[i], ref add, ref mul);
         }
     }
 }
Ejemplo n.º 10
0
 public static List <string> GetShopItems(List <string> shopData, BattleEquipType type)
 {
     if (shopData != null)
     {
         shopData = shopData.Where(delegate(string obj)
         {
             SysBattleItemsVo sysBattleItemsVo;
             return(BattleEquipTools_config.GetBattleItemVo(obj, out sysBattleItemsVo) && sysBattleItemsVo.type == (int)type);
         }).ToList <string>();
     }
     return(shopData);
 }
Ejemplo n.º 11
0
        private void RefreshUI_tip()
        {
            bool flag = this.tItem != null;

            this.com_shopItem.gameObject.SetActive(flag);
            this.label_attributes.gameObject.SetActive(flag);
            this.label_introduction.gameObject.SetActive(flag);
            if (flag)
            {
                this.com_shopItem.Item       = this.tItem;
                this.label_attributes.text   = BattleEquipTools_config.GetAttriDes(this.tItem.Config, "\n", 6);
                this.label_introduction.text = LanguageManager.Instance.GetStringById(this.tItem.Config.describe);
            }
        }
        public static bool WithinShopArea(ShopInfo shopInfo, Vector3 selfVect)
        {
            bool result = false;

            if (shopInfo != null)
            {
                Vector3  a    = Vector3.zero;
                TeamType team = BattleEquipTools_config.ShopType2TeamType(shopInfo.ShopType);
                a = MapManager.Instance.GetSpawnPos(team, shopInfo.Config.shop_origin).position;
                float num = (float)shopInfo.Config.shop_range;
                result = (Vector3.Distance(a, selfVect) <= num);
            }
            return(result);
        }
        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));
            }
        }
Ejemplo n.º 14
0
        public static void idsToSItems(ref Dictionary <ColumnType, Dictionary <string, SItemData> > sItems, List <string> ids, BattleEquipType menuType = BattleEquipType.none)
        {
            BattleEquipTools_config.RegularSItems(ref sItems, true);
            SysBattleItemsVo sysBattleItemsVo = null;

            if (ids != null)
            {
                for (int i = 0; i < ids.Count; i++)
                {
                    if (BattleEquipTools_config.GetBattleItemVo(ids[i], out sysBattleItemsVo) && (menuType == BattleEquipType.none || sysBattleItemsVo.type == (int)menuType) && sItems.ContainsKey((ColumnType)sysBattleItemsVo.level))
                    {
                        sItems[(ColumnType)sysBattleItemsVo.level].Add(sysBattleItemsVo.items_id, new SItemData(sysBattleItemsVo));
                    }
                }
            }
        }
        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);
        }
Ejemplo n.º 16
0
        public static Dictionary <string, string> GetRItemsDic(string heroID)
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            SysHeroMainVo sysHeroMainVo;

            if (BattleEquipTools_config.GetHeroMainVo(heroID, out sysHeroMainVo))
            {
                List <string> list = BattleEquipTools_config.StringToStringList(sysHeroMainVo.recommend_equip, ',', "[]");
                for (int i = 0; i < list.Count; i++)
                {
                    List <string> list2 = BattleEquipTools_config.StringToStringList(list[i], '|', "[]");
                    if (list2.Count == 2)
                    {
                        dictionary.Add(list2[0], list2[1]);
                    }
                }
            }
            return(dictionary);
        }
Ejemplo n.º 17
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);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 18
0
        public static int GetItemPrice(string equipID)
        {
            SysBattleItemsVo sysBattleItemsVo;

            return((!BattleEquipTools_config.GetBattleItemVo(equipID, out sysBattleItemsVo)) ? 0 : sysBattleItemsVo.sell);
        }