/trunk
local L = {} |
if(GetLocale() == 'deDE') then -- Katharsis |
L.NOSET = 'Kein set' |
L.TOOLTIP1 = 'Left-click to change your set' |
L.TOOLTIP2 = 'Right-click to open GearManager' |
L.HINT = {' ', '|cff00ff00Shift-click to update set|r', '|cff00ff00Ctrl-click to delete set|r'} |
L.TOOLTIP1 = 'Left-click to change your set' -- todo |
L.TOOLTIP2 = 'Right-click to open GearManager' -- todo |
L.HINT = {' ', '|cff00ff00Shift-click to update set|r', '|cff00ff00Ctrl-click to delete set|r'} -- todo |
elseif(GetLocale() == 'frFR') then -- Soeters |
L.NOSET = 'Pas de set' |
L.TOOLTIP1 = 'Left-click to change your set' |
L.TOOLTIP2 = 'Right-click to open GearManager' |
L.TOOLTIP1 = 'Left-click to change your set' -- todo |
L.TOOLTIP2 = 'Right-click to open GearManager' -- todo |
L.HINT = {' ', '|cff00ff00Maj-clic pour mettre à jour le set|r', '|cff00ff00Ctrl-clic pour supprimer le set|r'} |
elseif(GetLocale() == 'zhCN') then -- yleaf |
L.NOSET = 'æ å¥è£ ' |
L.TOOLTIP1 = 'Left-click to change your set' |
L.TOOLTIP2 = 'Right-click to open GearManager' |
L.TOOLTIP1 = 'Left-click to change your set' -- todo |
L.TOOLTIP2 = 'Right-click to open GearManager' -- todo |
L.HINT = {' ', '|cff00ff00Shiftç¹å»è¦çå¥è£ |r', '|cff00ff00Ctrlç¹å»å é¤å¥è£ |r'} |
elseif(GetLocale() == 'zhTW') then -- yleaf |
L.NOSET = 'ç¡å¥è£' |
L.TOOLTIP1 = 'Left-click to change your set' |
L.TOOLTIP2 = 'Right-click to open GearManager' |
L.TOOLTIP1 = 'Left-click to change your set' -- todo |
L.TOOLTIP2 = 'Right-click to open GearManager' -- todo |
L.HINT = {' ', '|cff00ff00Shifté»æè¦èå¥è£|r', '|cff00ff00Ctrlé»æåªé¤å¥è£|r'} |
elseif(GetLocale() == 'koKR') then -- mrgyver |
L.NOSET = 'ì¸í¸ ìì' |
L.TOOLTIP1 = 'Left-click to change your set' |
L.TOOLTIP2 = 'Right-click to open GearManager' |
L.HINT = {' ', '|cff00ff00Shift-click to update set|r', '|cff00ff00Ctrl-click to delete set|r'} |
L.TOOLTIP1 = 'ì¢-í´ë¦ ì¸í¸ ë³ê²½' |
L.TOOLTIP2 = 'ì°-í´ë¦ ì¥ë¹ ê´ë¦¬ì°½ ì´ê¸°' |
L.HINT = {' ', '|cff00ff00Shift-í´ë¦ íë©´ ì¸í¸ ì ë°ì´í¸|r', '|cff00ff00Ctrl-í´ë¦ íë©´ ì¸í¸ ìì |r'} |
else |
L.NOSET = 'No set' |
L.TOOLTIP1 = 'Left-click to change your set' |
end |
local BEQ = CreateFrame('Frame', 'Broker_EquipmentMenu', UIParent, 'UIDropDownMenuTemplate') |
BEQ:SetScript('OnEvent', function(self, event, ...) self[event](self, event, ...) end) |
local failIcon = [=[Interface\Icons\ability_seal]=] |
local defaultIcon = [=[Interface\PaperDollInfoFrame\UI-EquipmentManager-Toggle]=] |
local menu = {} |
local pendingUpdate = true |
local addon = CreateFrame('Frame', 'Broker_EquipmentMenu', UIParent, 'UIDropDownMenuTemplate') |
local broker = LibStub('LibDataBroker-1.1'):NewDataObject('Broker_Equipment', { |
type = 'data source', |
text = L.NOSET, |
icon = defaultIcon, |
icon = [=[Interface\PaperDollInfoFrame\UI-EquipmentManager-Toggle]=], |
iconCoords = {0.065, 0.935, 0.065, 0.935} |
}) |
dialog.data = name |
elseif(not InCombatLockdown()) then |
EquipmentManager_EquipSet(name) |
Broker_EquipmentDB.text = name |
Broker_EquipmentDB.icon = icon |
end |
end |
local function updateInfo(name, icon) |
broker.text = name |
broker.icon = icon |
Broker_EquipmentDB.text = name |
Broker_EquipmentDB.icon = icon |
end |
local function updateMenu() |
pendingUpdate = nil |
menu = wipe(menu) |
end |
else |
if(pendingUpdate) then updateMenu() end |
EasyMenu(menu, BEQ, self, 0, 0, 'MENU') |
EasyMenu(menu, addon, self, 0, 0, 'MENU') |
if(GameTooltip:GetOwner() == self) then GameTooltip:Hide() end |
end |
self:AddLine(L.TOOLTIP2) |
end |
function BEQ:ADDON_LOADED(event, addon) |
function addon:ADDON_LOADED(event, addon) |
if(addon ~= 'Broker_Equipment') then return end |
Broker_EquipmentDB = Broker_EquipmentDB or {text = L.NOSET, icon = broker.defaultIcon} |
Broker_EquipmentDB = Broker_EquipmentDB or {text = L.NOSET, icon = broker.icon} |
broker.text = Broker_EquipmentDB.text |
broker.icon = Broker_EquipmentDB.icon |
self:RegisterEvent('EQUIPMENT_SETS_CHANGED') |
self:RegisterEvent('VARIABLES_LOADED') |
self:UnregisterEvent(event) |
end |
function BEQ:EQUIPMENT_SETS_CHANGED() |
function addon:EQUIPMENT_SETS_CHANGED() |
pendingUpdate = true |
end |
function BEQ:VARIABLES_LOADED() |
function addon:VARIABLES_LOADED() |
SetCVar('equipmentManager', 1) |
GearManagerToggleButton:Show() |
end |
hooksecurefunc('EquipmentManager_EquipSet', function(name) |
if(name) then |
local icon = GetEquipmentSetInfoByName(name) |
-- Blizzard has some odd bug not always returning the whole icon location string |
-- This is a temporary fix around it |
icon = icon:sub(1, 9) ~= 'Interface' and [=[Interface\Icons\]=] .. icon or icon |
broker.text = name |
broker.icon = icon or failIcon |
else |
broker.text = L.NOSET |
broker.icon = defaultIcon |
hooksecurefunc('EquipmentManager_EquipSet', function(funcName) |
for index = 1, GetNumEquipmentSets() do |
local name, icon = GetEquipmentSetInfo(index) |
return name == funcName and updateInfo(name, icon) |
end |
end) |
BEQ:RegisterEvent('ADDON_LOADED') |
BEQ:RegisterEvent('EQUIPMENT_SETS_CHANGED') |
BEQ:RegisterEvent('VARIABLES_LOADED') |