示例#1
0
 public static void GiftSortByCategory(List <PropsInfo> sort, string mappingId)
 {
     if (giftSortMode.Value != SortMode.None)
     {
         //反正物品总共也没多少,开销应该不大,选择排序就完事了
         //先按分类排序
         if (giftSortMode.Value == SortMode.maxToMinByType || giftSortMode.Value == SortMode.minToMaxByType)
         {
             for (int i = 0; i < sort.Count; i++)
             {
                 int           minIndex         = i;
                 PropsCategory minPropsCategory = getPropsCategory(sort, i);
                 for (int j = i + 1; j < sort.Count; j++)
                 {
                     PropsCategory jPropsCategory = getPropsCategory(sort, j);
                     if ((giftSortMode.Value == SortMode.minToMaxByType && minPropsCategory > jPropsCategory) ||
                         (giftSortMode.Value == SortMode.maxToMinByType && minPropsCategory > jPropsCategory)
                         )
                     {
                         minIndex         = j;
                         minPropsCategory = getPropsCategory(sort, j);
                     }
                 }
                 if (i != minIndex)
                 {
                     PropsInfo temp = sort[i];
                     sort[i]        = sort[minIndex];
                     sort[minIndex] = temp;
                 }
             }
         }
     }
 }
        /// <summary>
        /// Удаление видов оплаты по id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult DeletePropsCategory(int id)
        {
            PropsCategory cat = db.PropsCategories.Find(id);

            db.PropsCategories.Remove(cat);
            db.SaveChanges();
            return(RedirectToAction("AddPropsCategory"));
        }
示例#3
0
 public static PropsCategory GetScrollType(PropsCategory skillType)
 {
     if (skillType < PropsCategory.Throwing)
     {
         return(skillType - PropsCategory.Fist + PropsCategory.Fist_Secret_Scroll);
     }
     return(PropsCategory.Throw_Secret_Scroll);
 }
 public ActionResult AddPropsCategory(PropsCategory cat)
 {
     if (ModelState.IsValid)
     {
         db.PropsCategories.Add(cat);
         db.SaveChanges();
     }
     ViewBag.PropsCategories = db.PropsCategories;
     return(View(cat));
 }
示例#5
0
        public static bool AssessoryPatch_UseProps(Inventory __instance, string id, CharacterInfoData user)
        {
            Props props = __instance.GetProps(id);

            if (props == null)
            {
                return(false);
            }
            PropsCategory propsCategory = props.PropsCategory;

            if (propsCategory == PropsCategory.Accessories)
            {
                Props equip = user.Equip.GetEquip(EquipType.Jewelry);
                if (equip != null)
                {
                    Traverse.Create(__instance).Method("DettachPropsEffect", new Type[] { typeof(Props), typeof(CharacterInfoData) }, new object[] { equip, user }).GetValue();
                }
                string s = user.Equip[EquipType.Jewelry];
                if (s == null)
                {
                    s = string.Empty;
                }
                List <string> list = s.Split(new char[]
                {
                    '|'
                }).ToList <string>();
                while (_accessoryIndex >= list.Count)
                {
                    list.Add("");
                }
                list[_accessoryIndex]         = props.Id;
                user.Equip[EquipType.Jewelry] = string.Join("|", list);
                if (equip != null)
                {
                    __instance.Add(equip.Id, 1, false);
                }
                string str = "UISE_Equip01.wav";
                Traverse.Create(__instance).Method("AttachPropsEffect", new Type[] { typeof(Props), typeof(CharacterInfoData) }, new object[] { props, user }).GetValue();
                __instance.Remove(props.Id, 1);
                var e = new Heluo.Events.SoundEventArgs
                {
                    Parent      = Game.UI.Canvas.gameObject,
                    SoundPath   = GameConfig.UISoundFolder + str,
                    Delay       = 0f,
                    Is3D        = false,
                    SoundVolume = 1f
                };
                Game.Event.Send(e);
                return(false);
            }
            return(true);
        }
