loot: add rarity threshold to random loot announce

This commit is contained in:
Road-block
2019-01-05 14:12:15 +01:00
committed by shagu
parent 42149eca5f
commit 29c315a282
11 changed files with 32 additions and 13 deletions
+7
View File
@@ -717,6 +717,12 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui.dropdowns.num_shapeshift_slots = BarLayoutOptions(NUM_SHAPESHIFT_SLOTS)
pfUI.gui.dropdowns.num_pet_action_slots = BarLayoutOptions(NUM_PET_ACTION_SLOTS)
pfUI.gui.dropdowns.loot_rarity = {}
for i=0, getn(_G.ITEM_QUALITY_COLORS)-2 do
local entry = string.format("%d:%s", i, string.format("%s%s%s", _G.ITEM_QUALITY_COLORS[i].hex, _G[string.format("ITEM_QUALITY%d_DESC",i)], FONT_COLOR_CODE_CLOSE))
table.insert(pfUI.gui.dropdowns.loot_rarity, entry)
end
-- main tab frame
pfUI.gui.tabs = CreateTabFrame(pfUI.gui, "LEFT")
pfUI.gui.tabs:SetPoint("TOPLEFT", pfUI.gui, "TOPLEFT", 0, -25)
@@ -1113,6 +1119,7 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(nil, this, T["Disable Loot Confirmation Dialog (Without Group)"], C.loot, "autopickup", "checkbox")
CreateConfig(nil, this, T["Enable Loot Window On MouseCursor"], C.loot, "mousecursor", "checkbox")
CreateConfig(nil, this, T["Enable Advanced Master Loot Menu"], C.loot, "advancedloot", "checkbox")
CreateConfig(nil, this, T["Random Roll Announcement Rarity"], C.loot, "rollannouncequal", "dropdown", pfUI.gui.dropdowns.loot_rarity)
CreateConfig(nil, this, T["Detailed Random Roll Announcement"], C.loot, "rollannounce", "checkbox")
CreateConfig(nil, this, T["Use Item Rarity Color For Loot-Roll Timer"], C.loot, "raritytimer", "checkbox")
this.setup = true
+14 -11
View File
@@ -37,18 +37,21 @@ pfUI:RegisterModule("loot", function ()
local slot = pfUI.loot.selectedSlot or 0
local to = table.getn(candidates)
if to >= 1 then
SendChatMessageWide(T["Random Rolling "]..GetLootSlotLink(slot))
if C.loot.rollannounce == "1" then
local k,names = 1, ""
for i=1,to do
names = (k==1) and (i..":"..pfUI.loot.index_to_name[candidates[i]]) or (names..", "..i..":"..pfUI.loot.index_to_name[candidates[i]])
-- fit the maximum names in a single 255 char message (15)
if i == to or k == 15 then
QueueFunction(SendChatMessageWide,names)
names = ""
local _,_,_,quality = GetLootSlotInfo(slot)
if quality >= tonumber(C.loot.rollannouncequal) then
SendChatMessageWide(T["Random Rolling "]..GetLootSlotLink(slot))
if C.loot.rollannounce == "1" then
local k,names = 1, ""
for i=1,to do
names = (k==1) and (i..":"..pfUI.loot.index_to_name[candidates[i]]) or (names..", "..i..":"..pfUI.loot.index_to_name[candidates[i]])
-- fit the maximum names in a single 255 char message (15)
if i == to or k == 15 then
QueueFunction(SendChatMessageWide,names)
names = ""
end
k = k<15 and k+1 or 1
end
k = k<15 and k+1 or 1
end
end
end
pfUI.loot:RegisterEvent("CHAT_MSG_SYSTEM")
pfUI.loot.randomRolling = true