Example #1
0
        //public Dictionary<ulong, DoorPortalComponentEx.DoorLotSettings> mDoorLotSettings = new Dictionary<ulong, DoorPortalComponentEx.DoorLotSettings>();

        public bool AllowPush(Sim sim, Lot lot)
        {
            if (!GoHere.ExternalAllowPush(sim.SimDescription, lot))
            {
                return(false);
            }

            if (SimClock.IsNightTime())
            {
                if (!mAllowNightVisitLot)
                {
                    return(false);
                }
            }
            else
            {
                if (SimTypes.IsOccult(sim.SimDescription, Sims3.UI.Hud.OccultTypes.Vampire))
                {
                    if (!mAllowVampireDayPush)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Example #2
0
        static float GetImpregnationChance(Sim abductee, SimDescription alien)
        {
            float result = Abductor.Settings.mImpregnantionChance;

            if (result <= 0)
            {
                Logger.Append("Alien Pregnancy: Disabled");
                return(0);
            }

            if (Abductor.Settings.mUseFertility)
            {
                if ((abductee.BuffManager != null && abductee.BuffManager.HasElement(BuffNames.ATwinkleInTheEye)) ||
                    abductee.TraitManager.HasElement(TraitNames.FertilityTreatment))
                {
                    result += TraitTuning.kFertilityBabyMakingChanceIncrease;
                }

                if (abductee.BuffManager != null && abductee.BuffManager.HasElement(BuffNames.MagicInTheAir))
                {
                    result += BuffMagicInTheAir.kBabyMakingChanceIncrease;
                }

                if (abductee.TraitManager.HasElement(TraitNames.WishedForLargeFamily))
                {
                    result += 100f;
                    abductee.BuffManager.RemoveElement(BuffNames.WishForLargeFamily);
                }

                if ((alien.CreatedSim != null && alien.CreatedSim.BuffManager != null && alien.CreatedSim.BuffManager.HasElement(BuffNames.ATwinkleInTheEye)) ||
                    alien.TraitManager.HasElement(TraitNames.FertilityTreatment))
                {
                    result += TraitTuning.kFertilityBabyMakingChanceIncrease;
                }

                if (alien.CreatedSim != null && alien.CreatedSim.BuffManager != null && alien.CreatedSim.BuffManager.HasElement(BuffNames.MagicInTheAir))
                {
                    result += BuffMagicInTheAir.kBabyMakingChanceIncrease;
                }

                if (alien.TraitManager.HasElement(TraitNames.WishedForLargeFamily))
                {
                    result += 100f;

                    if (alien.CreatedSim != null)
                    {
                        alien.CreatedSim.BuffManager.RemoveElement(BuffNames.WishForLargeFamily);
                    }
                }

                if (GameUtils.IsInstalled(ProductVersion.EP7) && SimClock.IsNightTime() && SimClock.IsFullMoon())
                {
                    result += Pregnancy.kFullMoonImprovedBabyChance * 100f;
                }
            }

            return(result);
        }
Example #3
0
        public override void OnDelayedWorldLoadFinished()
        {
            if (!GameUtils.IsInstalled(ProductVersion.EP7))
            {
                return;
            }

            Overwatch.Log("HandleLunarCycle");

            float hourOfDay = World.GetSunriseTime() + 2.6f;

            HudModel model = Sims3.UI.Responder.Instance.HudModel as HudModel;

            AlarmManager.Global.RemoveAlarm(model.mLunarUpdateAlram);
            model.mLunarUpdateAlram = AlarmManager.Global.AddAlarmDay(hourOfDay, ~DaysOfTheWeek.None, OnLunarUpdate, "LunarUpdateAlarm", AlarmType.NeverPersisted, null);

            if (Overwatch.Settings.mCurrentPhaseIndex < 0)
            {
                InitializeLunarPhase();
            }

            LunarUpdate(false);

            if (SimClock.IsNightTime())
            {
                // Reactivates any alarms that were not persisted to save
                EventTracker.SendEvent(new LunarCycleEvent(EventTypeId.kMoonRise, (LunarCycleManager.LunarPhase)World.GetLunarPhase()));

                if (SimClock.HoursPassedOfDay >= (World.GetSunsetTime() + LunarCycleManager.kLunarEffectsDelayHours))
                {
                    if (!Overwatch.Settings.mDisableFullMoonLighting)
                    {
                        LunarCycleManager.TriggerLunarLighting();
                    }
                }
            }

            if (Overwatch.Settings.mDisableFullMoonLighting)
            {
                AlarmManager.Global.RemoveAlarm(LunarCycleManager.mLunarEffectsAlarm);
                LunarCycleManager.mLunarEffectsAlarm = AlarmHandle.kInvalidHandle;
            }

            foreach (MoonDial dial in Sims3.Gameplay.Queries.GetObjects <MoonDial>())
            {
                try
                {
                    if (dial.mLunarFXLookUp.Length > Overwatch.Settings.mCurrentPhaseIndex)
                    {
                        dial.StartLunarFX(dial.mLunarFXLookUp[Overwatch.Settings.mCurrentPhaseIndex]);
                    }
                }
                catch
                { }
            }

            Sims3.UI.Responder.Instance.OptionsModel.OptionsChanged += OnOptionsChanged;
        }
Example #4
0
            public override bool Test(Sim a, Computer target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!SimClock.IsNightTime())
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("Not Night Time");
                    return(false);
                }

                if (isAutonomous)
                {
                    if (!mRandom)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Not Random");
                        return(false);
                    }

                    if (!Woohooer.Settings.mAutonomousComputer)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("No Autonomous");
                        return(false);
                    }

                    if (ScoringLookup.GetScore("LikeProfessional", a.SimDescription) < 0)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Score Fail");
                        return(false);
                    }

                    if (!CommonWoohoo.SatisfiesCooldown(a, RandomUtil.GetRandomObjectFromList <Sim>(LotManager.Actors), isAutonomous, ref greyedOutTooltipCallback))
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Cooldown Fail");
                        return(false);
                    }

                    if (!CommonWoohoo.HasWoohooableObject(a.LotHome, a, RandomUtil.GetRandomObjectFromList <Sim>(LotManager.Actors)))
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("No Woohooable Objects Fail");
                        return(false);
                    }

                    if (GetPotentials(a).Count == 0)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("No Choices");
                        return(false);
                    }
                }
                else
                {
                    if (!KamaSimtra.Settings.mShowRegisterInteraction)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("User Hidden");
                        return(false);
                    }
                }

                return(true);
            }
