Added: Ability to exit instances instantly by /out or keybind
Flightkick [01-04-21 - 23:46]
Added: Ability to exit instances instantly by /out or keybind
diff --git a/Outkasted.lua b/Outkasted.lua
index c8b52b6..684ed22 100644
--- a/Outkasted.lua
+++ b/Outkasted.lua
@@ -12,13 +12,37 @@ function Outkasted.TeleportToGuildHall()
end
end
+function Outkasted.LeaveInstance(confirm)
+ local LEAVE_DIALOG = "INSTANCE_LEAVE_DIALOG"
+
+ if not IsUnitInDungeon("reticleover") then
+ d("ZOS reports you're currently not inside a dungeon or trial but since this API seems unstable let me try to get you out anyway.")
+ else
+ d("Exiting instance")
+ end
+
+ if confirm == false then
+ ExitInstanceImmediately()
+ else
+ if IsInGamepadPreferredMode() then
+ ZO_Dialogs_ShowGamepadDialog(LEAVE_DIALOG)
+ else
+ ZO_Dialogs_ShowDialog(LEAVE_DIALOG)
+ end
+ end
+end
+
function Outkasted.OnAddOnLoaded(_, addonName)
if addonName ~= Outkasted.name then return end
+ EVENT_MANAGER:UnregisterForEvent(Outkasted.name, EVENT_ADD_ON_LOADED)
Outkasted.initMenu()
- ZO_CreateStringId("SI_BINDING_NAME_TP_OUTKASTED_GUILD_HALL", "Teleport to Outkasted guild house.")
+ ZO_CreateStringId("SI_BINDING_NAME_TP_OUTKASTED_GUILD_HALL", "Teleport to Outkasted guild house")
SLASH_COMMANDS["/guildhall"] = function() Outkasted.TeleportToGuildHall() end
+
+ ZO_CreateStringId("SI_BINDING_NAME_LEAVE_INSTANCE", "Leave instance")
+ SLASH_COMMANDS["/out"] = function() Outkasted.LeaveInstance(false) end
end
EVENT_MANAGER:RegisterForEvent(Outkasted.name, EVENT_ADD_ON_LOADED, Outkasted.OnAddOnLoaded)
diff --git a/bindings.xml b/bindings.xml
index d9f63c0..dda892c 100644
--- a/bindings.xml
+++ b/bindings.xml
@@ -1,9 +1,12 @@
<Bindings>
<Layer name="SI_KEYBINDINGS_LAYER_GENERAL">
- <Category name="Outkasted">
+ <Category name="|c22bd65Outkasted|r">
<Action name="TP_OUTKASTED_GUILD_HALL">
<Down>Outkasted.TeleportToGuildHall()</Down>
</Action>
+ <Action name="LEAVE_INSTANCE">
+ <Down>Outkasted.LeaveInstance()</Down>
+ </Action>
</Category>
</Layer>
</Bindings>