/// <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); } }
public static void Postfix(MakeSystem __instance, int ___baseMakeTyp) { if (!Main.Enabled || !Main.settings.MakeSystemAutoAccessories) { return; } StateManager.EquipAccessories(AptitudeTypeHelper.GetAptitudeTypeByBaseMakeType(___baseMakeTyp)); __instance.UpdateMakeWindow(); }
private static void Postfix(BuildingWindow __instance) { if (!Main.Enabled || __instance.readBookId <= 0 || !Main.settings.HomeSystemAutoAccessories) { return; } if (CallByPatch) { CallByPatch = false; return; } int aptitudeType; if (__instance.studySkillTyp < 17) { // 技藝 aptitudeType = AptitudeTypeHelper.GetAptitudeTypeBySkillType(__instance.studySkillTyp); } else { // 功法 aptitudeType = AptitudeTypeHelper.GetAptitudeTypeByBookId(__instance.readBookId); } var items = ItemHelper.GetAptitudeUpOrComprehensionUpAccessories(aptitudeType); if (Main.settings.AdvancedReadBookMode && BuildingWindow_GetNeedInt_Patch.LastNeedInt <= 50) { // 如果開了進階閱讀模式, 閱讀難度小於等於50時, 悟性優先 items = from item in items orderby item.ComprehensionUp descending select item; } else { // 否則資質優先 items = from item in items orderby item.AptitudeUp descending, item.ComprehensionUp descending select item; } StateManager.EquipAccessories(items); // 重新整理 CallByPatch = true; __instance.UpdateReadBookWindow(); }
private static void Prefix(int typ) { if (!Main.Enabled || !Main.settings.HealingAutoAccessories) { return; } if (typ == 0) { // 醫療 StateManager.EquipAccessories((int)AptitudeType.Treatment); } else { // 解毒 StateManager.EquipAccessories((int)AptitudeType.Poison); } }