Example #5
0
        public static float OnGetChanceOfSuccess(Sim abductee, SimDescription alien)
        {
            float chance = Aliens.Settings.mPregnancyChance;

            if (chance <= 0)
            {
                Common.DebugNotify("Abductions: Pregnancy Disabled");
                return(0);
            }

            if (Aliens.Settings.mUseFertility)
            {
                if ((abductee.BuffManager != null && abductee.BuffManager.HasElement(BuffNames.ATwinkleInTheEye)) ||
                    (abductee.TraitManager.HasElement(TraitNames.FertilityTreatment)))
                {
                    chance += TraitTuning.kFertilityBabyMakingChanceIncrease;
                }

                if (abductee.BuffManager != null && abductee.BuffManager.HasElement(BuffNames.MagicInTheAir))
                {
                    chance += BuffMagicInTheAir.kBabyMakingChanceIncrease;
                }

                if (abductee.TraitManager.HasElement(TraitNames.WishedForLargeFamily))
                {
                    chance += 100f;
                    abductee.BuffManager.RemoveElement(BuffNames.WishForLargeFamily);
                }

                if (GameUtils.IsInstalled(ProductVersion.EP7) && SimClock.IsNightTime() && SimClock.IsFullMoon())
                {
                    chance += Pregnancy.kFullMoonImprovedBabyChance;
                }
            }

            return(chance);
        }
