public static void Postfix(GameScript __instance, int a, ref int __state) { GameScript.allegianceQuest = __state + 1; DialogChain chain = DialogActions.autoDialogAfterChoice; if (chain != null) { if (DialogActions.autoDialogForce || chain.TriggerCondition == null || chain.TriggerCondition(GameScript.allegianceQuest)) { DialogChains.InitiateDialog(chain); } DialogActions.afterChoiceAction?.Invoke(a + 1); } DialogActions.autoDialogAfterChoice = null; DialogActions.afterChoiceAction = null; }
internal static void DisableQueuedGadgets() { Logger.Log("Unloading Gadgets..."); foreach (GadgetInfo gadget in QueuedGadgets) { Logger.Log("Unloading Gadget '" + gadget.Attribute.Name + "'"); gadget.Gadget.UnloadInternal(); LootTables.RemoveModEntries(gadget.Gadget.ModID); GadgetCoreAPI.RemoveModResources(gadget.Gadget.ModID); GadgetCoreAPI.UnregisterGadgetRPCs(gadget.Gadget.ModID); GadgetCoreAPI.UnregisterStatModifiers(gadget.Gadget.ModID); GadgetConsole.UnregisterGadgetCommands(gadget.Gadget.ModID); GadgetNetwork.UnregisterSyncVars(gadget.Gadget.ModID); PlanetRegistry.UnregisterGadget(gadget.Gadget.ModID); DialogChains.UnregisterGadgetChains(gadget.Gadget.ModID); foreach (Registry reg in GameRegistry.ListAllRegistries()) { reg.UnregisterGadget(gadget); } } Logger.Log("Done unloading Gadgets."); Logger.Log("Unpatching Gadgets..."); foreach (GadgetInfo gadget in QueuedGadgets.ToList()) { if (gadget.Gadget.HarmonyInstance == null) { continue; } Logger.Log("Unpatching Gadget '" + gadget.Attribute.Name + "'"); try { gadget.Gadget.HarmonyInstance.UnpatchAll(gadget.Mod.Name + "." + gadget.Attribute.Name + ".gadget"); } catch (Exception e) { Logger.LogError("Exception Unpatching Gadget '" + gadget.Attribute.Name + "':" + Environment.NewLine + e.ToString()); } } Logger.Log("Done unpatching Gadgets."); Logger.Log("Sorting Gadgets..."); Gadgets.SortGadgets(); Logger.Log("Done sorting Gadgets."); QueuedGadgets.Clear(); }
/// <summary> /// Register this to the <see cref="OnInteract"/> event to cause this tile to initiate dialog when interacted with. /// </summary> public IEnumerator InitiateDialogRoutine() { DialogChains.InitiateDialog(GetID()); yield break; }