Beispiel #1
0
 private static void UpdateAbilities(int newActorId)
 {
     if (Main.Settings.Abilities == Settings.Enums.Abilities.Inherit)
     {
         Taiwu.SetAbilities(newActorId, RemoveActorPatch.TaiwuAbilitiesBackup);
     }
 }
Beispiel #2
0
 private static void UpdateGoodness(int newActorId)
 {
     if (Main.Settings.Goodness == Settings.Enums.Goodness.Keep)
     {
         Taiwu.SetGoodness(newActorId, Taiwu.GetGoodness());
     }
 }
Beispiel #3
0
 public static void Prefix(List <int> actorId)
 {
     for (int i = 0; i < actorId.Count; i++)
     {
         if (actorId[i] == Taiwu.MainActorId)
         {
             TaiwuMaxAgeBackup    = Taiwu.GetMaxAge();
             TaiwuAbilitiesBackup = Taiwu.GetAbilities();
             TaiwuFeaturesBackup  = Taiwu.GetFeatures();
         }
     }
 }
Beispiel #4
0
        private static void UpdateAppearance(int newActorId)
        {
            switch (Main.Settings.Appearance)
            {
            case Settings.Enums.Appearance.Keep:
                Taiwu.SetAppearance(newActorId, Taiwu.GetAppearance());
                break;

            case Settings.Enums.Appearance.Change:
                Taiwu.SetAppearance(newActorId, Taiwu.IsMale(newActorId) ? Main.Settings.AppearanceMale : Main.Settings.AppearanceFemale);
                break;
            }
        }
Beispiel #5
0
        private static void UpdateName(int newActorId)
        {
            switch (Main.Settings.Name)
            {
            case Settings.Enums.Name.Keep:
                Taiwu.SetSurname(newActorId, Taiwu.GetSurname());
                Taiwu.SetForename(newActorId, Taiwu.GetForename());
                break;

            case Settings.Enums.Name.Change:
                Taiwu.SetSurname(newActorId, Taiwu.IsMale(newActorId) ? Main.Settings.SurnameMale : Main.Settings.SurnameFemale);
                Taiwu.SetForename(newActorId, Taiwu.IsMale(newActorId) ? Main.Settings.ForenameMale : Main.Settings.ForenameFemale);
                break;
            }
        }
Beispiel #6
0
        private static void UpdateFeatures(int newActorId)
        {
            if (Main.Settings.Features == Settings.Enums.Features.Inherit)
            {
                var features = RemoveActorPatch.TaiwuFeaturesBackup;

                features = Regex.Replace(features, @"\b(9998|9999)\b", "9997");        // 相枢入邪、相枢化魔 替换为 神魂俱安
                features = Regex.Replace(features, @"\b(4002|4003)\b", "4001");        // 杂阳毁阴、身怀六甲 替换为 真阳纯阴

                features = String.Join("|", features.Split('|').Distinct().ToArray()); // 保险起见,去重

                Taiwu.SetFeatures(newActorId, features);
                Taiwu.SetBornSolarTerm(newActorId, Taiwu.GetBornSolarTerm());
            }
        }
Beispiel #7
0
        public static void Prefix(ref int baseActorId)
        {
            if (Main.Enabled && IsInRandomHeirEvent() && IsTaiwuOldEnough())
            {
                // 人物性别存储在 presetActorDate 中,强行在 actorsDate 中设置性别会有副作用(死亡后性别恢复)。
                // 因此这里通过在创建人物时人为选择 baseActorId (presetActorId) 来实现性别修改。
                if (Main.Settings.Gender != Settings.Enums.Gender.Random)
                {
                    var gender = Taiwu.GetGender(); // 男: 1, 女: 2

                    if (Main.Settings.Gender == Settings.Enums.Gender.Invert)
                    {
                        gender = 3 - gender;
                    }

                    baseActorId = Taiwu.GetBasePresetActorId() + gender - 1;
                }
            }
        }
