--[[ |
|
Copyright (c) 2009 Adrian L Lange <adrianlund@gmail.com> |
All rights reserved. |
|
You're allowed to use this addon, free of monetary charge, |
but you are not allowed to modify, alter, or redistribute |
this addon without express, written permission of the author. |
|
--]] |
|
ChulloDB = ChulloDB or {helm = {}, cloak = {}, last = GetEquipmentSetInfo(1) or 'none'} |
local ShowCloak, ShowHelm, noop = ShowCloak, ShowHelm, function() end |
|
_G.ShowCloak, _G.ShowHelm = noop, noop |
for k, v in next, {InterfaceOptionsDisplayPanelShowCloak, InterfaceOptionsDisplayPanelShowHelm} do v:Disable(); v.Enable = noop end |
|
|
local function onClick(self) |
if(self.name == 'Helm') then |
ShowHelm(not ShowingHelm()) |
ChulloDB.helm[ChulloDB.last] = not ShowingHelm() |
else |
ShowCloak(not ShowingCloak()) |
ChulloDB.cloak[ChulloDB.last] = not ShowingCloak() |
end |
end |
|
local function create(name, parent) |
local check = CreateFrame('CheckButton', 'Chullo'..name, PaperDollFrame, 'OptionsCheckButtonTemplate') |
check:SetWidth(22) |
check:SetHeight(22) |
check:SetPoint('TOPRIGHT', anchor, 16, 5) |
check:SetScript('OnClick', onClick) |
check:SetScript('OnEnter', function(self) |
GameTooltip:SetOwner(self, 'ANCHOR_RIGHT') |
GameTooltip:SetText(_G['OPTION_TOOLTIP_SHOW_'..string.upper(name)]) |
end) |
check:SetScript('OnLeave', GameTooltip_Hide) |
check:SetToplevel() |
check.name = name |
return check |
end |
|
hooksecurefunc('EquipmentManager_EquipSet', function(name) |
if(name and ChulloDB.last ~= name) then |
ChulloDB.last = name |
|
helm:SetChecked(ChulloDB.helm[name]) |
ShowHelm(ChulloDB.helm[name]) |
|
cloak:SetChecked(ChulloDB.cloak[name]) |
ShowCloak(ChulloDB.cloak[name]) |
end |
end) |
|
create('Helm', CharacterHeadSlot):SetChecked(ShowingHelm()) |
create('Cloak', CharacterBackSlot):SetChecked(ShowingCloak()) |