Ejemplo n.º 1
0
        private static void Postfix(DateFile __instance, ref List <int> __result)
        {
            if (!Main.enabled)
            {
                return;
            }

            try
            {
                foreach (CharId childId in __result)
                {
                    // previousLives存了所有前世身份,最后一条是上一世
                    var previousLives = __instance.actorLife[childId][801];
                    if (previousLives == null || previousLives.Count == 0)
                    {
                        return;
                    }

                    // 尝试进行太吾抢占降生
                    bool isTaiwu = DeadTaiwuManager.instance.tryDeadTaiwuBirthPreemption(childId, ref previousLives);

                    if (Main.settings.lockGenderAll || (Main.settings.lockGenderTaiwu && isTaiwu))
                    {
                        int previousLifeId     = previousLives[previousLives.Count - 1];
                        int previousLifeGender = int.Parse(__instance.GetActorDate(previousLifeId, CharDataIndex.SEX, false));

                        // 性别:1- 男, 2 - 女, 1+2=3,性别翻转用 3-x
                        int gender = Main.settings.lockGenderAlter ? 3 - previousLifeGender : previousLifeGender;
                        __instance.actorsDate[childId][CharDataIndex.SEX] = gender.ToString();

                        // 恢复前世脸以及肤色
                        if (Main.settings.lockFaceAll || (Main.settings.lockFaceTaiwu && isTaiwu))
                        {
                            string face_components = __instance.GetActorDate(previousLifeId, CharDataIndex.FACE_COMPONENTS, false);
                            string face_colors     = __instance.GetActorDate(previousLifeId, CharDataIndex.FACE_COLORS, false);
                            string futa            = __instance.GetActorDate(previousLifeId, CharDataIndex.FUTA, false);

                            int charm = __instance.GetFaceCharm(gender, Array.ConvertAll(face_components.Split(new char[] { '|' }), int.Parse));

                            __instance.actorsDate[childId][CharDataIndex.FACE_COMPONENTS] = face_components;
                            __instance.actorsDate[childId][CharDataIndex.FACE_COLORS]     = face_colors;
                            __instance.actorsDate[childId][CharDataIndex.CHARM]           = charm.ToString();
                            __instance.actorsDate[childId][CharDataIndex.FUTA]            = futa;
                            __instance.MakeActorName(childId, int.Parse(__instance.GetActorDate(childId, 29, false)), __instance.GetActorDate(childId, 5, false), true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        private static void Postfix(DateFile __instance, ref List <int> __result)
        {
            if (!Main.enabled)
            {
                return;
            }

            try
            {
                int childId = __result[0];
                if (__instance.actorLife.ContainsKey(childId))
                {
                    var previousLives = __instance.actorLife[childId][801];
                    if (previousLives.Count > 0)
                    {
                        int previousLifeId = previousLives[previousLives.Count - 1];
                        if (Main.settings.lockGenderAll || (Main.settings.lockGenderTaiwu && isTaiwu(__instance, previousLifeId)))
                        {
                            int previousLifeGender = int.Parse(__instance.GetActorDate(previousLifeId, CharDataIndex.SEX, false));

                            // 性别:1- 男, 2 - 女, 1+2=3,性别翻转用 3-x
                            int gender = Main.settings.lockGenderAlter ? 3 - previousLifeGender : previousLifeGender;
                            __instance.actorsDate[childId][CharDataIndex.SEX] = gender.ToString();

                            // 恢复前世脸以及肤色
                            if (Main.settings.lockFaceAll || (Main.settings.lockFaceTaiwu && isTaiwu(__instance, previousLifeId)))
                            {
                                string face_components = __instance.GetActorDate(previousLifeId, CharDataIndex.FACE_COMPONENTS, false);
                                string face_colors     = __instance.GetActorDate(previousLifeId, CharDataIndex.FACE_COLORS, false);

                                int charm = __instance.GetFaceCharm(gender, Array.ConvertAll(face_components.Split(new char[] { '|' }), int.Parse));

                                __instance.actorsDate[childId][CharDataIndex.FACE_COMPONENTS] = face_components;
                                __instance.actorsDate[childId][CharDataIndex.FACE_COLORS]     = face_colors;
                                __instance.actorsDate[childId][CharDataIndex.CHARM]           = charm.ToString();
                                __instance.MakeActorName(childId, int.Parse(__instance.GetActorDate(childId, 29, false)), __instance.GetActorDate(childId, 5, false), true);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }