Esempio n. 1
0
        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++;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 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++;
                        }
                    }
                }
            }
        }