diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua index 166cf8a..bbb2af9 100644 --- a/ElvUI_SLE/defaults/profile.lua +++ b/ElvUI_SLE/defaults/profile.lua @@ -517,6 +517,13 @@ P["sle"] = { ["targetcount"] = false, ["visibleRange"] = 60, }, + --Order Halls + ["orderhall"] = { + ["autoOrder"] = { + ["enable"] = false, + ["autoEquip"] = false, + }, + }, --Quests ["quests"] = { ["visibility"] = { diff --git a/ElvUI_SLE/modules/garrison.lua b/ElvUI_SLE/modules/garrison.lua index ec71d6a..c2a7610 100644 --- a/ElvUI_SLE/modules/garrison.lua +++ b/ElvUI_SLE/modules/garrison.lua @@ -12,10 +12,15 @@ local buildID = { [206] = "Ship", [207] = "Ship", } +local zones = { + [971] = true, + [976] = true, +} local C_Garrison = C_Garrison function Gar:SHIPMENT_CRAFTER_INFO(event, success, _, maxShipments, plotID) if not _G["GarrisonCapacitiveDisplayFrame"] then return end --Just in case + if not zones[T.GetCurrentMapAreaID()] then return end local n = _G["GarrisonCapacitiveDisplayFrame"].available or 0 if Gar.clicked or n == 0 or not Gar.db.autoOrder.enable then return end Gar.clicked = true diff --git a/ElvUI_SLE/modules/load_modules.xml b/ElvUI_SLE/modules/load_modules.xml index e551a50..e6e7ce8 100644 --- a/ElvUI_SLE/modules/load_modules.xml +++ b/ElvUI_SLE/modules/load_modules.xml @@ -15,6 +15,7 @@ <Script file='enhancedshdows.lua'/> <Script file='toolbars.lua'/> <Script file='garrison.lua'/> + <Script file='orderhall.lua'/> <Script file='lfr.lua'/> <Script file='loot.lua'/> <Include file='minimap\load_minimap.xml'/> diff --git a/ElvUI_SLE/modules/orderhall.lua b/ElvUI_SLE/modules/orderhall.lua new file mode 100644 index 0000000..e1af262 --- /dev/null +++ b/ElvUI_SLE/modules/orderhall.lua @@ -0,0 +1,39 @@ +local SLE, T, E, L, V, P, G = unpack(select(2, ...)) +local OH = SLE:NewModule("OrderHall", 'AceEvent-3.0') +local _G = _G +local C_Garrison = C_Garrison + +function OH:SHIPMENT_CRAFTER_INFO(event, success, _, maxShipments, plotID) + if not _G["GarrisonCapacitiveDisplayFrame"] then return end --Just in case + if T.GetRealZoneText() ~= _G["ORDER_HALL_"..E.myclass] then return end + local n = _G["GarrisonCapacitiveDisplayFrame"].available or 0 + if OH.clicked or n == 0 or not OH.db.autoOrder.enable then return end + OH.clicked = true + local _, _, _, _, followerID = C_Garrison.GetShipmentItemInfo() + if followerID then + _G["GarrisonCapacitiveDisplayFrame"].CreateAllWorkOrdersButton:Click() + else + if OH.db.autoOrder.autoEquip then + _G["GarrisonCapacitiveDisplayFrame"].CreateAllWorkOrdersButton:Click() + end + end +end + +function OH:SHIPMENT_CRAFTER_CLOSED() + OH.clicked = false +end + +function OH:Initialize() + if not SLE.initialized then return end + OH.db = E.db.sle.orderhall + OH.clicked = false + + function OH:ForUpdateAll() + OH.db = E.db.sle.orderhall + end + + self:RegisterEvent("SHIPMENT_CRAFTER_INFO"); + self:RegisterEvent("SHIPMENT_CRAFTER_CLOSED"); +end + +SLE:RegisterModule(OH:GetName()) \ No newline at end of file diff --git a/ElvUI_SLE/options/load_options.xml b/ElvUI_SLE/options/load_options.xml index 9ab22ca..871181f 100644 --- a/ElvUI_SLE/options/load_options.xml +++ b/ElvUI_SLE/options/load_options.xml @@ -22,6 +22,7 @@ <Script file='enhancedshadows_c.lua'/> <Script file='farm_c.lua'/> <Script file='garrison_c.lua'/> + <Script file='orderhall_c.lua'/> <Script file='loot_c.lua'/> <Script file='nameplates_c.lua'/> <Script file='raidmarkers_c.lua'/> diff --git a/ElvUI_SLE/options/orderhall_c.lua b/ElvUI_SLE/options/orderhall_c.lua new file mode 100644 index 0000000..7ee7bcc --- /dev/null +++ b/ElvUI_SLE/options/orderhall_c.lua @@ -0,0 +1,43 @@ +local SLE, T, E, L, V, P, G = unpack(select(2, ...)) +local GARRISON_LOCATION_TOOLTIP = GARRISON_LOCATION_TOOLTIP +local EXPANSION_NAME5 = EXPANSION_NAME5 +local HallName = _G["ORDER_HALL_"..E.myclass] +local function configTable() + if not SLE.initialized then return end + E.Options.args.sle.args.modules.args.orderhall = { + type = "group", + name = L["Class Hall"], + order = 15, + args = { + header = { + order = 1, + type = "header", + name = HallName, + }, + autoOrder = { + order = 2, + type = "group", + name = L["Auto Work Orders"], + guiInline = true, + get = function(info) return E.db.sle.orderhall.autoOrder[ info[#info] ] end, + set = function(info, value) E.db.sle.orderhall.autoOrder[ info[#info] ] = value end, + args = { + enable = { + order = 1, + type = "toggle", + name = L["Enable"], + desc = L["Automatically queue maximum number of work orders available when visiting respected NPC."], + }, + autoEquip = { + order = 2, + type = "toggle", + name = L["Auto Work Orders for equipment"], + disabled = function() return not E.db.sle.orderhall.autoOrder.enable end, + }, + }, + }, + }, + } +end + +T.tinsert(SLE.Configs, configTable) \ No newline at end of file