예제 #1
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("FixActiveTopics");

            Dictionary <ulong, SimDescription> sims = SimListing.GetResidents(false);

            foreach (SimDescription sim in sims.Values)
            {
                if (sim.CreatedSim == null)
                {
                    continue;
                }
                if (sim.SkillManager == null)
                {
                    continue;
                }

                foreach (Skill skill in sim.SkillManager.List)
                {
                    if (skill.SkillLevel < 1)
                    {
                        continue;
                    }
                    switch (skill.Guid)
                    {
                    // Not sure why these don't work on their own, it may be the active
                    // topic limit. Either way readding them should troop the limit and fix
                    // them if they are truly broken
                    case SkillNames.Bartending:
                        ActiveTopic.AddToSim(sim.CreatedSim, "Bartending Skill");
                        Overwatch.Log("Readded Active Topic - Bartending Skill: " + sim.FullName);
                        break;

                    case SkillNames.Charisma:
                        ActiveTopic.AddToSim(sim.CreatedSim, "Smooth Recovery");
                        Overwatch.Log("Readded Active Topic - Charisma Skill: " + sim.FullName);
                        break;

                    case SkillNames.Logic:
                        if (skill.SkillLevel >= LogicSkill.kSkillLevelForSchoolTutor)
                        {
                            ActiveTopic.AddToSim(sim.CreatedSim, "Logic Skill");
                            Overwatch.Log("Readded Active Topic - Logic Skill: " + sim.FullName);
                        }
                        break;

                    case SkillNames.MartialArts:
                        ActiveTopic.AddToSim(sim.CreatedSim, "Martial Arts Skill");
                        Overwatch.Log("Readded Active Topic - Martial Arts Skill: " + sim.FullName);
                        break;

                    // hopelessly broken regardless
                    case SkillNames.Science:
                        ActiveTopic.AddToSim(sim.CreatedSim, "Science Skill");
                        Overwatch.Log("Readded Active Topic - Science Skill: " + sim.FullName);
                        break;
                    }
                }
            }
        }
예제 #2
0
        protected override void PrivatePerformAction(bool prompt)
        {
            try
            {
                Overwatch.Log(GetTitlePrefix());

                int count = 0;

                List <MultiImageObject> digital = new List <MultiImageObject>(Sims3.Gameplay.Queries.GetObjects <MultiImageObject>());
                foreach (MultiImageObject obj in digital)
                {
                    if (obj.mAlarmNextSlide == AlarmHandle.kInvalidHandle)
                    {
                        continue;
                    }

                    obj.StopSlideShow();
                    obj.StartSlideShow();

                    count++;
                }

                if (count > 0)
                {
                    Overwatch.AlarmNotify(Common.Localize(GetTitlePrefix() + ":Success", false, new object[] { count }));
                }
            }
            catch (Exception exception)
            {
                Common.Exception(Name, exception);
            }
        }
예제 #3
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupSeasonalLotMarkers");

            foreach (SeasonalLotMarker marker in Sims3.Gameplay.Queries.GetObjects <SeasonalLotMarker>())
            {
                if (marker.mSeasonalItems == null)
                {
                    continue;
                }

                foreach (KeyValuePair <SeasonalLotMarker.LotSeason, List <ObjectGuid> > season in marker.mSeasonalItems)
                {
                    if (season.Value == null)
                    {
                        continue;
                    }

                    for (int i = season.Value.Count - 1; i >= 0; i--)
                    {
                        Sim sim = GameObject.GetObject <GameObject>(season.Value[i]) as Sim;
                        if (sim != null)
                        {
                            Overwatch.Log(" Sim Detached: " + sim.FullName);

                            season.Value.RemoveAt(i);
                        }
                    }
                }
            }
        }
