Example #1
0
        public static List<InteractionObjectPair> GetAllInteractionsForActor(Sim ths, IActor actor)
        {
            List<InteractionObjectPair> allInteractionsForActor;
            InteractionInstance currentInteraction = ths.CurrentInteraction;
            Sim sim = actor as Sim;
            if (ths.DisablePieMenuOnSim)
            {
                sMsg += Common.NewLine + "Disabled";

                return new List<InteractionObjectPair>();
            }
            if (ths.BuffManager.HasElement(BuffNames.BabyIsComing))
            {
                sMsg += Common.NewLine + "Pregnant";

                allInteractionsForActor = new List<InteractionObjectPair>();
                allInteractionsForActor.Add(new InteractionObjectPair(Pregnancy.TakeToHospital.Singleton, ths));
                return allInteractionsForActor;
            }
            allInteractionsForActor = new List<InteractionObjectPair>(); //base.GetAllInteractionsForActor(actor);
            if (actor != ths)
            {
                List<InteractionObjectPair> list2;
                DaycareSituation daycareSituationForSim = DaycareSituation.GetDaycareSituationForSim(ths);
                if ((daycareSituationForSim != null) && daycareSituationForSim.OverrideActorInteractions)
                {
                    sMsg += Common.NewLine + "Daycare";

                    return daycareSituationForSim.GetAllInteractionsForActor(sim, ths);
                }
                if (FirefighterEmergencySituation.FindFirefighterEmergencySituationInvolvingSim(ths) != null)
                {
                    sMsg += Common.NewLine + "Firefighter";

                    allInteractionsForActor.Clear();
                }
                else
                {
                    if (actor.Posture.GetType() != ths.Posture.GetType())
                    {
                        sMsg += Common.NewLine + "Posture Socials " + actor.Posture.GetType().ToString() + " " + ths.Posture.GetType().ToString();

                        actor.Posture.AddSocialInteractions(ths, allInteractionsForActor);
                    }
                    if (actor.Posture.AllowsNormalSocials() && ths.Posture.AllowsNormalSocials())
                    {
                        int count = 0;

                        foreach (InteractionObjectPair pair in GetAllInteractionsForSim(ths.SocialComponent, sim, false))
                        {
                            pair.AddInteractions(actor, allInteractionsForActor);
                            count++;
                        }

                        sMsg += Common.NewLine + "Socials " + count;
                    }
                    if (currentInteraction != null)
                    {
                        InteractionTuning tuning = currentInteraction.InteractionObjectPair.Tuning;
                        if (((tuning != null) && tuning.mTradeoff.JoinableInteraction) && (!(currentInteraction.InteractionDefinition is IDoNotAddJoinInteraction) && !Sim.HaveSameCurrentInteraction(sim, ths)))
                        {
                            Sim.Join.Definition interaction = new Sim.Join.Definition();
                            new InteractionObjectPair(interaction, ths).AddInteractions(actor, allInteractionsForActor);
                        }
                    }
                    if ((sim.CurrentInteraction != null) && (sim.CurrentInteraction != currentInteraction))
                    {
                        InteractionObjectPair interactionObjectPair = sim.CurrentInteraction.InteractionObjectPair;
                        if (((interactionObjectPair.Tuning != null) && interactionObjectPair.Tuning.mTradeoff.JoinableInteraction) && !Sim.HaveSameCurrentInteraction(sim, ths))
                        {
                            Sim.AskToJoin.Definition definition2 = new Sim.AskToJoin.Definition();
                            new InteractionObjectPair(definition2, ths).AddInteractions(actor, allInteractionsForActor);
                        }
                    }
                }
                if (ths.mSituationSpecificInteractions.TryGetValue(sim, out list2) && (list2.Count > 0x0))
                {
                    foreach (InteractionObjectPair pair5 in list2)
                    {
                        bool flag = false;
                        foreach (InteractionObjectPair pair6 in allInteractionsForActor)
                        {
                            SocialInteractionA.Definition interactionDefinition = pair6.InteractionDefinition as SocialInteractionA.Definition;
                            SocialInteractionA.Definition definition4 = pair5.InteractionDefinition as SocialInteractionA.Definition;
                            if (((definition4 != null) && (interactionDefinition != null)) && (interactionDefinition.ActionKey == definition4.ActionKey))
                            {
                                string[] path = interactionDefinition.GetPath(actor.IsFemale);
                                string[] strArray2 = definition4.GetPath(actor.IsFemale);
                                if (strArray2.Length == path.Length)
                                {
                                    bool flag2 = true;
                                    for (int i = 0x0; i < strArray2.Length; i++)
                                    {
                                        if (strArray2[i] != path[i])
                                        {
                                            flag2 = false;
                                            break;
                                        }
                                    }
                                    if (flag2)
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (!flag)
                        {
                            allInteractionsForActor.Add(pair5);
                        }
                    }
                }
            }
            else
            {
                foreach (InteractionObjectPair pair7 in ths.SoloInteractions)
                {
                    pair7.AddInteractions(actor, allInteractionsForActor);
                }
            }
            foreach (Sim.IAddsSimInteractions interactions in Inventories.QuickDuoFind<Sim.IAddsSimInteractions, GameObject>(actor.Inventory))
            {
                interactions.GetAllInteractions(actor as Sim, ths, allInteractionsForActor);
            }
            allInteractionsForActor.Sort();
            return allInteractionsForActor;
        }
Example #2
0
        public static List <InteractionObjectPair> GetAllInteractionsForActor(Sim ths, IActor actor)
        {
            List <InteractionObjectPair> allInteractionsForActor;
            InteractionInstance          currentInteraction = ths.CurrentInteraction;
            Sim sim = actor as Sim;

            if (ths.DisablePieMenuOnSim)
            {
                sMsg += Common.NewLine + "Disabled";

                return(new List <InteractionObjectPair>());
            }
            if (ths.BuffManager.HasElement(BuffNames.BabyIsComing))
            {
                sMsg += Common.NewLine + "Pregnant";

                allInteractionsForActor = new List <InteractionObjectPair>();
                allInteractionsForActor.Add(new InteractionObjectPair(Pregnancy.TakeToHospital.Singleton, ths));
                return(allInteractionsForActor);
            }
            allInteractionsForActor = new List <InteractionObjectPair>(); //base.GetAllInteractionsForActor(actor);
            if (actor != ths)
            {
                List <InteractionObjectPair> list2;
                DaycareSituation             daycareSituationForSim = DaycareSituation.GetDaycareSituationForSim(ths);
                if ((daycareSituationForSim != null) && daycareSituationForSim.OverrideActorInteractions)
                {
                    sMsg += Common.NewLine + "Daycare";

                    return(daycareSituationForSim.GetAllInteractionsForActor(sim, ths));
                }
                if (FirefighterEmergencySituation.FindFirefighterEmergencySituationInvolvingSim(ths) != null)
                {
                    sMsg += Common.NewLine + "Firefighter";

                    allInteractionsForActor.Clear();
                }
                else
                {
                    if (actor.Posture.GetType() != ths.Posture.GetType())
                    {
                        sMsg += Common.NewLine + "Posture Socials " + actor.Posture.GetType().ToString() + " " + ths.Posture.GetType().ToString();

                        actor.Posture.AddSocialInteractions(ths, allInteractionsForActor);
                    }
                    if (actor.Posture.AllowsNormalSocials() && ths.Posture.AllowsNormalSocials())
                    {
                        int count = 0;

                        foreach (InteractionObjectPair pair in GetAllInteractionsForSim(ths.SocialComponent, sim, false))
                        {
                            pair.AddInteractions(actor, allInteractionsForActor);
                            count++;
                        }

                        sMsg += Common.NewLine + "Socials " + count;
                    }
                    if (currentInteraction != null)
                    {
                        InteractionTuning tuning = currentInteraction.InteractionObjectPair.Tuning;
                        if (((tuning != null) && tuning.mTradeoff.JoinableInteraction) && (!(currentInteraction.InteractionDefinition is IDoNotAddJoinInteraction) && !Sim.HaveSameCurrentInteraction(sim, ths)))
                        {
                            Sim.Join.Definition interaction = new Sim.Join.Definition();
                            new InteractionObjectPair(interaction, ths).AddInteractions(actor, allInteractionsForActor);
                        }
                    }
                    if ((sim.CurrentInteraction != null) && (sim.CurrentInteraction != currentInteraction))
                    {
                        InteractionObjectPair interactionObjectPair = sim.CurrentInteraction.InteractionObjectPair;
                        if (((interactionObjectPair.Tuning != null) && interactionObjectPair.Tuning.mTradeoff.JoinableInteraction) && !Sim.HaveSameCurrentInteraction(sim, ths))
                        {
                            Sim.AskToJoin.Definition definition2 = new Sim.AskToJoin.Definition();
                            new InteractionObjectPair(definition2, ths).AddInteractions(actor, allInteractionsForActor);
                        }
                    }
                }
                if (ths.mSituationSpecificInteractions.TryGetValue(sim, out list2) && (list2.Count > 0x0))
                {
                    foreach (InteractionObjectPair pair5 in list2)
                    {
                        bool flag = false;
                        foreach (InteractionObjectPair pair6 in allInteractionsForActor)
                        {
                            SocialInteractionA.Definition interactionDefinition = pair6.InteractionDefinition as SocialInteractionA.Definition;
                            SocialInteractionA.Definition definition4           = pair5.InteractionDefinition as SocialInteractionA.Definition;
                            if (((definition4 != null) && (interactionDefinition != null)) && (interactionDefinition.ActionKey == definition4.ActionKey))
                            {
                                string[] path      = interactionDefinition.GetPath(actor.IsFemale);
                                string[] strArray2 = definition4.GetPath(actor.IsFemale);
                                if (strArray2.Length == path.Length)
                                {
                                    bool flag2 = true;
                                    for (int i = 0x0; i < strArray2.Length; i++)
                                    {
                                        if (strArray2[i] != path[i])
                                        {
                                            flag2 = false;
                                            break;
                                        }
                                    }
                                    if (flag2)
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (!flag)
                        {
                            allInteractionsForActor.Add(pair5);
                        }
                    }
                }
            }
            else
            {
                foreach (InteractionObjectPair pair7 in ths.SoloInteractions)
                {
                    pair7.AddInteractions(actor, allInteractionsForActor);
                }
            }
            foreach (Sim.IAddsSimInteractions interactions in Inventories.QuickDuoFind <Sim.IAddsSimInteractions, GameObject>(actor.Inventory))
            {
                interactions.GetAllInteractions(actor as Sim, ths, allInteractionsForActor);
            }
            allInteractionsForActor.Sort();
            return(allInteractionsForActor);
        }