From 42cfdd78b370a0246e4e2d622f54d8e824183a96 Mon Sep 17 00:00:00 2001 From: Road-block Date: Tue, 15 May 2018 18:52:33 +0300 Subject: [PATCH] loot: make detailed random roll announce an option * api: SendChatMessageWide will use raid warning if player is raid leader or assist * loot: rearrange advanced masterloot menus so random rolling and special recipients precede class menu * loot: fix a special recipients unitpopup menu check so they won't show in the context menu when the player is solo * loot: change the auto confirm bind when solo implementation, so player doesn't have to double-click the loot * loot: make sure it works if the loot bind confirmation staticpopup is not at index 1 --- api/api.lua | 4 ++++ api/config.lua | 1 + env/translations_deDE.lua | 1 + env/translations_enUS.lua | 1 + env/translations_esES.lua | 1 + env/translations_frFR.lua | 1 + env/translations_koKR.lua | 1 + env/translations_ruRU.lua | 1 + env/translations_zhCN.lua | 1 + env/translations_zhTW.lua | 1 + modules/gui.lua | 1 + modules/loot.lua | 45 ++++++++++++++++++++++----------------- 12 files changed, 39 insertions(+), 20 deletions(-) diff --git a/api/api.lua b/api/api.lua index 78afe143..223ca7b2 100644 --- a/api/api.lua +++ b/api/api.lua @@ -212,7 +212,11 @@ end function pfUI.api.SendChatMessageWide(msg) local channel = "SAY" if UnitInRaid("player") then + if ( IsRaidLeader() or IsRaidOfficer() ) then + channel = "RAID_WARNING" + else channel = "RAID" + end elseif UnitExists("party1") then channel = "PARTY" end diff --git a/api/config.lua b/api/config.lua index 06072c16..8682c099 100644 --- a/api/config.lua +++ b/api/config.lua @@ -94,6 +94,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("loot", nil, "autopickup", "1") pfUI:UpdateConfig("loot", nil, "mousecursor", "1") pfUI:UpdateConfig("loot", nil, "advancedloot", "1") + pfUI:UpdateConfig("loot", nil, "rollannounce", "0") pfUI:UpdateConfig("loot", nil, "raritytimer", "1") pfUI:UpdateConfig("unitframes", nil, "disable", "0") diff --git a/env/translations_deDE.lua b/env/translations_deDE.lua index a162c24c..df67ed15 100644 --- a/env/translations_deDE.lua +++ b/env/translations_deDE.lua @@ -101,6 +101,7 @@ pfUI_translation["deDE"] = { ["Default"] = nil, ["Delete profile"] = nil, ["Delete / Reset"] = nil, + ["Detailed Random Roll Announcement"] = nil, ["Disable All UIErrors"] = nil, ["Disable Blizzard Castbar"] = nil, ["Disabled"] = nil, diff --git a/env/translations_enUS.lua b/env/translations_enUS.lua index c5e839f8..81ab5211 100644 --- a/env/translations_enUS.lua +++ b/env/translations_enUS.lua @@ -101,6 +101,7 @@ pfUI_translation["enUS"] = { ["Default"] = nil, ["Delete profile"] = nil, ["Delete / Reset"] = nil, + ["Detailed Random Roll Announcement"] = nil, ["Disable All UIErrors"] = nil, ["Disable Blizzard Castbar"] = nil, ["Disabled"] = nil, diff --git a/env/translations_esES.lua b/env/translations_esES.lua index c1b5662a..533e666c 100644 --- a/env/translations_esES.lua +++ b/env/translations_esES.lua @@ -101,6 +101,7 @@ pfUI_translation["esES"] = { ["Default"] = "Por Defecto", ["Delete profile"] = "Borrar Perfil", ["Delete / Reset"] = "Borrar / Restablecer", + ["Detailed Random Roll Announcement"] = nil, ["Disable All UIErrors"] = "Desactivar los Errores de la IU", ["Disable Blizzard Castbar"] = "Desactivar la Barra de Lanzamiento de Blizzard", ["Disabled"] = "Desactivado", diff --git a/env/translations_frFR.lua b/env/translations_frFR.lua index 137cd778..f2f477c3 100644 --- a/env/translations_frFR.lua +++ b/env/translations_frFR.lua @@ -101,6 +101,7 @@ pfUI_translation["frFR"] = { ["Default"] = "Défaut", ["Delete profile"] = "Supprimer le profil", ["Delete / Reset"] = "Supprimer / Réinitialiser", + ["Detailed Random Roll Announcement"] = nil, ["Disable All UIErrors"] = "Désactiver tout les messages d'erreur liés à l'UI", ["Disable Blizzard Castbar"] = "Désactiver la barre d'incantation d'origine", ["Disabled"] = "Désactivé", diff --git a/env/translations_koKR.lua b/env/translations_koKR.lua index 55a6b3c1..ee478d76 100644 --- a/env/translations_koKR.lua +++ b/env/translations_koKR.lua @@ -101,6 +101,7 @@ pfUI_translation["koKR"] = { ["Default"] = "기본", ["Delete profile"] = "프로파일 삭제", ["Delete / Reset"] = "지우기/초기화", + ["Detailed Random Roll Announcement"] = nil, ["Disable"] = "가리기", ["Disable All UIErrors"] = "모든 UI오류 비활성화", ["Disable Blizzard Castbar"] = "블리자드 캐스트바 사용 중지", diff --git a/env/translations_ruRU.lua b/env/translations_ruRU.lua index e18bdba8..fcdac11c 100644 --- a/env/translations_ruRU.lua +++ b/env/translations_ruRU.lua @@ -101,6 +101,7 @@ pfUI_translation["ruRU"] = { ["Default"] = "По умолчанию", ["Delete profile"] = "Удалить профиль", ["Delete / Reset"] = "Удалить / Сбросить", + ["Detailed Random Roll Announcement"] = nil, ["Disable All UIErrors"] = "Отключить все UI ошибки (красный текст сверху экрана)", ["Disable Blizzard Castbar"] = "Отключить панель применения Blizzard", ["Disabled"] = "Отключено", diff --git a/env/translations_zhCN.lua b/env/translations_zhCN.lua index aa3e22ff..559bafa6 100644 --- a/env/translations_zhCN.lua +++ b/env/translations_zhCN.lua @@ -101,6 +101,7 @@ pfUI_translation["zhCN"] = { ["Default"] = "默认设置", ["Delete profile"] = "删除配置", ["Delete / Reset"] = "还原", + ["Detailed Random Roll Announcement"] = nil, ["Disable All UIErrors"] = "禁用所有UI错误", ["Disable Blizzard Castbar"] = "隐藏暴雪施法条", ["Disabled"] = "不显示", diff --git a/env/translations_zhTW.lua b/env/translations_zhTW.lua index 154e0733..2d2df571 100644 --- a/env/translations_zhTW.lua +++ b/env/translations_zhTW.lua @@ -101,6 +101,7 @@ pfUI_translation["zhTW"] = { ["Default"] = "默認設置", ["Delete profile"] = "刪除配置", ["Delete / Reset"] = "還原", + ["Detailed Random Roll Announcement"] = nil, ["Disable All UIErrors"] = "禁用所有UI錯誤", ["Disable Blizzard Castbar"] = "隱藏暴雪施法條", ["Disabled"] = "不顯示", diff --git a/modules/gui.lua b/modules/gui.lua index f8c8513d..0583a541 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -945,6 +945,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["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 end diff --git a/modules/loot.lua b/modules/loot.lua index a5e991fc..5a6a5e55 100644 --- a/modules/loot.lua +++ b/modules/loot.lua @@ -39,15 +39,17 @@ pfUI:RegisterModule("loot", function () local to = table.getn(candidates) if to >= 1 then SendChatMessageWide(T["Random Rolling "]..GetLootSlotLink(slot)) - 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 = "" + 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 pfUI.loot:RegisterEvent("CHAT_MSG_SYSTEM") pfUI.loot.randomRolling = true @@ -253,6 +255,8 @@ pfUI:RegisterModule("loot", function () info.notCheckable = 1 info.isTitle = 1 UIDropDownMenu_AddButton(info) + pfUI.loot:BuildSpecialRollsMenu(UIDROPDOWNMENU_MENU_LEVEL) + pfUI.loot:BuildSpecialRecipientsMenu(UIDROPDOWNMENU_MENU_LEVEL) for order, class in ipairs(CLASS_SORT_ORDER) do local lclass = classes_in_raid[class] if (lclass) then @@ -269,9 +273,9 @@ pfUI:RegisterModule("loot", function () UIDropDownMenu_AddButton(info) end end - pfUI.loot:BuildSpecialRecipientsMenu(UIDROPDOWNMENU_MENU_LEVEL) - pfUI.loot:BuildSpecialRollsMenu(UIDROPDOWNMENU_MENU_LEVEL) elseif level == 2 then -- players + pfUI.loot:BuildSpecialRollsMenu(UIDROPDOWNMENU_MENU_LEVEL) + pfUI.loot:BuildSpecialRecipientsMenu(UIDROPDOWNMENU_MENU_LEVEL) local players = players_in_class[UIDROPDOWNMENU_MENU_VALUE] if (players) and next(players) then table.sort(players) @@ -287,8 +291,6 @@ pfUI:RegisterModule("loot", function () UIDropDownMenu_AddButton(info,UIDROPDOWNMENU_MENU_LEVEL) end end - pfUI.loot:BuildSpecialRecipientsMenu(UIDROPDOWNMENU_MENU_LEVEL) - pfUI.loot:BuildSpecialRollsMenu(UIDROPDOWNMENU_MENU_LEVEL) end end @@ -405,7 +407,7 @@ pfUI:RegisterModule("loot", function () if not ((method == "master" and lootmasterID == 0) or IsRaidLeader()) then UnitPopupShown[index] = 0 end - if (unit) and UnitIsPlayer(unit) and not (UnitInRaid(unit) or UnitInParty(unit)) then + if (unit) and UnitIsPlayer(unit) and not (UnitInRaid(unit) or (UnitInParty(unit) and UnitExists("party1"))) then UnitPopupShown[index] = 0 end end @@ -490,6 +492,15 @@ pfUI:RegisterModule("loot", function () end end + local function AutoBind(arg1) + if GetNumPartyMembers() == 0 and GetNumRaidMembers() == 0 then + local dialog = StaticPopup_FindVisible("LOOT_BIND",arg1) + if dialog then + _G[dialog:GetName().."Button1"]:Click() + end + end + end + function pfUI.loot:CreateSlot(id) local frame = CreateFrame("LootButton", 'pfLootButton'..id, pfUI.loot) frame:RegisterForClicks('LeftButtonUp', 'RightButtonUp') @@ -664,13 +675,7 @@ pfUI:RegisterModule("loot", function () end if C.loot.autopickup == "1" and event == "LOOT_BIND_CONFIRM" then - if GetNumPartyMembers() == 0 and GetNumRaidMembers() == 0 then - local dialog = StaticPopup_Show("LOOT_BIND") - if dialog then - dialog.data = arg1 - StaticPopup1Button1:Click() - end - end + QueueFunction(AutoBind,arg1) end end)