Beispiel #8
0
        public static void OnGUI(UnityModManager.ModEntry modEntry)
        {
            var infoLabelStyle = new GUIStyle(GUI.skin.GetStyle("label"));

            infoLabelStyle.normal.textColor = new Color(0.5f, 0.5f, 0.5f, 1f);

            var errorLabelStyle = new GUIStyle(GUI.skin.GetStyle("label"));

            errorLabelStyle.normal.textColor = new Color(1f, 0.25f, 0.25f, 1f);

            GUILayout.BeginVertical("Box");

            GUILayout.BeginHorizontal();
            GUILayout.Label("性别:", GUILayout.Width(40));
            Settings.Gender = (Settings.Enums.Gender)GUILayout.SelectionGrid((int)Settings.Gender, new string[] { "保持", "随机", "反转" }, 3, GUI.skin.toggle, GUILayout.Width(150));
            GUILayout.Space(10);
            switch (Settings.Gender)
            {
            case Settings.Enums.Gender.Keep:
                GUILayout.Label("重生时性别不变", infoLabelStyle);
                break;

            case Settings.Enums.Gender.Random:
                GUILayout.Label("重生时性别随机", infoLabelStyle);
                break;

            case Settings.Enums.Gender.Invert:
                GUILayout.Label("重生时转为异性", infoLabelStyle);
                break;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("姓名:", GUILayout.Width(40));
            Settings.Name = (Settings.Enums.Name)GUILayout.SelectionGrid((int)Settings.Name, new string[] { "保持", "随机", "修改" }, 3, GUI.skin.toggle, GUILayout.Width(150));
            GUILayout.Space(10);
            switch (Settings.Name)
            {
            case Settings.Enums.Name.Keep:
                GUILayout.Label("重生时姓名不变", infoLabelStyle);
                break;

            case Settings.Enums.Name.Random:
                GUILayout.Label("重生时姓名随机", infoLabelStyle);
                break;

            case Settings.Enums.Name.Change:
                GUILayout.Label("重生时修改姓名", infoLabelStyle);
                break;
            }
            GUILayout.EndHorizontal();
            if (Settings.Name == Settings.Enums.Name.Change)
            {
                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("男性:", GUILayout.Width(40));
                Settings.SurnameMale  = GUILayout.TextField(Settings.SurnameMale, GUILayout.Width(46));
                Settings.ForenameMale = GUILayout.TextField(Settings.ForenameMale, GUILayout.Width(46));
                GUILayout.Space(10);
                GUILayout.Label("女性:", GUILayout.Width(40));
                Settings.SurnameFemale  = GUILayout.TextField(Settings.SurnameFemale, GUILayout.Width(46));
                Settings.ForenameFemale = GUILayout.TextField(Settings.ForenameFemale, GUILayout.Width(46));
                GUILayout.EndHorizontal();
            }

            GUILayout.BeginHorizontal();
            GUILayout.Label("相貌:", GUILayout.Width(40));
            Settings.Appearance = (Settings.Enums.Appearance)GUILayout.SelectionGrid((int)Settings.Appearance, new string[] { "保持", "随机", "修改" }, 3, GUI.skin.toggle, GUILayout.Width(150));
            GUILayout.Space(10);
            switch (Settings.Appearance)
            {
            case Settings.Enums.Appearance.Keep:
                GUILayout.Label("重生时相貌不变", infoLabelStyle);
                break;

            case Settings.Enums.Appearance.Random:
                GUILayout.Label("重生时相貌随机", infoLabelStyle);
                break;

            case Settings.Enums.Appearance.Change:
                GUILayout.Label("重生时修改相貌", infoLabelStyle);
                break;
            }
            GUILayout.EndHorizontal();
            if (Settings.Appearance == Settings.Enums.Appearance.Change)
            {
                GUILayout.BeginVertical("Box");
                GUILayout.BeginHorizontal();
                GUILayout.Label("男性:", GUILayout.Width(40));
                Settings.AppearanceMale = GUILayout.TextField(Settings.AppearanceMale, GUILayout.Width(250));
                GUILayout.Space(10);
                if (GUILayout.Button("获取当前", GUILayout.Width(70)) && Taiwu.IsInGame())
                {
                    Settings.AppearanceMale = Taiwu.GetAppearance();
                }
                if (Settings.AppearanceMale != "" && !Taiwu.IsAppearanceValueValid(Settings.AppearanceMale))
                {
                    GUILayout.Space(9);
                    GUILayout.Label("格式错误", errorLabelStyle, GUILayout.Width(52));
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                GUILayout.Label("女性:", GUILayout.Width(40));
                Settings.AppearanceFemale = GUILayout.TextField(Settings.AppearanceFemale, GUILayout.Width(250));
                GUILayout.Space(10);
                if (GUILayout.Button("获取当前", GUILayout.Width(70)) && Taiwu.IsInGame())
                {
                    Settings.AppearanceFemale = Taiwu.GetAppearance();
                }
                if (Settings.AppearanceFemale != "" && !Taiwu.IsAppearanceValueValid(Settings.AppearanceFemale))
                {
                    GUILayout.Space(9);
                    GUILayout.Label("格式错误", errorLabelStyle, GUILayout.Width(52));
                }
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
            }

            GUILayout.BeginHorizontal();
            GUILayout.Label("立场:", GUILayout.Width(40));
            Settings.Goodness = (Settings.Enums.Goodness)GUILayout.SelectionGrid((int)Settings.Goodness, new string[] { "保持", "随机" }, 3, GUI.skin.toggle, GUILayout.Width(150));
            GUILayout.Space(10);
            switch (Settings.Goodness)
            {
            case Settings.Enums.Goodness.Keep:
                GUILayout.Label("重生时立场不变", infoLabelStyle);
                break;

            case Settings.Enums.Goodness.Random:
                GUILayout.Label("重生时立场随机", infoLabelStyle);
                break;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("属性:", GUILayout.Width(40));
            Settings.Abilities = (Settings.Enums.Abilities)GUILayout.SelectionGrid((int)Settings.Abilities, new string[] { "继承", "随机" }, 3, GUI.skin.toggle, GUILayout.Width(150));
            GUILayout.Space(10);
            switch (Settings.Abilities)
            {
            case Settings.Enums.Abilities.Inherit:
                GUILayout.Label("重生时继承能力和资质", infoLabelStyle);
                break;

            case Settings.Enums.Abilities.Random:
                GUILayout.Label("重生时能力和资质随机", infoLabelStyle);
                break;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("特性:", GUILayout.Width(40));
            Settings.Features = (Settings.Enums.Features)GUILayout.SelectionGrid((int)Settings.Features, new string[] { "继承", "随机" }, 3, GUI.skin.toggle, GUILayout.Width(150));
            GUILayout.Space(10);
            switch (Settings.Features)
            {
            case Settings.Enums.Features.Inherit:
                GUILayout.Label("重生时继承特性", infoLabelStyle);
                break;

            case Settings.Enums.Features.Random:
                GUILayout.Label("重生时特性随机", infoLabelStyle);
                break;
            }
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }
Beispiel #9
0
 private static bool IsTaiwuOldEnough()
 {
     return(Taiwu.GetAge() >= Math.Min(30, RemoveActorPatch.TaiwuMaxAgeBackup - 1));
 }