Example #1
0
        public override bool Run()
        {
            try
            {
                if (Target is Lot)
                {
                    Lot target = Target as Lot;

                    string text = StringInputDialog.Show(Common.Localize("ChangeName:Lot"), Common.Localize("ChangeName:Prompt"), target.Name);
                    if (string.IsNullOrEmpty(text))
                    {
                        return(false);
                    }

                    target.Name = text;
                }
                else if (Target is RabbitHole)
                {
                    RabbitHole hole = Target as RabbitHole;

                    string str = StringInputDialog.Show(Common.Localize("ChangeName:Rabbithole"), Common.Localize("ChangeName:Prompt"), Target.CatalogName);
                    if (string.IsNullOrEmpty(str))
                    {
                        return(false);
                    }

                    hole.SetOverrideNameString(str);
                }
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
            }
            return(true);
        }
Example #2
0
 public override string GetInteractionName(Sim actor, RabbitHole target, InteractionObjectPair iop)
 {
     return(mDisplayName ?? Common.LocalizeEAString(actor.IsFemale, "Gameplay/Core/VisitCommunityLot:VisitNamedLot", new object[]
     {
         target.GetLocalizedName()
     }));
 }
Example #3
0
        public static void GiveVisitingBuffs(Sim actor, RabbitHole target, RabbitHole.VisitRabbitHoleTuningClass visitTuning, Origin visitBuffOrigin)
        {
            Career occupationAsCareer = actor.OccupationAsCareer;

            if ((occupationAsCareer != null) && (occupationAsCareer.CareerLoc.Owner == target))
            {
                actor.BuffManager.AddElement(BuffNames.Bored, visitBuffOrigin);
                return;
            }

            float visitBoredomChanceAdult = visitTuning.VisitBoredomChanceAdult;

            if (actor.SimDescription.Teen)
            {
                visitBoredomChanceAdult = visitTuning.VisitBoredomChanceTeen;
            }
            else if (actor.SimDescription.Child)
            {
                visitBoredomChanceAdult = visitTuning.VisitBoredomChanceChild;
            }

            if (RandomUtil.RandomChance(visitBoredomChanceAdult))
            {
                actor.BuffManager.AddElement(BuffNames.Bored, visitBuffOrigin);
                return;
            }

            BuffNames[] namesArray = new BuffNames[] { BuffNames.Excited, BuffNames.Fascinated, BuffNames.Intrigued, BuffNames.Impressed, BuffNames.Educated };
            actor.BuffManager.AddElement(namesArray[RandomUtil.GetInt(0x4)], visitBuffOrigin);
        }
Example #4
0
        protected override bool TargetAllow(SimDescription target)
        {
            Career career = target.Occupation as Career;

            if (career == null)
            {
                IncStat("No Job");
                return(false);
            }
            else
            {
                RabbitHole hole = career.CareerLoc.Owner;
                if (hole == null)
                {
                    IncStat("No Hole");
                    return(false);
                }
                else
                {
                    List <SimDescription> owners = Money.GetDeedOwner(hole);
                    if ((!owners.Contains(Sim)) && (!owners.Contains(Mutual)))
                    {
                        IncStat("Not Owner");
                        return(false);
                    }
                }
            }

            return(base.TargetAllow(target));
        }
        public static bool IsShowing(RabbitHole venue, float hours24)
        {
            Theatre theatre = venue as Theatre;

            if (theatre == null)
            {
                ComboCriminalTheater theatre2 = venue as ComboCriminalTheater;
                if (theatre2 == null)
                {
                    ComboStadiumTheatre theatre3 = venue as ComboStadiumTheatre;

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

                    theatre = theatre3.GetTheatre();
                }

                theatre = theatre2.GetTheatre();
            }

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

            return(theatre.IsOpenAt(hours24));
        }
Example #6
0
 public override string GetInteractionName(Sim actor, RabbitHole target, InteractionObjectPair iop)
 {
     return(Localization.LocalizeString(actor.IsFemale, "Gameplay/Objects/RabbitHoles/EiffelTower:TakeElevatorToTopWithCost", new object[]
     {
         EiffelTower.TakeElevatorToTop.kElevatorPricePerPerson
     }));
 }
