Revision 9

This commit is contained in:
Robin 2021-01-13 15:37:12 +01:00
commit 608861be57
17 changed files with 442 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "Common"]
path = Common
url = https://git.grml.de/rilgamon/Common.git

1
Common Submodule

@ -0,0 +1 @@
Subproject commit 762c59c6c6abc6ecaa71f3e36bb2c6dd16b8e0ed

259
core.lua Normal file
View File

@ -0,0 +1,259 @@
local name, addon = ...
local parentName = addon['parentName'] or "BrokerPack"
local childName = "zz_LFG" -- Change childName to your addons foldername
local ldbicon = LibStub("LibDBIcon-1.0")
local defaults = {
}
local options = {
}
local db
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
for _, t in pairs(LFG_EYE_TEXTURES) do
local cols = floor(t.width / t.iconSize)
local colWidth = t.iconSize / t.width
local rowHeight = t.iconSize / t.height
local iconCoords = { }
for i = 1, t.frames do
local L = mod(i - 1, cols) * colWidth
local R = L + colWidth
local T = ceil(i / cols) * rowHeight
local B = T - rowHeight
iconCoords[i] = { L, R, B, T }
end
t.iconCoords = iconCoords
end
local currentQueueType
local currentFrame = 1
local currentIcon = LFG_EYE_TEXTURES.default
local iconCoords = currentIcon.iconCoords
local updateDelay = currentIcon.delay
local counter = 0
local ldbobj = nil
local function UpdateIconCoords(self, elapsed)
counter = counter + elapsed
if counter > updateDelay then
if currentFrame > currentIcon.frames then
currentFrame = 1
end
ldbobj['iconCoords'] = iconCoords[currentFrame] or iconCoords[1]
currentFrame = currentFrame + 1
counter = 0
end
end
local function GetScreenHalf()
local _, y = GetCursorPosition()
if y * 2 > UIParent:GetHeight() then
return "TOP"
else
return "BOTTOM"
end
end
local actions = {
{
text = L["Click to open the Dungeon Finder."],
enabled = function() return C_LFGInfo.CanPlayerUseLFD() end,
selected = function(button) return button == "LeftButton" and not IsModifierKeyDown() end,
func = function() PVEFrame_ToggleFrame("GroupFinderFrame", LFDParentFrame) end,
},
{
text = L["Alt-Click to open the Raid Finder."],
enabled = function() return C_LFGInfo.CanPlayerUseLFR() end,
selected = function(button) return button == "LeftButton" and IsAltKeyDown() end,
func = function() PVEFrame_ToggleFrame("GroupFinderFrame", RaidFinderFrame) end,
},
{
text = L["Ctrl-Click to open the Premade Groups window."],
enabled = function() return not IsTrialAccount() end,
selected = function(button) return button == "LeftButton" and IsControlKeyDown() end,
func = function() PVEFrame_ToggleFrame("GroupFinderFrame", LFGListPVEStub) end,
},
{
text = L["Right-Click to open the PVP window."],
enabled = function() return C_LFGInfo.CanPlayerUsePVP() end,
selected = function(button) return button == "RightButton" end,
func = function() TogglePVPUI() end,
},
{
text = L["Middle-Click or Shift-Click to open the Pet Journal."],
enabled = function() return C_PetJournal.IsFindBattleEnabled() and C_PetJournal.IsJournalUnlocked() end,
selected = function(button) return button == "MiddleButton" or (button == "LeftButton" and IsShiftKeyDown()) end,
func = function() ToggleCollectionsJournal(2) end,
},
}
local queueTypes = {
"dungeon", -- Dungeon Finder
"raid", -- Other Raids
"raid", -- Raid Finder
"scenario", -- Scenarios
"raid", -- Flex Raid
"pvp" -- World PVP
}
local function GetQueueInfo()
for i = 1, NUM_LE_LFG_CATEGORYS do
local mode, submode = GetLFGMode(i)
if mode then
return queueTypes[i], mode, submode, i
end
end
for i = 1, GetMaxBattlefieldID() do
local status = GetBattlefieldStatus(i)
if status and status ~= "none" then
return "pvp", status
end
end
for i = 1, MAX_WORLD_PVP_QUEUES do
local status = GetWorldPVPQueueStatus(i)
if status and status ~= "none" then
return "pvp", status
end
end
local status = C_PetBattles.GetPVPMatchmakingInfo()
if status then
return "petbattle", status
end
end
local function OnText(message)
addon:OnText(childName, message)
end
local function OnEnter(self,...)
if GetQueueInfo() and not QueueStatusFrame:IsVisible() then
QueueStatusFrame:Show()
QueueStatusFrame:SetParent(UIParent)
QueueStatusFrame:SetClampedToScreen(true)
QueueStatusFrame:SetFrameStrata("TOOLTIP")
QueueStatusFrame:ClearAllPoints()
if GetScreenHalf() == "TOP" then
QueueStatusFrame:SetPoint("TOP", self, "BOTTOM", 0, -5)
else
QueueStatusFrame:SetPoint("BOTTOM", self, "TOP", 0, 5)
end
else
GameTooltip:SetOwner(self, "ANCHOR_BOTTOM")
GameTooltip:ClearLines()
GameTooltip:SetText(L["LFG"])
for i = 1, #actions do
if actions[i].enabled() then
GameTooltip:AddLine(actions[i].text, 1, 1, 1)
end
end
GameTooltip:Show()
end
end
local function OnLeave(self)
QueueStatusFrame:Hide()
GameTooltip:Hide()
end
local function OnClick(self, button)
if button == "RightButton" and GetQueueInfo() and not IsShiftKeyDown() then
PlaySound(SOUNDKIT.IG_MAINMENU_OPEN)
local screenHalf = GetScreenHalf()
QueueStatusMinimapButtonDropDown.point = screenHalf == "TOP" and "TOPLEFT" or "BOTTOMLEFT"
QueueStatusMinimapButtonDropDown.relativePoint = screenHalf == "TOP" and "BOTTOMLEFT" or "TOPLEFT"
ToggleDropDownMenu(1, nil, QueueStatusMinimapButtonDropDown, self, 0, 0)
else
for i = 1, #actions do
local action = actions[i]
if action.selected(button) then
if action.enabled() then
action.func()
end
break
end
end
end
end
local function OnEvent(self, event)
local queueType, queueStatus = GetQueueInfo()
if queueType and queueStatus ~= "queued" then
queueType = nil
end
if queueType == currentQueueType then
return
end
currentQueueType = queueType
currentIcon = queueType and LFG_EYE_TEXTURES[queueType] or LFG_EYE_TEXTURES.default
iconCoords = currentIcon.iconCoords
updateDelay = currentIcon.delay
ldbobj['icon'] = currentIcon.file
if queueType then
currentFrame = 1
self:SetScript("OnUpdate", UpdateIconCoords)
else
self:SetScript("OnUpdate", nil)
currentFrame = 1
ldbobj['iconCoords'] = iconCoords[1]
end
end
local function OnEvent2(self, event)
local mode, _ = GetLFGMode(LE_LFG_CATEGORY_LFD)
if(mode == 'queued') then
local hasData, _, tankNeeds, healerNeeds, dpsNeeds, _ = GetLFGQueueStats(LE_LFG_CATEGORY_LFD)
if(hasData) then
local newtext = ""
if(tankNeeds > 0) then
newtext = "T"
end
if(healerNeeds > 0) then
newtext = newtext .. "H"
end
if(dpsNeeds > 0) then
for i = 1, dpsNeeds do
newtext = newtext .. "D"
end
end
ldbobj['text'] = newtext == "" and ldbobj['label'] or format(("|cffFF3300%s|r"),newtext)
else
ldbobj['text'] = ldbobj['label']
end
else
ldbobj['text'] = ldbobj['label']
end
end
local function getPref(pref)
return db[pref[#pref]]
end
local function setPref(pref,value)
db[pref[#pref]] = value
end
local function init()
options = addon:InitConfig(childName, true, {
['type'] = "data source", -- 'data source | launcher'
['icon'] = "Interface\\LFGFrame\\LFG-Eye",
['text'] = L.LFG,
['iconCoords'] = LFG_EYE_TEXTURES.default.iconCoords[1],
['OnEnter'] = OnEnter,
['OnLeave'] = OnLeave,
['OnClick'] = OnClick,
}, getPref, setPref)
db = addon['db']['profile'][childName]
ldbobj = addon:GetLDB(childName)
local f = CreateFrame("Frame")
QueueStatusFrame_OnLoad(f)
f:SetScript("OnEvent", OnEvent)
f.StatusEntries = nil
UpdateIconCoords(f,0)
QueueStatusMinimapButton:Hide()
QueueStatusMinimapButton.Show = QueueStatusMinimapButton.Hide
addon:RegisterFunc({"LFG_UPDATE", "LFG_ROLE_CHECK_UPDATE", "LFG_PROPOSAL_UPDATE", "LFG_PROPOSAL_FAILED", "LFG_PROPOSAL_SUCCEEDED", "LFG_PROPOSAL_SHOW", "LFG_QUEUE_STATUS_UPDATE"}, 'OnEvent', OnEvent2)
end
addon:startup(name, childName, init, true, defaults)

6
license.txt Normal file
View File

@ -0,0 +1,6 @@
The following license excludes the libraries (Libs) included. See the libraries directory or website.
This AddOn is public domain. That means you can change it, rename it or paint it yellow.
My name (Rilgamon) is valid only for WoWInterface.com and curse.com.
If you use/offer this addon on another website please remove my name.
If you want to give me credit you can replace it with a link to my profile on WoWInterface.com.

14
locale_deDE.lua Normal file
View File

@ -0,0 +1,14 @@
local addonname, addon = ...
local name = "zz_LFG"
local L = LibStub("AceLocale-3.0"):NewLocale(name, "deDE", false)
if L then
L[name] = name
L[name..' Settings'] = name..' Settings'
L["Alt-Click to open the Raid Finder."] = "ALT-klicken, um Schlachtzugsbrowser zu öffnen."
L["Basic LFG button for your DataBroker display."] = "Einfache LFG-Schaltfläche für deine DataBroker-Anzeige."
L["Click to open the Dungeon Finder."] = "Klicken, um Dungeonbrowser zu öffnen."
L["Ctrl-Click to open the Premade Groups window."] = "STRG-klicken, um Organisierte-Gruppenfenster zu öffnen."
L["LFG"] = "LFG"
L["Middle-Click or Shift-Click to open the Pet Journal."] = "Mittleren klicken oder SHIFT-klicken, um Wildtierführer zu öffnen."
L["Right-Click to open the PVP window."] = "Rechtsklicken, um PvP-Fenster zu öffnen."
end

14
locale_enEN.lua Normal file
View File

@ -0,0 +1,14 @@
local addonname, addon = ...
local name = "zz_LFG"
local L = LibStub("AceLocale-3.0"):NewLocale(name, "enEN", true)
if L then
L[name] = name
L[name..' Settings'] = name..' Settings'
L["Alt-Click to open the Raid Finder."] = true
L["Basic LFG button for your DataBroker display."] = true
L["Click to open the Dungeon Finder."] = true
L["Ctrl-Click to open the Premade Groups window."] = true
L["LFG"] = true
L["Middle-Click or Shift-Click to open the Pet Journal."] = true
L["Right-Click to open the PVP window."] = true
end

14
locale_esES.lua Normal file
View File

@ -0,0 +1,14 @@
local addonname, addon = ...
local name = "zz_LFG"
local L = LibStub("AceLocale-3.0"):NewLocale(name, "esES", false)
if L then
L[name] = name
L[name..' Settings'] = name..' Settings'
L["Alt-Click to open the Raid Finder."] = "Alt+clic para mostrar el buscador de bandas."
L["Basic LFG button for your DataBroker display."] = "Botón básico de BDG para tu exhibición DataBroker."
L["Click to open the Dungeon Finder."] = "Haz clic para mostrar el buscador de mazmorras."
L["Ctrl-Click to open the Premade Groups window."] = "Ctrl+clic para mostrar el cuadro de grupos ya creados."
L["LFG"] = "BDG"
L["Middle-Click or Shift-Click to open the Pet Journal."] = "Haz clic media o Mayús+clic para mostrar la guía de mascotas."
L["Right-Click to open the PVP window."] = "Haz clic derecho para mostrar el cuadro de JcJ."
end

14
locale_esMX.lua Normal file
View File

@ -0,0 +1,14 @@
local addonname, addon = ...
local name = "zz_LFG"
local L = LibStub("AceLocale-3.0"):NewLocale(name, "esMX", false)
if L then
L[name] = name
L[name..' Settings'] = name..' Settings'
L["Alt-Click to open the Raid Finder."] = "Alt-clic para mostrar el buscador de bandas."
L["Basic LFG button for your DataBroker display."] = "Botón básico de BDG para tu exhibición DataBroker."
L["Click to open the Dungeon Finder."] = "Haz clic para mostrar el buscador de calabozos."
L["Ctrl-Click to open the Premade Groups window."] = "Ctrl+clic para mostrar el cuadro de grupos ya creados."
L["LFG"] = "BDG"
L["Middle-Click or Shift-Click to open the Pet Journal."] = "Haz clic media o Mayús+clic para mostrar la guía de mascotas."
L["Right-Click to open the PVP window."] = "Haz clic derecho para mostrar el cuadro de JcJ."
end

14
locale_frFR.lua Normal file
View File

@ -0,0 +1,14 @@
local addonname, addon = ...
local name = "zz_LFG"
local L = LibStub("AceLocale-3.0"):NewLocale(name, "frFR", false)
if L then
L[name] = name
L[name..' Settings'] = name..' Settings'
L["Alt-Click to open the Raid Finder."] = "Clic-alt pour afficher la recherche de raid."
L["Basic LFG button for your DataBroker display."] = "Bouton de base de RdG votre étalage DataBroker."
L["Click to open the Dungeon Finder."] = "Cliquer pour afficher la cadre des donjons."
L["Ctrl-Click to open the Premade Groups window."] = "Clic-ctrl pour afficher les groupes prédéfinis."
L["LFG"] = "RdG"
L["Middle-Click or Shift-Click to open the Pet Journal."] = "Clic milieu ou clic-maj pour afficher le codex des mascottes."
L["Right-Click to open the PVP window."] = "Clic droit pour afficher ou fermer le panneau de JcJ."
end

14
locale_itIT.lua Normal file
View File

@ -0,0 +1,14 @@
local addonname, addon = ...
local name = "zz_LFG"
local L = LibStub("AceLocale-3.0"):NewLocale(name, "itIT", false)
if L then
L[name] = name
L[name..' Settings'] = name..' Settings'
L["Alt-Click to open the Raid Finder."] = "Alt-clicca per mostrare il ricerca delle incursioni."
L["Basic LFG button for your DataBroker display."] = "Bottone di base di CG per vostra esposizione DataBroker."
L["Click to open the Dungeon Finder."] = "Clicca per mostrare il ricerca delle istanze."
L["Ctrl-Click to open the Premade Groups window."] = "Ctrl-clicca per mostrare il pannello delle gruppi organizzati."
L["LFG"] = "CG"
L["Middle-Click or Shift-Click to open the Pet Journal."] = "Clicca medio o Maiusc-clicca per mostrare il diario delle mascotte."
L["Right-Click to open the PVP window."] = "Clicca destro per mostrare l'interfaccia del PvP."
end

13
locale_koKR.lua Normal file
View File

@ -0,0 +1,13 @@
local addonname, addon = ...
local name = "zz_LFG"
local L = LibStub("AceLocale-3.0"):NewLocale(name, "koKR", false)
if L then
L[name] = name
L[name..' Settings'] = name..' Settings'
L["Alt-Click to open the Raid Finder."] = "ALT클릭 하면 공격대 찾기 창을 켜거나 끕니다."
L["Click to open the Dungeon Finder."] = "클릭 하면 던전 찾기 창을 켜거나 끕니다."
L["Ctrl-Click to open the Premade Groups window."] = "CTRL클릭 하면 파티 구성하기 창을 켜거나 끕니다."
L["LFG"] = "던전 찾기"
L["Middle-Click or Shift-Click to open the Pet Journal."] = "가운데클릭 또는 쉬프트클릭 하면 애완동물 도감 창을 켜거나 끕니다."
L["Right-Click to open the PVP window."] = "오른쪽클릭 하면 명예창 창을 켜거나 끕니다."
end

14
locale_ptBR.lua Normal file
View File

@ -0,0 +1,14 @@
local addonname, addon = ...
local name = "zz_LFG"
local L = LibStub("AceLocale-3.0"):NewLocale(name, "ptBR", false)
if L then
L[name] = name
L[name..' Settings'] = name..' Settings'
L["Alt-Click to open the Raid Finder."] = "Alt-clique para mostrar o localizador de raides."
L["Basic LFG button for your DataBroker display."] = "Botão básico de PG para seu exibição DataBroker."
L["Click to open the Dungeon Finder."] = "Clique para mostrar o localizador de masmorras."
L["Ctrl-Click to open the Premade Groups window."] = "Ctrl-clique para mostrar o localizador de cenários."
L["LFG"] = "PG"
L["Middle-Click or Shift-Click to open the Pet Journal."] = "Meio-clique ou shift-clique para mostrar o diário de mascotes."
L["Right-Click to open the PVP window."] = "Direito-clique para mostrar o quadro de JxJ."
end

13
locale_ruRU.lua Normal file
View File

@ -0,0 +1,13 @@
local addonname, addon = ...
local name = "zz_LFG"
local L = LibStub("AceLocale-3.0"):NewLocale(name, "ruRU", false)
if L then
L[name] = name
L[name..' Settings'] = name..' Settings'
L["Alt-Click to open the Raid Finder."] = "Alt-клик для открытия Поиск рейда."
L["Click to open the Dungeon Finder."] = "Щелкните для открытия Поиск подземелий."
L["Ctrl-Click to open the Premade Groups window."] = "Ctrl-клик для открытия Заранее собранные группы."
L["LFG"] = "ЛФГ"
L["Middle-Click or Shift-Click to open the Pet Journal."] = "Щелкните средней кнопкой мыши или Shift-клик для открытия Транспорт и питомцы."
L["Right-Click to open the PVP window."] = "Щелкните правой кнопкой мыши для открытия Окно PvP."
end

13
locale_zhCN.lua Normal file
View File

@ -0,0 +1,13 @@
local addonname, addon = ...
local name = "zz_LFG"
local L = LibStub("AceLocale-3.0"):NewLocale(name, "zhCN", false)
if L then
L[name] = name
L[name..' Settings'] = name..' Settings'
L["Alt-Click to open the Raid Finder."] = "Alt+左键点击进入团队浏览器窗口。"
L["Click to open the Dungeon Finder."] = "左键点击进入副本工具窗口。"
L["Ctrl-Click to open the Premade Groups window."] = "按住Ctrl键单击打开/关闭预创建队伍窗口"
L["LFG"] = "寻求组队"
L["Middle-Click or Shift-Click to open the Pet Journal."] = "中键点击或shift+左键点击打开宠物手册。"
L["Right-Click to open the PVP window."] = "右键点击打开PVP窗口。"
end

13
locale_zhTW.lua Normal file
View File

@ -0,0 +1,13 @@
local addonname, addon = ...
local name = "zz_LFG"
local L = LibStub("AceLocale-3.0"):NewLocale(name, "zhTW", false)
if L then
L[name] = name
L[name..' Settings'] = name..' Settings'
L["Alt-Click to open the Raid Finder."] = "Alt-點擊開啟/關閉團隊搜尋器視窗。"
L["Click to open the Dungeon Finder."] = "點擊開啟/關閉地城搜尋視窗。"
L["Ctrl-Click to open the Premade Groups window."] = "Ctrl-點擊開啟/關閉 預組隊伍視窗。"
L["LFG"] = "尋求組隊"
L["Middle-Click or Shift-Click to open the Pet Journal."] = "中鍵點擊或Shift+左鍵點擊開啟/關閉寵物手冊。"
L["Right-Click to open the PVP window."] = "右鍵點擊開啟/關閉PVP視窗。"
end

14
pack.xml Normal file
View File

@ -0,0 +1,14 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<Script file="locale_enEN.lua"/>
<Script file="locale_deDE.lua"/>
<Script file="locale_esES.lua"/>
<Script file="locale_esMX.lua"/>
<Script file="locale_frFR.lua"/>
<Script file="locale_itIT.lua"/>
<Script file="locale_koKR.lua"/>
<Script file="locale_ptBR.lua"/>
<Script file="locale_ruRU.lua"/>
<Script file="locale_zhCN.lua"/>
<Script file="locale_zhTW.lua"/>
<Script file="core.lua"/>
</Ui>

9
zz_LFG.toc Normal file
View File

@ -0,0 +1,9 @@
## Interface: 90002
## Title: zz LFG
## Notes: LFG Broker Tool
## Author: Rilgamon
## X-WoWI-ID: 25726
## SavedVariables: zz_LFGDB
## OptionalDeps: Ace3, BrokerPack, zzLibCommon
Common\common.xml
pack.xml