diff --git a/ElvUI_SLE/core/toolkit.lua b/ElvUI_SLE/core/toolkit.lua
index b55b91d..fc3c412 100644
--- a/ElvUI_SLE/core/toolkit.lua
+++ b/ElvUI_SLE/core/toolkit.lua
@@ -56,6 +56,7 @@ local function UpdateAll()
UF:Update_CombatIndicator()
end
LT:LootShow()
+ LT:Update()
UB:UpdateAll()
RM:Update()
RF:Update()
diff --git a/ElvUI_SLE/defaults/private.lua b/ElvUI_SLE/defaults/private.lua
index fbb5d90..6d8e3ad 100644
--- a/ElvUI_SLE/defaults/private.lua
+++ b/ElvUI_SLE/defaults/private.lua
@@ -61,6 +61,9 @@ V['sle'] = {
['loot'] = {
['enable'] = false,
+ ['autoconfirm'] = false,
+ ['autogreed'] = false,
+ ['autodisenchant'] = false,
},
['vehicle'] = {
diff --git a/ElvUI_SLE/modules/loot.lua b/ElvUI_SLE/modules/loot.lua
index 784253d..6af45c2 100644
--- a/ElvUI_SLE/modules/loot.lua
+++ b/ElvUI_SLE/modules/loot.lua
@@ -6,13 +6,16 @@ local loottemp = {}
local MyName = E.myname
local IsInGroup, IsInRaid, IsPartyLFG = IsInGroup, IsInRaid, IsPartyLFG
local GetNumGroupMembers, GetRaidRosterInfo = GetNumGroupMembers, GetRaidRosterInfo
-local GetLootSlotType, GetLootSlotLink, GetLootSlotInfo = GetLootSlotType, GetLootSlotLink, GetLootSlotInfo
+local GetLootSlotType, GetLootSlotLink, GetLootSlotInfo, GetLootRollItemInfo = GetLootSlotType, GetLootSlotLink, GetLootSlotInfo, GetLootRollItemInfo
local GetNumLootItems, GetItemInfo = GetNumLootItems, GetItemInfo
local IsLeftControlKeyDown = IsLeftControlKeyDown
local loot = {}
local numbers = {}
local n = 0
local Tremove = table.remove
+local ann, GrDes = false, false
+local frozen, chaos = select(1, GetItemInfo(43102)), select(1, GetItemInfo(52078))
+local UnitLevel = UnitLevel
local function Check()
local name, rank, isML
@@ -90,7 +93,8 @@ local function List()
end
end
-local function Announce()
+local function Announce(event)
+ if event ~= "LOOT_OPENED" then return end
if not IsInGroup() then return end -- not in group, exit.
local m = 0
local q = E.db.sle.loot.quality == "EPIC" and 4 or E.db.sle.loot.quality == "RARE" and 3 or E.db.sle.loot.quality == "UNCOMMON" and 2
@@ -131,8 +135,79 @@ function LT:LootShow()
end
end
+local function HandleRoll(event, id)
+ if not GrDes then return end
+
+ local name = select(2, GetLootRollItemInfo(id))
+ if (name == frozen) or (name == chaos) then
+ RollOnLoot(id, 2)
+ end
+
+ local Maxed = GetMaxPlayerLevel()
+ if IsXPUserDisabled() == true then Maxed = UnitLevel("player") end
+
+ if UnitLevel("player") ~= Maxed then return end
+
+ if(id and select(4, GetLootRollItemInfo(id))== 2 and not (select(5, GetLootRollItemInfo(id)))) then
+ if E.private.sle.loot.autodisenchant and RollOnLoot(id, 3) then
+ RollOnLoot(id, 3)
+ else
+ RollOnLoot(id, 2)
+ end
+ end
+end
+
+local function HandleEvent(event, ...)
+ if event == "CONFIRM_LOOT_ROLL" or event == "CONFIRM_DISENCHANT_ROLL" then
+ local arg1, arg2 = ...
+ ConfirmLootRoll(arg1, arg2)
+ elseif event == "LOOT_OPENED" or event == "LOOT_BIND_CONFIRM" then
+ if ann then Announce(event) end
+ count = GetNumLootItems()
+ if count == 0 then CloseLoot() return end
+ for slot = 1, count do
+ ConfirmLootSlot(slot)
+ end
+ end
+end
+
+function LT:Update()
+ if E.private.sle.loot.autogreed or E.private.sle.loot.autodisenchant then
+ GrDes = true
+ E.db.general.autoRoll = false
+ else
+ GrDes = false
+ end
+ if IsAddOnLoaded("ElvUI_Config") then
+ if GrDes then
+ E.Options.args.general.args.general.args.autoRoll.disabled = true
+ else
+ E.Options.args.general.args.general.args.autoRoll.disabled = false
+ end
+ end
+end
+
+local function LoadConfig(event, addon)
+ if addon ~= "ElvUI_Config" then return end
+ LT:UnregisterEvent("ADDON_LOADED")
+ LT:Update()
+end
+
function LT:Initialize()
+ ann = E.private.sle.loot.enable
+
+ self:Update()
+ UIParent:UnregisterEvent("LOOT_BIND_CONFIRM")
+ UIParent:UnregisterEvent("CONFIRM_DISENCHANT_ROLL")
+ UIParent:UnregisterEvent("CONFIRM_LOOT_ROLL")
+
+ self:RegisterEvent("CONFIRM_DISENCHANT_ROLL", HandleEvent)
+ self:RegisterEvent("CONFIRM_LOOT_ROLL", HandleEvent)
+ self:RegisterEvent("LOOT_BIND_CONFIRM", HandleEvent)
+ self:RegisterEvent("LOOT_OPENED", HandleEvent)
+
self:RegisterEvent('PLAYER_ENTERING_WORLD', 'LootShow');
- if not E.private.sle.loot.enable then return end
- self:RegisterEvent("LOOT_OPENED", Announce)
+
+ self:RegisterEvent("START_LOOT_ROLL", HandleRoll)
+ self:RegisterEvent("ADDON_LOADED", LoadConfig)
end
\ No newline at end of file
diff --git a/ElvUI_SLE/options/loot_c.lua b/ElvUI_SLE/options/loot_c.lua
index ed984bd..e838970 100644
--- a/ElvUI_SLE/options/loot_c.lua
+++ b/ElvUI_SLE/options/loot_c.lua
@@ -1,4 +1,5 @@
local E, L, V, P, G, _ = unpack(ElvUI);
+local LT = E:GetModule('SLE_Loot')
local function configTable()
E.Options.args.sle.args.options.args.loot = {
@@ -16,7 +17,7 @@ local function configTable()
type = "description",
name = L["LOOT_DESC"],
},
- enabled = {
+ enable = {
order = 3,
type = "toggle",
name = L["Enable"],
@@ -37,8 +38,32 @@ local function configTable()
type = "description",
name = "",
},
- quality = {
+ autoconfirm = {
order = 6,
+ type = "toggle",
+ name = "Auto Confirm",
+ desc = "Automatically click OK on BOP items",
+ get = function(info) return E.private.sle.loot.autoconfirm end,
+ set = function(info,value) E.private.sle.loot.autoconfirm = value; end,
+ },
+ autogreed = {
+ order = 7,
+ type = "toggle",
+ name = "Auto Greed",
+ desc = "Automatically greed uncommon (green) quality items at max level",
+ get = function(info) return E.private.sle.loot.autogreed end,
+ set = function(info,value) E.private.sle.loot.autogreed = value; LT:Update() end,
+ },
+ autodisenchant = {
+ order = 8,
+ type = "toggle",
+ name = "Auto Disenchant",
+ desc = "Automatically disenchant uncommon (green) quality items at max level",
+ get = function(info) return E.private.sle.loot.autodisenchant end,
+ set = function(info,value) E.private.sle.loot.autodisenchant = value; LT:Update() end,
+ },
+ quality = {
+ order = 9,
type = "select",
name = L["Loot Quality"],
desc = L["Set the minimum quality of an item to announce."],
@@ -52,7 +77,7 @@ local function configTable()
},
},
chat = {
- order = 7,
+ order = 10,
type = "select",
name = L["Chat"],
desc = L["Announce loot to the selected channel."],