コード例 #1
0
        public override void Simulate()
        {
            try
            {
                OnStart();
                if (IfMineKill)
                {
                    NiecMod.KillNiec.KillSimNiecX.MineKill(mtarget, mdeathType, mobj, mplayDeathAnim, msleepyes);
                }
            }
            catch (ResetException)
            {
                StyledNotification.Show(new StyledNotification.Format("Simulate" + "Failed", StyledNotification.NotificationStyle.kGameMessagePositive));
                //throw;
            }
            catch (Exception exception)
            {
                NiecException.WriteLog(mtarget.Name + " " + NiecException.LogException(exception), true, false, false);
            }
#pragma warning disable 1058
            catch {
                NiecException.PrintMessagePro("Failed to Mono Runtime!\n" + ToString(), false, 10);
            }
#pragma warning restore 1058
            finally
            {
                OnCleanUp();
                Simulator.DestroyObject(ObjectId);
            }
        }
コード例 #2
0
 public override void Simulate()
 {
     try
     {
         OnStart();
         if (IfMineKill)
         {
             NiecMod.KillNiec.KillSimNiecX.MineKill(mtarget, mdeathType, mobj, mplayDeathAnim, msleepyes);
         }
     }
     catch (ResetException)
     {
         throw;
     }
     catch (Exception exception)
     {
         NiecException.WriteLog(mtarget.Name + " " + NiecException.LogException(exception), true, false, false);
     }
     finally
     {
         OnCleanUp();
         Simulator.DestroyObject(ObjectId);
     }
 }
コード例 #3
0
ファイル: Instantiator.cs プロジェクト: niec-and-linc/OpenDGS
        public static int NnFailedcallbooksleep(object[] parameters)
        {
            try
            {
                var list = new List <Sim>();
                foreach (Sim sim in LotManager.Actors)
                {
                    if (sim.InteractionQueue != null && CheckKillSim(sim))
                    {
                        list.Add(sim);
                    }
                }

                /*
                 * if (list.Count == 0)
                 * {
                 *  return list.Count;
                 * }
                 */
                if (list.Count != 0)
                {
                    foreach (Sim nlist in list)
                    {
                        try
                        {
                            HelperNraPro helperNra = new HelperNraPro();

                            //helperNra = HelperNra;

                            helperNra.mSim = nlist;

                            helperNra.mdeathtype = nlist.SimDescription.DeathStyle;

                            if (nlist.Household != null)
                            {
                                helperNra.mHousehold = nlist.Household;
                            }

                            helperNra.mSimdesc = nlist.SimDescription;

                            if (!nlist.LotCurrent.IsWorldLot)
                            {
                                helperNra.mHouseVeri3 = nlist.Position;
                            }

                            else if (Sim.ActiveActor != null && !Sim.ActiveActor.LotCurrent.IsWorldLot)
                            {
                                helperNra.mHouseVeri3 = Sim.ActiveActor.Position;
                            }


                            //helperNra.mdeathtype = simDeathType;

                            /*helperNra.malarmx =  */
                            AlarmManager.Global.AddAlarm(3f, TimeUnit.Hours, new AlarmTimerCallback(helperNra.FailedCallBookSleep), "FailedCallBookSleep " + nlist.Name, AlarmType.AlwaysPersisted, null);
                        }
                        catch (Exception exception)
                        { NiecException.WriteLog("helperNra " + NiecException.NewLine + NiecException.LogException(exception), true, true, false); }
                    }
                }
                //return;
            }
            catch
            { }
            return(1);
        }
