Example #1
0
        private static void OnStartupApp(object sender, EventArgs e)
        {
            string station            = "";
            bool   isWorkoutStation   = false;
            bool   isSlowDanceStation = false;

            if (Simulator.LoadXML(typeof(Bootstrap).Assembly.GetName().Name) is XmlDocument xmlDocument)
            {
                if (xmlDocument.GetElementsByTagName("Broadcaster")[0] is XmlElement xmlElement)
                {
                    if (xmlElement.GetElementsByTagName("Station")[0] is XmlElement stationElement)
                    {
                        station = stationElement.GetAttribute("value");
                    }
                    if (xmlElement.GetElementsByTagName("IsWorkoutStation")[0] is XmlElement workoutElement)
                    {
                        isWorkoutStation = workoutElement.GetAttribute("value") == "1" ? true : false;
                    }
                    if (xmlElement.GetElementsByTagName("IsSlowDanceStation")[0] is XmlElement danceElement)
                    {
                        isSlowDanceStation = danceElement.GetAttribute("value") == "1" ? true : false;
                    }
                }
            }
            AddStationIfNeeded(station, isWorkoutStation, isSlowDanceStation);
            Simulator.AddObject(new Common.RepeatingFunctionTask(new Common.GenericDelegate <bool>(InjectOptions)));
        }
Example #2
0
        public static void SplitHousehold(EditTownController ths, UIBinInfo from)
        {
            try
            {
                if (ths == null)
                {
                    return;
                }

                Household household = Household.Find(from.HouseholdId);
                if (household != null)
                {
                    IMovingModel model = new GameEntryMovingModelEx(household);
                    if (model != null)
                    {
                        EditTownSplitDialog.Show(model);
                        Simulator.AddObject(new OneShotFunctionWithParams(ths.SplitHouseholdsTask, from));
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("SplitHousehold", e);
            }
        }
Example #3
0
        public override bool OnLotPick(ulong id)
        {
            try
            {
                if (mPlacing)
                {
                    return(false);
                }

                UIBinInfo lotInfo = FindBinInfoForLot(id, MaptagTypes.None);
                if (lotInfo == null)
                {
                    return(false);
                }

                if (mModel.IsLotLocked(lotInfo.LotId) && !World.IsEditInGameFromWBMode())
                {
                    Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(delegate
                    {
                        SimpleMessageDialog.Show(null, Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString("Ui/Tooltip/Maptag:Locked", new object[0x0]), ModalDialog.PauseMode.PauseTask);
                    }));
                    return(false);
                }

                OnSelection(lotInfo);
                return(true);
            }
            catch (Exception e)
            {
                Common.Exception("OnLotPick", e);
                return(false);
            }
        }
Example #4
0
            private static void OnAcceptHousehold(WindowBase sender, UIButtonClickEventArgs eventArgs)
            {
                try
                {
                    CASPuck ths = CASPuck.Instance;

                    Sims3.UI.Function f = null;
                    if (!ths.mUiBusy && !ths.mAttemptingToAddSim)
                    {
                        ths.mUiBusy = true;
                        if (f == null)
                        {
                            f = delegate
                            {
                                CASController.Singleton.SetCurrentState(CASState.Summary);
                                if (ths.ShowRequiredItemsDialogTask())
                                {
                                    ths.AcceptHouseholdCallback();
                                }
                                else
                                {
                                    ths.mUiBusy = false;
                                }
                            };
                        }
                        Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(f));
                    }
                    eventArgs.Handled = true;
                }
                catch (Exception e)
                {
                    Common.Exception("OnAcceptHousehold", e);
                }
            }