예제 #4
0
        protected static void ReconcileGenealogy(string type, string name, List <Genealogy> newGenes, List <Genealogy> oldGenes)
        {
            if ((newGenes == null) || (oldGenes == null))
            {
                return;
            }

            foreach (Genealogy oldGene in oldGenes)
            {
                if (newGenes.Find((e) => { return(object.ReferenceEquals(e, oldGene)); }) != null)
                {
                    continue;
                }

                if (newGenes.Find((e) => { return(e.IMiniSimDescription == oldGene.IMiniSimDescription); }) != null)
                {
                    continue;
                }

                newGenes.Add(oldGene);

                Overwatch.Log("Merged " + type + " Genealogy: " + name);
            }

            oldGenes.Clear();
        }
예제 #5
0
        protected static void RepairMiniSim(SimDescription sim)
        {
            if (sim == null)
            {
                return;
            }

            MiniSimDescription miniSim = MiniSimDescription.Find(sim.SimDescriptionId);

            if (miniSim != null)
            {
                if (sim.Partner != null)
                {
                    if (miniSim.PartnerSimDescriptionId != sim.Partner.SimDescriptionId)
                    {
                        Overwatch.Log(Relationships.GetFullName(sim) + " MiniSim Partner Reset");

                        miniSim.PartnerSimDescriptionId = sim.Partner.SimDescriptionId;
                    }
                }
                else
                {
                    if (miniSim.PartnerSimDescriptionId != 0)
                    {
                        Overwatch.Log(Relationships.GetFullName(sim) + " MiniSim Partner Cleared");

                        miniSim.PartnerSimDescriptionId = 0;
                    }
                }
            }
        }
예제 #6
0
        protected void RemoveDanglingAgeUpAlarms()
        {
            foreach (List <AlarmManager.Timer> list in AlarmManager.Global.mTimers.Values)
            {
                foreach (AlarmManager.Timer timer in list)
                {
                    if (timer.CallBack == null)
                    {
                        continue;
                    }

                    if (timer.CallBack.Method.ToString().Contains("AgeTransitionWithoutCakeCallback"))
                    {
                        Overwatch.Log("Dropped AgeTransitionWithoutCakeCallback: " + timer.CallBack.Target);

                        List <AlarmHandle> list2;
                        IAlarmOwner        objectRef = timer.ObjectRef;
                        if ((objectRef != null) && AlarmManager.Global.mGameObjectIndex.TryGetValue(objectRef, out list2))
                        {
                            if ((list2.Count == 1) && (list2[0] == timer.Handle))
                            {
                                AlarmManager.Global.mGameObjectIndex.Remove(objectRef);
                            }
                            else
                            {
                                list2.Remove(timer.Handle);
                            }
                        }
                        timer.Clear();
                    }
                }
            }
        }
예제 #7
0
            public void Reset(SimDescription sim, AgingState state)
            {
                state.DayPassedSinceLastTransition = mDayPassed;

                if (IsOldEnoughToAge(AgingManager.Singleton, state))
                {
                    if (mWithoutCake != 0)
                    {
                        state.AgeTransitionWithoutCakeAlarm = AlarmManager.Global.AddAlarm(mWithoutCake, TimeUnit.Hours, state.AgeTransitionWithoutCakeCallback, "The Cake is a Lie and Then You Die", AlarmType.AlwaysPersisted, sim);

                        Overwatch.Log("Age-up: " + state.SimDescription.FullName);
                    }

                    if (mMessage != 0)
                    {
                        state.AgeTransitionMessageAlarm = AlarmManager.Global.AddAlarm(mMessage, TimeUnit.Hours, state.ShowAgeTransitionMessageCallback, "Tell Player that the Cake is a Lie", AlarmType.AlwaysPersisted, sim);
                    }
                }
                else
                {
                    if (mWithoutCake != 0)
                    {
                        Overwatch.Log("Age-up Dropped: " + state.SimDescription.FullName);
                    }
                }

                if (mEarlyMessage != 0)
                {
                    state.AgeTransitionEarlyMessageAlarm = AlarmManager.Global.AddAlarm(mEarlyMessage, TimeUnit.Hours, state.ShowAgeTransitionEarlyMessageCallback, "Tell player that the cake will be a lie in a few days", AlarmType.AlwaysPersisted, sim);
                }
            }