Example #6
0
        public static void Update()
        {
            List <Lot> lotChoices = new List <Lot>();

            foreach (Lot lot in LotManager.AllLots)
            {
                if (!IsValidLot(lot, null))
                {
                    continue;
                }

                lotChoices.Add(lot);
            }

            List <FoodTruck> truckList = new List <FoodTruck>(Sims3.Gameplay.Queries.GetObjects <FoodTruck>());

            int trucksToSpawn = 0x0;
            int count         = truckList.Count;

            if (count < Traffic.Settings.mMaxFoodTrucks)
            {
                if (lotChoices.Count > FoodTruckManager.kMinWideParkingSpaceRequired)
                {
                    trucksToSpawn = 0x1;
                }
                else if (lotChoices.Count < FoodTruckManager.kMinWideParkingSpaceRequired)
                {
                    trucksToSpawn = lotChoices.Count - FoodTruckManager.kMinWideParkingSpaceRequired;
                }
            }
            else if (count > Traffic.Settings.mMaxFoodTrucks)
            {
                trucksToSpawn = Traffic.Settings.mMaxFoodTrucks - count;
            }
            else if ((Traffic.Settings.mRequireFoodParkingSpace) && (lotChoices.Count < FoodTruckManager.kMinWideParkingSpaceRequired))
            {
                trucksToSpawn = lotChoices.Count - FoodTruckManager.kMinWideParkingSpaceRequired;
            }

            if ((trucksToSpawn > 0x0) && (lotChoices.Count > 0x0))
            {
                Lot randomObjectFromList = RandomUtil.GetRandomObjectFromList(lotChoices);
                lotChoices.Remove(randomObjectFromList);

                FoodTruck truck = FoodTruckManager.AddTruckIntoWorld(randomObjectFromList);
                if (truck != null)
                {
                    truckList.Add(truck);
                }
            }

            if (Common.kDebugging)
            {
                Common.DebugNotify("Food Truck Manager: " + truckList.Count + " " + trucksToSpawn + " " + lotChoices.Count);
            }

            if (truckList.Count > 0x0)
            {
                RandomUtil.RandomizeListOfObjects <FoodTruck>(truckList);
                foreach (FoodTruck truck in truckList)
                {
                    if ((trucksToSpawn < 0x0) || (lotChoices.Count == 0) || ((SimClock.IsNightTime()) && (!Traffic.Settings.mAllowFoodTruckAtNight)))
                    {
                        truck.FadeOut(false, true);
                        trucksToSpawn++;
                    }
                    else if (lotChoices.Count > 0x0)
                    {
                        bool moveToNewLot = FoodTruckEx.MoveToNewLot(truck);

                        if ((moveToNewLot) || (!IsValidLot(TruckController.GetLot(truck), truck)))
                        {
                            Lot item = RandomUtil.GetRandomObjectFromList(lotChoices);
                            lotChoices.Remove(item);

                            FoodTruckEx.RouteToNewLot(truck, item);

                            Common.DebugNotify("Food Truck: ", truck.ObjectId, item.ObjectId);

                            TruckController.AddTruck(truck);
                        }
                    }

                    FoodTruckEx.AddMapTags(truck);
                }
            }
        }
Example #7
0
        public static float OnGetChanceOfSuccess(Sim a, Sim b, CommonWoohoo.WoohooStyle style)
        {
            float chance = 0;

            bool useFertility = true;

            int speciesIndex = PersistedSettings.GetSpeciesIndex(a);

            switch (style)
            {
            case CommonWoohoo.WoohooStyle.Risky:
                if ((a.SimDescription.Teen) || (b.SimDescription.Teen))
                {
                    chance = Woohooer.Settings.mRiskyTeenBabyMadeChance;
                }
                else
                {
                    chance = Woohooer.Settings.mRiskyBabyMadeChanceV2[speciesIndex];
                }

                useFertility = Woohooer.Settings.mRiskyFertility[speciesIndex];
                break;

            case CommonWoohoo.WoohooStyle.TryForBaby:
                if ((a.SimDescription.Teen) || (b.SimDescription.Teen))
                {
                    chance = Woohooer.Settings.mTryForBabyTeenBabyMadeChance;
                }
                else
                {
                    chance = Woohooer.Settings.mTryForBabyMadeChanceV2[speciesIndex];
                }

                useFertility = Woohooer.Settings.mTryForBabyFertility[speciesIndex];
                break;
            }

            if (chance <= 0)
            {
                Common.DebugNotify("Pregnancy: No Chance");
                return(0);
            }

            if (useFertility)
            {
                if (a.IsHuman)
                {
                    if ((a.BuffManager != null) && a.BuffManager.HasTransformBuff())
                    {
                        return(0);
                    }

                    if ((b.BuffManager == null) && b.BuffManager.HasTransformBuff())
                    {
                        return(0);
                    }

                    if ((a.TraitManager.HasElement(TraitNames.FertilityTreatment)) || ((a.BuffManager != null) && a.BuffManager.HasElement(BuffNames.ATwinkleInTheEye)))
                    {
                        chance += TraitTuning.kFertilityBabyMakingChanceIncrease;
                    }

                    if ((b.TraitManager.HasElement(TraitNames.FertilityTreatment)) || ((b.BuffManager != null) && b.BuffManager.HasElement(BuffNames.ATwinkleInTheEye)))
                    {
                        chance += TraitTuning.kFertilityBabyMakingChanceIncrease;
                    }
                }
                else
                {
                    if (a.TraitManager.HasElement(TraitNames.FertilityTreatmentPet))
                    {
                        chance += TraitTuning.kFertilityLitterMakingChanceIncrease;
                    }

                    if (b.TraitManager.HasElement(TraitNames.FertilityTreatmentPet))
                    {
                        chance += TraitTuning.kFertilityLitterMakingChanceIncrease;
                    }
                }

                if (a.TraitManager.HasElement(TraitNames.WishedForLargeFamily))
                {
                    chance += 100f;
                    a.BuffManager.RemoveElement(BuffNames.WishForLargeFamily);
                }

                if (b.TraitManager.HasElement(TraitNames.WishedForLargeFamily))
                {
                    chance += 100f;
                    b.BuffManager.RemoveElement(BuffNames.WishForLargeFamily);
                }

                if ((a.BuffManager != null) && a.BuffManager.HasElement(BuffNames.MagicInTheAir))
                {
                    chance += BuffMagicInTheAir.kBabyMakingChanceIncrease * 100f;
                }

                if ((b.BuffManager != null) && b.BuffManager.HasElement(BuffNames.MagicInTheAir))
                {
                    chance += BuffMagicInTheAir.kBabyMakingChanceIncrease * 100f;
                }

                if ((GameUtils.IsInstalled(ProductVersion.EP7)) && (SimClock.IsNightTime()) && (SimClock.IsFullMoon()))
                {
                    chance += Pregnancy.kFullMoonImprovedBabyChance * 100f;
                }
            }

            return(chance);
        }
