private static void Postfix() { if (!Main.enabled || !Main.settings.open) { return; } if (Main.settings.card == 0 && Autofix.Getpoint(0) == 0 && Autofix.Getpoint(1) == 0 && Autofix.Getpoint(2) == 0 && Autofix.Getpoint(3) == 0) { return; } List <int> part = new List <int>(); if (Main.settings.是否修理武器) { part = new List <int> { 0, 1, 2 } } ; if (Main.settings.是否修理头部装备) { part.Add(3); } if (Main.settings.是否修理护甲) { part.Add(5); } if (Main.settings.是否修理鞋子) { part.Add(6); } if (Main.settings.是否修理其他) { part.AddRange(new List <int> { 4, 7, 8, 9, 10 }); } if (part.Count == 0) { return; } List <int> people = new List <int> { DateFile.instance.MianActorID() }; if (Main.settings.familiy) { people.AddRange(DateFile.instance.GetFamily(false, false)); } Autofix.LazyBone(people, part); } }
private static void Postfix() { bool flag = !Main.enabled || !Main.settings.open; if (!flag) { bool flag2 = Main.settings.card == 0 && Autofix.Getpoint(0) == 0 && Autofix.Getpoint(1) == 0 && Autofix.Getpoint(2) == 0 && Autofix.Getpoint(3) == 0; if (!flag2) { List <int> list = new List <int>(); bool weapon = Main.settings.weapon; if (weapon) { list = new List <int> { 0, 1, 2 }; } bool hat = Main.settings.hat; if (hat) { list.Add(3); } bool armor = Main.settings.armor; if (armor) { list.Add(5); } bool shouse = Main.settings.shouse; if (shouse) { list.Add(6); } bool pearl = Main.settings.pearl; if (pearl) { list.AddRange(new List <int> { 4, 7, 8, 9, 10 }); } bool flag3 = list.Count == 0; if (!flag3) { List <int> list2 = new List <int> { DateFile.instance.MianActorID() }; bool familiy = Main.settings.familiy; if (familiy) { list2.AddRange(DateFile.instance.GetFamily(false, false)); } Autofix.LazyBone(list2, list); } } } }
static void OnGUI(UnityModManager.ModEntry modEntry) { if (!ExistMianActor()) { GUILayout.Label("存档未载入!", new GUILayoutOption[0]); } else { settings.open = GUILayout.Toggle(settings.open, "开启自动修理业务", new GUILayoutOption[0]); if (settings.open) { GUILayout.BeginVertical("Box", new GUILayoutOption[0]); GUILayout.Label("选择修理部位", new GUIStyle { normal = { textColor = new Color(0.999999f, 0.537255f, 0.537255f) } }, new GUILayoutOption[0]); GUILayout.BeginHorizontal(); settings.是否修理武器 = GUILayout.Toggle(settings.是否修理武器, "武器", new GUILayoutOption[0]); settings.是否修理头部装备 = GUILayout.Toggle(settings.是否修理头部装备, "头盔", new GUILayoutOption[0]); settings.是否修理护甲 = GUILayout.Toggle(settings.是否修理护甲, "护甲", new GUILayoutOption[0]); settings.是否修理鞋子 = GUILayout.Toggle(settings.是否修理鞋子, "鞋子", new GUILayoutOption[0]); settings.是否修理其他 = GUILayout.Toggle(settings.是否修理其他, "其他", new GUILayoutOption[0]); GUILayout.EndHorizontal(); settings.familiy = GUILayout.Toggle(settings.familiy, "也修理队友的装备", new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.BeginVertical("Box", new GUILayoutOption[0]); GUILayout.Label("请选择会员卡种类:", new GUIStyle { normal = { textColor = new Color(0.999999f, 0.537255f, 0.537255f) } }, new GUILayoutOption[0]); settings.card = GUILayout.Toolbar(settings.card, settings.cardText, new GUILayoutOption[] { GUILayout.Width(400f) }); GUILayout.EndVertical(); if (settings.card == 0) { if (!DateFile.instance.HaveLifeDate(10001, 79)) { //想不到吧!我把会员卡偷偷塞入了初代太吾的菊花里! //(茄茄跟我说不会坏档来着) if (GUILayout.Button("点击办理会员卡", new GUILayoutOption[] { GUILayout.Width(180f) })) { if (!DateFile.instance.actorLife.ContainsKey(10001)) { DateFile.instance.actorLife.Add(10001, new Dictionary <int, List <int> > { { 79, new List <int> { 0, 0, 0, 0 } } }); } else { DateFile.instance.actorLife[10001].Add(79, new List <int> { 0, 0, 0, 0 }); } } } else { GUILayout.BeginVertical("Box", new GUILayoutOption[0]); GUILayout.Label("您的账户余额如下:", new GUIStyle { normal = { textColor = new Color(0.999999f, 0.537255f, 0.537255f) } }, new GUILayoutOption[0]); GUILayout.BeginHorizontal(); GUILayout.Label(string.Format("木材:{0}", DateFile.instance.actorLife[10001][79][0]), new GUILayoutOption[] { GUILayout.Width(180f) }); GUILayout.Label(string.Format("金石:{0}", DateFile.instance.actorLife[10001][79][1]), new GUILayoutOption[] { GUILayout.Width(180f) }); GUILayout.Label(string.Format("织物:{0}", DateFile.instance.actorLife[10001][79][2]), new GUILayoutOption[] { GUILayout.Width(180f) }); GUILayout.Label(string.Format("银两:{0}", DateFile.instance.actorLife[10001][79][3]), new GUILayoutOption[] { GUILayout.Width(180f) }); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.BeginVertical("Box", new GUILayoutOption[0]); GUILayout.Space(8); GUILayout.Label("请选择充值目标(银两会在相应资源不足时支付维修费用,但会消耗50%额外手续费):", new GUIStyle { normal = { textColor = new Color(0.999999f, 0.537255f, 0.537255f) } }, new GUILayoutOption[0]); settings.payment = GUILayout.Toolbar(settings.payment, settings.paymentText, new GUILayoutOption[] { GUILayout.Width(400f) }); GUILayout.Space(15); GUILayout.Label("请输入充值数量:", new GUIStyle { normal = { textColor = new Color(0.999999f, 0.537255f, 0.537255f) } }, new GUILayoutOption[0]); var deal = GUILayout.TextField(settings.number.ToString(), 6, GUILayout.Width(100)); if (GUI.changed) { if (!int.TryParse(deal, out settings.number)) { settings.number = 0; } } GUILayout.EndVertical(); GUILayout.BeginHorizontal("Box", new GUILayoutOption[] { GUILayout.Width(180f) }); settings.yes = GUILayout.Button("确认充值", new GUILayoutOption[] { GUILayout.Width(180f) }); settings.no = GUILayout.Button("注销会员", new GUILayoutOption[] { GUILayout.Width(180f) }); var test = ""; GUILayout.Label(test, new GUILayoutOption[0]); GUILayout.EndHorizontal(); if (settings.yes) { if (settings.number != 0) { if (Autofix.Buy(settings.payment, settings.number)) { test = "交易成功(^・ᴗ・^)"; } else { test = "充值失败!充值额度不可超过所持资源上限!"; } GUILayout.Label(test, new GUILayoutOption[0]); GUILayout.EndVertical(); } } if (settings.no) { int taiu = DateFile.instance.MianActorID(); UIDate.instance.ChangeResource(taiu, 1, DateFile.instance.actorLife[10001][79][0], true); UIDate.instance.ChangeResource(taiu, 2, DateFile.instance.actorLife[10001][79][1], true); UIDate.instance.ChangeResource(taiu, 3, DateFile.instance.actorLife[10001][79][2], true); UIDate.instance.ChangeResource(taiu, 5, DateFile.instance.actorLife[10001][79][3], true); DateFile.instance.actorLife[10001].Remove(79); } } } else { GUILayout.BeginVertical("Box", new GUILayoutOption[0]); GUILayout.Space(8); GUILayout.Label("好懒,不想充值……我堂堂太吾传人难道还付不起修理费吗?!修就对啦!!!", new GUIStyle { normal = { textColor = new Color(0.999999f, 0.537255f, 0.537255f) } }, new GUILayoutOption[0]); settings.bymoney = GUILayout.Toggle(settings.bymoney, "以银两支付修理费用(会消耗50%额外手续费)", new GUILayoutOption[0]); GUILayout.EndVertical(); } } } }
public static void LazyBone(List <int> people, List <int> type) { foreach (int actorId in people) { foreach (int num in type) { int num2 = int.Parse(DateFile.instance.GetActorDate(actorId, 301 + num, true)); bool flag = num2 > 0; if (flag) { string itemDate = DateFile.instance.GetItemDate(num2, 902, true); string itemDate2 = DateFile.instance.GetItemDate(num2, 4, true); string itemDate3 = DateFile.instance.GetItemDate(num2, 49, true); int num3 = int.Parse(DateFile.instance.GetItemDate(num2, 506, true)); bool flag2 = itemDate != "0" && itemDate2 == "4" && itemDate3 != "0" && num3 < 4; if (flag2) { int num4 = Autofix.Charge(num2, int.Parse(itemDate)); bool flag3 = num4 != 0; if (flag3) { int num5 = 0; switch (num3) { case 0: num5 = 2; break; case 1: num5 = 1; break; case 2: num5 = 0; break; case 3: num5 = 1; break; } bool flag4 = Main.settings.card == 0; if (flag4) { int num6 = Autofix.Getpoint(num5); bool flag5 = num6 >= num4; if (flag5) { Items.SetItemProperty(num2, 901, itemDate); DateFile.instance.actorLife[10001][79][num5] = num6 - num4; } else { bool flag6 = Autofix.Getpoint(3) >= num4 + num4 / 2; if (flag6) { Items.SetItemProperty(num2, 901, itemDate); DateFile.instance.actorLife[10001][79][3] = Autofix.Getpoint(3) - num4 - num4 / 2; } } } else { int num7 = DateFile.instance.MianActorID(); bool bymoney = Main.settings.bymoney; if (bymoney) { num5 = 3; num4 += num4 / 2; } int num8 = (num5 == 3) ? (num5 + 2) : (num5 + 1); int num9 = DateFile.instance.ActorResource(num7)[num8]; bool flag7 = num9 >= num4; if (flag7) { Items.SetItemProperty(num2, 901, itemDate); UIDate.instance.ChangeResource(num7, num8, -num4, false); } } } } } } } }