Ejemplo n.º 1
0
        protected static void InitializeLunarPhase()
        {
            LunarCycleManager.LunarPhase phase = (LunarCycleManager.LunarPhase)World.GetLunarPhase();

            LunarCycleManager.LunarPhase[] choices = GetCycle();

            if ((Overwatch.Settings.mCurrentPhaseIndex < 0) ||
                (Overwatch.Settings.mCurrentPhaseIndex >= choices.Length) ||
                (choices[Overwatch.Settings.mCurrentPhaseIndex] != phase))
            {
                Overwatch.Settings.mCurrentPhaseIndex = 0;

                for (int i = 0; i < choices.Length; i++)
                {
                    if (choices[i] == phase)
                    {
                        Overwatch.Settings.mCurrentPhaseIndex = i;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected static void LunarUpdate(bool change)
        {
            HudModel model = Sims3.UI.Responder.Instance.HudModel as HudModel;

            LunarCycleManager.LunarPhase[] choices = null;

            uint result;

            OptionsModel.GetOptionSetting("EnableLunarPhase", out result);
            if (result == 0x0)
            {
                choices = GetCycle();

                if (change)
                {
                    Overwatch.Settings.mCurrentPhaseIndex++;
                }

                if (Overwatch.Settings.mCurrentPhaseIndex >= choices.Length)
                {
                    Overwatch.Settings.mCurrentPhaseIndex = 0;
                }

                World.ForceLunarPhase((int)choices[Overwatch.Settings.mCurrentPhaseIndex]);
            }

            LunarCycleManager.LunarPhase phase = (LunarCycleManager.LunarPhase)World.GetLunarPhase();
            if (phase != LunarCycleManager.LunarPhase.kFullMoon)
            {
                if ((LunarCycleManager.sFullMoonZombies == null) || (LunarCycleManager.sFullMoonZombies.Count == 0))
                {
                    foreach (Sim sim in LotManager.Actors)
                    {
                        if (sim.LotHome != null)
                        {
                            continue;
                        }

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

                        sim.BuffManager.RemoveElement(BuffNames.Zombie);
                    }
                }

                OnDewolf(false);
            }
            else
            {
                new Common.AlarmTask(Common.AlarmTask.TimeTo(World.GetSunriseTime()), TimeUnit.Hours, OnDewolf);
            }

            EventTracker.SendEvent(new MoonRiseEvent((uint)World.GetLunarPhase()));
            if (model.LunarUpdate != null)
            {
                model.LunarUpdate((uint)World.GetLunarPhase());
            }

            if (Overwatch.Settings.mDisableFullMoonLighting)
            {
                if (LunarCycleManager.mLunarEffectsAlarm != AlarmHandle.kInvalidHandle)
                {
                    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
                { }
            }

            if (choices != null)
            {
                SimDisplay display = SimDisplay.Instance;
                if (display != null)
                {
                    int numDaysUntilFullMoon = 0;

                    int index = Overwatch.Settings.mCurrentPhaseIndex;
                    while ((choices[index] != LunarCycleManager.LunarPhase.kFullMoon) && (numDaysUntilFullMoon < choices.Length))
                    {
                        numDaysUntilFullMoon++;
                        index++;
                        if (index >= choices.Length)
                        {
                            index = 0;
                        }
                    }

                    if (display.mLunarCycleIcon != null)
                    {
                        string entryKey = "UI/LunarCycle:MoonString" + ((uint)World.GetLunarPhase() + 0x1);
                        display.mLunarCycleIcon.TooltipText = Common.LocalizeEAString(entryKey);

                        if (numDaysUntilFullMoon > 0x0)
                        {
                            display.mLunarCycleIcon.TooltipText = display.mLunarCycleIcon.TooltipText + "\n";
                            display.mLunarCycleIcon.TooltipText = display.mLunarCycleIcon.TooltipText + Common.LocalizeEAString(false, "UI/LunarCycle:NextFullMoon", new object[] { numDaysUntilFullMoon });
                        }
                    }
                }
            }
        }