示例#6
0
        public static bool HasSkillType(string infoId, PropsCategory skillType)
        {
            var info = Game.GameData.Character[infoId];

            if (info == null)
            {
                return(false);
            }
            foreach (var skill in info.Skill.Values)
            {
                if (skill.Item.Type == skillType)  // 只要学会过一项同系招式即可
                {
                    return(true);
                }
            }
            return(false);
        }
示例#7
0
        public static void EquipSortByAttack(List <PropsInfo> sort)
        {
            if (equipSortMode.Value != SortMode.None)
            {
                //反正物品总共也没多少,开销应该不大,用选择排序就完事了

                //在按攻击力大小排序
                for (int i = 0; i < sort.Count; i++)
                {
                    PropsCategory iPropsCategory   = getPropsCategory(sort, i);
                    int           minIndex         = i;
                    int           minAttack        = getAttack(sort, i);
                    PropsCategory minPropsCategory = getPropsCategory(sort, i);
                    for (int j = i + 1; j < sort.Count; j++)
                    {
                        int           jAttack        = getAttack(sort, j);
                        PropsCategory jPropsCategory = getPropsCategory(sort, j);
                        if ((equipSortMode.Value == SortMode.minToMax && minAttack > jAttack) ||
                            (equipSortMode.Value == SortMode.maxToMin && minAttack < jAttack) ||
                            (equipSortMode.Value == SortMode.minToMaxByType && iPropsCategory == jPropsCategory && minAttack > jAttack) ||
                            (equipSortMode.Value == SortMode.maxToMinByType && iPropsCategory == jPropsCategory && minAttack < jAttack)
                            )
                        {
                            minIndex         = j;
                            minAttack        = getAttack(sort, j);
                            minPropsCategory = getPropsCategory(sort, j);
                        }
                    }
                    if (i != minIndex)
                    {
                        PropsInfo temp = sort[i];
                        sort[i]        = sort[minIndex];
                        sort[minIndex] = temp;
                    }
                }
            }
        }
示例#8
0
        public static void GiftSortByNumber(List <PropsInfo> sort, string mappingId)
        {
            if (giftSortMode.Value != SortMode.None)
            {
                //反正物品总共也没多少,开销应该不大,用选择排序就完事了

                //在按大小排序
                for (int i = 0; i < sort.Count; i++)
                {
                    PropsCategory iPropsCategory   = getPropsCategory(sort, i);
                    int           minIndex         = i;
                    int           minFavExp        = getFavExp(sort, mappingId, i);
                    PropsCategory minPropsCategory = getPropsCategory(sort, i);
                    for (int j = i + 1; j < sort.Count; j++)
                    {
                        int           jFavExp        = getFavExp(sort, mappingId, j);
                        PropsCategory jPropsCategory = getPropsCategory(sort, j);
                        if ((giftSortMode.Value == SortMode.minToMax && minFavExp > jFavExp) ||
                            (giftSortMode.Value == SortMode.maxToMin && minFavExp < jFavExp) ||
                            (giftSortMode.Value == SortMode.minToMaxByType && iPropsCategory == jPropsCategory && minFavExp > jFavExp) ||
                            (giftSortMode.Value == SortMode.maxToMinByType && iPropsCategory == jPropsCategory && minFavExp < jFavExp)
                            )
                        {
                            minIndex         = j;
                            minFavExp        = getFavExp(sort, mappingId, j);
                            minPropsCategory = getPropsCategory(sort, j);
                        }
                    }
                    if (i != minIndex)
                    {
                        PropsInfo temp = sort[i];
                        sort[i]        = sort[minIndex];
                        sort[minIndex] = temp;
                    }
                }
            }
        }
