Quantcast

Oh well, whatever

Darthpred [07-06-14 - 04:06]
Oh well, whatever
Filename
ElvUI_SLE/config/profile.lua
ElvUI_SLE/modules/loot/loot.lua
ElvUI_SLE/modules/loot/options.lua
diff --git a/ElvUI_SLE/config/profile.lua b/ElvUI_SLE/config/profile.lua
index 3d096b6..a425519 100755
--- a/ElvUI_SLE/config/profile.lua
+++ b/ElvUI_SLE/config/profile.lua
@@ -268,6 +268,7 @@ P['sle'] = {
 		['quality'] = "EPIC",
 		['chat'] = "RAID",
 		['auto'] = true,
+		['improved'] = false,
 	},

 	--Tooltip Faction Icon
diff --git a/ElvUI_SLE/modules/loot/loot.lua b/ElvUI_SLE/modules/loot/loot.lua
index 2085b69..3904115 100755
--- a/ElvUI_SLE/modules/loot/loot.lua
+++ b/ElvUI_SLE/modules/loot/loot.lua
@@ -13,6 +13,7 @@ local GetNumLootItems = GetNumLootItems
 local IsLeftControlKeyDown = IsLeftControlKeyDown
 local GetLootSlotLink = GetLootSlotLink
 local GetLootSlotInfo = GetLootSlotInfo
+local GetItemInfo = GetItemInfo

 local improved = {
 	--110, --Test, BC Heroic last boss epic drop ilvl
@@ -42,6 +43,108 @@ end
 function LT:Announce()
 	local name = {}
 	local loot = {}
+	local numbers = {}
+	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
+	local n = 0
+	--local inGroup, inRaid, inPartyLFG = IsInGroup(), IsInRaid(), IsPartyLFG()
+	local p, chat
+	if not IsInGroup() then return end -- not in group, exit.
+	if (LT:Check() and E.db.sle.loot.auto) or (IsLeftControlKeyDown() and (IsInGroup() or IsInRaid())) then
+		for i = 1, GetNumLootItems() do
+			if GetLootSlotType(i) == 1 then
+				for j = 1, t do
+					if GetLootSlotLink(i) == loottemp[j] then
+						check = true
+					end
+				end
+			end
+		end
+		if check == false or IsLeftControlKeyDown() then
+			for i = 1, GetNumLootItems() do
+				if GetLootSlotType(i) ~= 1 then
+					m = m + 1
+				else
+					local _, item, quantity, quality = GetLootSlotInfo(i)
+					if quality >= q then
+						name[i] = item
+
+						k = 1
+						while name[i] ~= name[k] do
+						k = k + 1
+						end
+
+						if i == k then
+							n = n + 1
+							loot[n] = GetLootSlotLink(i)
+							numbers[n] = quantity
+						else
+
+							p = 1
+							while GetLootSlotLink(k) ~= loot[p] do
+							p = p + 1
+						end
+						numbers[p] = numbers[p] + quantity
+					end
+				end
+			end
+		end
+		if n ~= 0 then
+			if E.db.sle.loot.chat == "PARTY" then
+				SendChatMessage(L["Loot Dropped:"], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY")
+			elseif E.db.sle.loot.chat == "RAID" then
+				if IsInRaid() then
+					SendChatMessage(L["Loot Dropped:"], IsPartyLFG() and "INSTANCE_CHAT" or "RAID")
+				else
+					SendChatMessage(L["Loot Dropped:"], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY")
+				end
+			elseif E.db.sle.loot.chat == "SAY" then
+				SendChatMessage(L["Loot Dropped:"], "SAY")
+			end
+		end
+		for i = 1, n do
+			if E.db.sle.loot.chat == "PARTY" then
+				if numbers[i] == 1 then
+					SendChatMessage(i..". "..loot[i], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY")
+				elseif numbers[i] > 1 then
+					SendChatMessage(i..". "..loot[i].."x"..numbers[i], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY")
+				end
+			elseif E.db.sle.loot.chat == "RAID" then
+				if IsInRaid() then
+					if numbers[i] == 1 then
+						SendChatMessage(i..". "..loot[i], IsPartyLFG() and "INSTANCE_CHAT" or "RAID")
+					elseif numbers[i] > 1 then
+							SendChatMessage(i..". "..loot[i].."x"..numbers[i], IsPartyLFG() and "INSTANCE_CHAT" or "RAID")
+						end
+				else
+					if numbers[i] == 1 then
+						SendChatMessage(i..". "..loot[i], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY")
+					elseif numbers[i] > 1 then
+						SendChatMessage(i..". "..loot[i].."x"..numbers[i], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY")
+					end
+				end
+			elseif E.db.sle.loot.chat == "SAY" then
+				if numbers[i] == 1 then
+					SendChatMessage(i..". "..loot[i], "SAY")
+				elseif numbers[i] > 1 then
+					SendChatMessage(i..". "..loot[i].."x"..numbers[i], "SAY")
+					end
+				end
+			end
+		end
+		for i = 1, GetNumLootItems() do
+			if GetLootSlotType(i) == 1 then
+				loottemp[i] = GetLootSlotLink(i)
+			end
+		end
+		t = GetNumLootItems()
+		check = false
+	end
+end
+
+function LT:AnnounceI()
+	local name = {}
+	local loot = {}
 	local lootImp = {}
 	local numbers = {}
 	local numbersImp = {}
@@ -178,6 +281,7 @@ function LT:Announce()
 						end
 					end
 				elseif E.db.sle.loot.chat == "SAY" then
+
 					if numbersImp[i] == 1 then
 						SendChatMessage(i..". "..lootImp[i], "SAY")
 					elseif numbersImp[i] > 1 then
@@ -197,9 +301,18 @@ function LT:Announce()
 	end
 end

+function LT:Register()
+	self:UnregisterEvent("LOOT_OPENED")
+	if E.db.sle.loot.improved then
+		self:RegisterEvent("LOOT_OPENED", "AnnounceI")
+	else
+		self:RegisterEvent("LOOT_OPENED", "Announce")
+	end
+end
+
 function LT:Initialize()
 	if not E.private.sle.loot.enable then return end
-	self:RegisterEvent("LOOT_OPENED", "Announce")
+	self:Register()
 end

 E:RegisterModule(LT:GetName())
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/loot/options.lua b/ElvUI_SLE/modules/loot/options.lua
index 95b239f..7cd4e81 100755
--- a/ElvUI_SLE/modules/loot/options.lua
+++ b/ElvUI_SLE/modules/loot/options.lua
@@ -34,10 +34,13 @@ E.Options.args.sle.args.options.args.loot = {
 			get = function(info) return E.db.sle.loot.auto end,
 			set = function(info, value) E.db.sle.loot.auto = value; end
 		},
-		spacer = {
+		improved = {
 			order = 5,
-			type = "description",
-			name = "",
+			type = "toggle",
+			name = L["Improved"],
+			disabled = function() return not E.private.sle.loot.enable end,
+			get = function(info) return E.db.sle.loot.improved end,
+			set = function(info, value) E.db.sle.loot.improved = value; LT:Register() end
 		},
 		quality = {
 			order = 6,