Example #5
0
        public static void RestartTimers()
        {
            if (World.IsEditInGameFromWBMode())
            {
                return;
            }

            foreach (AlarmTask task in sTasks)
            {
                task.Dispose();
            }

            sTasks.Clear();

            if (sTimer != null)
            {
                sTimer.Stop();
                sTimer = null;
            }

            switch (Saver.Settings.SaveStyle)
            {
            case SaverSpace.Options.SaveStyle.RealTime:
                if (Saver.Settings.mRealMinutesBetweenSaves > 0)
                {
                    sTimer = new AutoSave(Saver.Settings.mRealMinutesBetweenSaves);

                    Simulator.AddObject(sTimer);
                }
                break;

            case SaverSpace.Options.SaveStyle.SimTime:
                if (Saver.Settings.mSimMinutesBetweenSaves > 0)
                {
                    sTasks.Add(new AlarmTask(Saver.Settings.mSimMinutesBetweenSaves, TimeUnit.Minutes, OnSimTimer, Saver.Settings.mSimMinutesBetweenSaves, TimeUnit.Minutes));
                }
                break;

            case SaverSpace.Options.SaveStyle.SimHour:
                foreach (float hour in Saver.Settings.mSimSaveHour)
                {
                    sTasks.Add(new AlarmTask(hour, DaysOfTheWeek.All, OnSimTimer));
                }
                break;
            }

            if ((sTimer == null) && (sTasks.Count == 0))
            {
                SimpleMessageDialog.Show(Common.Localize("Root:MenuName"), Common.Localize("Unset:Prompt"));

                Saver.Settings.SaveStyle = SaverSpace.Options.SaveStyle.RealTime;
                Saver.Settings.mRealMinutesBetweenSaves = 30;

                RestartTimers();
            }
        }
Example #6
0
        public static ListenerAction OnClean(Event e)
        {
            Sim actor = e.Actor as Sim;

            if (actor != null)
            {
                Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTThirst.RemoveMakeup), actor));
            }
            return(ListenerAction.Keep);
        }
Example #7
0
        public static ListenerAction OnGotBuff(Event e)
        {
            Sim actor = e.Actor as Sim;

            if (actor != null)
            {
                Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(EnableSparkle.ProcessBuff), actor));
            }
            return(ListenerAction.Keep);
        }
Example #8
0
        protected void RouteTruckToLot()
        {
            if (mTruck.mRouteToLot != null)
            {
                mTruck.mRouteToLot.Destroy();
            }

            mTruck.mRouteToLot = new OneShotFunction(new Sims3.Gameplay.Function(OneShotRouteToLot));
            Simulator.AddObject(mTruck.mRouteToLot);
        }
Example #9
0
        public static ListenerAction OnClean(Event e)
        {
            Sim target = e.Actor as Sim;

            if (target != null)
            {
                Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTBiteMark.RemoveMakeup), target));
            }
            return(ListenerAction.Keep);
        }
Example #10
0
 private new void OnSelection(UIBinInfo info)
 {
     if (((mFrom != null) && (mFrom != info)) && (info.HouseholdId != ulong.MaxValue))
     {
         mModel.CenterCamera(info.LotId);
         GameEntryMovingModelEx.MergeHouseholds(EditTownController.Instance, mFrom, info);
     }
     else
     {
         Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(WarnCantMergeHouseholds), info));
     }
 }
Example #11
0
            protected override bool OnPerform()
            {
                if (SelectObjectTask.sSelectObjectTask == null)
                {
                    return(true);
                }

                SelectObjectTask.Shutdown();

                SelectObjectTask.sSelectObjectTask = new SelectTask();
                Simulator.AddObject(SelectObjectTask.sSelectObjectTask);
                return(false);
            }
Example #12
0
            protected override bool OnPerform()
            {
                if (PickObjectTask.sPickObjectTask == null)
                {
                    return(true);
                }

                PickObjectTask.Shutdown();

                PickObjectTask.sPickObjectTask = new PickTask();
                Simulator.AddObject(PickObjectTask.sPickObjectTask);
                return(false);
            }
Example #13
0
        private static ListenerAction OnGotBuff(Event e)
        {
            Sim sim = e.Actor as Sim;

            if (sim != null)
            {
                if (sim.IsHuman)
                {
                    Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(ProcessBuff), sim));
                }
            }
            return(ListenerAction.Keep);
        }
