Beispiel #1
0
            public override bool Test(Sim a, CarUFO target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!target.CanBeUsedBy(a, false))
                {
                    return(false);
                }

                if (target.InUse)
                {
                    greyedOutTooltipCallback = CreateTooltipCallback(Localization.LocalizeString(a.IsFemale, "Ui/Tooltip:ObjectInUse", new object[0]));
                    return(false);
                }

                if (!a.Household.IsAlienHousehold)
                {
                    List <Sim> validCandidates = GetValidCandidates(a, target);

                    if (validCandidates.Count == 0)
                    {
                        greyedOutTooltipCallback = CreateTooltipCallback(CarUFO.LocalizeString(a.IsFemale, "AbductSimNoSimsTooltip", new object[0]));
                        return(false);
                    }
                }

                return(true);
            }
Beispiel #2
0
        public static void AddInteraction(CarUFO ufo)
        {
            foreach (InteractionObjectPair pair in ufo.Interactions)
            {
                if (pair.InteractionDefinition.GetType() == Singleton.GetType())
                {
                    return;
                }
            }

            ufo.AddInteraction(Singleton);
        }
Beispiel #3
0
        public static void ReplaceInteraction(CarUFO ufo)
        {
            ufo.RemoveInteractionByType(sOldSingleton);

            foreach (InteractionObjectPair pair in ufo.Interactions)
            {
                if (pair.InteractionDefinition.GetType() == Singleton.GetType())
                {
                    return;
                }
            }

            ufo.AddInteraction(Singleton);
        }
            public override void Init(AlienAbductionSituationEx parent)
            {
                CarUFO ufo = parent.Alien.Inventory.Find <CarUFO>();

                if (ufo == null)
                {
                    parent.CleanupAbduction();
                    return;
                }

                AbductSimAEx abductSim = ForceSituationSpecificInteraction(ufo, parent.Alien, AbductSimAEx.Singleton, null, new Callback(OnCompletion),
                                                                           new Callback(OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)) as AbductSimAEx;

                abductSim.SimToAbduct = parent.Abductee;
            }
Beispiel #5
0
            public static new List <Sim> GetValidCandidates(Sim a, CarUFO target)
            {
                List <Sim> list = new List <Sim>();

                Relationship[] relationships = Relationship.GetRelationships(a);

                foreach (Relationship current in relationships)
                {
                    Sim otherSim = current.GetOtherSim(a);

                    if (otherSim != null && a.Household != otherSim.Household && CanBeAbducted(a, otherSim))
                    {
                        list.Add(otherSim);
                    }
                }

                return(list);
            }
            public override void Init(AlienAbductionSituationEx parent)
            {
                CarUFO ufo = parent.Alien.Inventory.Find <CarUFO>();

                if (ufo == null)
                {
                    Common.DebugNotify("AlienAbductionSituation.AbductSim.Init" + Common.NewLine + " - UFO is null");
                    parent.CleanupAbduction();
                    return;
                }

                AbductSimEx abductSim = ForceSituationSpecificInteraction(ufo, parent.Alien, AbductSimEx.Singleton, null,
                                                                          new Callback(OnCompletion), new Callback(OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior))
                                        as AbductSimEx;

                if (abductSim == null)
                {
                    Common.DebugNotify("Alien Abduction Situation - Abduct Sim interaction is null");
                    parent.CleanupAbduction();
                    return;
                }

                abductSim.SimToAbduct = parent.Abductee;
            }
Beispiel #7
0
        public override bool Run()
        {
            if (Target.InUse)
            {
                return(false);
            }

            mNPCAbductor = (SimToAbduct != null);

            if (!mNPCAbductor)
            {
                SimToAbduct = GetSelectedObject() as Sim;
            }

            if (SimToAbduct == null)
            {
                return(false);
            }

            StandardEntry();

            if (!SetupAbductee())
            {
                StandardExit();
                return(false);
            }

            Animation.ForceAnimation(Actor.ObjectId, true);
            Animation.ForceAnimation(Target.ObjectId, true);
            Target.mTakeOffPos = Actor.Position;

            if (!Target.RouteToUFOAndTakeOff(Actor))
            {
                StandardExit();
                return(false);
            }

            Camera.FocusOnGivenPosition(mJig.Position, CarUFO.kAbductLerpParams, true);
            BeginCommodityUpdates();
            bool flag = AbductSim();

            EndCommodityUpdates(true);
            Sim[] sims;

            if (flag)
            {
                EventTracker.SendEvent(EventTypeId.kAbductSimUFO, Actor, SimToAbduct);
                sims = new Sim[] { Actor, SimToAbduct };

                if (mNPCAbductor)
                {
                    DoTimedLoop(AlienUtils.kAbductionLength, ExitReason.None);
                }
            }
            else
            {
                sims = new Sim[] { Actor };
            }

            DateAndTime previous   = SimClock.CurrentTime();
            Vector3     landRefPos = GetLandingRefPos(mNPCAbductor);

            while (!Target.TryLandUFOAndExitSims(sims, landRefPos, true))
            {
                Simulator.Sleep(30u);

                if (SimClock.ElapsedTime(TimeUnit.Minutes, previous) > 30f)
                {
                    Target.ForceExitUFODueToLandingFailure(sims);
                    break;
                }
            }

            mFromInventory = (mFromInventory || mNPCAbductor);

            if (mFromInventory)
            {
                mFromInventory = Actor.Inventory.TryToAdd(Target);
            }

            if (!mFromInventory)
            {
                Target.ParkUFO(Actor.LotHome, Actor);
            }

            if (flag)
            {
                if (mNPCAbductor)
                {
                    SimToAbduct.BuffManager.AddElement(BuffsAndTraits.sAbductedEx, Origin.FromAbduction);
                    ThoughtBalloonManager.BalloonData data = new ThoughtBalloonManager.BalloonData(Actor.GetThumbnailKey());
                    data.BalloonType = ThoughtBalloonTypes.kThoughtBalloon;
                    data.LowAxis     = ThoughtBalloonAxis.kDislike;
                    data.Duration    = ThoughtBalloonDuration.Medium;
                    data.mPriority   = ThoughtBalloonPriority.High;
                    SimToAbduct.ThoughtBalloonManager.ShowBalloon(data);
                    SimToAbduct.PlayReaction(AlienUtils.kAbductionReactions[RandomUtil.GetInt(0, AlienUtils.kAbductionReactions.Length - 1)], ReactionSpeed.NowOrLater);
                    SimToAbduct.ShowTNSIfSelectable(CarUFO.LocalizeString(SimToAbduct.IsFemale, "NPCAbductionTNS", new object[] { SimToAbduct.ObjectId }),
                                                    StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, SimToAbduct.ObjectId);
                }
                else
                {
                    Sim.ForceSocial(Actor, SimToAbduct, "Reveal Prank", InteractionPriorityLevel.High, true);
                }

                FinishLinkedInteraction(true);
            }

            StandardExit();

            if (flag)
            {
                WaitForSyncComplete();
            }

            return(flag);
        }
Beispiel #8
0
 public override string GetInteractionName(Sim actor, CarUFO target, InteractionObjectPair iop)
 {
     return(base.GetInteractionName(actor, target, new InteractionObjectPair(sOldSingleton, target)));
 }
Beispiel #9
0
 public override string GetInteractionName(Sim actor, CarUFO target, InteractionObjectPair iop)
 {
     return(Common.Localize("AbductSimAEx:MenuName"));
 }