Example #7
0
        protected override DereferenceResult Perform(ComboRabbitHole reference, FieldInfo field, List <ReferenceWrapper> objects)
        {
            if (Matches(reference, "ContainedRabbitholes", field, objects))
            {
                if (Performing)
                {
                    RemoveKeys(reference.ContainedRabbitholes, objects);

                    try
                    {
                        RabbitHole hole = Find <RabbitHole>(objects);
                        if (hole != null)
                        {
                            switch (hole.Guid)
                            {
                            case RabbitHoleType.DaySpa:
                                reference.AddComboPiece("DaySpa", "Gameplay/Objects/RabbitHoles/DaySpa:DaySpa");
                                break;

                            case RabbitHoleType.Bookstore:
                                reference.AddComboPiece("Bookstore", "Gameplay/Objects/RabbitHoles/Bookstore:Bookstore");
                                break;

                            case RabbitHoleType.BusinessAndJournalism:
                                reference.AddComboPiece("Business", "Gameplay/Objects/RabbitHoles/Business:Business");
                                break;

                            case RabbitHoleType.Restaurant:
                                reference.AddComboPiece("RestaurantBistro", "Gameplay/Objects/RabbitHoles/Restaurant:Restaurant");
                                break;

                            case RabbitHoleType.CityHall:
                                reference.AddComboPiece("CityHall", "Gameplay/Objects/RabbitHoles/CityHall:CityHall");
                                break;

                            case RabbitHoleType.PoliceStation:
                                reference.AddComboPiece("PoliceStation", "Gameplay/Objects/RabbitHoles/PoliceStation:PoliceStation");
                                break;

                            case RabbitHoleType.MilitaryBase:
                                reference.AddComboPiece("Military", "Gameplay/Objects/RabbitHoles/MilitaryBase:MilitaryBase");
                                break;
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception(reference, e);
                    }

                    return(DereferenceResult.End);
                }
                else
                {
                    return(DereferenceResult.Found);
                }
            }

            return(DereferenceResult.Failure);
        }
Example #8
0
        public void OnWorldLoadFinished()
        {
            try
            {
                Managers.ManagerCareer.RetiredLocation = null;

                Career staticCareer = CareerManager.GetStaticCareer(CareerGuid);
                if (staticCareer == null)
                {
                    return;
                }

                foreach (RabbitHole hole in RabbitHole.GetRabbitHolesOfType(RabbitHoleType.CityHall))
                {
                    CareerLocation location = new CareerLocation(hole, staticCareer);
                    if (!hole.CareerLocations.ContainsKey((ulong)staticCareer.Guid))
                    {
                        hole.CareerLocations.Add((ulong)staticCareer.Guid, location);

                        if (location.Career != null)
                        {
                            Managers.ManagerCareer.RetiredLocation = location;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Common.Exception("Retired WorldLoadFinished", exception);
            }
        }
        public static bool IsShowing(RabbitHole venue, float hours24)
        {
            Theatre theatre = venue as Theatre;
            if (theatre == null)
            {
                ComboCriminalTheater theatre2 = venue as ComboCriminalTheater;
                if (theatre2 == null)
                {
                    ComboStadiumTheatre theatre3 = venue as ComboStadiumTheatre;

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

                    theatre = theatre3.GetTheatre();
                }

                theatre = theatre2.GetTheatre();
            }

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

            return theatre.IsOpenAt(hours24);
        }
Example #10
0
            public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    if (a.FamilyFunds < CollegeOfBusiness.kCostOfResumeInterviewClass)
                    {
                        return(false);
                    }
                    if (!SimClock.IsTimeBetweenTimes(CollegeOfBusiness.AttendResumeWritingAndInterviewTechniquesClass.kStartAvailibilityTime, CollegeOfBusiness.AttendResumeWritingAndInterviewTechniquesClass.kEndAvailibilityTime))
                    {
                        return(false);
                    }

                    /*
                     * if (!GameUtils.IsUniversityWorld())
                     * {
                     *  return false;
                     * }
                     */
                    return(true);
                }
                catch (Exception e)
                {
                    Common.Exception(a, target, e);
                    return(false);
                }
            }
Example #11
0
        public static void ReimburseDeeds(RealEstateManager newOwner, RabbitHole rabbitHole)
        {
            foreach (Household house in Household.GetHouseholdsLivingInWorld())
            {
                if (house.RealEstateManager == null)
                {
                    continue;
                }

                if (house.RealEstateManager == newOwner)
                {
                    continue;
                }

                PropertyData data = house.RealEstateManager.FindProperty(rabbitHole);
                if (data == null)
                {
                    continue;
                }

                int totaValue = data.TotalValue;

                using (ManagerMoney.SetAccountingKey setKey = new ManagerMoney.SetAccountingKey(house, "PropertySold"))
                {
                    house.RealEstateManager.SellProperty(data, true);
                }

                if (house != Household.ActiveHousehold)
                {
                    Common.Notify(Common.Localize("Deeds:Reimbursement", false, new object[] { house.Name, totaValue }));
                }
            }
        }
Example #12
0
        public static void GettingItOnInRabbitHole(InteractionInstance instance, Sim wooHooer, Sim wooHooee, RabbitHoleRomanticType romanticType, RabbitHole.VisitRabbitHoleTuningClass visitTuning, CommonWoohoo.WoohooStyle style, CommonWoohoo.WoohooLocation location, bool impregnate)
        {
            RabbitHole target = instance.Target as RabbitHole;

            if (instance.InstanceActor == wooHooer)
            {
                switch (romanticType)
                {
                case RabbitHoleRomanticType.TryForBaby:
                case RabbitHoleRomanticType.WooHoo:
                    CommonWoohoo.RunPostWoohoo(wooHooer, wooHooee, target, style, location, true);
                    break;
                }

                Relationship relationship = Relationship.Get(wooHooer, wooHooee, true);
                if (relationship != null)
                {
                    relationship.UpdateSTCFromOutsideConversation(wooHooer, wooHooee, visitTuning.WooHooingCommodity, visitTuning.WooHooingSTCIncrement);
                }
            }

            if ((impregnate) && (CommonPregnancy.IsSuccess(wooHooer, wooHooee, instance.Autonomous, style)))
            {
                CommonPregnancy.Impregnate(wooHooer, wooHooee, instance.Autonomous, style);
            }

            target.RabbitHoleProxy.TurnOffWooHooEffect();
        }
Example #13
0
            public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    if (a.FamilyFunds < CollegeOfBusiness.kCostOfBudgetClass)
                    {
                        return(false);
                    }
                    if (!SimClock.IsTimeBetweenTimes(CollegeOfBusiness.AttendBudgetClass.kStartAvailibilityTime, CollegeOfBusiness.AttendBudgetClass.kEndAvailibilityTime))
                    {
                        return(false);
                    }

                    /*
                     * if (!GameUtils.IsUniversityWorld())
                     * {
                     *  return false;
                     * }
                     */
                    float num = 0f;
                    if (CollegeOfBusiness.AttendBudgetClass.sCooldownDict.TryGetValue(a.SimDescription.SimDescriptionId, out num))
                    {
                        return((SimClock.ElapsedTime(TimeUnit.Hours) - num) > CollegeOfBusiness.AttendBudgetClass.kInteractionCooldown);
                    }
                    return(true);
                }
                catch (Exception e)
                {
                    Common.Exception(a, target, e);
                    return(false);
                }
            }
Example #14
0
        public override void Init(ArrestSuspectSituation parent)
        {
            IPoliceStation objects = (IPoliceStation)RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation);

            if (objects == null)
            {
                base.Exit();
            }
            else
            {
                IPoliceStation randomObjectFromList = RandomUtil.GetRandomObjectFromList <IPoliceStation>(objects);
                parent.Station = randomObjectFromList;
            }
            SimDescription description = parent.CreateNewCopFromPool();

            if (description == null)
            {
                base.Exit();
            }
            else
            {
                if (description.CreatedSim != null)
                {
                    parent.Cop = description.CreatedSim;
                    parent.Cop.SwitchToOutfitWithoutSpin(OutfitCategories.Career);
                }
                else
                {
                    SimOutfit outfit = description.GetOutfit(OutfitCategories.Career, 0);
                    parent.Cop = description.Instantiate(Vector3.OutOfWorld, outfit.Key);
                }
                parent.CopCar = CarNpcManager.Singleton.CreateServiceCar(ServiceType.Police);
                base.ForceSituationSpecificInteraction(parent.Cop, parent.Cop, new ArrestSuspectSituation.GoToCulpritsLocation.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.High));
            }
        }
