コード例 #1
0
        /// <summary>
        /// 切換功法 / 裝備的共用函數
        /// </summary>
        /// <param name="homeSystem">HomeSystem instance</param>
        /// <param name="keyValue">關鍵值, 修習=studySkillId, 突破=levelUPSkillId, 讀書=readBookId</param>
        /// <param name="aptitudeFunc">使用 keyValue 計算對應的技能種類的Function</param>
        public static void SwitchProc(BuildingWindow homeSystem, int keyValue, Func <int, int> aptitudeFunc)
        {
            if (!Main.Enabled)
            {
                return;
            }
            if (keyValue <= 0)
            {
                return;
            }

            if (Main.settings.HomeSystemAutoAccessories)
            {
                int aptitudeType;
                if (homeSystem.studySkillTyp < 17)
                {
                    // 技藝
                    aptitudeType = AptitudeTypeHelper.GetAptitudeTypeBySkillType(homeSystem.studySkillTyp);
                }
                else
                {
                    // 功法
                    aptitudeType = aptitudeFunc(keyValue);
                }
                StateManager.EquipAccessories(aptitudeType);
            }

            if (Main.settings.HomeSystemGongFaIndex >= 0)
            {
                StateManager.UseGongFa(Main.settings.HomeSystemGongFaIndex);
            }
        }
コード例 #2
0
        private static void Prefix(int charId)
        {
            var df = DateFile.instance;

            if (charId != df.mianActorId)
            {
                return;
            }
            //#if (DEBUG)
            //            Main.Logger.Log($"現在內息: {df.GetActorMianQi(charId)}");
            //#endif
            if (!Main.Enabled)
            {
                return;
            }

            if (Main.settings.RestAutoEquip)
            {
                var items = ItemHelper.GetEquipItems()
                            .Select(kvp => kvp.Value).Concat(ItemHelper.GetBagItems().Concat(ItemHelper.GetWarehouseItems()))
                            .AsQueryable();

                // 取得內息最高的3樣武器
                items = items.Where(ItemHelper.GetEquipTypeFilter(EquipType.Weapon));
                items = items.Where(ItemHelper.GetHasDataFilter(ItemDateKey.MianQi));
                items = items.OrderByDescending(ItemHelper.GetOrderByData(ItemDateKey.MianQi));
                if (Main.settings.EnabledLog)
                {
                    foreach (var item in items.Take(3))
                    {
                        Main.Logger.Log($"裝備: {item} ({df.GetItemDate(item, 0, false)}), 內息: { df.GetItemDateValue(item, ItemDateKey.MianQi)}");
                    }
                }
                StateManager.EquipWeapons(items.Take(3));
            }

            if (Main.settings.RestGongFaIndex >= 0)
            {
                StateManager.UseGongFa(Main.settings.RestGongFaIndex);
            }
        }
コード例 #3
0
        //static ItemData[] Emptys;

        //static HomeSystem_UpdateReadBookWindow_Patch()
        //{
        //    Emptys = Enumerable.Repeat(new ItemData(0, ItemSource.Bag), 3).ToArray();
        //}

        private static void Prefix(BuildingWindow __instance)
        {
            if (!Main.Enabled ||
                __instance.readBookId <= 0 ||
                CallByPatch)
            {
                return;
            }

            if (Main.settings.HomeSystemGongFaIndex >= 0)
            {
                StateManager.UseGongFa(Main.settings.HomeSystemGongFaIndex);
            }
            if (Main.settings.HomeSystemAutoAccessories)
            {
                // 換上三個空的避免裝備資質影響判斷
                StateManager.Equip(Emptys, EquipSlot.Accessory1);
            }

            // HomeSystem_Patch.SwitchProc(__instance, __instance.readBookId, AptitudeTypeHelper.GetAptitudeTypeByBookId);

            //
            //DateFile df = DateFile.instance;
            //int actorId = df.MianActorID();
            //int readSkillId = int.Parse(df.GetItemDate(__instance.readBookId, 32, true));
            //int num5 = int.Parse(df.skillDate[readSkillId][3]);
            // n6 <= 100

            //int n6 = UnityEngine.Mathf.Min(df.GetActorValue(actorId, 501 + num5, true) * 100 / int.Parse(df.skillDate[readSkillId][15]), 100);
            //int num = 1000 - 10 * n6;
            //num < 50;
            //1000 - 10 * n6 < 50;
            //10 * n6 > 950;
            //n6 > 95;
            // df.GetActorValue(actorId, 501 + num5, true) * 100 / df.skillDate[readSkillId][15] > 95
            // df.GetActorValue(actorId, 501 + num5, true) * 100 > 95 * df.skillDate[readSkillId][15]
            // df.GetActorValue(actorId, 501 + num5, true) > 95 * df.skillDate[readSkillId][15] / 100
        }