コード例 #4
0
        public override bool Run()
        {
            try
            {
                Target.AddExitReason(ExitReason.SuspensionRequested);
                NFinalizeDeath.ForceCancelAllInteractionsPro(Target);



                /*
                 * if (Target.InteractionQueue.HasInteractionOfType(Sims3.Gameplay.Objects.Environment.BonehildaCoffin.AwakenBonehilda.Singleton)) // Fixed Error Cancel All GrimReaperSituation.ReapSoul.Singleton
                 * {
                 *  SimpleMessageDialog.Show("NiecMod", "Cancel BonehildaCoffin.AwakenBonehilda.Singleton");
                 *  Target.SetObjectToReset();
                 *  NiecMod.Nra.SpeedTrap.Sleep();
                 *  return true;
                 * }
                 * if (Target.InteractionQueue.HasInteractionOfType(GrimReaperSituation.ReapSoul.Singleton)) // Fixed Error Cancel All GrimReaperSituation.ReapSoul.Singleton
                 * {
                 *  if (!AcceptCancelDialog.Show("Cancel Quit ReapSoul? Accept Reset ReapSoul")) return false;
                 *  //SimpleMessageDialog.Show("NiecS3Mod", " Sorry, Can't Cancel GrimReaperSituation.ReapSoul");
                 *  Target.SetObjectToReset();
                 *  NiecMod.Nra.SpeedTrap.Sleep();
                 *  return true;
                 * }
                 * if (!Target.HasBeenDestroyed && Simulator.CheckYieldingContext(false))
                 * {
                 *  NiecMod.Nra.SpeedTrap.Sleep();
                 *  if (AcceptCancelDialog.Show("Force Cancel All Interactions Without Cleanup?"))
                 *  {
                 *      NFinalizeDeath.ForceCancelAllInteractionsWithoutCleanup(Target);
                 *      Target.InteractionQueue.OnReset();
                 *      return true;
                 *  }
                 *  else if (!AcceptCancelDialog.Show("Cancel All Interactions?"))
                 *  {
                 *      this.FixExit = false;
                 *      return true;
                 *  }
                 *
                 *  try
                 *  {
                 *      foreach (InteractionInstance interactionInstance in Target.InteractionQueue.InteractionList) // Cant Cancel Fix
                 *      {
                 *          interactionInstance.MustRun = false;
                 *          interactionInstance.Hidden = false;
                 *      }
                 *  }
                 *  catch
                 *  { }
                 *  NFinalizeDeath.CancelAllInteractions(Target);
                 * }
                 *
                 * return true;
                 *
                 *
                 * /*
                 * //Custom CancelAllInteractions
                 * checked
                 * {
                 *  for (int i = Target.InteractionQueue.mInteractionList.Count - 1; i >= 0; i--)
                 *  {
                 *      if (!(Target.InteractionQueue.mInteractionList[i] is ExtKillSimNiec))
                 *      {
                 *          try
                 *          {
                 *              Target.InteractionQueue.CancelNthInteraction(i, true, ExitReason.SuspensionRequested);
                 *          }
                 *          catch
                 *          { }
                 *
                 *      }
                 *  }
                 * }
                 */



                /*
                 * for (int i = Target.InteractionQueue.mInteractionList.Count - 1; i >= 0; i--)
                 * {
                 *  try
                 *  {
                 *      InteractionInstance interactionInstance = Target.InteractionQueue.mInteractionList[i];
                 *      if (!(interactionInstance is ExtKillSimNiec))
                 *      {
                 *          Target.InteractionQueue.CancelNthInteraction(i);
                 *      }
                 *  }
                 *  catch (Exception)
                 *  {
                 *
                 *      throw;
                 *  }
                 *
                 * }
                 */
                /*
                 * try
                 * {
                 *  Target.InteractionQueue.OnReset();
                 * }
                 * catch
                 * { }
                 */


                /*
                 * // Test 1
                 * {
                 *  //try
                 *  //Target.InteractionQueue.OnReset();
                 *
                 * }
                 *
                 * {
                 *  Target.InteractionQueue.CancelAllInteractions(); // Cancel All Interactions Byasss Anti-Cancel
                 * }
                 *
                 * // Test 2
                 *
                 *
                 *
                 *
                 * // Test 3
                 * {
                 *  Target.InteractionQueue.OnReset(); // Sim Interactions is Reset
                 *  Target.InteractionQueue.CancelAllInteractions();
                 * }
                 * // Test 4
                 * {
                 *  Target.InteractionQueue.CancelAllInteractions(); // Cancel All Interactions Byasss Anti-Cancel
                 *  Target.InteractionQueue.OnReset();
                 * }
                 * foreach (InteractionInstance interactionInstance in Target.InteractionQueue.InteractionList) // Cant Cancel Fix
                 * {
                 *  interactionInstance.MustRun = false;
                 *  interactionInstance.Hidden = false;
                 * }
                 * {
                 *  Target.InteractionQueue.CancelAllInteractions();
                 * }
                 *
                 * {
                 *  Target.InteractionQueue.OnReset();
                 * }
                 *
                 * {
                 *  Target.InteractionQueue.CancelAllInteractions();
                 * }
                 *
                 * {
                 *  Target.InteractionQueue.CancelAllInteractions();
                 * }
                 * //
                 * {
                 *
                 *  if (Target.IsInActiveHousehold)
                 *  {
                 *      //Target.BuffManager.AddElement(BuffNames.HeartBroken, 60000, 6000000, Origin.FromGrimReaper);
                 *      return false;
                 *  }
                 *
                 *
                 *  Target.InteractionQueue.Add(Singleton.CreateInstance(Target, Target, new InteractionPriority((InteractionPriorityLevel)999), false, true));
                 *  Target.InteractionQueue.AddNext(Singleton.CreateInstance(Target, Target, new InteractionPriority((InteractionPriorityLevel)999), false, true));
                 *  Target.InteractionQueue.OnReset();
                 * }
                 * //Actor.LoopIdle();
                 * return true;
                 */
            }
            catch (ResetException)
            {
                foreach (InteractionInstance interactionInstance in Target.InteractionQueue.InteractionList) // Cant Cancel Fix
                {
                    interactionInstance.SetPriority(new InteractionPriority((InteractionPriorityLevel)0, -1f));
                    interactionInstance.MustRun = false;
                    interactionInstance.Hidden  = false;
                }
                Target.InteractionQueue.Add(Singleton.CreateInstance(Target, Target, new InteractionPriority((InteractionPriorityLevel)999, 999f), false, true));
                Target.InteractionQueue.Add(Singleton.CreateInstance(Target, Target, new InteractionPriority((InteractionPriorityLevel)999, 999f), false, true));
                Target.InteractionQueue.Add(Singleton.CreateInstance(Target, Target, new InteractionPriority((InteractionPriorityLevel)999, 999f), false, true));
                Target.InteractionQueue.Add(Singleton.CreateInstance(Target, Target, new InteractionPriority((InteractionPriorityLevel)999, 999f), false, true));
                Target.InteractionQueue.Add(Singleton.CreateInstance(Target, Target, new InteractionPriority((InteractionPriorityLevel)999, 999f), false, true));
                Target.InteractionQueue.Add(Singleton.CreateInstance(Target, Target, new InteractionPriority((InteractionPriorityLevel)999, 999f), false, true));
                Target.InteractionQueue.Add(Singleton.CreateInstance(Target, Target, new InteractionPriority((InteractionPriorityLevel)999, 999f), false, true));
                Target.InteractionQueue.CancelAllInteractions();
                //throw;
            }
            catch (Exception ex)
            {
                NiecException.WriteLog("CancelAllInteractions: " + NiecException.NewLine + NiecException.LogException(ex), true, false, true);
            }

            /*
             * if (Target.InteractionQueue.HasInteractionOfType(Sims3.Gameplay.Objects.Environment.BonehildaCoffin.AwakenBonehilda.Singleton)) // Fixed Error Cancel All GrimReaperSituation.ReapSoul.Singleton
             * {
             *  SimpleMessageDialog.Show("NiecS3Mod", " Sorry, Can't Cancel GrimReaperSituation.ReapSoul");
             *  Target.SetObjectToReset();
             *  return false;
             * }
             */
            return(true);
        }
