static void Postfix(PeopleLifeAI __instance, ref int typ, ref int[] aiEventDate, ref Dictionary <int, Dictionary <int, List <int[]> > > ___eventDate) { if (!settings.disableBeg) { return; } //乞讨事件屏蔽 if (___eventDate == null) { logger.Log("___eventDate is null"); return; } if (typ > 0 && typ < 10 && typ != 8) { if (aiEventDate[2] == 207 || aiEventDate[2] == 208 || aiEventDate[2] == 209 || aiEventDate[2] == 218 || aiEventDate[2] == 219 || aiEventDate[2] == 220 || aiEventDate[2] == 221 || aiEventDate[2] == 222 || aiEventDate[2] == 223 || aiEventDate[2] == 224) { if (___eventDate.ContainsKey(typ)) { for (int i = ___eventDate[typ][aiEventDate[1]].Count - 1; i >= 0; i--) { if (___eventDate[typ][aiEventDate[1]][i][2] == aiEventDate[2]) { ___eventDate[typ][aiEventDate[1]].Remove(___eventDate[typ][aiEventDate[1]][i]); ___eventDate.Remove(typ); //logger.Log(string.Format("remove actor id{0},event id {1},evnet type{2}", aiEventDate[1], aiEventDate[2], typ)); } } } } } }
private static void Prefix(PeopleLifeAI __instance, ref int actorId, ref int mapId, ref int tileId, ref int mainActorId, bool isTaiwuAtThisTile, ref int worldId) { foreach (var e in EventExtentionHandle.aiTurnEvents) { PeopleLifeAI.instance.aiTrunEvents.Add(e); } EventExtentionHandle.aiTurnEvents.Clear(); }
static bool Prefix(PeopleLifeAI __instance, ref int fatherId, ref int motherId, ref int setFather, ref int setMother) { if (!Main.enabled || Main.settings.numChild == 1) { return(true); } //Main.Logger.Log("生孩子倍率:" + Main.settings.numChild); int num = Main.settings.numChild == 0?50:100 * Main.settings.numChild; int num4 = num; if (int.Parse(DateFile.instance.GetActorDate(motherId, 14, false)) == 2) { if (!DateFile.instance.HaveLifeDate(motherId, 901) && UnityEngine.Random.Range(0, 15000) < int.Parse(DateFile.instance.GetActorDate(fatherId, 24, true)) * int.Parse(DateFile.instance.GetActorDate(motherId, 24, true))) { int num2 = DateFile.instance.MianActorID(); bool flag = fatherId == num2 || motherId == num2; int num3 = (!flag) ? Main.settings.npcUpLimit || Main.settings.numChild == 0 ? 50 : 50 * Main.settings.numChild : 25; num -= DateFile.instance.GetActorSocial(fatherId, 310, false, false).Count *num3; num -= DateFile.instance.GetActorSocial(motherId, 310, false, false).Count *num3; if (UnityEngine.Random.Range(0, num4) < num) { DateFile.instance.ChangeActorFeature(motherId, 4002, 4003); if (flag && UnityEngine.Random.Range(0, 100) < (DateFile.instance.getQuquTrun - 100) / 10) { DateFile.instance.getQuquTrun = 0; DateFile.instance.actorLife[motherId].Add(901, new List <int> { 1042, fatherId, motherId, setFather, setMother }); } else { DateFile.instance.actorLife[motherId].Add(901, new List <int> { UnityEngine.Random.Range(6, 10), fatherId, motherId, setFather, setMother }); } } } } return(false); }
static bool Prefix(PeopleLifeAI __instance, int fatherId, int motherId, int setFather, int setMother) { if (!Main.enabled || !Main.settings.npcNumberLimited) { return(true); } if ((!Main.settings.actorChildrenNumberLimited) && (fatherId == DateFile.instance.MianActorID() || motherId == DateFile.instance.MianActorID())) { return(true); } if (fatherId <= 0 || motherId <= 0) { return(true); } int gangId = int.Parse(DateFile.instance.GetActorDate(fatherId, 19, false)); if (setMother == 1 && setFather == 0) { gangId = int.Parse(DateFile.instance.GetActorDate(motherId, 19, false)); } int gangActorNum = 0; int key = int.Parse(DateFile.instance.GetGangDate(gangId, 3)); int key2 = int.Parse(DateFile.instance.GetGangDate(gangId, 4)); if (DateFile.instance.gangGroupDate.ContainsKey(key) && DateFile.instance.gangGroupDate[key].ContainsKey(key2)) { List <int> list = new List <int>(DateFile.instance.gangGroupDate[key][key2].Keys); for (int i = 0; i < list.Count; i++) { gangActorNum += DateFile.instance.GetGangActor(gangId, list[i]).Count(); } } if (Main.settings.npcMaxNumber > 0 && gangActorNum >= Main.settings.npcMaxNumber) { return(false); } return(true); }