public static bool Prefix()
        {
            if (!Main.enabled)
            {
                return(true);
            }

            int mainActorId = DateFile.instance.MianActorID();
            int targetId = MessageEventManager.Instance.MainEventData[1];
            int mapId = 0, tileId = 0;

            List <int> actorAtPlace = DateFile.instance.GetActorAtPlace(targetId);

            if (actorAtPlace != null)
            {
                mapId  = actorAtPlace[0];
                tileId = actorAtPlace[1];
            }

            switch (MessageEventManager.Instance.EventValue[1])
            {
            case 11:
            {
                List <int> Values = MessageEventManager.Instance.EventValue;
                bool       跳过战力检定 = Main.settings.rape.skipBattle;
                bool       影响双方情绪 = Main.settings.rape.moodChange;
                bool       结仇     = Main.settings.rape.beHated;
                bool       单亲     = Main.settings.rape.oneParent;

                if (!Main.settings.rape.overwriteArg)
                {
                    if (Values.Count > 2)
                    {
                        跳过战力检定 = (Values[2] != 0);
                    }
                    if (Values.Count > 3)
                    {
                        影响双方情绪 = (Values[3] != 0);
                    }
                    if (Values.Count > 4)
                    {
                        结仇 = (Values[4] != 0);
                    }
                    if (Values.Count > 5)
                    {
                        单亲 = (Values[5] != 0);
                    }
                }

                RapeHelper.Rape(mainActorId, targetId, mapId, tileId, 跳过战力检定, 影响双方情绪, 结仇, 单亲);
                break;
            }

            default:
                return(true);
            }

            WorldMapSystem.instance.UpdatePlaceActor(WorldMapSystem.instance.choosePartId, WorldMapSystem.instance.choosePlaceId);
            return(false);
        }
Exemplo n.º 2
0
        public static bool Prefix(int mapId, int tileId, bool isTaiwuAtThisTile, Dictionary <int, int> righteousInfo, object disasterInfo, int worldId, int mainActorId, Dictionary <int, List <int> > mainActorItems, System.Random random)
        {
            if (!Main.enabled || !Main.settings.rape.autorape.Enabled)
            {
                return(true);
            }

            if (!isTaiwuAtThisTile)
            {
                return(true);
            }

            Debug("开始寻找目标");

            int 角色立场 = DateFile.instance.GetActorGoodness(mainActorId);
            int 欺辱概率 = int.Parse(DateFile.instance.goodnessDate[角色立场][25]);
            int 战力评价 = int.Parse(DateFile.instance.GetActorDate(mainActorId, 993, applyBonus: false));
            int 性别   = int.Parse(DateFile.instance.GetActorDate(mainActorId, 14, applyBonus: false));

            PeopleLifeAIHelper.GetTileCharacters(mapId, tileId, out int[] aliveChars);
            List <int> list = aliveChars.ToList();

            if (Main.settings.rape.autorape.JustLover)
            {
                list = list.Where((int id) => DateFile.instance.GetActorSocial(mainActorId, 312).Contains(id)).ToList();
            }
            if (Main.settings.rape.autorape.FilterName)
            {
                try
                {
                    list = list.Where((int id) => DateFile.instance.GetActorName(id).IndexOf(Main.settings.rape.autorape.Name) != -1).ToList();
                }
                catch (Exception e)
                {
                    Debug("地块有角色姓名获取失败,无法使用姓名过滤,主动欺辱判定强行终止。");
                    Debug(e.ToString());
                    return(true);
                }
            }
            if (Main.settings.rape.autorape.DifferentSex)
            {
                list = list.Where((int id) => int.Parse(DateFile.instance.GetActorDate(id, 14, applyBonus: false)) != 性别).ToList();
            }

            string names = "";

            foreach (int kid in list)
            {
                try
                {
                    names += DateFile.instance.GetActorName(kid) + " ";
                }
                catch (Exception)
                {
                    list.Remove(kid);
                    Debug(string.Format("{0} 无法获取姓名,将从列表中移除", kid));
                }
            }

            if (list.Count == 0)
            {
                Debug("无可欺辱目标");
                return(true);
            }
            else
            {
                Debug("欺辱目标名单: " + names);
            }

            if (Main.settings.rape.autorape.SpecifiedPossibility)
            {
                欺辱概率 = Main.settings.rape.autorape.Possibility;
            }

            int var1 = UnityEngine.Random.Range(0, 100);

            if (list.Count > 0 && var1 < 欺辱概率)
            {
                Debug("欺辱概率判定通过,需求 " + var1 + ",结果 " + 欺辱概率);
                int  targetID = list[UnityEngine.Random.Range(0, list.Count)];
                bool r        = RapeHelper.Rape(mainActorId, targetID, mapId, tileId, Main.settings.rape.skipBattle, Main.settings.rape.moodChange, Main.settings.rape.beHated, Main.settings.rape.oneParent);
            }
            else
            {
                Debug("欺辱概率判定未通过,需求 " + var1 + ",结果 " + 欺辱概率);
            }
            return(true);
        }