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); } }
protected bool LookupRoutine() { if (!mChecked) { //mError += "Assembly: " + mAssemblyName + NiecException.NewLine + "ClassName: " + mClassName + NiecException.NewLine + "RoutineName: " + mRoutineName; try { mChecked = true; if (!string.IsNullOrEmpty(mAssemblyName)) { Assembly assembly = AssemblyCheckByNiec.FindAssembly(mAssemblyName); if (assembly != null) { //mError += NiecException.NewLine + " Assembly Found: " + assembly.FullName; Type type = assembly.GetType(mClassName); if (type != null) { //mError += Common.NewLine + " Class Found: " + type.ToString(); if (mParameters != null) { mMethod = type.GetMethod(mRoutineName, mParameters); } else { mMethod = type.GetMethod(mRoutineName); } //if (mMethod != null) //{ // //mError += Common.NewLine + " Routine Found"; //} } } } } catch (Exception e) { //mError += Common.NewLine + "Exception"; NiecException.WriteLog("Error " + e.ToString(), true, true); } finally { //Common.WriteLog(mError); } } return(mMethod != null); }
public static int NMineKillLogA(object[] parameters) { try { if (NiecException.WriteLog(Niec.iCommonSpace.KillPro.LogTraneEx.ToString(), true, false, false)) { NiecException.PrintMessage("WriteLog" + NiecException.NewLine + "Created MineKillLog No: " + Niec.iCommonSpace.KillPro.sLogEnumeratorTrane); } } catch { } return(0); }
public T Invoke <T>(object obj, object[] parameters) { if (!Valid) { return(default(T)); } try { return((T)mMethod.Invoke(obj, parameters)); } catch (Exception e) { NiecException.WriteLog("Error Invoke: " + e.ToString(), true, true); return(default(T)); } }
public static ObjectGuid Perform(NiecNraTask.NraFunction func) { try { if (func == null) { throw new ArgumentNullException("func"); } } catch (Exception ex) { NiecException.WriteLog(ex.ToString(), true, true, false); throw; } return(new NiecTask(func).AddToSimulator()); }
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); } }
public static void Init() { if (mInited) { return; } if (Urnstone.KillSim.Singleton is Urnstone.KillSim.Definition) // if mod other { Urnstone.KillSim.Singleton = new Definition(); } else { NiecException.WriteLog("Urnstone.KillSim.Singleton: " + Urnstone.KillSim.Singleton.GetType().AssemblyQualifiedName); Urnstone.KillSim.Singleton = new Definition(); } mInited = true; }
public static void SSetFakeObjectId(ObjectGuid value, out NiecTask currentTask) { currentTask = null; NiecTask task = Simulator.GetTask(Simulator.CurrentTask) as NiecTask; if (task != null) { currentTask = task; task.mObjectId = value; } if (Simulator.CurrentTask == value) { NiecException.WriteLog("DEBUG: SetFakeObjectId ok"); } else { NiecException.WriteLog("DEBUG: SetFakeObjectId failed"); } }
public static void WriteLogOnWorldQuit(object sender, EventArgs args) { string msge = Niec.iCommonSpace.KillPro.LogTraneEx.ToString(); if (!string.IsNullOrEmpty(msge)) { try { NiecException.WriteLog(msge, true, false, false); Niec.iCommonSpace.KillPro.sLogEnumeratorTrane = 0; Niec.iCommonSpace.KillPro.LogTraneEx = null; Niec.iCommonSpace.KillPro.LogTraneEx = new StringBuilder(); } catch { } } try { Niec.iCommonSpace.KillPro.sLogEnumeratorTrane = 0; } catch { } }
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); } }
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); }
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); }
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; } }