예제 #8
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupAging");

            new Common.AlarmTask(4, TimeUnit.Hours, OnCheckAging, 4, TimeUnit.Hours);

            Dictionary <SimDescription, AgingData> agingData = new Dictionary <SimDescription, AgingData>();

            Dictionary <ulong, SimDescription> sims = SimListing.GetResidents(false);

            foreach (SimDescription sim in sims.Values)
            {
                if (sim.AgingState != null)
                {
                    agingData.Add(sim, new AgingData(sim.AgingState));
                }

                AgingManager.Singleton.RemoveSimDescription(sim);
            }

            RemoveDanglingAgeUpAlarms();

            foreach (SimDescription sim in sims.Values)
            {
                if (sim.AgingEnabled)
                {
                    if ((SimTypes.InServicePool(sim, Sims3.Gameplay.Services.ServiceType.GrimReaper)) || (sim.IsRaccoon) || (sim.IsDeer))
                    {
                        sim.AgingEnabled = false;
                    }
                    else
                    {
                        AgingManager.Singleton.AddSimDescription(sim);

                        if ((sim.AgingState != null) && (agingData.ContainsKey(sim)))
                        {
                            agingData[sim].Reset(sim, sim.AgingState);
                        }
                    }
                }
                else
                {
                    if (sim.AgingState == null)
                    {
                        sim.AgingState = new AgingState(sim);
                    }
                }
            }

            /*
             * if (!GameStates.IsOnVacation)
             * {
             *  foreach (MiniSimDescription description in MiniSimDescription.GetVacationWorldSimDescriptions())
             *  {
             *      if (description.mDeathStyle != SimDescription.DeathType.None) continue;
             *
             *      description.mbAgingEnabled = true;
             *  }
             * }*/
        }
예제 #9
0
        public override void OnDelayedWorldLoadFinished()
        {
            new Common.DelayedEventListener(EventTypeId.kSkillLearnedSkill, OnLearnedSkill);

            // Must be immediate
            EventTracker.AddListener(EventTypeId.kGetNCutGems, OnGetNCutGems);

            Overwatch.Log("CleanupCollecting");

            if (SeashellData.sTotalNumberSeashells > 8)
            {
                SeashellData.sTotalNumberSeashells = 8;
                Overwatch.Log("Fixed seashell count");
            }

            foreach (SimDescription sim in Household.AllSimsLivingInWorld())
            {
                Collecting skill = sim.SkillManager.GetSkill <Collecting>(SkillNames.Collecting);
                if (skill == null)
                {
                    continue;
                }

                EnactCorrections(skill);
            }
        }
예제 #10
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupKnownRecipes");

            foreach (SimDescription sim in Household.EverySimDescription())
            {
                if (sim.SkillManager == null)
                {
                    continue;
                }

                Cooking skill = sim.SkillManager.GetSkill <Cooking>(SkillNames.Cooking);
                if (skill == null)
                {
                    continue;
                }

                if (skill.KnownRecipes == null)
                {
                    continue;
                }

                foreach (string recipe in new List <string>(skill.KnownRecipes))
                {
                    if (!Recipe.NameToRecipeHash.ContainsKey(recipe))
                    {
                        skill.KnownRecipes.Remove(recipe);

                        Overwatch.Log(" Removed " + recipe + ": " + sim.FullName);
                    }
                }
            }
        }
        public override void OnWorldLoadFinished()
        {
            Overwatch.Log(GetTitlePrefix());

            SocialWorkerChildAbuse service = SocialWorkerChildAbuse.Instance;
            List <ulong>           remove  = new List <ulong>();

            if (service != null)
            {
                foreach (KeyValuePair <ulong, Service.ServiceRequest> pair in service.mLotsRequested)
                {
                    Lot lot = LotManager.GetLot(pair.Key);
                    if (lot == null || (lot != Household.ActiveHouseholdLot))
                    {
                        remove.Add(pair.Key);
                    }
                }

                foreach (ulong num in remove)
                {
                    Lot lot = LotManager.GetLot(num);
                    if (lot != null)
                    {
                        service.ClearServiceForLot(lot);
                    }
                    else
                    {
                        service.mLotsRequested.Remove(num);
                    }
                    Overwatch.Log("Removed invalid Social Worker service request");
                }
            }
        }
