示例#1
0
        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]);
        }
示例#2
0
        public static void AddSocials(string name, SocialComponent ths, CommodityTypes commodity, Sim actor, Sim target, List<SocialInteractionCandidate> socials, bool isAutonomous, int maxNumSocials, List<InteractionObjectPair> results, string[] inlineParentMenu, TraitNames trait)
        {
            sMsg += Common.NewLine + "AddSocials " + name + " " + commodity + " " + socials.Count;

            int num = 0x0;
            InteractionPriority priority = new InteractionPriority(isAutonomous ? InteractionPriorityLevel.Autonomous : InteractionPriorityLevel.UserDirected);
            GreyedOutTooltipCallback greyedOutTooltipCallback = null;
            foreach (SocialInteractionCandidate candidate in socials)
            {
                string[] strArray = inlineParentMenu;
                bool flag = true;
                if (num >= maxNumSocials)
                {
                    break;
                }

                sMsg += Common.NewLine + " Testing " + candidate.Name;

                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);

                    sMsg += Common.NewLine + "  " + candidate.Name + " = " + result;

                    if ((IUtil.IsPass(result) || (greyedOutTooltipCallback != null)) || Sims3.Gameplay.UI.PieMenu.PieMenuShowFailureReason)
                    {
                        results.Add(iop);
                        if (flag)
                        {
                            num++;
                        }
                    }
                }
            }
        }
示例#3
0
 public void PerformPrank(Business business)
 {
     if (!CheckIfAttemptingPrankOnConsecutiveDay(business))
     {
         bool flag = false;
         Sim createdSim = business.SimConspiringPrank.CreatedSim;
         Sim sim2 = business.SimAffectedByPrank.CreatedSim;
         bool flag2 = business.SimAffectedByPrank == createdSim.Occupation.Boss;
         Relationship relationship = Relationship.Get(createdSim, sim2, true);
         LTRData data = LTRData.Get(relationship.LTR.CurrentLTR);
         if (!relationship.STC.InNegativeContext || (data.RelationshipClass >= LTRData.RelationshipClassification.Medium))
         {
             base.Display(LocalizeString(createdSim.SimDescription, "FunnyPrankWorked", new object[] { createdSim.SimDescription, business.SimAffectedByPrank }), createdSim.ObjectId, business);
             flag = true;
             float change = flag2 ? Business.kLTRIncreaseWhenPrankSucceedsOnBoss : Business.kLTRIncreaseWhenPrankSucceeds;
             relationship.LTR.UpdateLiking(change);
             relationship.UpdateSTCFromOutsideConversation(sim2, createdSim, CommodityTypes.Funny, (float) Business.kSTCValueOnPranks);
         }
         else if (relationship.STC.InNegativeContext || (data.RelationshipClass == LTRData.RelationshipClassification.Low))
         {
             base.Display(LocalizeString(createdSim.SimDescription, "BadPrankFailed", new object[] { createdSim.SimDescription, business.SimAffectedByPrank }), createdSim.ObjectId, business);
             CommodityTypes[] randomList = new CommodityTypes[] { CommodityTypes.Boring, CommodityTypes.Creepy, CommodityTypes.Insulting, CommodityTypes.Awkward, CommodityTypes.Steamed };
             float num2 = flag2 ? Business.kLTRDecreaseWhenPrankFailsOnBoss : Business.kLTRDecreaseWhenPrankFails;
             relationship.LTR.UpdateLiking(num2);
             relationship.UpdateSTCFromOutsideConversation(sim2, createdSim, RandomUtil.GetRandomObjectFromList(randomList), (float) Business.kSTCValueOnPranks);
         }
         if (flag2)
         {
             float perfChange = flag ? Business.kCareerPerformanceChange : (-1f * Business.kCareerPerformanceChange);
             business.AddPerformance(perfChange);
         }
         business.WasLastPrankSuccessful = flag;
         business.IsPrankSet = false;
     }
 }
示例#4
0
        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;
        }
示例#5
0
        // 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;
            }
        }