Example #14
0
        public static void OnAcceptSim(WindowBase sender, UIButtonClickEventArgs eventArgs)
        {
            try
            {
                CASPuck ths = CASPuck.Instance;

                if (!ths.UiBusy)
                {
                    ths.UiBusy = true;
                    CASExitLoadScreen.DisableQuit = true;

                    // Custom
                    if (CASLogic.Instance.OutfitCategory == OutfitCategories.Career)
                    {
                        CASLogic.Instance.OutfitCategory = OutfitCategories.Everyday;

                        SpeedTrap.Sleep();
                    }

                    if (Responder.Instance.CASModel.CASMode == CASMode.CreateABot)
                    {
                        Function f = delegate
                        {
                            CASController.Singleton.SetCurrentState(CASState.BotSummary);
                            if (ths.ShowCABRequiredItemsDialogTask())
                            {
                                // Custom
                                AcceptSimCallback(ths);
                            }
                            else
                            {
                                ths.UiBusy = false;
                            }
                        };

                        Simulator.AddObject(new OneShotFunctionTask(f));
                    }
                    else
                    {
                        // Custom
                        AcceptSimCallback(ths);
                    }
                }
                eventArgs.Handled = true;
            }
            catch (Exception exception)
            {
                Common.Exception("OnAcceptHousehold", exception);
            }
        }
Example #15
0
        public static void OnCloseClick(WindowBase sender, UIButtonClickEventArgs eventArgs)
        {
            try
            {
                CASPuck ths = CASPuck.gSingleton;
                if (ths == null)
                {
                    return;
                }

                //Common.DebugNotify(delegate { return "UiBusy: " + ths.mUiBusy + Common.NewLine + "LeaveCAS: " + ths.mLeaveCAS; });

                //if (!ths.UiBusy && !ths.mLeaveCAS)
                {
                    ths.UiBusy = true;
                    Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(delegate
                    {
                        string entryKey = (Responder.Instance.CASModel.CASMode == CASMode.Full) ? "Ui/Caption/CAS/ExitDialog:Prompt" : "Ui/Caption/CAS/ExitDialog:AlternatePrompt";
                        if (TwoButtonDialog.Show(Common.LocalizeEAString(entryKey), Common.LocalizeEAString("Ui/Caption/Global:Yes"), Common.LocalizeEAString("Ui/Caption/Global:No")))
                        {
                            CASController singleton = CASController.Singleton;
                            singleton.AllowCameraMovement(false);

                            ICASModel cASModel = Responder.Instance.CASModel;
                            while (cASModel.IsProcessing())
                            {
                                SpeedTrap.Sleep();
                            }

                            Sims.CASBase.sWasCanceled = true;

                            sender.Enabled = false;
                            cASModel.RequestClearChangeReport();
                            singleton.SetCurrentState(CASState.None);
                        }
                        else
                        {
                            ths.UiBusy = false;
                        }
                    }));
                    eventArgs.Handled = true;
                }
            }
            catch (Exception e)
            {
                Common.Exception("OnCloseClick", e);
            }
        }
Example #16
0
 private static void OnNavButtonClicked(WindowBase sender, UIButtonClickEventArgs args)
 {
     try
     {
         CASTattoo ths = CASTattoo.gSingleton;
         if (!ths.AdvancedMode)
         {
             Simulator.AddObject(new OneShotFunctionTask(OnNavButtonClickedHelper));
         }
         args.Handled = true;
     }
     catch (Exception e)
     {
         Common.Exception("OnNavButtonClicked", e);
     }
 }
Example #17
0
        public ObjectGuid AddToSimulatorSID()
        {
            if (IsOpenDGSInstalled)
            {
                return(Simulator.AddObject(this));
            }
            else
            {
                //NonRandom = true;

                var objectid = new ObjectGuid(NonOpenDGSIDSID);
                NonOpenDGSIDSID += 0x10;
                //CurrentTaskID = objectid;
                return(Simulator.AddObjectWithId(this, objectid));
            }
        }
Example #18
0
File: CAF.cs Project: yakoder/NRaas
        public void OnWorldLoadFinished()
        {
            try
            {
                if (sTask == null)
                {
                    sTask = new PanelTask();

                    Simulator.AddObject(sTask);
                }
            }
            catch (Exception exception)
            {
                Common.Exception("OnWorldLoadFinished", exception);
            }
        }
Example #19
0
        protected static void OnTimer()
        {
            try
            {
                if (sTimer != null)
                {
                    sTimer.Destroy();
                    sTimer = null;
                }

                sTimer = new Adjuster();
                Simulator.AddObject(sTimer);
            }
            catch (Exception exception)
            {
                Common.Exception("OnTimer", exception);
            }
        }