예제 #12
0
        public override void OnPreLoad()
        {
            try
            {
                Overwatch.Log("Try MoreFishInTank");

                FishTankModern.kFishTankTuning.kMaximumNumberOfFish = 12;

                foreach (FishTankModern tank in Sims3.Gameplay.Queries.GetObjects <FishTankModern>())
                {
                    if (tank.Inventory.mMaxInventoryCapacity < FishTankModern.kFishTankTuning.kMaximumNumberOfFish)
                    {
                        tank.Inventory.mMaxInventoryCapacity = FishTankModern.kFishTankTuning.kMaximumNumberOfFish;

                        if (tank.LotCurrent != null)
                        {
                            Overwatch.Log(" Tank Updated: " + tank.LotCurrent.Name);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(Name, e);
            }
        }
예제 #13
0
        protected override void PrivatePerformAction(bool prompt)
        {
            Overwatch.Log(Name);

            int count = 0;

            foreach (ElevatorDoors obj in Sims3.Gameplay.Queries.GetObjects <ElevatorDoors>())
            {
                ElevatorInterior.ElevatorPortalComponent comp = obj.InteriorObj.ElevatorPortal as ElevatorInterior.ElevatorPortalComponent;
                if (comp != null)
                {
                    if (comp.mAssignedSims != null)
                    {
                        foreach (SimDescription sim in new List <SimDescription>(comp.mAssignedSims.Keys))
                        {
                            if (sim.CreatedSim != null)
                            {
                                ResetSimTask.Perform(sim.CreatedSim, true);
                            }
                        }
                    }
                }

                obj.SetObjectToReset();
                count++;
            }

            Overwatch.Log("Elevators Reset: " + count);
        }
예제 #14
0
        protected override void PrivatePerformAction(bool prompt)
        {
            Overwatch.Log("Delete All Magical Gnomes");

            int count = 0;

            try
            {
                foreach (MagicGnomeBase gnome in Sims3.Gameplay.Queries.GetObjects <MagicGnomeBase>())
                {
                    if (!gnome.DestroyOnGrab)
                    {
                        gnome.Dispose();
                        gnome.Destroy();
                        count++;
                    }
                }

                foreach (GnomeMemorial memorial in Sims3.Gameplay.Queries.GetObjects <GnomeMemorial>())
                {
                    memorial.Dispose();
                    memorial.Destroy();
                    count++;
                }

                if ((prompt) || (count > 0))
                {
                    Overwatch.AlarmNotify(Common.Localize("DeleteAllMagicalGnomes:Success", false, new object[] { count }));
                }
            }
            catch (Exception e)
            {
                Common.Exception(Name, e);
            }
        }
예제 #15
0
        protected bool Allow(Lot lot)
        {
            if (lot.IsResidentialLot)
            {
                return(false);
            }
            else if (LotManager.ActiveLot == lot)
            {
                return(false);
            }
            else if (Household.ActiveHousehold == null)
            {
                return(false);
            }
            else if (Occupation.DoesLotHaveAnyActiveJobs(lot))
            {
                Overwatch.Log("Active Job");
                return(false);
            }
            else
            {
                foreach (Sim sim in Households.AllSims(Household.ActiveHousehold))
                {
                    if (sim.LotCurrent == lot)
                    {
                        Overwatch.Log("Active Sim");
                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #16
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupCompletedOpportunities");

            Dictionary <ulong, SimDescription> sims = SimListing.GetResidents(false);

            foreach (SimDescription sim in sims.Values)
            {
                if (sim.Household == null)
                {
                    continue;
                }

                if (sim.CreatedSim == null)
                {
                    continue;
                }

                if (sim.CreatedSim.OpportunityManager == null)
                {
                    continue;
                }

                foreach (Opportunity opp in sim.CreatedSim.OpportunityManager.List)
                {
                    if (sim.Household.mCompletedHouseholdOpportunities.Remove((ulong)opp.Guid))
                    {
                        Overwatch.Log("Removed Opportunity: " + opp.Guid);
                    }
                }
            }
        }
예제 #17
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupGenericPerformanceObjects");

            foreach (GenericPerformanceObject obj in Sims3.Gameplay.Queries.GetObjects <GenericPerformanceObject>())
            {
                if (obj.SimOwner != null)
                {
                    continue;
                }

                Inventory inventory = Inventories.ParentInventory(obj);
                if (inventory == null)
                {
                    continue;
                }

                Sim sim = inventory.Owner as Sim;
                if (sim == null)
                {
                    continue;
                }

                obj.SimOwner = sim.SimDescription;

                Overwatch.Log("  Sim reattached : " + obj.GetLocalizedName());
            }
        }
예제 #18
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupAutonomy");

            if (AutonomyManager.sInstance == null)
            {
                foreach (Sim sim in LotManager.Actors)
                {
                    if (sim.Autonomy == null)
                    {
                        sim.mAutonomy = new Autonomy(sim.FullName, sim);

                        Overwatch.Log("Restarted Autonomy " + sim.FullName);
                    }

                    if (sim.Autonomy.PreferredVenues == null)
                    {
                        sim.Autonomy.PreferredVenues = new Dictionary <IMetaObject, bool>();

                        Overwatch.Log("Restarted PreferredVenues " + sim.FullName);
                    }
                }

                AutonomyManager.Startup();

                Overwatch.Log("Autonomy Manager Restarted");
            }
        }
예제 #19
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupGroupScienceStation");

            foreach (GroupScienceStation station in Sims3.Gameplay.Queries.GetObjects <GroupScienceStation>())
            {
                if (station.mActiveMeteorites != null && station.mActiveMeteorites.Count > 0)
                {
                    foreach (MeteoriteObject obj in station.mActiveMeteorites)
                    {
                        try
                        {
                            //VisualEffect.OnEffectFinishedEventHandler -= new EventHandler(obj.ImpactEffectCallback);
                            obj.mFallEffect.Stop();
                            obj.mFallEffect = null;
                            obj.mOwner.RemoveActiveMeteoriteObject(obj);
                        }
                        catch
                        { }
                    }

                    station.mActiveMeteorites.Clear();
                    Overwatch.Log("Dropped bogus science station effects");
                }
            }
        }
예제 #20
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupTraits");

            foreach (List <SimDescription> sims in SimListing.AllSims <SimDescription>(null, true).Values)
            {
                foreach (SimDescription sim in sims)
                {
                    if (sim.TraitManager == null)
                    {
                        continue;
                    }

                    List <ulong> remove = new List <ulong>();

                    foreach (KeyValuePair <ulong, Trait> trait in sim.TraitManager.mValues)
                    {
                        if (TraitManager.sDictionary.ContainsKey(trait.Key))
                        {
                            continue;
                        }

                        remove.Add(trait.Key);
                    }

                    foreach (ulong trait in remove)
                    {
                        sim.TraitManager.mValues.Remove(trait);

                        Overwatch.Log(" Removed: " + sim.FullName);
                    }
                }
            }
        }
예제 #21
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("TestDoesObjectNeedCleaning");

            foreach (Lot lot in LotManager.AllLots)
            {
                foreach (GameObject obj in lot.GetObjects <GameObject>())
                {
                    try
                    {
                        Lot.DoesObjectNeedCleaning(obj);
                    }
                    catch
                    {
                        Overwatch.Log(" Fail: " + obj.GetType());

                        try
                        {
                            Overwatch.Log(" Name: " + obj.CatalogName);
                        }
                        catch
                        { }
                    }
                }
            }
        }
예제 #22
0
        public override void OnWorldLoadFinished()
        {
            Overwatch.Log(GetTitlePrefix());

            TimeTraveler service = TimeTraveler.Instance;
            List <ulong> remove  = new List <ulong>();

            if (service != null)
            {
                foreach (KeyValuePair <ulong, Service.ServiceRequest> pair in service.mLotsRequested)
                {
                    if (!service.mTimeTravelerServiceRequests.ContainsKey(pair.Key))
                    {
                        remove.Add(pair.Key);
                    }
                }

                foreach (ulong num in remove)
                {
                    Lot lot = LotManager.GetLot(num);
                    if (lot != null)
                    {
                        service.ClearServiceForLot(lot);
                    }
                    else
                    {
                        service.mLotsRequested.Remove(num);
                    }
                    Overwatch.Log("Removed invalid Time Traveler service request");
                }
            }
        }
예제 #23
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupMountedFish");

            foreach (MountedFish mount in Sims3.Gameplay.Queries.GetObjects <MountedFish>())
            {
                if (mount.mFish == null)
                {
                    continue;
                }

                if (!mount.mFish.HasBeenDestroyed)
                {
                    continue;
                }

                FishData data;
                if (!Fish.sFishData.TryGetValue(mount.mFish.Type, out data))
                {
                    continue;
                }

                FishInitParameters initData = new FishInitParameters(mount.mFish.Type, mount.mFish.mWeight, mount.mFish.mFishingSim);
                Fish fish = GlobalFunctions.CreateObject(data.MedatorName, data.IngredientData.RequiredCodeVersion, Vector3.OutOfWorld, 0x0, Vector3.UnitZ, null, initData) as Fish;
                if (fish == null)
                {
                    continue;
                }

                mount.mFish  = fish;
                fish.Mounted = true;

                Overwatch.Log(" Fixed: " + fish.Type);
            }
        }