Example #8
0
        public override bool Run()
        {
            try
            {
                if (!StartSync())
                {
                    return(false);
                }

                StandardEntry(false);
                BeginCommodityUpdates();
                if (IsMaster)
                {
                    ReturnInstance.EnsureMaster();
                    StartSocial("Kiss");
                    InitiateSocialUI(Actor, Target);
                    (LinkedInteractionInstance as NestedCuddleInteraction).Rejected = Rejected;

                    // Custom
                    mReactToSocialBroadcaster = new ReactionBroadcaster(Actor, Conversation.ReactToSocialParams, SocialComponentEx.ReactToJealousEventMedium);
                    //SocialComponent.SendCheatingEvents(Actor, Target, !Rejected);

                    if (Rejected)
                    {
                        ReturnInstance.mCurrentStateMachine.RequestState(null, "KissReject");
                        ReturnInstance.mCurrentStateMachine.RequestState(null, "ExitSitting");
                        FinishSocial("Kiss", true);
                        FinishSocialContext();
                    }
                    else
                    {
                        ReturnInstance.mCurrentStateMachine.RequestState(null, "Kiss");
                        FinishSocial("Kiss", true);
                    }
                }
                else
                {
                    DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                }

                FinishLinkedInteraction(IsMaster);
                EndCommodityUpdates(!Rejected);
                StandardExit(false, false);
                EventTracker.SendEvent(new SocialEvent(EventTypeId.kSocialInteraction, Actor, Target, "Kiss", !IsMaster, !Rejected, false, CommodityTypes.Undefined));
                if (Rejected)
                {
                    InvokeDoResumeOnCleanup = false;
                }
                else
                {
                    Actor.SimDescription.SetFirstKiss(Target.SimDescription);
                    if (SimClock.IsNightTime() && SimClock.IsFullMoon())
                    {
                        Actor.BuffManager.AddElement(BuffNames.KissedUnderFullMoon, Origin.None);
                        EventTracker.SendEvent(EventTypeId.kKissedUnderFullMoon, Actor);
                    }
                }

                WaitForSyncComplete();
                return(!Rejected);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #9
0
        public static float OnGetChanceOfSuccess(Sim a, Sim b)
        {
            float chance = Abductor.Settings.mImpregnationChance;

            if (chance <= 0)
            {
                Common.DebugNotify("Alien Pregnancy: No Chance");
                return(0);
            }

            bool useFertility = Abductor.Settings.mUseFertility;

            if (useFertility)
            {
                if (a.BuffManager != null && a.BuffManager.HasTransformBuff())
                {
                    return(0);
                }

                if (b.BuffManager != null && b.BuffManager.HasTransformBuff())
                {
                    return(0);
                }

                if ((a.BuffManager != null && a.BuffManager.HasElement(BuffNames.ATwinkleInTheEye)) || a.TraitManager.HasElement(TraitNames.FertilityTreatment))
                {
                    chance += TraitTuning.kFertilityBabyMakingChanceIncrease;
                }

                if (a.BuffManager != null && a.BuffManager.HasElement(BuffNames.MagicInTheAir))
                {
                    chance += BuffMagicInTheAir.kBabyMakingChanceIncrease * 100f;
                }

                if (a.TraitManager.HasElement(TraitNames.WishedForLargeFamily))
                {
                    chance += 100f;
                    a.BuffManager.RemoveElement(BuffNames.WishForLargeFamily);
                }

                if ((b.BuffManager != null && b.BuffManager.HasElement(BuffNames.ATwinkleInTheEye)) || b.TraitManager.HasElement(TraitNames.FertilityTreatment))
                {
                    chance += TraitTuning.kFertilityBabyMakingChanceIncrease;
                }

                if (b.TraitManager.HasElement(TraitNames.WishedForLargeFamily))
                {
                    chance += 100f;
                    b.BuffManager.RemoveElement(BuffNames.WishForLargeFamily);
                }

                if (b.BuffManager != null && b.BuffManager.HasElement(BuffNames.MagicInTheAir))
                {
                    chance += BuffMagicInTheAir.kBabyMakingChanceIncrease * 100f;
                }

                if (GameUtils.IsInstalled(ProductVersion.EP7) && SimClock.IsNightTime() && SimClock.IsFullMoon())
                {
                    chance += Pregnancy.kFullMoonImprovedBabyChance * 100f;
                }
            }

            return(chance);
        }
Example #10
0
        public static void Update(IceCreamTruckManager ths)
        {
            bool winter = SeasonsManager.Enabled && (SeasonsManager.CurrentSeason == Season.Winter);
            int[] numArray = (SeasonsManager.Enabled && (SeasonsManager.CurrentSeason == Season.Summer)) ? IceCreamTruckManager.kHoursOfOperationSummer : IceCreamTruckManager.kHoursOfOperation;

            if ((winter || !SimClock.IsTimeBetweenTimes((float)numArray[0], (float)numArray[1])) || ((SimClock.IsNightTime()) && (!Traffic.Settings.mAllowIceCreamAtNight)))
            {
                foreach (IceCreamTruck truck in new List<IceCreamTruck>(ths.mIceCreamTrucks))
                {
                    truck.EndService();
                }

                ths.mIceCreamTrucks.Clear();
            }
            else
            {
                List<IceCreamTruckManager.LotData> data = null;
                if (data == null)
                {
                    data = new List<IceCreamTruckManager.LotData>();
                    PopulateLotList(data);
                }

                if ((data.Count > 0) && (ths.mIceCreamTrucks.Count < Traffic.Settings.mMaxIceCreamTrucks))
                {
                    IceCreamTruckManager.LotData randomObjectFromList = RandomUtil.GetRandomObjectFromList(data);
                    data.Remove(randomObjectFromList);

                    AddTruckIntoWorld(ths, randomObjectFromList.mLot);
                }
                else if ((ths.mIceCreamTrucks.Count > 0) && ((data.Count == 0) || (ths.mIceCreamTrucks.Count > Traffic.Settings.mMaxIceCreamTrucks)))
                {
                    IceCreamTruck truck = RandomUtil.GetRandomObjectFromList(ths.mIceCreamTrucks);

                    ths.mIceCreamTrucks.Remove(truck);

                    truck.FadeOut(false, true);
                }

                //Common.DebugNotify("Ice Cream Trucks " + ths.mIceCreamTrucks.Count);

                foreach (IceCreamTruck truck in ths.mIceCreamTrucks)
                {
                    if ((truck.MoveToNewLot()) || (!IsValidLot(TruckController.GetLot(truck), truck)))
                    {
                        if (data.Count == 0) continue;

                        ths.PopulateLotListDistanceAndScore(truck, data);
                        ths.RouteToNextBestSpot(truck, data);

                        for (int i = 0; i < data.Count; i++)
                        {
                            if (data[i].mLot == truck.mDestinationLot)
                            {
                                data.RemoveAt(i);
                                break;
                            }
                        }

                        Common.DebugNotify("Ice Cream Truck", truck.ObjectId, truck.mDestinationLot.ObjectId);

                        TruckController.AddTruck(truck);
                    }
                }
            }
        }