コード例 #5
0
 public override void Simulate()
 {
     try
     {
         mFunction();
     }
     catch (Exception exception)
     {
         if (exception.StackTrace != null)
         {
             NiecException.WriteLog(ToString() + System.Environment.NewLine + System.Environment.NewLine + NiecException.LogException(exception), true, true, false);
         }
     }
     finally
     {
         Simulator.DestroyObject(ObjectId);
     }
 }
コード例 #6
0
        public override void Simulate()
        {
            //mTaskC = Simulator.CurrentTask;
            //if (NonRandom) {
            //    base.ObjectId = CurrentTaskID;
            //}
            if (errorRuntimeFound)
            {
                if (!needNoErrorRuntime)
                {
                    if (ErrorRuntimeFound != null)
                    {
                        ErrorRuntimeFound.Append("\nDate: " + DateTime.Now.ToString() + "\nFailed to Mono Runtime!\n" + ToString());
                    }
                    ScriptCore.Simulator.Simulator_DestroyObjectImpl(ObjectId.Value);
                    return;
                }
                else
                {
                    errorRuntimeFound = false; needNoErrorRuntimeNoFound = false; goto r;
                }
            }
            needNoErrorRuntimeNoFound = true;
r:
            try
            {
                errorRuntimeFound = true;

                if (mFunction == null || mFunction.method_info == null || (!mFunction.Method.IsStatic && mFunction.Target == null))
                {
                    throw new NotSupportedException("NiecTask: mFunction GC BUG!");
                }
                else
                {
                    mFunction();
                }
            }
            catch (Exception exception)
            {
                if (exception.StackTrace != null)
                {
                    NiecException.WriteLog(ToString() + System.Environment.NewLine + System.Environment.NewLine + NiecException.LogException(exception), true, true, false);
                }
                if (WaitPerform_WaitingCurrentTask != NiecMod.Helpers.NiecRunCommand.NiecInvalidObjectGuid)
                {
                    exThrow = exception;
                }
            }
#pragma warning disable 1058
            catch {
                NiecException.PrintMessagePro("Failed to Mono Runtime!\n" + ToString(), false, 10);
            }
#pragma warning restore 1058
            //finally
            //{
            //    //ResetFakeObjectId();
            //    Simulator.DestroyObject(ObjectId);
            //}
            finally
            {
                if (WaitPerform_WaitingCurrentTask != NiecMod.Helpers.NiecRunCommand.NiecInvalidObjectGuid)
                {
                    Simulator.Wake(WaitPerform_WaitingCurrentTask);
                }
                ScriptCore.Simulator.Simulator_DestroyObjectImpl(ObjectId.Value);
                //NonOpenDGSID -= 10;
            }
        }