Example #1
0
        /// <summary>
        /// 删除角色生平经历
        /// </summary>
        /// <param name="ActorID">被删的角色 ID</param>
        /// <param name="RecordType">被删掉的记录类型</param>
        public static void DelLifeRecord(int ActorID, int RecordType)
        {
            var records = LifeRecords.GetAllRecords(ActorID).ToList();

            records.RemoveAll(i => i.messageId == RecordType);
            LifeRecords.RemoveRecords(ActorID);
            LifeRecords.AddRecords(ActorID, records.ToArray());
        }
Example #2
0
        /// <summary>
        /// 删除角色生平经历
        /// </summary>
        /// <param name="ActorID">被删的角色 ID</param>
        /// <param name="Records">被删掉的记录数组</param>
        public static void DelLifeRecord(int ActorID, LifeRecords.LifeRecord[] Records)
        {
            var records = LifeRecords.GetAllRecords(ActorID).ToList();

            records.RemoveAll(i => Records.Contains(i));
            LifeRecords.RemoveRecords(ActorID);
            LifeRecords.AddRecords(ActorID, records.ToArray());
        }
Example #3
0
        /// <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]));
            }
        }
Example #4
0
        /// <summary>
        /// 获取角色生平经历
        /// </summary>
        /// <param name="ActorID">角色 ID</param>
        /// <param name="RecordTypes">null 为任意,获取的记录类型</param>
        /// <param name="ParamTypes">null 为任意,参数类型</param>
        /// <param name="ParamValues">null 为任意,参数内容</param>
        public static List <LifeRecords.LifeRecord> GetLifeRecords(int ActorID, List <int> RecordTypes = null, List <int> ParamTypes = null, List <int> ParamValues = null)
        {
            var result = new List <LifeRecords.LifeRecord>();

            if ((RecordTypes?.Count ?? 0) == 0)
            {
                RecordTypes = null;
            }
            if ((ParamTypes?.Count ?? 0) == 0)
            {
                ParamTypes = null;
            }
            if ((ParamValues?.Count ?? 0) == 0)
            {
                ParamValues = null;
            }
            if (ParamValues == null && ParamTypes == null && RecordTypes == null)
            {
                return(LifeRecords.GetAllRecords(ActorID)?.ToList() ?? result);
            }
            var temp = LifeRecords.GetAllRecords(ActorID)?.ToList() ?? result;

            foreach (var i in temp)
            {
                if (RecordTypes != null && !RecordTypes.Contains(i.messageId))
                {
                    continue;
                }

                if (ParamTypes != null)
                {
                    string text             = DateFile.instance.actorMassageDate[i.messageId][2];
                    int[]  pramType         = (text == "-1") ? new int[] { } : Enumerable.ToArray(Enumerable.Select(text.Split('|'), int.Parse));
                    bool   ParmTypeContains = false;
                    foreach (var ii in ParamTypes)
                    {
                        if (pramType.Contains(ii))
                        {
                            ParmTypeContains = true;
                            break;
                        }
                    }
                    if (!ParmTypeContains)
                    {
                        continue;
                    }
                }

                if (ParamTypes != null && !ParamTypes.Contains(i.param0) && !ParamTypes.Contains(i.param1) && !ParamTypes.Contains(i.param2))
                {
                    continue;
                }

                result.Add(i);
            }

            return(result);
        }
Example #5
0
        /// <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);
        }