示例#9
0
        public static void Reforge_OnShow(CtrlForge __instance)
        {
            if (isReforgeMode)
            {
                var array = Traverse.Create(__instance).Field("sort").Field("array").GetValue() as List <ForgeInfo>[];
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i] != null)
                    {
                        array[i].Clear();
                    }
                    else
                    {
                        array[i] = new List <ForgeInfo>();
                    }
                }
                List <string> showed = new List <string>();
                Game.GameData.Inventory.GetDictionary();
                foreach (var key in Game.GameData.Inventory.Keys)
                {
                    Props props = Game.Data.Get <Props>(key);
                    if (props == null)
                    {
                        continue;
                    }
                    PropsCategory propsCategory = props.PropsCategory;
                    int           index         = -1;
                    switch (propsCategory)
                    {
                    case PropsCategory.Fist:
                    case PropsCategory.Leg:
                        index = 0;
                        break;

                    case PropsCategory.Sword:
                    case PropsCategory.Blade:
                        index = 1;
                        break;

                    case PropsCategory.Long:
                    case PropsCategory.Short:
                        index = 2;
                        break;

                    case PropsCategory.DualWielding:
                    case PropsCategory.Special:
                        index = 3;
                        break;

                    case PropsCategory.Armor:
                        index = 4;
                        break;
                    }
                    if (index >= 0)
                    {
                        ForgeInfo forgeInfo = new ForgeInfo
                        {
                            Id = key,
                            IsConditionPass = true
                        };
                        Traverse.Create(forgeInfo).Property("Item").SetValue(new Forge()
                        {
                            Id      = key,
                            PropsId = key,
                        });
                        Traverse.Create(forgeInfo).Property("Equip").SetValue(props);
                        array[index].Add(forgeInfo);
                    }
                }
            }
        }
        public static bool ModExt_NewPropsUI(CtrlMedicine __instance)
        {
            var mapping = Traverse.Create(__instance).Field("mapping");
            var sort    = Traverse.Create(__instance).Field("sort").GetValue <List <PropsInfo> >();

            mapping.SetValue(GlobalLib.GetUICharacterMapping());
            sort.Clear();
            foreach (KeyValuePair <string, InventoryData> keyValuePair in Game.GameData.Inventory)
            {
                string key   = keyValuePair.Key;
                Props  props = Game.Data.Get <Props>(key);
                if (props != null && props.PropsType == PropsType.Medicine)
                {
                    bool show = false;
                    if (props.CanUseID != null && props.CanUseID.Count > 0)
                    {
                        for (int i = 0; i < props.CanUseID.Count; i++)
                        {
                            string text = props.CanUseID[i];
                            if (!text.IsNullOrEmpty() && text == mapping.GetValue <CharacterMapping>().Id)
                            {
                                show = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        show = true;
                        if (props.PropsCategory >= PropsCategory.Fist_Secret_Scroll && props.PropsCategory <= PropsCategory.Throw_Secret_Scroll && key.StartsWith("p_scroll"))
                        {
                            foreach (var pe in props.PropsEffect)
                            {
                                if (pe is PropsLearnSkill pls)
                                {
                                    PropsCategory skillType = Game.Data.Get <Skill>(pls.Id).Type;
                                    if (!GlobalLib.HasSkillType(mapping.GetValue <CharacterMapping>().InfoId, skillType))
                                    {
                                        show = false;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (show)
                    {
                        PropsInfo propsInfo = new PropsInfo(key)
                        {
                            ConditionStatus = ((props.UseTime == PropsUseTime.Battle) ? PropsInfo.PropsConditionStatus.UseTimeFail_Battle : PropsInfo.PropsConditionStatus.AllPass)
                        };
                        sort.Add(propsInfo);
                    }
                }
            }
            var view = Traverse.Create(__instance).Field("view").GetValue <UIMedicine>();

            view.UpdateProps(sort.Count);
            if (sort.Count <= 0)
            {
                view.UpdatePropsIntroduction(null);
            }
            return(false);
        }
示例#11
0
        public static void openElementUI()
        {
            Heluo.Logger.LogError("openElementUI start");
            if (nonbattleChangeElement.Value)
            {
                //show结束时ctrlMartialArts还没当前角色数据,需要从ctrlhome处获得

                List <CharacterMapping> characterMapping = Traverse.Create(homeController).Field("characterMapping").GetValue <List <CharacterMapping> >();
                int communityIndex = Traverse.Create(homeController).Field("communityIndex").GetValue <int>();

                CharacterMapping mapping = characterMapping[communityIndex];
                characterInfoData = Game.GameData.Character[mapping.InfoId];
                clickSkill        = characterInfoData.GetSkill(characterInfoData.SpecialSkill);

                //不是切换功体或召唤技能
                if (clickSkill == null || (clickSkill.Item.DamageType != DamageType.ChangeElement && clickSkill.Item.DamageType != DamageType.Summon))
                {
                    return;
                }
                //mp不足
                if (characterInfoData.MP < clickSkill.Item.RequestMP)
                {
                    string text2 = Game.Data.Get <StringTable>("SecondaryInterface1207").Text;
                    Game.UI.AddMessage(text2, UIPromptMessage.PromptType.Normal);
                    return;
                }

                //切换功体
                if (clickSkill.Item.DamageType == DamageType.ChangeElement)
                {
                    Game.MusicPlayer.Current_Volume = 0.5f;

                    //从uibattle处获得五行盘ui
                    UIBattle      uiBattle     = Game.UI.Open <UIBattle>();
                    WgBattleRound battle_round = uiBattle.battle_round;
                    battle_round.gameObject.SetActive(false);//隐藏右上角的回合数
                    UIAttributeList attr_list = Traverse.Create(uiBattle).Field("attr_list").GetValue <UIAttributeList>();

                    //图层设置为最前,否则会被挡住
                    Game.UI.SetParent(attr_list.transform, UIForm.Depth.Front);
                    attr_list.transform.SetAsLastSibling();

                    attr_list.Show();
                    attr_list.SetOriginElement((int)characterInfoData.Element, new Action <int>(OnElementSelect), delegate
                    {
                        Game.MusicPlayer.Current_Volume = 1f;
                    });
                }
                //召唤小熊猫,开启乖乖技能列表
                else if (nonbattleUseHealSkill.Value && clickSkill.Item.DamageType == DamageType.Summon)
                {
                    CharacterInfoData  characterInfoData = Game.GameData.Character["in91001"];
                    CharacterSkillData skill             = characterInfoData.Skill;
                    Props equip = characterInfoData.Equip.GetEquip(EquipType.Weapon);
                    if (equip == null)
                    {
                        return;
                    }
                    List <SkillData> list          = new List <SkillData>();
                    PropsCategory    propsCategory = equip.PropsCategory;
                    foreach (string key in skill.Keys)
                    {
                        SkillData skillData = skill[key];
                        if (skillData.Item == null)
                        {
                            Debug.LogError("Skill表中找不到" + skillData.Id + "的文本");
                        }
                        else if (!(skillData.Item.Id == characterInfoData.SpecialSkill))
                        {
                            list.Add(skillData);
                        }
                    }
                    if (list.Count > 0)
                    {
                        MartialArtsWindowInfo martialArtsWindowInfo = new MartialArtsWindowInfo();
                        martialArtsWindowInfo.Mapping = new CharacterMapping();
                        Npc npc = Game.Data.Get <Npc>("in91001");
                        martialArtsWindowInfo.Mapping.Id         = "in91001";
                        martialArtsWindowInfo.Mapping.InfoId     = npc.CharacterInfoId;
                        martialArtsWindowInfo.Mapping.ExteriorId = npc.ExteriorId;
                        martialArtsWindowInfo.Sort        = list;
                        martialArtsWindowInfo.SkillColumn = (CtrlMartialArts.UISkillColumn) 5;
                        Game.UI.Open <UIMartialArtsWindow>().OpenWindow(martialArtsWindowInfo, null);
                        return;
                    }
                }
            }
        }