Example #20
0
        public static void HideCurrentTooltip()
        {
            if (sLastObjectId == sTipObject && sLastObjectId != 0)
            {
                RestartAlarm();
            }

            if (sCurrentTip != null)
            {
                sCurrentTip.TooltipWindow.Visible = false;
                // because...EA
                sCurrentTip.TooltipWindow.ShadeColor = new Color(sCurrentTip.TooltipWindow.ShadeColor.ARGB & 0xffffff);
                Simulator.AddObject(new TooltipManager.DisposeTooltipTask(sCurrentTip));
                KillAlarm();
                sCurrentTip = null;
                sTipObject  = 0L;
            }
        }
Example #21
0
 public static int cleanVampFaces(object obj)
 {
     try
     {
         foreach (KeyValuePair <Sim, bool> pair in thirstySims)
         {
             if (thirstySims[pair.Key])
             {
                 Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTThirst.runClean), pair.Key));
             }
         }
     }
     catch (Exception exception)
     {
         SimpleMessageDialog.Show("Vampire Tweaker - Uninstalling Wizard", "An error is ocurred when uninstalling. Check notification bar");
         StyledNotification.Show(new StyledNotification.Format("Failed the removal of the sim dictionary (thirstySims) \n" + exception, StyledNotification.NotificationStyle.kDebugAlert));
     }
     return(1);
 }
Example #22
0
        public static ListenerAction OnGotBuff(Event e)
        {
            Sim actor = e.Actor as Sim;

            if (actor != null)
            {
                if (actor.SimDescription.IsHuman || (actor.SimDescription.IsSupernaturalForm))
                {
                    if ((lastTriggered == null) || (lastTriggered != actor))
                    {
                        Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTBiteMark.ProcessBuff), actor));
                    }
                }
                else if (bitedSims.ContainsKey(actor))
                {
                    Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTBiteMark.RemoveMakeup), actor));
                }
            }
            return(ListenerAction.Keep);
        }
Example #23
0
        public static ListenerAction OnGotBuff(Event e)
        {
            Sim actor = e.Actor as Sim;

            if (actor != null)
            {
                if (actor.SimDescription.IsVampire)
                {
                    if ((lastTriggered == null) || (lastTriggered != actor))
                    {
                        Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTThirst.ProcessBuff), actor));
                    }
                }
                else if (thirstySims.ContainsKey(actor))
                {
                    Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTThirst.RemoveMakeup), actor));
                }
            }
            return(ListenerAction.Keep);
        }
        private static ListenerAction OnGotBuff(Event e)
        {
            Sim actor = e.Actor as Sim;

            if (actor != null)
            {
                if (actor.SimDescription.IsWerewolf)
                {
                    if ((lastTriggered == null) || (lastTriggered != actor))
                    {
                        Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(WolfFeet.ProcessBuff), actor));
                    }
                }
                else if (transformedSims.ContainsKey(actor))
                {
                    Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(WolfFeet.RemoveMakeup), actor));
                    transformedSims.Remove(actor);
                }
            }
            return(ListenerAction.Keep);
        }
Example #25
0
        public void OnWorldLoadFinished()
        {
            Common.kDisableLotMenu = false;

            Simulator.AddObject(new RegisterCommandsTask());

            new Common.DelayedEventListener(EventTypeId.kInventoryObjectAdded, OnNewObject);
            new Common.DelayedEventListener(EventTypeId.kObjectStateChanged, OnNewObject);

            // Corrects for an error in SetGraduatedBoardingSchool.Definition AddInteractions when running in CAW
            if (BoardingSchool.BoardingSchoolData.sBoardingSchoolDataList == null)
            {
                BoardingSchool.BoardingSchoolData.sBoardingSchoolDataList = new PairedListDictionary <BoardingSchool.BoardingSchoolTypes, BoardingSchool.BoardingSchoolData>();

                StubXMLRow stubRow = new StubXMLRow();
                foreach (BoardingSchool.BoardingSchoolTypes types in Enum.GetValues(typeof(BoardingSchool.BoardingSchoolTypes)))
                {
                    BoardingSchool.BoardingSchoolData.sBoardingSchoolDataList.Add(types, new BoardingSchool.BoardingSchoolData(stubRow));
                }
            }
        }