예제 #24
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupBogusNewsArticles");

            foreach (Newspaper paper in Sims3.Gameplay.Queries.GetObjects <Newspaper> ())
            {
                try
                {
                    if ((paper.LatestNews != null) && (paper.LatestNews.mArticles != null))
                    {
                        int index = 0;
                        while (index < paper.LatestNews.mArticles.Count)
                        {
                            News.HotSpotArticle hotspot = paper.LatestNews.mArticles[index] as News.HotSpotArticle;
                            if ((hotspot != null) && (hotspot.mLot == null))
                            {
                                paper.LatestNews.mArticles.RemoveAt(index);

                                Overwatch.Log("Bogus News Article Dropped");
                            }
                            else
                            {
                                index++;
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(paper, e);
                }
            }
        }
예제 #25
0
        public override void OnWorldLoadFinished()
        {
            Overwatch.Log(GetTitlePrefix());

            try
            {
                bool fix = false;
                foreach (Lot lot in LotManager.AllLots)
                {
                    if (lot.ResortManager != null)
                    {
                        if (lot.ResortManager.mOwnerLot == null || LotManager.GetLot(lot.ResortManager.mOwnerLot.LotId) == null)
                        {
                            fix = true;
                            lot.ResortManager.mOwnerLot = lot;
                        }
                    }
                }

                if (fix)
                {
                    Overwatch.Log("Fixed resort managers");
                }
            }
            catch (Exception e)
            {
                Common.Exception(GetTitlePrefix(), e);
            }
        }
예제 #26
0
        protected override void PrivatePerformAction(bool prompt)
        {
            try
            {
                Overwatch.Log("Turn Off Televisions");

                int count = 0;

                List <TV> televisions = new List <TV>(Sims3.Gameplay.Queries.GetObjects <TV>());
                foreach (TV obj in televisions)
                {
                    if ((!NRaas.Overwatch.Settings.mAffectActiveLot) && (Household.ActiveHousehold != null))
                    {
                        if (obj.LotCurrent.Household == Household.ActiveHousehold)
                        {
                            continue;
                        }

                        bool found = false;
                        foreach (Sim sim in Households.AllSims(Household.ActiveHousehold))
                        {
                            if (sim.LotCurrent == obj.LotCurrent)
                            {
                                found = true;
                                break;
                            }
                        }

                        if (found)
                        {
                            continue;
                        }
                    }

                    if (obj.TurnedOn)
                    {
                        try
                        {
                            obj.ClearStateInformation();
                            obj.TurnOff();
                            count++;
                        }
                        catch
                        {
                            obj.SetObjectToReset();
                        }
                    }
                }

                if (count > 0)
                {
                    Overwatch.AlarmNotify(Common.Localize("TurnOffTelevisions:Success", false, new object[] { count }));
                }
            }
            catch (Exception exception)
            {
                Common.Exception(Name, exception);
            }
        }
예제 #27
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CorrectThumbnailHelper");

            ScriptCore.ThumbnailManager manager = ThumbnailManager.sInstance as ScriptCore.ThumbnailManager;

            manager.OnPrepareObject = ThumbnailHelperEx.OnPrepareObject;
        }
예제 #28
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;
        }
