public override void AddInteractions(InteractionObjectPair iop, Sim actor, Sim target, List <InteractionObjectPair> results) { bool ungreeted = false; if (Skills.Assassination.StaticGuid != SkillNames.None) { Relationship relationship = Relationship.Get(target, actor, false); if ((relationship == null) || (relationship.LTR.CurrentLTR == LongTermRelationshipTypes.Stranger)) { ungreeted = true; } else if (target.NeedsToBeGreeted(actor)) { ungreeted = true; } } if (ungreeted) { foreach (SimDescription.DeathType type in Assassination.Types.Keys) { if (ActionData.Get("NRaas Assassin " + type) != null) { results.Add(new InteractionObjectPair(new Definition("NRaas Assassin " + type), target)); } } } }
public SocialSymptom(XmlDbRow row) : base(row) { if (BooterLogger.Exists(row, "Social", Guid)) { mSocial = row.GetString("Social"); if (mSocial != "Braaaiiins") { if (ActionData.Get(mSocial) == null) { BooterLogger.AddError(Guid + " Invalid Social: " + mSocial); } } } if (BooterLogger.Exists(row, "RoomOnly", Guid)) { mRoomOnly = row.GetBool("RoomOnly"); } mScoring = row.GetString("Scoring"); if (!string.IsNullOrEmpty(mScoring)) { if (ScoringLookup.GetScoring(mScoring) == null) { BooterLogger.AddError(Guid + " Invalid Scoring: " + mScoring); } mMinimum = row.GetInt("Minimum", 0); } }
public void OnPreLoad() { MethodInfo stopMethod = typeof(TrainSim).GetMethod("OnDenyTest"); ActionData data = ActionData.Get("Train Sim"); if (data != null) { data.ProceduralTest = stopMethod; } Tunings.Inject <AthleticGameObject, AthleticGameObject.TrainSim.Definition, Definition>(false); }
public override List <Sim> GetYouShouldTargets(Sim thisActor, Sim pushedSocialActor) { InteractionPriority priority = new InteractionPriority(InteractionPriorityLevel.UserDirected); SocialInteractionA.Definition pushedSocialDefinition = new SocialInteractionA.Definition(mPushedSocialActionKey, new string[0x0], null, false); pushedSocialDefinition.ChecksToSkip = mChecksToSkip; List <Sim> list = new List <Sim>(); foreach (Sim sim in pushedSocialActor.LotCurrent.GetAllActors()) { if (sim == thisActor) { continue; } if (sim == pushedSocialActor) { continue; } if (sim.SimDescription.HasActiveRole) { continue; } GreyedOutTooltipCallback tooltipCallback = null; if (!PushedSocialTest(pushedSocialActor, sim, pushedSocialDefinition, priority, tooltipCallback)) { continue; } ActionData data = ActionData.Get(mPushedSocialActionKey); if ((data != null) && ((data.IntendedCommodityString == CommodityTypes.Amorous) || (data.IntendedCommodityString == AmorousCommodity.sAmorous2))) { // Custom Function string reason; if (!CommonSocials.CanGetRomantic(sim.SimDescription, pushedSocialActor.SimDescription, false, true, true, ref tooltipCallback, out reason)) { continue; } } list.Add(sim); } return(list); }
public void Apply() { foreach (InteractionTuning tuning in InteractionTuning.sAllTunings.Values) { ITUNSettings setting = GetSettings(tuning, false); if (setting == null) { continue; } setting.Apply(Key, tuning); } for (int i = mTunables.Count - 1; i >= 0; i--) { TunableStore setting = mTunables[i]; if (!setting.Valid) { mTunables.RemoveAt(i); } else { setting.Apply(Key); } } List <string> remove = new List <string>(); foreach (ActionDataSetting setting in mActionData.Values) { ActionData data = ActionData.Get(setting.mName); if (data != null) { setting.Apply(Key, data); } else { remove.Add(setting.mName); } } foreach (string key in remove) { mActionData.Remove(key); } }
public void SetToDefault() { List <ITUNSettings> itunSettings = InteractionBooter.GetSettings(mKey); foreach (ITUNSettings setting in itunSettings) { mSettings[setting.mName] = setting; } Dictionary <string, bool> matched = new Dictionary <string, bool>(); foreach (InteractionTuning tuning in InteractionTuning.sAllTunings.Values) { ITUNSettings setting = GetSettings(tuning, false); if (setting == null) { continue; } matched.Add(setting.mName, true); } foreach (ITUNSettings setting in itunSettings) { if (matched.ContainsKey(setting.mName)) { continue; } BooterLogger.AddError("Unmatched ITUN:" + Common.NewLine + " ObjectName: " + setting.mName.Replace("|", Common.NewLine + " InteractionName:")); } foreach (TunableStore setting in TuningBooter.GetSettings(mKey)) { AddTunable(setting, true); } foreach (ActionDataSetting setting in SocialBooter.GetSettings(mKey)) { ActionData data = ActionData.Get(setting.mName); if (data != null) { mActionData[data.Key] = setting; } } }
public static List <SocialInteractionCandidate> Get(Sim actor, Sim target, ShortTermContextTypes category, LongTermRelationshipTypes group, bool isActive, ActiveTopic topic, bool isAutonomous, ref string msg) { Dictionary <LongTermRelationshipTypes, Dictionary <bool, List <string> > > dictionary; List <SocialInteractionCandidate> list = new List <SocialInteractionCandidate>(); if (ActionAvailabilityData.sStcInteractions.TryGetValue(category, out dictionary)) { Dictionary <bool, List <string> > dictionary2; List <string> list2; bool flag = dictionary.TryGetValue(group, out dictionary2); if (!flag) { group = LongTermRelationshipTypes.Default; flag = dictionary.TryGetValue(group, out dictionary2); } if (!flag || !dictionary2.TryGetValue(isActive, out list2)) { msg += Common.NewLine + "Get Fail 1 " + category; return(list); } msg += Common.NewLine + "Get Found " + category + " " + list2.Count; foreach (string str in list2) { ActionData data = ActionData.Get(str); GreyedOutTooltipCallback greyedOutTooltipCallback = null; InteractionTestResult result = data.Test(actor, target, isAutonomous, topic, ref greyedOutTooltipCallback); msg += Common.NewLine + " " + str + " " + result; if ((IUtil.IsPass(result) || (greyedOutTooltipCallback != null)) || Sims3.Gameplay.UI.PieMenu.PieMenuShowFailureReason) { list.Add(new SocialInteractionCandidate(str, data.GetParentMenu(actor, target), topic)); } } } else { msg += Common.NewLine + "Get Fail 2 " + category; } return(list); }
protected override void Perform(BooterHelper.BootFile file, XmlDbRow row) { string name = row.GetString("Name"); if (string.IsNullOrEmpty(name)) { BooterLogger.AddError("Name missing"); return; } if (ActionData.Get(name) == null) { BooterLogger.AddError("ActionData missing: " + name); return; } Add(ParseKey(row), new SeasonSettings.ActionDataSetting(name, row)); }
public SocialTest(XmlDbRow row) { string name = row.GetString("GUID"); if (BooterLogger.Exists(row, "Socials", name)) { mSocials = row.GetStringList("SocialName", ','); for (int i = mSocials.Count - 1; i >= 0; i--) { if (ActionData.Get(mSocials[i]) == null) { BooterLogger.AddError(name + " Invalid Social: " + mSocials[i]); mSocials.RemoveAt(i); } } } if (BooterLogger.Exists(row, "AllowAccept", name)) { mAllowAccept = row.GetBool("AllowAccept"); } if (BooterLogger.Exists(row, "AllowReject", name)) { mAllowReject = row.GetBool("AllowReject"); } if (BooterLogger.Exists(row, "AllowRecipient", name)) { mAllowRecipient = row.GetBool("AllowRecipient"); } if (BooterLogger.Exists(row, "AllowInitiator", name)) { mAllowInitiator = row.GetBool("AllowInitiator"); } }
private static List <SocialInteractionCandidate> GetInternal(string name, Sim actor, Sim target, LongTermRelationshipTypes group, bool isActive, ActiveTopic topic, bool isAutonomous, Dictionary <LongTermRelationshipTypes, Dictionary <bool, List <string> > > interactionCategories) { Dictionary <bool, List <string> > dictionary; List <string> list2; bool flag = interactionCategories.TryGetValue(group, out dictionary); if (!flag) { sMsg += Common.NewLine + " Try Default"; group = LongTermRelationshipTypes.Default; flag = interactionCategories.TryGetValue(group, out dictionary); } List <SocialInteractionCandidate> list = new List <SocialInteractionCandidate>(); if (flag && dictionary.TryGetValue(isActive, out list2)) { sMsg += Common.NewLine + " Choices = " + list2.Count; foreach (string str in list2) { ActionData data = ActionData.Get(str); GreyedOutTooltipCallback greyedOutTooltipCallback = null; InteractionTestResult result = data.Test(actor, target, isAutonomous, topic, ref greyedOutTooltipCallback); sMsg += Common.NewLine + " " + str + " = " + result; if ((IUtil.IsPass(result) || (greyedOutTooltipCallback != null)) || Sims3.Gameplay.UI.PieMenu.PieMenuShowFailureReason) { list.Add(new SocialInteractionCandidate(str, data.GetParentMenu(actor, target), topic)); } } } return(list); }
// From Conversation public static List <SocialInteractionCandidate> GetSocialsForSTC(CommodityTypes commodity, Sim actor, Sim target, Relationship r, Conversation c, bool isAutonomous, ref string msg) { using (Common.TestSpan span = new Common.TestSpan(TimeSpanLogger.Bin, "GetSocialsForSTC: " + commodity, Common.DebugLevel.Stats)) { ShortTermContextTypes str2; List <SocialInteractionCandidate> list3; LongTermRelationshipTypes group = LongTermRelationshipTypes.Stranger; if (r != null) { group = r.LTR.CurrentLTR; } bool flag = (r != null) && ((r.STC == null) || (commodity == r.STC.CurrentCommodity)); if (!SocialComponent.SocialCommodityIsAvailable(commodity, target, actor, r)) { return(null); } if (flag) { bool flag2; str2 = Conversation.GetCurrentSTC(actor, target, r, c, out flag2); } else { str2 = STCData.FirstSTC(commodity); } List <SocialInteractionCandidate> collection = ActionAvailabilityData.Get(actor, target, str2, group, true, null, isAutonomous); if ((isAutonomous && (r != null)) && (r.STC.CurrentCommodity == commodity)) { ShortTermContextTypes str4; collection = new List <SocialInteractionCandidate>(collection); ShortTermContextTypes str3 = STCData.PreviousSTC(str2); do { collection.AddRange(ActionAvailabilityData.Get(actor, target, str3, group, true, null, isAutonomous)); str4 = str3; str3 = STCData.PreviousSTC(str3); }while (!(str4 == str3)); } if (isAutonomous) { goto Label_0167; } ShortTermContextTypes category = STCData.FirstSTC(commodity); Label_00D5: msg += Common.NewLine + "GetSocialsForSTC " + category; foreach (SocialInteractionCandidate candidate in Get(actor, target, category, group, true, null, isAutonomous, ref msg)) { ActionData action = ActionData.Get(candidate.Name); if (Conversation.SimHasTraitEncouragingOrRequiringSocial(actor, action)) { if (category != STCData.FirstSTC(commodity)) { candidate.OnlyAppearsInTraitMenu = true; } collection.Add(candidate); } } ShortTermContextTypes str6 = STCData.NextSTC(category); if (str6 != category) { category = str6; goto Label_00D5; } Label_0167: msg += Common.NewLine + "Collection " + collection.Count; list3 = new List <SocialInteractionCandidate>(); foreach (SocialInteractionCandidate candidate2 in collection) { ActionData data2 = ActionData.Get(candidate2.Name); if (flag || !data2.DoesSocialOnlyAppearWhenSTCIsCurrent) { msg += Common.NewLine + " " + candidate2.Name; list3.Add(candidate2); } } return(list3); } }
public static void AddSocials(SocialComponent ths, Sim actor, Sim target, List <SocialInteractionCandidate> socials, bool isAutonomous, int maxNumSocials, List <InteractionObjectPair> results, string[] inlineParentMenu, TraitNames trait, ref string msg) { int num = 0x0; InteractionPriority priority = new InteractionPriority(isAutonomous ? InteractionPriorityLevel.Autonomous : InteractionPriorityLevel.UserDirected); GreyedOutTooltipCallback greyedOutTooltipCallback = null; foreach (SocialInteractionCandidate candidate in socials) { using (Common.TestSpan span = new Common.TestSpan(TimeSpanLogger.Bin, candidate.Name, Common.DebugLevel.Stats)) { string[] strArray = inlineParentMenu; bool flag = true; if (num >= maxNumSocials) { break; } ActiveTopic topic = candidate.Topic; if (topic != null) { ActiveTopicData data = topic.Data; if (data.HasPieMenuOverride()) { flag = false; strArray = new string[] { data.GetText(actor, new object[0x0]) }; } } ActionData data2 = ActionData.Get(candidate.Name); if (data2.AppearsOnTopLevel) { strArray = new string[0x0]; } if (!ths.DoesSocialAppear(candidate.Name, results, strArray)) { InteractionObjectPair iop = null; if (((data2.IntendedCommodityString == CommodityTypes.Friendly) && ((actor.Posture is ISeatedSocialPosture) || (target.Posture is ISeatedSocialPosture))) && data2.AllowCarryChild) { InteractionDefinition interaction = new SeatedSocialInteractionA.SeatedDefinition(candidate.Name, strArray, candidate.Topic, false, trait, false); iop = new InteractionObjectPair(interaction, target); InteractionInstanceParameters parameters = new InteractionInstanceParameters(iop, actor, priority, isAutonomous, true); if (!IUtil.IsPass(interaction.Test(ref parameters, ref greyedOutTooltipCallback))) { iop = null; } if (((candidate.Name == "Chat") && !actor.CanBeInSameGroupTalkAsMe(target)) && (actor.Posture is ISeatedSocialPosture)) { string[] strArray2 = new string[0x0]; if (!ths.DoesSocialAppear(candidate.Name, results, strArray2)) { interaction = new SeatedSocialInteractionA.SeatedDefinition(candidate.Name, strArray2, candidate.Topic, false, trait, true); InteractionObjectPair pair2 = new InteractionObjectPair(interaction, target); parameters = new InteractionInstanceParameters(pair2, actor, priority, isAutonomous, true); if (IUtil.IsPass(interaction.Test(ref parameters, ref greyedOutTooltipCallback))) { results.Add(pair2); } } } } if (iop == null) { iop = new InteractionObjectPair(new SocialInteractionA.Definition(candidate.Name, strArray, candidate.Topic, false, trait), target); } InteractionInstanceParameters parameters2 = new InteractionInstanceParameters(iop, actor, priority, isAutonomous, true); InteractionTestResult result = iop.InteractionDefinition.Test(ref parameters2, ref greyedOutTooltipCallback); msg += Common.NewLine + parameters2.InteractionDefinition.GetInteractionName(ref parameters2) + ": " + result; if ((IUtil.IsPass(result) || (greyedOutTooltipCallback != null)) || Sims3.Gameplay.UI.PieMenu.PieMenuShowFailureReason) { results.Add(iop); if (flag) { num++; } } } } } }
public static string Perform <NEWCLASS>(string oldFunction, string newFunction, string key) { try { MethodInfo oldFunc = typeof(SocialTest).GetMethod(oldFunction); if (oldFunc == null) { return(oldFunction + " Old Not Found"); } MethodInfo newFunc = typeof(NEWCLASS).GetMethod(newFunction); if (newFunc == null) { return(newFunction + " New Not Found"); } if (ActionData.sData.Values.Count == 0) { return(oldFunction + " - " + newFunction + ": No Actions"); } bool found = false; if (!string.IsNullOrEmpty(key)) { ActionData data = ActionData.Get(key); if (data != null) { if ((data.ProceduralTest != null) && (data.ProceduralTest.ToString() == oldFunc.ToString())) { data.ProceduralTest = newFunc; found = true; } } } else { foreach (ActionData data in ActionData.sData.Values) { if ((data.ProceduralTest != null) && (data.ProceduralTest.ToString() == oldFunc.ToString())) { data.ProceduralTest = newFunc; found = true; } } } if (found) { return(null); } else { return(oldFunction + " - " + newFunction + ": No Change"); } } catch (Exception e) { Common.Exception(oldFunction + " - " + newFunction, e); return(oldFunction + " - " + newFunction + ": Exception"); } }
public static List <SocialInteractionCandidate> GetSocialsForSTC(CommodityTypes commodity, Sim actor, Sim target, Relationship r, Conversation c, bool isAutonomous) { ShortTermContextTypes types2; List <SocialInteractionCandidate> list3; LongTermRelationshipTypes stranger = LongTermRelationshipTypes.Stranger; if (r != null) { stranger = r.LTR.CurrentLTR; } bool flag = (r != null) && ((r.STC == null) || (commodity == r.STC.CurrentCommodity)); if (!SocialComponent.SocialCommodityIsAvailable(commodity, target, actor, r)) { sMsg += Common.NewLine + "Denied"; return(null); } if (flag) { bool flag2; types2 = Conversation.GetCurrentSTC(actor, target, r, c, out flag2); sMsg += Common.NewLine + "CurrentSTC " + types2 + " " + r.STC.CurrentCommodity; } else { types2 = STCData.FirstSTC(commodity); sMsg += Common.NewLine + "FirstSTC " + types2 + " " + r.STC.CurrentCommodity; } List <SocialInteractionCandidate> collection = Get("1", actor, target, types2, stranger, true, null, isAutonomous); if ((isAutonomous && (r != null)) && (r.STC.CurrentCommodity == commodity)) { ShortTermContextTypes types4; collection = new List <SocialInteractionCandidate>(collection); ShortTermContextTypes types3 = STCData.PreviousSTC(types2); do { collection.AddRange(Get("2", actor, target, types3, stranger, true, null, isAutonomous)); types4 = types3; types3 = STCData.PreviousSTC(types3); }while (types4 != types3); } if (isAutonomous) { goto Label_014C; } ShortTermContextTypes stc = STCData.FirstSTC(commodity); Label_00C4: List <SocialInteractionCandidate> traitList = Get("3", actor, target, stc, stranger, true, null, isAutonomous); foreach (SocialInteractionCandidate candidate in traitList) { ActionData action = ActionData.Get(candidate.Name); if (Conversation.SimHasTraitEncouragingOrRequiringSocial(actor, action)) { if (stc != STCData.FirstSTC(commodity)) { candidate.OnlyAppearsInTraitMenu = true; } collection.Add(candidate); } } ShortTermContextTypes types6 = STCData.NextSTC(stc); if (types6 != stc) { stc = types6; goto Label_00C4; } Label_014C: sMsg += Common.NewLine + "Final = " + collection.Count; list3 = new List <SocialInteractionCandidate>(); foreach (SocialInteractionCandidate candidate2 in collection) { sMsg += Common.NewLine + "Test " + candidate2.Name; ActionData data2 = ActionData.Get(candidate2.Name); if (flag || !data2.DoesSocialOnlyAppearWhenSTCIsCurrent) { sMsg += Common.NewLine + " Added " + candidate2.Name; list3.Add(candidate2); } } return(list3); }
public static void OnSocialEvent(Event e) { SocialEvent socialEvent = e as SocialEvent; if (socialEvent == null) { return; } if (socialEvent.WasRecipient) { return; } if (!socialEvent.WasAccepted) { return; } Sim actor = socialEvent.Actor as Sim; if (actor == null) { return; } Sim target = socialEvent.TargetObject as Sim; if (target == null) { return; } if (actor.Household != target.Household) { return; } if (target.SimDescription == null) { return; } List <Homemaker> careers = GetCareerForSim(e); if (careers == null) { careers = GetCareerOfGuardian(e); } if (careers == null) { return; } ActionData data = ActionData.Get(socialEvent.SocialName); if (data == null) { return; } switch (data.IntendedCommodityString) { case CommodityTypes.Friendly: case CommodityTypes.Funny: case CommodityTypes.Amorous: Homemaker.AddMarks(careers, Homemaker.StipendValue.PositiveSocial, 1); break; case CommodityTypes.Creepy: case CommodityTypes.Insulting: case CommodityTypes.Steamed: Homemaker.AddMarks(careers, Homemaker.StipendValue.NegativeSocial, 1); break; } }