/
elseif(GetLocale() == 'zhTW') then |
L.TOOLTIP = 'é»æé¸æå¥è£' |
L.NOSET = 'ç¡å¥è£' |
elseif(GetLocale() == 'koKR') then |
L.TOOLTIP = 'ë¹ì ì ì¸í¸ë¥¼ ë³ê²½íë ¤ë©´ ì¬ê¸°ë¥¼ í´ë¦íì¸ì.' |
L.NOSET = 'ì¸í¸ ìì' |
else |
L.TOOLTIP = 'Click here to change your set' |
L.NOSET = 'No set' |
iconCoords = {0.065, 0.935, 0.065, 0.935} |
}) |
-- borrowed from tekkub's EquipSetUpdater |
local function GetTextureIndex(tex) |
tex = tex:lower() |
local numicons = GetNumMacroIcons() |
for i=INVSLOT_FIRST_EQUIPPED,INVSLOT_LAST_EQUIPPED do if GetInventoryItemTexture("player", i) then numicons = numicons + 1 end end |
for i=1,numicons do |
local texture, index = GetEquipmentSetIconInfo(i) |
if texture:lower() == tex then return index end |
end |
end |
local function equipSet(name, icon) |
EquipmentManager_EquipSet(name) |
local function handleClick(name, icon) |
if(IsShiftKeyDown() and IsAltKeyDown()) then |
local dialog = StaticPopup_Show('CONFIRM_DELETE_EQUIPMENT_SET', name) |
dialog.data = name |
elseif(IsControlKeyDown() and IsAltKeyDown()) then |
local dialog = StaticPopup_Show('CONFIRM_OVERWRITE_EQUIPMENT_SET', name) |
dialog.data = name |
dialog.selectedIcon = GetTextureIndex(icon) |
elseif(EquipmentSetContainsLockedItems(name) or UnitOnTaxi('player') or UnitCastingInfo('player')) then |
return |
else |
EquipmentManager_EquipSet(name) |
if(InCombatLockdown()) then |
pendingName = name |
broker.text = '|cffff0000'..name |
else |
broker.text = name |
if(InCombatLockdown()) then |
pendingName = name |
broker.text = '|cffff0000'..name |
else |
broker.text = name |
end |
broker.icon = icon |
Broker_EquipmentDB.text = name |
Broker_EquipmentDB.icon = icon |
end |
broker.icon = icon |
Broker_EquipmentDB.text = name |
Broker_EquipmentDB.icon = icon |
end |
local function initDropDown() |
info.index = index |
info.text = name |
info.icon = icon |
info.func = function() equipSet(name, icon) end |
info.func = function() handleClick(name, icon) end |
menuList[index] = info |
end |
end |
function broker:OnClick(button) |
if(button == 'RightButton') then |
-- open the frame |
ToggleCharacter('PaperDollFrame') |
if(GameTooltip:GetOwner() == self) then |
GameTooltip:Hide() |
end |
if(PaperDollFrame:IsShown()) then |
end |
-- now click the damn button |
else |
if(GameTooltip:GetOwner() == self) then |
GameTooltip:Hide() |
end |
if(pendingUpdate) then |
createDropDown() |
end |
if(pendingUpdate) then |
createDropDown() |
end |
ToggleDropDownMenu(1, nil, addon, self, 0, 0) |
end |
ToggleDropDownMenu(1, nil, addon, self, 0, 0) |
end |
function broker:OnTooltipShow() |
self:AddLine(L.TOOLTIP) |
end |
hooksecurefunc('EquipmentManager_EquipSet', function(name) |
if(EquipmentSetContainsLockedItems(name) or UnitOnTaxi('player') or UnitCastingInfo('player')) then return end |
if(name == broker.text) then return end |
if(name) then |
local icon = GetEquipmentSetInfoByName(name) |
broker.text = name |
broker.icon = icon:match('Interface') and icon or [=[Interface\Icons\]=] .. icon |
else |
broker.text = L.NOSET |
broker.icon = [=[Interface\PaperDollInfoFrame\UI-EquipmentManager-Toggle]=] |
end |
end) |
addon:RegisterEvent('ADDON_LOADED') |
addon:RegisterEvent('PLAYER_REGEN_ENABLED') |