예제 #29
0
        protected override void PrivatePerformAction(bool prompt)
        {
            try
            {
                Overwatch.Log("Recover Missing Sims");

                string msg = null;

                List <Sim> sims = new List <Sim>(LotManager.Actors);
                foreach (Sim sim in sims)
                {
                    SimDescription simDesc = sim.SimDescription;
                    if (simDesc == null)
                    {
                        continue;
                    }

                    if ((!sim.SimDescription.IsValidDescription) || (sim.Household == null))
                    {
                        try
                        {
                            GreyedOutTooltipCallback callback = null;
                            if (RecoverMissingSimTask.Allowed(sim.SimDescription, false, ref callback))
                            {
                                simDesc.Fixup();

                                if (Instantiation.AttemptToPutInSafeLocation(sim, true))
                                {
                                    sim.Autonomy.Motives.RecreateMotives(sim);
                                    sim.SetObjectToReset();
                                }

                                msg += Common.NewLine + simDesc.FullName;
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(simDesc, e);
                        }
                    }
                }

                List <Household> houses = new List <Household>(Household.sHouseholdList);
                foreach (Household house in houses)
                {
                    msg += Perform(house, prompt);
                }

                if ((msg != null) && (msg != ""))
                {
                    Overwatch.AlarmNotify(Common.Localize("RecoverMissingSims:Success", false, new object[] { msg }));
                }
            }
            catch (Exception exception)
            {
                Common.Exception(Name, exception);
            }
        }
예제 #30
0
        protected override void PrivatePerformAction(bool prompt)
        {
            Overwatch.Log(Name);

            List <Relationship> fullList = new List <Relationship>();

            int count = 0;

            foreach (SimDescription sim in new List <SimDescription>(Relationship.sAllRelationships.Keys))
            {
                count += Corrections.CleanupRelationship(sim, Overwatch.Log);
            }

            foreach (Relationship relation in fullList)
            {
                if (Relationships.RepairRelationship(relation, Overwatch.Log))
                {
                    count++;
                }
            }

            foreach (SimDescription sim in Household.EverySimDescription())
            {
                if (sim.Partner == null)
                {
                    continue;
                }

                if (!sim.Partner.IsValidDescription)
                {
                    sim.mPartner = null;

                    Overwatch.Log("Partner Relationship Dropped: " + sim.FullName);

                    count++;
                }
                else
                {
                    Relationship relation = Relationship.Get(sim, sim.Partner, false);
                    if (relation == null)
                    {
                        relation = Relationship.Get(sim, sim.Partner, true);

                        relation.MakeAcquaintances();

                        Overwatch.Log("Partner Relationship Corrected: " + sim.FullName);

                        count++;
                    }
                }
            }

            if ((prompt) || (count > 0))
            {
                Overwatch.AlarmNotify(Common.Localize(GetTitlePrefix() + ":Success", false, new object[] { count }));
            }
        }