Example #15
0
        protected bool AllowStandalone(CareerLocation location)
        {
            if (GetValue <AllowStandAloneOption, bool>())
            {
                return(true);
            }

            RabbitHole owner = location.Owner;

            if ((owner == null) || (owner.CareerLocations == null))
            {
                return(true);
            }

            foreach (CareerLocation loc in owner.CareerLocations.Values)
            {
                if (loc.Career == null)
                {
                    continue;
                }

                if (!loc.Career.IsPartTime)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #16
0
        public static void OnWorldLoadFinished(object sender, EventArgs evtArgs)
        {
            kDebugging = Settings.mDebugging;

            foreach (Sim sim in Sims3.Gameplay.Queries.GetObjects <Sim>())
            {
                DebugInduceAlienPregnancy.AddInteraction(sim);
                ReturnAlienBabyEx.AddInteraction(sim);
            }

            /*
             * foreach (CarUFO ufo in Sims3.Gameplay.Queries.GetObjects<CarUFO>())
             * {
             *  AbductSimAEx.AddInteraction(ufo);
             * }
             */

            foreach (Lot lot in Sims3.Gameplay.Queries.GetObjects <Lot>())
            {
                DebugTriggerAbduction.AddInteraction(lot);
                HaveAlienBabyHome.AddInteraction(lot);
            }

            foreach (RabbitHole hospital in RabbitHole.GetRabbitHolesOfType(RabbitHoleType.Hospital))
            {
                HaveAlienBabyHospital.AddInteraction(hospital);
            }

            EventTracker.AddListener(EventTypeId.kChildBornOrAdopted, new ProcessEventDelegate(OnNewBaby));
            EventTracker.AddListener(EventTypeId.kBoughtObject, new ProcessEventDelegate(OnObjectChanged));
            EventTracker.AddListener(EventTypeId.kBoughtObjectInEditTownMode, new ProcessEventDelegate(OnObjectChanged));
            EventTracker.AddListener(EventTypeId.kInventoryObjectAdded, new ProcessEventDelegate(OnObjectChanged));
            EventTracker.AddListener(EventTypeId.kObjectStateChanged, new ProcessEventDelegate(OnObjectChanged));
        }
Example #17
0
        public List <SimDescription> GetDeedOwner(RabbitHole hole)
        {
            List <SimDescription> owners = new List <SimDescription>();

            if (hole != null)
            {
                foreach (Household house in Household.GetHouseholdsLivingInWorld())
                {
                    if (house.RealEstateManager == null)
                    {
                        continue;
                    }

                    PropertyData data = house.RealEstateManager.FindProperty(hole);
                    if (data == null)
                    {
                        continue;
                    }

                    foreach (SimDescription sim in HouseholdsEx.Humans(house))
                    {
                        if (Households.AllowGuardian(sim))
                        {
                            owners.Add(sim);
                        }
                    }
                }
            }

            return(owners);
        }
 public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
 {
     try
     {
         if (a.FamilyFunds < CollegeOfBusiness.kCostOfResumeInterviewClass)
         {
             return false;
         }
         if (!SimClock.IsTimeBetweenTimes(CollegeOfBusiness.AttendResumeWritingAndInterviewTechniquesClass.kStartAvailibilityTime, CollegeOfBusiness.AttendResumeWritingAndInterviewTechniquesClass.kEndAvailibilityTime))
         {
             return false;
         }
         /*
         if (!GameUtils.IsUniversityWorld())
         {
             return false;
         }
         */
         return true;
     }
     catch (Exception e)
     {
         Common.Exception(a, target, e);
         return false;
     }
 }
Example #19
0
 public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
 {
     try
     {
         if (a.FamilyFunds < CollegeOfBusiness.kCostOfBudgetClass)
         {
             return false;
         }
         if (!SimClock.IsTimeBetweenTimes(CollegeOfBusiness.AttendBudgetClass.kStartAvailibilityTime, CollegeOfBusiness.AttendBudgetClass.kEndAvailibilityTime))
         {
             return false;
         }
         /*
         if (!GameUtils.IsUniversityWorld())
         {
             return false;
         }
         */
         float num = 0f;
         if (CollegeOfBusiness.AttendBudgetClass.sCooldownDict.TryGetValue(a.SimDescription.SimDescriptionId, out num))
         {
             return ((SimClock.ElapsedTime(TimeUnit.Hours) - num) > CollegeOfBusiness.AttendBudgetClass.kInteractionCooldown);
         }
         return true;
     }
     catch (Exception e)
     {
         Common.Exception(a, target, e);
         return false;
     }
 }
Example #20
0
            public void HaveTheBaby()
            {
                if (Pregnancy.mContractionBroadcast != null)
                {
                    Pregnancy.mContractionBroadcast.Dispose();
                }

                Abductee.RemoveAlarm(Pregnancy.PreggersAlarm);
                Abductee.RemoveAlarm(Pregnancy.mContractionsAlarm);
                bool flag = false;

                foreach (InteractionInstance current in Abductee.InteractionQueue.InteractionList)
                {
                    HaveAlienBabyHospital haveBabyHospital = current as HaveAlienBabyHospital;

                    if (haveBabyHospital != null)
                    {
                        haveBabyHospital.CancellableByPlayer = false;
                        haveBabyHospital.BabyShouldBeBorn    = true;
                        flag = true;
                        break;
                    }
                }

                if (!flag)
                {
                    List <RabbitHole> hospitals            = RabbitHole.GetRabbitHolesOfType(RabbitHoleType.Hospital);
                    float             distanceToBirthplace = Abductee.LotHome.GetDistanceToObject(Abductee);
                    RabbitHole        hospital             = null;

                    foreach (RabbitHole current in hospitals)
                    {
                        float distanceToHospital = current.RabbitHoleProxy.GetDistanceToObject(Abductee);

                        if (distanceToHospital < distanceToBirthplace)
                        {
                            distanceToBirthplace = distanceToHospital;
                            hospital             = current;
                        }
                    }

                    InteractionInstance instance;

                    if (hospital != null)
                    {
                        instance = HaveAlienBabyHospital.Singleton.CreateInstance(hospital, Abductee,
                                                                                  new InteractionPriority(InteractionPriorityLevel.Pregnancy), false, false);
                        (instance as HaveAlienBabyHospital).BabyShouldBeBorn = true;
                    }
                    else
                    {
                        instance = HaveAlienBabyHome.Singleton.CreateInstance(Abductee.LotHome, Abductee,
                                                                              new InteractionPriority(InteractionPriorityLevel.Pregnancy), false, false);
                    }

                    Abductee.InteractionQueue.Add(instance);
                    ActiveTopic.AddToSim(Abductee, "Recently Had Baby");
                }
            }
Example #21
0
        public static Household ReturnLotOwner(Lot lot)
        {
            Household lotOwner = null;

            if (lot != null)
            {
                //Check first is the lot a rabbit hole lot.
                List <RabbitHole> rList       = new List <RabbitHole>(Sims3.Gameplay.Queries.GetObjects <RabbitHole>());
                RabbitHole        rhOnThisLot = null;
                foreach (RabbitHole r in rList)
                {
                    if (r.LotCurrent == lot)
                    {
                        rhOnThisLot = r;
                        break;
                    }
                }
                //Is there a rabbit hole on this lot
                if (rhOnThisLot != null)
                {
                    List <Household> hList = new List <Household>(Sims3.Gameplay.Queries.GetObjects <Household>());
                    Sims3.Gameplay.RealEstate.PropertyData pd = null;
                    if (hList != null && hList.Count > 0)
                    {
                        foreach (Household h in hList)
                        {
                            pd = h.RealEstateManager.FindProperty(rhOnThisLot);

                            if (pd != null && pd.Owner != null)
                            {
                                lotOwner = pd.Owner.OwningHousehold;
                                break;
                            }
                        }
                    }
                }

                //If the lot is not a RH lot, check for venues
                if (lotOwner == null)
                {
                    List <Household> hList = new List <Household>(Sims3.Gameplay.Queries.GetObjects <Household>());
                    Sims3.Gameplay.RealEstate.PropertyData pd = null;
                    if (hList != null && hList.Count > 0)
                    {
                        foreach (Household h in hList)
                        {
                            pd = h.RealEstateManager.FindProperty(lot);

                            if (pd != null && pd.Owner != null)
                            {
                                lotOwner = pd.Owner.OwningHousehold;
                                break;
                            }
                        }
                    }
                }
            }
            return(lotOwner);
        }
Example #22
0
 private ArrestSuspectSituation(Lot lot, Sim simToArrest)
     : base(lot)
 {
     this.SimToArrest    = simToArrest;
     this.ArrestLocation = lot;
     this.SimsLocation   = RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation);
     base.SetState(new CreateCopAndRoute(this));
 }
Example #23
0
            public override void PopulatePieMenuPicker(ref InteractionInstanceParameters parameters, out List <ObjectPicker.TabInfo> listObjs, out List <ObjectPicker.HeaderInfo> headers, out int NumSelectableRows)
            {
                NumSelectableRows = 0x1;
                RabbitHole target = parameters.Target as RabbitHole;
                Sim        actor  = parameters.Actor as Sim;

                base.PopulateSimPicker(ref parameters, out listObjs, out headers, GetRomanticSims(target, actor, parameters.Autonomous, false), false);
            }
Example #24
0
 protected PurchaseDeedsScenario(PurchaseDeedsScenario scenario)
     : base(scenario)
 {
     mRabbitHole = scenario.mRabbitHole;
     mHoles      = scenario.mHoles;
     mLot        = scenario.mLot;
     mLots       = scenario.mLots;
 }
Example #25
0
        public override bool Run()
        {
            try
            {
                RabbitHole target = null;

                foreach (RabbitHole hole in Sims3.Gameplay.Queries.GetObjects <RabbitHole>())
                {
                    if (hole.Guid == RabbitHoleType.CityHall)
                    {
                        target = hole;
                        break;
                    }
                }

                ReimburseDeeds(Actor.Household.RealEstateManager, Target);

                if (target != null)
                {
                    RabbitHole.PurchaseVenue.Definition definition = new RabbitHole.PurchaseVenue.Definition(Target);
                    return(Actor.InteractionQueue.PushAsContinuation(definition.CreateInstance(target, Actor, GetPriority(), Autonomous, true), false));
                }

                StandardEntry();
                BeginCommodityUpdates();

                bool flag = false;
                try
                {
                    using (ManagerMoney.SetAccountingKey setKey = new ManagerMoney.SetAccountingKey(Actor.Household, "PropertyBought"))
                    {
                        if (Target.IsCommunityLot)
                        {
                            flag = Actor.Household.RealEstateManager.PurchaseVenue(Target) != null;
                        }
                        else
                        {
                            flag = Actor.Household.RealEstateManager.PurchasePrivateLot(Target) != null;
                        }
                    }
                }
                finally
                {
                    EndCommodityUpdates(true);
                    StandardExit();
                }
                return(flag);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #26
0
        public static void OnAttendedProSportsGame(Event e)
        {
            RabbitHole rabbitHole = e.TargetObject as RabbitHole;

            if (rabbitHole != null && rabbitHole.RabbitHoleProxy != rabbitHole)
            {
                rabbitHole.AddToUseList(e.Actor as Sim);
            }
        }
Example #27
0
            public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (RabbitHole.GetRabbitHolesOfType(RabbitHoleType.Hospital).Count <= 0)
                {
                    return(false);
                }

                return(target.BuffManager.HasElement(BuffsAndTraits.sAlienBabyIsComing));
            }
            public override Sim GetTarget(Sim actor, RabbitHole target, InteractionInstance paramInteraction)
            {
                WooHooInEiffelTowerWithEx interaction = paramInteraction as WooHooInEiffelTowerWithEx;

                if (interaction == null)
                {
                    return(null);
                }

                return(interaction.GetSelectedObject() as Sim);
            }
Example #29
0
            public override Sim GetTarget(Sim actor, RabbitHole target, InteractionInstance paramInteraction)
            {
                TInteraction interaction = paramInteraction as TInteraction;

                if (interaction == null)
                {
                    return(null);
                }

                return(interaction.GetSelectedObject() as Sim);
            }
Example #30
0
 public override string GetInteractionName(Sim actor, RabbitHole target, InteractionObjectPair iop)
 {
     if (InteractionName.StartsWith("VisitWithInteraction"))
     {
         return(Common.LocalizeEAString(actor.IsFemale, "Gameplay/Core/VisitCommunityLot:VisitNamedLotWith", new object[] { target.CatalogName }));
     }
     else
     {
         return(base.GetInteractionName(actor, target, iop));
     }
 }
Example #31
0
 /*public override string GetInteractionName(Sim actor, RabbitHole target, InteractionObjectPair iop)
  * {
  *      if (this.InteractionName.StartsWith("VisitInteraction"))
  *      {
  *              return Common.LocalizeEAString(actor.IsFemale, "Gameplay/Core/VisitCommunityLot:VisitNamedLot", new object[]
  *                      {
  *                              target.CatalogName
  *                      });
  *      }
  *      return base.GetInteractionName(actor, target, iop);
  * }*/
 public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
 {
     if (isAutonomous && a.IsInGroupingSituation())
     {
         return(false);
     }
     if (a.GetSituationOfType <GroupingSituation>() != null)
     {
         return(this.IsGroupAddition);
     }
     return(a.Posture == null || a.Posture.Container != target);
 }
Example #32
0
        public static Household ReturnLotOwner(Lot lot)
        {
            Household owningHousehold = null;

            if (lot != null)
            {
                List <RabbitHole> list       = new List <RabbitHole>(Sims3.Gameplay.Queries.GetObjects <RabbitHole>());
                RabbitHole        rabbitHole = null;
                foreach (RabbitHole hole2 in list)
                {
                    if (hole2.LotCurrent == lot)
                    {
                        rabbitHole = hole2;
                        break;
                    }
                }
                if (rabbitHole != null)
                {
                    List <Household> list2 = new List <Household>(Sims3.Gameplay.Queries.GetObjects <Household>());
                    PropertyData     data  = null;
                    if ((list2 != null) && (list2.Count > 0))
                    {
                        foreach (Household household2 in list2)
                        {
                            data = household2.RealEstateManager.FindProperty(rabbitHole);
                            if ((data != null) && (data.Owner != null))
                            {
                                owningHousehold = data.Owner.OwningHousehold;
                                break;
                            }
                        }
                    }
                }
                if (owningHousehold == null)
                {
                    List <Household> list3 = new List <Household>(Sims3.Gameplay.Queries.GetObjects <Household>());
                    PropertyData     data2 = null;
                    if ((list3 == null) || (list3.Count <= 0))
                    {
                        return(owningHousehold);
                    }
                    foreach (Household household3 in list3)
                    {
                        data2 = household3.RealEstateManager.FindProperty(lot);
                        if ((data2 != null) && (data2.Owner != null))
                        {
                            return(data2.Owner.OwningHousehold);
                        }
                    }
                }
            }
            return(owningHousehold);
        }
Example #33
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            List <RabbitHole> schools = new List <RabbitHole>(Sims3.Gameplay.Queries.GetObjects <SchoolRabbitHole>());

            if (schools.Count == 0)
            {
                return(false);
            }

            RabbitHole choice = RandomUtil.GetRandomObjectFromList(schools);

            return(Situations.PushInteraction(this, Sim, choice, Education.GiveLectureInAtRabbitHole.Singleton));
        }
Example #34
0
        protected static bool IsAlreadyOwned(RabbitHole hole, Household me)
        {
            foreach (Household house in Household.sHouseholdList)
            {
                if (house == me) continue;

                if (house.RealEstateManager == null) continue;

                PropertyData data = house.RealEstateManager.FindProperty(hole);
                if (data != null)
                {
                    return data.IsFullOwner;
                }
            }

            return false;
        }
Example #35
0
        public static bool CanReviewRabbitHole(Sim sim, RabbitHole rabbitHole)
        {
            Journalism journalism = OmniCareer.Career<Journalism>(sim.Occupation);

            if (!OmniCareer.HasMetric<MetricStoriesAndReviews>(sim.Occupation))
            {
                return false;
            }
            foreach (Journalism.ReviewedRabbitHole hole in journalism.RabbitHolesReviewed)
            {
                if (hole.EventLocation == rabbitHole)
                {
                    return false;
                }
            }
            return true;
        }
Example #36
0
 public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
 {
     return true;
 }
Example #37
0
 public RabbitHoleItem(RabbitHole hole, OwnerType type)
     : base(hole.CatalogName, type)
 {
     mHole = hole;
 }
        // replaces the method from RabbitHole class - identical except for new slot reassignment code
        public bool RouteNearEntranceAndEnterRabbitHole(Sim a, RabbitHole.IRabbitHoleFollowers inst, RabbitHole.BeforeEnteringRabbitHoleDelegate beforeEntering, bool canUseCar, Route.RouteMetaType routeMetaType, bool playRouteFailure)
        {
            if ((Target.RabbitHoleProxy.EnterSlots.Count == 0) || (Target.RabbitHoleProxy.ExitSlots.Count == 0))
            {
                return false;
            }
            if (a.IsInRidingPosture && ((Target.RabbitHoleProxy.MountedEnterSlots.Count == 0) || (Target.RabbitHoleProxy.MountedExitSlots.Count == 0)))
            {
                return false;
            }
            List<Sim> list = new List<Sim>();
            CarryingChildPosture posture = a.Posture as CarryingChildPosture;
            if (posture != null)
            {
                list.Add(posture.Child);
            }
            if (inst != null)
            {
                if (inst.SimFollowers != null)
                {
                    foreach (Sim sim in inst.SimFollowers)
                    {
                        posture = sim.Posture as CarryingChildPosture;
                        if (posture != null)
                        {
                            list.Add(posture.Child);
                        }
                    }
                    foreach (Sim sim2 in list)
                    {
                        inst.AddFollower(sim2);
                    }
                }
                else if (list.Count > 0)
                {
                    inst.AddFollower(list[0]);
                }
            }
            bool flag = false;
            Route item = null;
            Sim parent = null;
            if (a.IsInRidingPosture)
            {
                if (a.Parent is Sim)
                {
                    parent = a.Parent as Sim;
                }
                item = parent.CreateRoute();
                item.ExecutionFromNonSimTaskIsSafe = true;
            }
            else
            {
                item = a.CreateRoute();
            }
            bool flag2 = false;
            int kRouteAttemptsToEnterRabbitHole = RabbitHole.kRouteAttemptsToEnterRabbitHole;
            Slot slotToUse = Slot.None;
            while ((kRouteAttemptsToEnterRabbitHole > 0) && !flag2)
            {
                kRouteAttemptsToEnterRabbitHole--;
                try
                {
                    Target.RabbitHoleProxy.ActiveEntryRoutes.Add(item);
                    if (playRouteFailure)
                    {
                        item.DoRouteFail = kRouteAttemptsToEnterRabbitHole == 0;
                    }
                    item.SetOption(Route.RouteOption.EnablePlanningAsCar, canUseCar);
                    if (Target.mGuid == RabbitHoleType.Subway)
                    {
                        item.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
                    }
                    if (Target.mGuid == RabbitHoleType.HoverTrainStation)
                    {
                        item.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, false);
                    }
                    item.SetRouteMetaType(routeMetaType);
                    foreach (Slot slot2 in Target.RabbitHoleProxy.EnterSlots)
                    {
                        item.AddObjectToIgnoreForRoute(Target.RabbitHoleProxy.SlotToSlotInfo[slot2].Footprint.ObjectId);
                    }
                    foreach (Slot slot3 in Target.RabbitHoleProxy.MountedEnterSlots)
                    {
                        item.AddObjectToIgnoreForRoute(Target.RabbitHoleProxy.SlotToSlotInfo[slot3].Footprint.ObjectId);
                    }
                    item.PlanToSlot(Target.RabbitHoleProxy, (a.IsInRidingPosture ? Target.RabbitHoleProxy.MountedEnterSlots : Target.RabbitHoleProxy.EnterSlots).ToArray());
                    if (!item.PlanResult.Succeeded())
                    {
                        item.DoRouteFail = playRouteFailure;
                        if (a.IsInRidingPosture)
                        {
                            return parent.DoRoute(item);
                        }
                        return a.DoRoute(item);
                    }
                    slotToUse = (Slot)item.PlanResult.mDestSlotNameHash;

                    // Slot Reassignment
                    if ((Target.RabbitHoleProxy.EnterSlots.Count > 1) && (Target.RabbitHoleProxy.EnterSlots.Count <= 5))
                    {
                        slotToUse = ReassignSlot(Target.RabbitHoleProxy.EnterSlots.Count);
                    }
                    List<Sim> followers = (inst == null) ? null : inst.SimFollowers;
                    if ((!flag && (followers != null)) && ((followers.Count > 1) || ((followers.Count == 1) && (followers[0].Posture.Container != a))))
                    {
                        //if (RouteOutside(a, followers, this.RabbitHoleProxy.EnterSlots[0x0], false, true, true, false))
                        if (Target.RouteOutside(a, followers, Target.RabbitHoleProxy.EnterSlots[0], false, true, true, false))
                        {
                            flag = true;
                            flag2 = true;
                        }
                    }
                    else
                    {
                        //flag2 = RouteOutside(a, followers, none, false, true, false, false);
                        flag2 = Target.RouteOutside(a, followers, slotToUse, false, true, false, false);
                    }
                    if (!flag2 && (kRouteAttemptsToEnterRabbitHole > 0))
                    {
                        if (IntroTutorial.TutorialSim == a)
                        {
                            break;
                        }
                        a.RemoveExitReason(ExitReason.RouteFailed);
                        if (a.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                        {
                            break;
                        }
                        a.LoopIdle();
                        Simulator.Sleep((uint)SimClock.ConvertToTicks(RandomUtil.GetFloat(RabbitHole.kMinSimMinutesToSleepOnFailedRouteAttempt, RabbitHole.kMaxSimMinutesToSleepOnFailedRouteAttempt), TimeUnit.Minutes));
                    }
                    continue;
                }
                finally
                {
                    Target.RabbitHoleProxy.ActiveEntryRoutes.Remove(item);
                }
            }
            item = null;
            if (((a.ExitReason & ExitReason.HigherPriorityNext) == ExitReason.None) && ((a.ExitReason & ExitReason.UserCanceled) == ExitReason.None))
            {
                if (flag2)
                {
                    RabbitHole.NumSuccess++;
                }
                else
                {
                    RabbitHole.NumFail++;
                }
            }
            if (!flag2)
            {
                return flag2;
            }
            if ((beforeEntering != null) && !beforeEntering())
            {
                List<Sim> simFollowers = null;
                if (inst != null)
                {
                    simFollowers = inst.SimFollowers;
                }
                //RouteOutside(a, simFollowers, RandomUtil.GetRandomObjectFromList<Slot>(a.IsInRidingPosture ? this.RabbitHoleProxy.MountedEnterSlots : this.RabbitHoleProxy.EnterSlots), false, false, true, true);
                Target.RouteOutside(a, simFollowers, RandomUtil.GetRandomObjectFromList<Slot>(a.IsInRidingPosture ? Target.RabbitHoleProxy.MountedEnterSlots : Target.RabbitHoleProxy.EnterSlots), false, false, true, true);
                return false;
            }
            LeadingHorsePosture posture2 = a.Posture as LeadingHorsePosture;
            if (posture2 != null)
            {
                Sim container = posture2.Container as Sim;
                LeadingHorsePosture.ReleaseHorseFromLeadingPosture(a, container, false);
                Target.AnimateEnterRabbitHole(a, slotToUse, true, routeMetaType);
                Target.AnimateEnterRabbitHole(container, slotToUse, true, routeMetaType);
                return flag2;
            }
            return Target.AnimateEnterRabbitHole(a, slotToUse, true, routeMetaType);
        }
Example #39
0
 public Item(Household house, RabbitHole hole, RealEstate.OwnerType type)
     : base(hole, type)
 {
     mHouse = house;
     mName = TownFamily.GetQualifiedName(house);
 }
 public override string GetInteractionName(Sim actor, RabbitHole target, InteractionObjectPair iop)
 {
     return base.GetInteractionName(actor, target, new InteractionObjectPair(sOldSingleton, target));
 }
 public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
 {
     return CommonSpace.Helpers.TravelUtilEx.CanSimTriggerTravelToUniversityWorld(a, Traveler.Settings.mTravelFilter, true, ref greyedOutTooltipCallback);
 } 
Example #42
0
            public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    CareerLocation location;
                    Career career = a.OccupationAsCareer;
                    if (career == null)
                    {
                        return false;
                    }
                    else if (!a.IsSelectable && Party.IsGuestAtAParty(a))
                    {
                        return false;
                    }
                    else if (!target.CareerLocations.TryGetValue((ulong)career.Guid, out location) || (career.CareerLoc != location))
                    {
                        return false;
                    }

                    bool flag = IsAllowedToWork(career) || career.ShouldBeAtWork();
                    if (career.SpecialWorkDay)
                    {
                        return false;
                    }

                    if (!flag || (career.DayLength == 0f))
                    {
                        greyedOutTooltipCallback = delegate
                        {
                            if (career.DayLength == 0f)
                            {
                                return WorkInRabbitHole.LocalizeString("ZeroDayLengthError", new object[0x0]);
                            }
                            return Localization.LocalizeString("Gameplay/Careers/WorkInRabbitHole:Closed", new object[] { career.GetHoursUntilWorkStringRaw() });
                        };
                        return false;
                    }

                    if (((isAutonomous && a.IsSelectable) && (career.CurLevel.HasCarpool && career.CarpoolEnabled)) && (career.HoursUntilWork >= Career.kHoursBeforeStartCarpoolArrives))
                    {
                        return false;
                    }
                    return true;
                }
                catch (Exception e)
                {
                    Common.Exception(a, target, e);
                    return false;
                }
            }