Example #26
0
        public static void OnCreateSimClick(WindowBase sender, UIButtonClickEventArgs eventArgs)
        {
            try
            {
                CASPuck ths = CASPuck.gSingleton;

                Sims3.UI.Function f = null;
                if (ths.mAttemptingToAdd)
                {
                    if (f == null)
                    {
                        f = delegate
                        {
                            while (ths.mAttemptingToAdd)
                            {
                                SpeedTrap.Sleep();
                            }

                            // Custom
                            CallCreateSimCallback((CASPuck.ControlIDs)sender.ID);
                        };
                    }
                    Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(f));
                }
                else
                {
                    // Custom
                    CallCreateSimCallback((CASPuck.ControlIDs)sender.ID);
                }

                ths.HideEditPopupMenu();
                ths.HideAddPopupMenu();
                eventArgs.Handled = true;
            }
            catch (Exception e)
            {
                Common.Exception("OnCreateSimClick", e);
            }
        }
Example #27
0
 private static int OnThrowException(object[] paramenters)
 {
     Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(new Sims3.UI.Function(ThrowExceptionFunction)));
     return(0);
 }
        public static void OnMaterialsSkewerGridMouseDown(WindowBase sender, UIMouseEventArgs eventArgs)
        {
            Common.StringBuilder msg = new Common.StringBuilder("OnMaterialsSkewerGridMouseDown");

            try
            {
                CASCompositorController ths = CASCompositorController.sController;
                if (ths == null)
                {
                    return;
                }

                if ((ths.mCurrentDesignObject == null) || (ths.mMaterialSkewerSelectedPattern == -1))
                {
                    msg += "A";

                    if (sender.Enabled)
                    {
                        eventArgs.Handled = true;
                    }
                }
                else if (ths.mCurrentDesignObject.Processing)
                {
                    msg += "B";

                    ths.mMaterialToSelect = ((int)sender.ID) - 0x1300a;
                    Audio.StartSound("ui_tertiary_button");
                    if (sender.Enabled)
                    {
                        eventArgs.Handled = true;
                    }
                }
                else if ((sender as Button).Enabled)
                {
                    msg += "C";

                    ths.mClickedWin    = sender;
                    ths.mMouseClickPos = sender.WindowToScreen(eventArgs.MousePosition);

                    // Must be after mClickedWin is set above
                    int selection = ((int)ths.mClickedWin.ID) - 0x1300a;

                    bool selected = (selection == ths.MaterialSkewerSelectedPattern);

                    ths.MaterialSelect(selection, true);

                    if (eventArgs.MouseKey == MouseKeys.kMouseLeft)
                    {
                        msg += "D";

                        ths.mPickupScript = Simulator.AddObject(new Sims3.Gameplay.OneShotFunctionTask(ths.StartMaterialDrag, StopWatch.TickStyles.Seconds, CASCompositorController.kPickupDelay));
                        UIManager.SetCaptureTarget(InputContext.kICMouse, sender);

                        if ((eventArgs.Modifiers & (Modifiers.kModifierMaskShift | Modifiers.kModifierMaskControl)) != Modifiers.kModifierMaskNone)
                        {
                            Common.FunctionTask.Perform(OnProcessRandomizeColor);
                        }
                    }
                    else if (eventArgs.MouseKey == MouseKeys.kMouseRight)
                    {
                        msg += "E";

                        if ((selected) && ((eventArgs.Modifiers & (Modifiers.kModifierMaskShift | Modifiers.kModifierMaskControl)) != Modifiers.kModifierMaskNone))
                        {
                            Common.FunctionTask.Perform(OnProcessRandomizeCategory);
                        }
                        else
                        {
                            Common.FunctionTask.Perform(OnProcessRandomizeMaterial);
                        }
                    }

                    msg += "E";

                    eventArgs.Handled = true;
                }
            }
            catch (Exception e)
            {
                Common.Exception(msg, e);
            }
        }
Example #29
0
 public static void ChangeLotType(UIBinInfo info)
 {
     Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(ChangeLotTypeTask), info));
 }
Example #30
0
 public virtual ObjectGuid AddToSimulator()
 {
     return(Simulator.AddObject(this));
 }