protected static bool LoadSocialData(BooterHelper.DocumentBootFile socialData) { if (!socialData.IsValid) { BooterLogger.AddError(socialData + ": Unknown SocialData File"); return(false); } XmlElementLookup lookup = new XmlElementLookup(socialData.Document); List <XmlElement> actions = lookup["Action"]; if ((actions == null) || (actions.Count == 0)) { BooterLogger.AddError(socialData + ": No Action"); return(false); } bool isEp5Installed = GameUtils.IsInstalled(ProductVersion.EP5); foreach (XmlElement element in actions) { XmlElementLookup table = new XmlElementLookup(element); CommodityTypes types; ParserFunctions.TryParseEnum <CommodityTypes>(element.GetAttribute("com"), out types, CommodityTypes.Undefined); ProductVersion version; ParserFunctions.TryParseEnum <ProductVersion>(element.GetAttribute("ver"), out version, ProductVersion.BaseGame); ActionData data = new ActionData(element.GetAttribute("key"), types, version, table, isEp5Installed); List <XmlElement> list = table["LHS"]; if (list.Count > 0x0) { SocialRuleLHS.sDictionary.Remove(data.Key); foreach (XmlElement element3 in list) { SocialRuleLHS lhs = new SocialRuleLHS(data.Key, data.IntendedCommodityString, element3); lhs.ProceduralPrecondition = FindMethod(element3.GetAttribute("ProcTest")); } SocialRuleLHS.Get(data.Key).Sort(new Comparison <SocialRuleLHS>(SocialRuleLHS.SortSocialRules)); } ActionData.Add(data); BooterLogger.AddTrace(" " + data.Key + " Added"); } return(true); }
public void OnPreLoad() { CommodityData amorous = CommodityData.Get(CommodityTypes.Amorous); CommodityData.Add(new CommodityData( sAmorous2, amorous.ChangeToneText, amorous.mIsPositive, false /*amorous.mIsSymmetric*/, amorous.mAppearsAsSubMenu, amorous.EndStanceX, amorous.EndStanceY, amorous.NumSocialsDecremented, amorous.NextCommodity1, amorous.NextCommodity2, amorous.X1, amorous.X2, amorous.Y1, amorous.Y2, amorous.Y3 )); CommodityTable.sMap[sAmorous2] = new Dictionary<CommodityTypes, float>(); CommodityTable.Add(sAmorous2, sAmorous2, 1); foreach (CommodityTypes type in Enum.GetValues(typeof(CommodityTypes))) { if (type == CommodityTypes.Undefined) continue; CommodityTable.Add(sAmorous2, type, CommodityTable.Get(CommodityTypes.Amorous, type)); CommodityTable.Add(type, sAmorous2, CommodityTable.Get(type, CommodityTypes.Amorous)); } foreach (SocialRuleLHS oldRule in new List<SocialRuleLHS>(SocialRuleLHS.Get("GR"))) { if (oldRule.GeneralCommodity != CommodityTypes.Amorous) continue; SocialRuleLHS newRule = new SocialRuleLHS( "GR", sAmorous2, oldRule.mSpeechAct, oldRule.ThirdParty, oldRule.STCommodityPositive, new Pair<CommodityTypes, bool>(oldRule.STCommodity.First, oldRule.STCommodity.Second), new Pair<ShortTermContextTypes, bool>(oldRule.STContext.First, oldRule.STContext.Second), oldRule.TargetMood, new Pair<LongTermRelationshipTypes, bool>(oldRule.LTRelationship.First, oldRule.LTRelationship.Second), oldRule.LTRMin, oldRule.LTRMax, "", "", "", oldRule.mSkillLevel, oldRule.mSkillThresholdAbove, "", "", "", "", "", oldRule.Partner, oldRule.WrongGenderPreference, oldRule.Repetition, oldRule.ActorAgeRestrictions, oldRule.TargetAgeRestrictions, oldRule.TargetBetrayed, oldRule.SpecificityOverride, oldRule.STEffectCommodity, oldRule.LTROverride ); newRule.mActorTraits = oldRule.mActorTraits; newRule.mTargetTraits = oldRule.mTargetTraits; newRule.mSkill = oldRule.mSkill; newRule.mActorIncreasedEffectiveness = oldRule.mActorIncreasedEffectiveness; newRule.mActorReducedEffectiveness = oldRule.mActorReducedEffectiveness; newRule.mTargetIncreasedEffectiveness = oldRule.mTargetIncreasedEffectiveness; newRule.mTargetReducedEffectiveness = oldRule.mTargetReducedEffectiveness; newRule.ProceduralPrecondition = oldRule.ProceduralPrecondition; } SocialRuleLHS.Get("GR").Sort(new Comparison<SocialRuleLHS>(SocialRuleLHS.SortSocialRules)); CloneSTCData(sFlirty2, sAmorous2, ShortTermContextTypes.Flirty); CloneSTCData(sSeductive2, sAmorous2, ShortTermContextTypes.Seductive); CloneSTCData(sHot2, sAmorous2, ShortTermContextTypes.Hot); STCData.SetNextSTC(sFlirty2, sSeductive2); STCData.SetNextSTC(sSeductive2, sHot2); }
public void OnPreLoad() { CommodityData amorous = CommodityData.Get(CommodityTypes.Amorous); CommodityData.Add(new CommodityData( sAmorous2, amorous.ChangeToneText, amorous.mIsPositive, false /*amorous.mIsSymmetric*/, amorous.mAppearsAsSubMenu, amorous.EndStanceX, amorous.EndStanceY, amorous.NumSocialsDecremented, amorous.NextCommodity1, amorous.NextCommodity2, amorous.X1, amorous.X2, amorous.Y1, amorous.Y2, amorous.Y3 )); CommodityTable.sMap[sAmorous2] = new Dictionary <CommodityTypes, float>(); CommodityTable.Add(sAmorous2, sAmorous2, 1); foreach (CommodityTypes type in Enum.GetValues(typeof(CommodityTypes))) { if (type == CommodityTypes.Undefined) { continue; } CommodityTable.Add(sAmorous2, type, CommodityTable.Get(CommodityTypes.Amorous, type)); CommodityTable.Add(type, sAmorous2, CommodityTable.Get(type, CommodityTypes.Amorous)); } foreach (SocialRuleLHS oldRule in new List <SocialRuleLHS>(SocialRuleLHS.Get("GR"))) { if (oldRule.GeneralCommodity != CommodityTypes.Amorous) { continue; } SocialRuleLHS newRule = new SocialRuleLHS( "GR", sAmorous2, oldRule.mSpeechAct, oldRule.ThirdParty, oldRule.STCommodityPositive, new Pair <CommodityTypes, bool>(oldRule.STCommodity.First, oldRule.STCommodity.Second), new Pair <ShortTermContextTypes, bool>(oldRule.STContext.First, oldRule.STContext.Second), oldRule.TargetMood, new Pair <LongTermRelationshipTypes, bool>(oldRule.LTRelationship.First, oldRule.LTRelationship.Second), oldRule.LTRMin, oldRule.LTRMax, "", "", "", oldRule.mSkillLevel, oldRule.mSkillThresholdAbove, "", "", "", "", "", oldRule.Partner, oldRule.WrongGenderPreference, oldRule.Repetition, oldRule.ActorAgeRestrictions, oldRule.TargetAgeRestrictions, oldRule.TargetBetrayed, oldRule.SpecificityOverride, oldRule.STEffectCommodity, oldRule.LTROverride ); newRule.mActorTraits = oldRule.mActorTraits; newRule.mTargetTraits = oldRule.mTargetTraits; newRule.mSkill = oldRule.mSkill; newRule.mActorIncreasedEffectiveness = oldRule.mActorIncreasedEffectiveness; newRule.mActorReducedEffectiveness = oldRule.mActorReducedEffectiveness; newRule.mTargetIncreasedEffectiveness = oldRule.mTargetIncreasedEffectiveness; newRule.mTargetReducedEffectiveness = oldRule.mTargetReducedEffectiveness; newRule.ProceduralPrecondition = oldRule.ProceduralPrecondition; } SocialRuleLHS.Get("GR").Sort(new Comparison <SocialRuleLHS>(SocialRuleLHS.SortSocialRules)); CloneSTCData(sFlirty2, sAmorous2, ShortTermContextTypes.Flirty); CloneSTCData(sSeductive2, sAmorous2, ShortTermContextTypes.Seductive); CloneSTCData(sHot2, sAmorous2, ShortTermContextTypes.Hot); STCData.SetNextSTC(sFlirty2, sSeductive2); STCData.SetNextSTC(sSeductive2, sHot2); }
protected static bool LoadSocialData(BooterHelper.DocumentBootFile socialData) { if (!socialData.IsValid) { BooterLogger.AddError(socialData + ": Unknown SocialData File"); return false; } XmlElementLookup lookup = new XmlElementLookup(socialData.Document); List<XmlElement> actions = lookup["Action"]; if ((actions == null) || (actions.Count == 0)) { BooterLogger.AddError(socialData + ": No Action"); return false; } bool isEp5Installed = GameUtils.IsInstalled(ProductVersion.EP5); foreach (XmlElement element in actions) { XmlElementLookup table = new XmlElementLookup(element); CommodityTypes types; ParserFunctions.TryParseEnum<CommodityTypes>(element.GetAttribute("com"), out types, CommodityTypes.Undefined); ProductVersion version; ParserFunctions.TryParseEnum<ProductVersion>(element.GetAttribute("ver"), out version, ProductVersion.BaseGame); ActionData data = new ActionData(element.GetAttribute("key"), types, version, table, isEp5Installed); List<XmlElement> list = table["LHS"]; if (list.Count > 0x0) { SocialRuleLHS.sDictionary.Remove(data.Key); foreach (XmlElement element3 in list) { SocialRuleLHS lhs = new SocialRuleLHS(data.Key, data.IntendedCommodityString, element3); lhs.ProceduralPrecondition = FindMethod(element3.GetAttribute("ProcTest")); } SocialRuleLHS.Get(data.Key).Sort(new Comparison<SocialRuleLHS>(SocialRuleLHS.SortSocialRules)); } ActionData.Add(data); BooterLogger.AddTrace(" " + data.Key + " Added"); } return true; }
public void OnPreLoad() { // We use this one because it is ahead of other checks ActiveTopicData celebrityTopic = ActiveTopicData.Get("CelebrityTopic"); if (celebrityTopic != null) { celebrityTopic.TestFunction = typeof(CommonSocials).GetMethod("AlterSTC"); } ActiveTopicData alwaysOnTopic = ActiveTopicData.Get("Always On"); if (alwaysOnTopic != null) { alwaysOnTopic.TestFunction = typeof(CommonSocials).GetMethod("AlterSTC"); } InteractionTuning tuning = Tunings.GetTuning<IWeddingArch, WeddingArch.RouteToWeddingArchSlot.Definition>(); if (tuning != null) { tuning.Availability.Teens = true; } tuning = Tunings.GetTuning<WeddingCake, WeddingCake.CutWeddingCake.Definition>(); if (tuning != null) { tuning.Availability.Teens = true; } STCData.SetNumSocialsDuringConversation(int.MaxValue); if (GameUtils.IsInstalled(ProductVersion.EP4)) { BooterLogger.AddError(SocialRHSReplacer.Perform<CommonSocials>("Be Frisky", "OnBeFriskyAccept")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("BeFriskyProceduralTest")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("CanWatchTheStars")); tuning = Tunings.GetTuning<Sim,Sim.WatchTheStars.Definition>(); if (tuning != null) { tuning.RemoveFlags(InteractionTuning.FlagField.DisallowAutonomous); } BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestAskToProm")); } if (GameUtils.IsInstalled(ProductVersion.EP5)) { BooterLogger.AddTrace(ActionDataReplacer.Perform<CommonSocials>("TestHorseWooHoo", "OnEAHorseWoohooTest")); BooterLogger.AddTrace(ActionDataReplacer.Perform<CommonSocials>("TestPetWooHoo", "OnEAPetWoohooTest")); BooterLogger.AddError(SocialRHSReplacer.Perform<CommonSocials>("Pet Woohoo", "OnPetWoohooAccepted")); BooterLogger.AddError(SocialRHSReplacer.Perform<CommonSocials>("HorseWooHoo", "OnHorseWooHoo")); BooterLogger.AddError(SocialRHSReplacer.Perform<CommonSocials>("Adopt Stray", "OnStrayPetAdopted")); BooterLogger.AddError(SocialRHSReplacer.Perform<CommonSocials>("Adopt Wild Horse", "AdoptWildHorseSuccessProcAfter")); BooterLogger.AddError(SocialRHSReplacer.Perform<CommonSocials>("Unicorn Invite", "OnUnicornInviteAccept")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("AdoptStrayTest")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("AdoptWildHorseProceduralTest")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("UnicornInviteTest")); } if (GameUtils.IsInstalled(ProductVersion.EP7)) { BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestLunaticBuff")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestNuzzleRomanticCheck")); ActionAvailabilityReplacer.Perform("Confess To Watching You While You Sleep", sRomanticToFriendly); } if (GameUtils.IsInstalled(ProductVersion.EP9)) { BooterLogger.AddError(SocialRHSReplacer.Perform<CommonSocials>("Spicy WooHoo", "OnSpicyWooHoo")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestJuicedKiss")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestJuicedLeapIntoArms")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestJuicedMakeOut")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestJuicedWooHoo")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestKissAndMakeUp")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestSpicyWooHoo")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestCanSketchTargetNude")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestCinnamonKiss")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestHeatOfMomentKiss")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestIsPlantSim")); } if (GameUtils.IsInstalled(ProductVersion.EP11)) { BooterLogger.AddError(SocialRHSReplacer.Perform<CommonSocials>("Jetpack Woohoo", "AfterJetPackWoohoo")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestDipKiss")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestElectrifiedKiss")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestJetPackKiss")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestJetPackSlowDance")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestJetPackWooHoo")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestSparkKiss")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestCanUploadFeelings")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestCanComplimentHardware")); } ActionAvailabilityReplacer.Perform("Make Promise To Protect", sRomanticToFriendly); ActionAvailabilityReplacer.Perform("Ask To Be Protected", sRomanticToFriendly); BooterLogger.AddError(SocialRHSReplacer.Perform<CommonSocials>("WooHoo", "OnWooHoo")); BooterLogger.AddError(SocialRHSReplacer.Perform<CommonSocials>("Try For Baby", "OnTryForBaby")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestLetsGoOnDate")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestFirstKiss")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestKiss")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestKissOnCheek")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestMakeOut")); BooterLogger.AddTrace(ActionDataReplacer.Perform<CommonSocials>("TestWooHoo", "OnEAWoohooTest")); BooterLogger.AddTrace(ActionDataReplacer.Perform<CommonSocials>("TestTryForBaby", "OnEATryForBabyTest")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestProposeMarriage")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestHavePrivateWedding")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestGetMarried")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestGetMarriedUsingArch")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestAccuseOfCheating")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestProposeGoingSteady")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestAskNPCToStayOver")); BooterLogger.AddError(ActionDataReplacer.PerformKey<CommonSocials>("TestAskToStayOver", "Ask To Stay Over Romantically")); ActionData askSign = ActionData.Get("Ask Sign"); if ((askSign != null) && (askSign.IntendedCommodityString == CommodityTypes.Amorous)) { BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestAskSign", "TestDisable")); } ActionData askAboutPartner = ActionData.Get("Ask About Partner"); if ((askAboutPartner != null) && (askAboutPartner.IntendedCommodityString == CommodityTypes.Amorous)) { BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestAskAboutPartner", "TestDisable")); } BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestCanVibrateBed")); BooterLogger.AddError(ActionDataReplacer.Perform<CommonSocials>("TestProposeToMoveInWith")); MethodInfo testAttraction = typeof(CommonSocials).GetMethod("OnTestAttraction"); MethodInfo defaultTest = typeof(CommonSocials).GetMethod("OnDefaultTest"); MethodInfo defaultNonRomanticTest = typeof(CommonSocials).GetMethod("OnDefaultNonRomanticTest"); MethodInfo stopMethod = typeof(CommonSocials).GetMethod("OnDenyTest"); MethodInfo testMassage = typeof(CommonSocials).GetMethod("OnTestMassage"); MethodInfo testBreakup = typeof(CommonSocials).GetMethod("OnTestBreakup"); CASAGSAvailabilityFlags restrictedAges = CASAGSAvailabilityFlags.HumanBaby | CASAGSAvailabilityFlags.HumanToddler | CASAGSAvailabilityFlags.HumanChild; foreach (ActionData data in ActionData.sData.Values) { if (!data.IsRomantic) { switch (data.Key) { case "Ask For Son/Daughters Hand": case "Announce Engagement": case "Announce Pregnancy": case "Ask Determine Gender Of Baby": case "Ask to Move In": case "Cancel Wedding": case "Divorce": case "Fret Over Commitment": case "Request Feel My Tummy": case "Tell About Betrayers Other Relationship": case "WooHoo AutoReject": case "Accuse of Cheating": data.mActorAgeAllowed |= CASAGSAvailabilityFlags.HumanTeen; data.mTargetAgeAllowed |= CASAGSAvailabilityFlags.HumanTeen; break; } if (data.ProceduralTest == null) { data.ProceduralTest = defaultNonRomanticTest; } continue; } else { bool ignore = false; switch (data.Key) { case "Greet Flirty": case "Greet Hot": case "Greet Seductive": ignore = true; break; } if (ignore) continue; } if (!sRomanticSocials.ContainsKey(data.Key)) { sRomanticSocials.Add(data.Key, data.JealousyLevel); } data.mJealousyLevel = JealousyLevel.None; data.IsRomantic = false; // Disables CanGetRomantic checks data.mActorAgeAllowed |= CASAGSAvailabilityFlags.HumanTeen; data.mTargetAgeAllowed |= CASAGSAvailabilityFlags.HumanTeen; if (data.Key.Contains("NRaas")) continue; if ((data.Key == "WooHoo") || (data.Key == "Pet Woohoo") || (data.Key == "HorseWooHoo")) { continue; } else if (data.Key == "Try For Baby") { continue; } else if (data.Key == "Massage") { data.ProceduralTest = testMassage; } else if (data.ProceduralTest == null) { if ((data.Key == "Break Up") || (data.Key == "Divorce")) { data.ProceduralTest = testBreakup; } else { data.ProceduralTest = defaultTest; } } else if (!data.ProceduralTest.DeclaringType.AssemblyQualifiedName.Contains("NRaas")) { switch (data.Key) { case "Vampire Drink": case "Ask About Partner": case "Vampire Offer To Turn": case "Ask To Forsake Vampire Guile": case "Ask To Forsake Witchitude": case "Ask To Forsake Fairy Charms": case "Ask To Forsake Werewolf Powers": case "Demonstrate MtoM": break; default: BooterLogger.AddError(data.Key + ": " + data.ProceduralTest); break; } } bool found = false; if (SocialRuleRHS.sDictionary.ContainsKey(data.Key)) { foreach (SocialRuleRHS rule in SocialRuleRHS.Get(data.Key)) { if ((rule.InteractionBitsAdded & LongTermRelationship.InteractionBits.Kissed) == LongTermRelationship.InteractionBits.Kissed) { if ((rule.InteractionBitsAdded & LongTermRelationship.InteractionBits.Romantic) == LongTermRelationship.InteractionBits.Romantic) { sKissRules.Add(rule); BooterLogger.AddTrace("Kiss Rule: " + data.Key); } } /* if ((rule.InteractionBitsAdded & LongTermRelationship.InteractionBits.Romantic) == LongTermRelationship.InteractionBits.Romantic) { if (!sRomanticSetters.ContainsKey(data.Key)) { sRomanticSetters.Add(data.Key, true); } rule.mInteractionBitsAdded &= ~LongTermRelationship.InteractionBits.Romantic; } */ if (rule.STEffectCommodity == CommodityTypes.Awkward) { found = true; } } if (found) { SocialRuleLHS newRule = new SocialRuleLHS( data.Key, CommodityTypes.Undefined, SpeechAct.None, 0, 0, new Pair<CommodityTypes, bool>(CommodityTypes.Undefined, true), new Pair<ShortTermContextTypes, bool>(ShortTermContextTypes.Undefined, true), -101, new Pair<LongTermRelationshipTypes, bool>(LongTermRelationshipTypes.Undefined, true), -100, 100, "", "", "", 1, true, "", "", "", "", "", MaybeBool.False, MaybeBool.False, MaybeBool.False, restrictedAges, restrictedAges, MaybeBool.False, 1000, CommodityTypes.Awkward, 0 ); newRule.ProceduralPrecondition = testAttraction; SocialRuleLHS.Get(data.Key).Sort(new Comparison<SocialRuleLHS>(SocialRuleLHS.SortSocialRules)); } } } }