/// <summary> /// 框架来自 ActorMenu.ShowActorMassage(int key) /// </summary> /// <param name="id">npcId, 在 AC 中叫做 key</param> private static void GetAllMessage(int id) { actorMessages.Clear(); int mianActorId = DateFile.instance.MianActorID(); actorMessages.Add(string.Format(DateFile.instance.SetColoer(20002, "·") + " {0}{1}{2}{3}{4}\n", DateFile.instance.massageDate[8010][1].Split('|')[0], DateFile.instance.SetColoer(10002, DateFile.instance.solarTermsDate[int.Parse(DateFile.instance.GetActorDate(id, 25, applyBonus: false))][102]), DateFile.instance.massageDate[8010][1].Split('|')[1], DateFile.instance.GetActorName(id, realName: false, baseName: true), DateFile.instance.massageDate[8010][1].Split('|')[2])); LifeRecords.LifeRecord[] allRecords = LifeRecords.GetAllRecords(id); if (allRecords != null) { int num2 = Mathf.Max(DateFile.instance.GetActorFavor(false, mianActorId, id), 0); LifeRecords.LifeRecord[] array = allRecords; for (int i = 0; i < array.Length; i++) { LifeRecords.LifeRecord record = array[i]; if (DateFile.instance.actorMassageDate.ContainsKey(record.messageId)) { // 一个不知道作用的值,但是姑且这么用 // 原作者应该知道,但是可惜联系不上 int unknown_key = int.Parse(DateFile.instance.actorMassageDate[record.messageId][4]); unknown_key = 30000 * unknown_key / 100; // num2 也不知道,直接抄过来的嘛 if (id != mianActorId && num2 < unknown_key) { string format = DateFile.instance.SetColoer(20002, "·") + " {0}{1}:{2}\n"; string str = DateFile.instance.massageDate[16][1]; DateFile instance = DateFile.instance; short year = record.year; actorMessages.Add(string.Format(format, str + instance.SetColoer(10002, year.ToString()) + DateFile.instance.massageDate[16][3], DateFile.instance.SetColoer(20002, DateFile.instance.solarTermsDate[record.solarTerm][0]), DateFile.instance.SetColoer(10001, DateFile.instance.massageDate[12][2]))); } else { string format = DateFile.instance.SetColoer(20002, "·") + " {0}{1}:" + DateFile.instance.actorMassageDate[record.messageId][1] + "\n"; object[] args = DateFile.instance.GetLifeRecordMassageElements(id, record).ToArray(); actorMessages.Add(string.Format(format, args)); } } } } //死亡 int num3 = int.Parse(DateFile.instance.GetActorDate(id, 26, false)); if (num3 > 0) { actorMessages.Add(string.Format("■ {0}{1}{2}\n", DateFile.instance.massageDate[8010][2].Split(new char[] { '|' })[0], DateFile.instance.SetColoer(10002, DateFile.instance.GetActorDate(id, 11, false), false), DateFile.instance.massageDate[8010][2].Split(new char[] { '|' })[1])); } }
/// <summary> /// 经历筛选 /// </summary> public static bool Prefix(int key, ActorMenu __instance, List <string> ___showMassage, ref int ___showMassageIndex) { if (!Main.enabled || Main.settings.showAllMessage) { return(true); } ___showMassage.Clear(); int num = DateFile.instance.MianActorID(); ___showMassage.Add(string.Format(DateFile.instance.SetColoer(20002, "·") + " {0}{1}{2}{3}{4}\n", DateFile.instance.massageDate[8010][1].Split('|')[0], DateFile.instance.SetColoer( 10002, DateFile.instance.solarTermsDate[int.Parse(DateFile.instance.GetActorDate(key, 25, applyBonus: false))][102]), DateFile.instance.massageDate[8010][1].Split('|')[1], DateFile.instance.GetActorName(key, realName: false, baseName: true), DateFile.instance.massageDate[8010][1].Split('|')[2])); LifeRecords.LifeRecord[] allRecords = LifeRecords.GetAllRecords(key); if (allRecords != null) { int num2 = Mathf.Max(DateFile.instance.GetActorFavor(isEnemy: false, num, key), 0); for (int i = 0; i < allRecords.Length; i++) { LifeRecords.LifeRecord record = allRecords[i]; if (!Changer.exclucdedMessageTypes.Contains(record.messageId) && DateFile.instance.actorMassageDate.ContainsKey(record.messageId)) { int num3 = int.Parse(DateFile.instance.actorMassageDate[record.messageId][4]); num3 = 30000 * num3 / 100; if (key != num && num2 < num3) { List <string> list = ___showMassage; string format = DateFile.instance.SetColoer(20002, "·") + " {0}{1}:{2}\n"; string str = DateFile.instance.massageDate[16][1]; DateFile instance = DateFile.instance; short year = record.year; list.Add(string.Format(format, str + instance.SetColoer(10002, year.ToString()) + DateFile.instance.massageDate[16][3], DateFile.instance.SetColoer(20002, DateFile.instance.solarTermsDate[record.solarTerm][0]), DateFile.instance.SetColoer(10001, DateFile.instance.massageDate[12][2]))); } else { List <string> list2 = ___showMassage; string format2 = DateFile.instance.SetColoer(20002, "·") + " {0}{1}:" + DateFile.instance.actorMassageDate[record.messageId][1] + "\n"; object[] args = DateFile.instance.GetLifeRecordMassageElements(key, record).ToArray(); list2.Add(string.Format(format2, args)); } } } } ___showMassageIndex = 0; if (ShowMassage == null) { var bindingFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic; var method = typeof(ActorMenu).GetMethod("ShowMassage", bindingFlags, null, new[] { typeof(int) }, null); ShowMassage = (Action <int>)Delegate.CreateDelegate(typeof(Action <int>), __instance, method, true); } ShowMassage(___showMassageIndex); return(false); }
/// <summary> /// 删除角色生平经历 /// </summary> /// <param name="ActorID">被删的角色 ID</param> /// <param name="Record">对应的记录</param> public static void DelLifeRecord(int ActorID, LifeRecords.LifeRecord Record) { DelLifeRecord(ActorID, new LifeRecords.LifeRecord[] { Record }); }