protected static void AddKey(ShortTermContextTypes stc, LongTermRelationshipTypes ltr, bool isActive, string key) { Dictionary <LongTermRelationshipTypes, Dictionary <bool, List <string> > > ltrList; if (!ActionAvailabilityData.sStcInteractions.TryGetValue(stc, out ltrList)) { return; } Dictionary <bool, List <string> > activeList; if (!ltrList.TryGetValue(ltr, out activeList)) { activeList = new Dictionary <bool, List <string> >(); ltrList.Add(ltr, activeList); } List <string> keyList; if (!activeList.TryGetValue(isActive, out keyList)) { keyList = new List <string>(); activeList.Add(isActive, keyList); } if (!keyList.Contains(key)) { keyList.Add(key); } }
protected static void CloneSTCData(ShortTermContextTypes newSTC, CommodityTypes newCom, ShortTermContextTypes oldSTC) { STCData oldData = STCData.Get(oldSTC); STCData.Add(new STCData(newSTC, oldData.mText, oldData.mPassiveText, newCom, oldData.RangeMin, oldData.RangeMax, oldData.IdleJazzState, oldData.LTRDecayFromBelow, oldData.LTRDecayFromAbove, oldData.VisitLengthChange, oldData.CharismaIncrease, oldData.X1, oldData.Y1, oldData.X2, oldData.Y2, oldData.X3, oldData.Y3, oldData.MoodThresholdForAcceptRequest)); ActionAvailabilityData.sStcInteractions.Add(newSTC, ActionAvailabilityData.sStcInteractions[oldSTC]); }
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 static void AddKey(ShortTermContextTypes stc, LongTermRelationshipTypes ltr, bool isActive, string key) { Dictionary<LongTermRelationshipTypes, Dictionary<bool, List<string>>> ltrList; if (!ActionAvailabilityData.sStcInteractions.TryGetValue(stc, out ltrList)) return; Dictionary<bool, List<string>> activeList; if (!ltrList.TryGetValue(ltr, out activeList)) { activeList = new Dictionary<bool, List<string>>(); ltrList.Add(ltr, activeList); } List<string> keyList; if (!activeList.TryGetValue(isActive, out keyList)) { keyList = new List<string>(); activeList.Add(isActive, keyList); } if (!keyList.Contains(key)) { keyList.Add(key); } }
// 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 List<SocialInteractionCandidate> Get(string name, Sim actor, Sim target, ShortTermContextTypes stc, LongTermRelationshipTypes group, bool isActive, ActiveTopic topic, bool isAutonomous) { sMsg += Common.NewLine + "GetActionAvailability " + name + " " + stc + " " + group + " " + isActive; Dictionary<LongTermRelationshipTypes, Dictionary<bool, List<string>>> dictionary; if (ActionAvailabilityData.sStcInteractions.TryGetValue(stc, out dictionary)) { return GetInternal(name, actor, target, group, isActive, topic, isAutonomous, dictionary); } else { sMsg += Common.NewLine + " Empty"; } return new List<SocialInteractionCandidate>(); }
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 List <SocialInteractionCandidate> Get(string name, Sim actor, Sim target, ShortTermContextTypes stc, LongTermRelationshipTypes group, bool isActive, ActiveTopic topic, bool isAutonomous) { sMsg += Common.NewLine + "GetActionAvailability " + name + " " + stc + " " + group + " " + isActive; Dictionary <LongTermRelationshipTypes, Dictionary <bool, List <string> > > dictionary; if (ActionAvailabilityData.sStcInteractions.TryGetValue(stc, out dictionary)) { return(GetInternal(name, actor, target, group, isActive, topic, isAutonomous, dictionary)); } else { sMsg += Common.NewLine + " Empty"; } return(new List <SocialInteractionCandidate>()); }
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; }