From 5931aea9f747a1203828bf3c08055b907ca1b514 Mon Sep 17 00:00:00 2001 From: Repooc Date: Mon, 24 Feb 2014 17:00:53 -0500 Subject: [PATCH] Some characterframe modifications. --- ElvUI_SLE/config/profile.lua | 3 +- .../modules/characterframe/characterframe.lua | 151 +++++++++++--------- ElvUI_SLE/modules/characterframe/options.lua | 22 +-- 3 files changed, 96 insertions(+), 80 deletions(-) diff --git a/ElvUI_SLE/config/profile.lua b/ElvUI_SLE/config/profile.lua index 87bcbe3..3e25cca 100755 --- a/ElvUI_SLE/config/profile.lua +++ b/ElvUI_SLE/config/profile.lua @@ -61,7 +61,8 @@ P['sle'] = { --Character Frame Options ['characterframeoptions'] = { - ['missingnotice'] = true, + ['shownormalgradient'] = true, + ['showerrorgradient'] = true, ['showimage'] = true, ['itemlevel'] = { ['enable'] = true, diff --git a/ElvUI_SLE/modules/characterframe/characterframe.lua b/ElvUI_SLE/modules/characterframe/characterframe.lua index b08eb7c..a55c250 100755 --- a/ElvUI_SLE/modules/characterframe/characterframe.lua +++ b/ElvUI_SLE/modules/characterframe/characterframe.lua @@ -152,16 +152,14 @@ local function CreateArmoryFrame(self) Slot.Socket2:Point(Slot.Direction, Slot.Socket1, Slot.Direction == 'LEFT' and 'RIGHT' or 'LEFT', Slot.Direction == 'LEFT' and 1 or -1, 0) Slot.Socket3:Point(Slot.Direction, Slot.Socket2, Slot.Direction == 'LEFT' and 'RIGHT' or 'LEFT', Slot.Direction == 'LEFT' and 1 or -1, 0) - --if E.db.sle.characterframeoptions.itemgem.gemwarning ~= false then - Slot.SocketWarning = CreateFrame('Button', nil, Slot) - Slot.SocketWarning:Size(E.db.sle.characterframeoptions.itemgem.warningSize) - Slot.SocketWarning:RegisterForClicks('AnyUp') - Slot.SocketWarning.Texture = Slot.SocketWarning:CreateTexture(nil, 'OVERLAY') - Slot.SocketWarning.Texture:SetInside() - Slot.SocketWarning.Texture:SetTexture('Interface\\AddOns\\ElvUI_SLE\\media\\textures\\Warning-Small.tga') - Slot.SocketWarning:SetScript('OnEnter', C.CommonScript.OnEnter) - Slot.SocketWarning:SetScript('OnLeave', C.CommonScript.OnLeave) - --end + Slot.SocketWarning = CreateFrame('Button', nil, Slot) + Slot.SocketWarning:Size(E.db.sle.characterframeoptions.itemgem.warningSize) + Slot.SocketWarning:RegisterForClicks('AnyUp') + Slot.SocketWarning.Texture = Slot.SocketWarning:CreateTexture(nil, 'OVERLAY') + Slot.SocketWarning.Texture:SetInside() + Slot.SocketWarning.Texture:SetTexture('Interface\\AddOns\\ElvUI_SLE\\media\\textures\\Warning-Small.tga') + Slot.SocketWarning:SetScript('OnEnter', C.CommonScript.OnEnter) + Slot.SocketWarning:SetScript('OnLeave', C.CommonScript.OnLeave) end self[slotName] = Slot @@ -183,6 +181,16 @@ local function CreateArmoryFrame(self) CreateArmoryFrame = nil end +function CFO:ChangeGradiantVisibility() + for _, slotName in pairs(C.GearList) do + if E.db.sle.characterframeoptions.shownormalgradient ~= false then + f[slotName].Gradation:Show() + else + f[slotName].Gradation:Hide() + end + end +end + function CFO:ResizeErrorIcon() for _, slotName in pairs(C.GearList) do if slotName ~= 'ShirtSlot' and slotName ~= 'TabardSlot' then @@ -351,91 +359,98 @@ function CFO:ArmoryFrame_DataSetting() end -- Check Error - if E.db.sle.KnightFrame_Armory.NoticeMissing ~= false then - if (not IsEnchanted and C.EnchantableSlots[slotName]) or ((slotName == 'Finger0Slot' or slotName == 'Finger1Slot') and CFO.PlayerProfession.Enchanting and CFO.PlayerProfession.Enchanting >= 550 and not IsEnchanted) then - ErrorDetected = true + if (not IsEnchanted and C.EnchantableSlots[slotName]) or ((slotName == 'Finger0Slot' or slotName == 'Finger1Slot') and CFO.PlayerProfession.Enchanting and CFO.PlayerProfession.Enchanting >= 550 and not IsEnchanted) then + ErrorDetected = true + if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then Slot.EnchantWarning:Show() Slot.ItemEnchant:SetText('|cffff0000'..L['Not Enchanted']) - elseif CFO.PlayerProfession.Engineering and ((slotName == 'BackSlot' and CFO.PlayerProfession.Engineering >= 380) or (slotName == 'HandsSlot' and CFO.PlayerProfession.Engineering >= 400) or (slotName == 'WaistSlot' and CFO.PlayerProfession.Engineering >= 380)) and not UsableEffect then - ErrorDetected = true + end + elseif CFO.PlayerProfession.Engineering and ((slotName == 'BackSlot' and CFO.PlayerProfession.Engineering >= 380) or (slotName == 'HandsSlot' and CFO.PlayerProfession.Engineering >= 400) or (slotName == 'WaistSlot' and CFO.PlayerProfession.Engineering >= 380)) and not UsableEffect then + ErrorDetected = true + if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then Slot.EnchantWarning:Show() Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110403)..'|r : '..L['Missing Tinkers'] - elseif slotName == 'ShoulderSlot' and CFO.PlayerProfession.Inscription and C.ItemEnchant_Profession_Inscription and CFO.PlayerProfession.Inscription >= C.ItemEnchant_Profession_Inscription.NeedLevel and not C.ItemEnchant_Profession_Inscription[enchantID] then - ErrorDetected = true + end + elseif slotName == 'ShoulderSlot' and CFO.PlayerProfession.Inscription and C.ItemEnchant_Profession_Inscription and CFO.PlayerProfession.Inscription >= C.ItemEnchant_Profession_Inscription.NeedLevel and not C.ItemEnchant_Profession_Inscription[enchantID] then + ErrorDetected = true + if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then Slot.EnchantWarning:Show() Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110400)..'|r : '..L['This is not profession only.'] - elseif slotName == 'WristSlot' and CFO.PlayerProfession.LeatherWorking and C.ItemEnchant_Profession_LeatherWorking and CFO.PlayerProfession.LeatherWorking >= C.ItemEnchant_Profession_LeatherWorking.NeedLevel and not C.ItemEnchant_Profession_LeatherWorking[enchantID] then - ErrorDetected = true + end + elseif slotName == 'WristSlot' and CFO.PlayerProfession.LeatherWorking and C.ItemEnchant_Profession_LeatherWorking and CFO.PlayerProfession.LeatherWorking >= C.ItemEnchant_Profession_LeatherWorking.NeedLevel and not C.ItemEnchant_Profession_LeatherWorking[enchantID] then + ErrorDetected = true + if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then Slot.EnchantWarning:Show() Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110423)..'|r : '..L['This is not profession only.'] - elseif slotName == 'BackSlot' and CFO.PlayerProfession.Tailoring and C.ItemEnchant_Profession_Tailoring and CFO.PlayerProfession.Tailoring >= C.ItemEnchant_Profession_Tailoring.NeedLevel and not C.ItemEnchant_Profession_Tailoring[enchantID] then - ErrorDetected = true + end + elseif slotName == 'BackSlot' and CFO.PlayerProfession.Tailoring and C.ItemEnchant_Profession_Tailoring and CFO.PlayerProfession.Tailoring >= C.ItemEnchant_Profession_Tailoring.NeedLevel and not C.ItemEnchant_Profession_Tailoring[enchantID] then + ErrorDetected = true + if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then Slot.EnchantWarning:Show() Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110426)..'|r : '..L['This is not profession only.'] end end - if E.db.sle.characterframeoptions.itemgem.showwarning ~= false then - if GemTotal_1 > GemTotal_2 or GemTotal_1 > GemCount then - ErrorDetected = true + if GemTotal_1 > GemTotal_2 or GemTotal_1 > GemCount then + ErrorDetected = true + if E.db.sle.characterframeoptions.itemgem.showwarning ~= false then Slot.SocketWarning:Show() + end - if GemTotal_1 > GemTotal_2 then - if slotName == 'WaistSlot' then - if TrueItemLevel < 300 then - _, Slot.SocketWarning.Link = GetItemInfo(41611) - elseif TrueItemLevel < 417 then - _, Slot.SocketWarning.Link = GetItemInfo(55054) - else - _, Slot.SocketWarning.Link = GetItemInfo(90046) - end - elseif slotName == 'HandsSlot' then - Slot.SocketWarning.Link = GetSpellLink(114112) - elseif slotName == 'WristSlot' then - Slot.SocketWarning.Link = GetSpellLink(113263) + if GemTotal_1 > GemTotal_2 then + if slotName == 'WaistSlot' then + if TrueItemLevel < 300 then + _, Slot.SocketWarning.Link = GetItemInfo(41611) + elseif TrueItemLevel < 417 then + _, Slot.SocketWarning.Link = GetItemInfo(55054) + else + _, Slot.SocketWarning.Link = GetItemInfo(90046) end + elseif slotName == 'HandsSlot' then + Slot.SocketWarning.Link = GetSpellLink(114112) + elseif slotName == 'WristSlot' then + Slot.SocketWarning.Link = GetSpellLink(113263) + end - if slotName == 'WaistSlot' then - Slot.SocketWarning.Message = L['Missing Buckle'] - elseif slotName == 'WristSlot' or slotName == 'HandsSlot' then - Slot.SocketWarning.Message = '|cff71d5ff'..GetSpellInfo(110396)..'|r : '..L['Missing Socket'] - end - else - Slot.SocketWarning.Message = '|cffff5678'..(GemTotal_1 - GemCount)..'|r '..L['Empty Socket'] + if slotName == 'WaistSlot' then + Slot.SocketWarning.Message = L['Missing Buckle'] + elseif slotName == 'WristSlot' or slotName == 'HandsSlot' then + Slot.SocketWarning.Message = '|cff71d5ff'..GetSpellInfo(110396)..'|r : '..L['Missing Socket'] end + else + Slot.SocketWarning.Message = '|cffff5678'..(GemTotal_1 - GemCount)..'|r '..L['Empty Socket'] + end - if GemTotal_1 ~= GemTotal_2 and slotName == 'WaistSlot' then - Slot.SocketWarning:SetScript('OnClick', function(self, button) - local itemName, itemLink - - if TrueItemLevel < 300 then - itemName, itemLink = GetItemInfo(41611) - elseif TrueItemLevel < 417 then - itemName, itemLink = GetItemInfo(55054) - else - itemName, itemLink = GetItemInfo(90046) - end + if GemTotal_1 ~= GemTotal_2 and slotName == 'WaistSlot' then + Slot.SocketWarning:SetScript('OnClick', function(self, button) + local itemName, itemLink + + if TrueItemLevel < 300 then + itemName, itemLink = GetItemInfo(41611) + elseif TrueItemLevel < 417 then + itemName, itemLink = GetItemInfo(55054) + else + itemName, itemLink = GetItemInfo(90046) + end - if HandleModifiedItemClick(itemLink) then - elseif IsShiftKeyDown() then - if button == 'RightButton' then - SocketInventoryItem(Slot.ID) - elseif BrowseName and BrowseName:IsVisible() then - AuctionFrameBrowse_Reset(BrowseResetButton) - BrowseName:SetText(itemName) - BrowseName:SetFocus() - end + if HandleModifiedItemClick(itemLink) then + elseif IsShiftKeyDown() then + if button == 'RightButton' then + SocketInventoryItem(Slot.ID) + elseif BrowseName and BrowseName:IsVisible() then + AuctionFrameBrowse_Reset(BrowseResetButton) + BrowseName:SetText(itemName) + BrowseName:SetFocus() end - end) - end + end + end) end end end -- Change Gradation - --if ErrorDetected and E.db.sle.KnightFrame_Armory.NoticeMissing ~= false then - if ErrorDetected and E.db.sle.characterframeoptions.missingnotice ~= false then + if ErrorDetected and E.db.sle.characterframeoptions.showerrorgradient ~= false then if Slot.Direction == 'LEFT' then Slot.Gradation:SetTexCoord(0, .5, .5, 1) else diff --git a/ElvUI_SLE/modules/characterframe/options.lua b/ElvUI_SLE/modules/characterframe/options.lua index 93a5963..ebda251 100755 --- a/ElvUI_SLE/modules/characterframe/options.lua +++ b/ElvUI_SLE/modules/characterframe/options.lua @@ -32,22 +32,22 @@ local function configTable() guiInline = true, disabled = function() return not E.private.sle.characterframeoptions.enable end, args = { - equipmentgradient = { + normalgradient = { order = 1, type = 'toggle', - name = L["Show Equipment Gradient"], - desc = L["Shows gradient effect for equipment slots."], - get = function(info) return E.db.sle.characterframeoptions.equipmentgradient end, - set = function(info, value) E.db.sle.characterframeoptions.equipmentgradient = value; CFO:ArmoryFrame_DataSetting(); end, + name = L["Show Equipment Gradients"], + desc = L["Shows gradient effect for all equipment slots."], + get = function(info) return E.db.sle.characterframeoptions.shownormalgradient end, + set = function(info, value) E.db.sle.characterframeoptions.shownormalgradient = value; CFO:ChangeGradiantVisibility(); end, }, - missingnotice = { + errorgradient = { order = 2, type = 'toggle', - name = L["Show Error Highlight"], + name = L["Show Error Gradients"], desc = L["Highlights equipment slot if an error has been found."], - --disabled = function() return not E.private.sle.characterframeoptions.enable or not E.db.sle.characterframeoptions.equipmentgradient end, - get = function(info) return E.db.sle.characterframeoptions.missingnotice end, - set = function(info, value) E.db.sle.characterframeoptions.missingnotice = value; CFO:ArmoryFrame_DataSetting(); end, + disabled = function() return not E.private.sle.characterframeoptions.enable or not E.db.sle.characterframeoptions.shownormalgradient end, + get = function(info) return E.db.sle.characterframeoptions.showerrorgradient end, + set = function(info, value) E.db.sle.characterframeoptions.showerrorgradient = value; CFO:ArmoryFrame_DataSetting(); end, }, bgimage = { order = 3, @@ -252,7 +252,7 @@ local function configTable() type = "toggle", name = L["Show Enchant Warning"], get = function(info) return E.db.sle.characterframeoptions.itemenchant.showwarning end, - set = function(info, value) E.db.sle.characterframeoptions.itemenchant.showwarning = value; --[[CFO:ArmoryFrame_DataSetting();]] end, + set = function(info, value) E.db.sle.characterframeoptions.itemenchant.showwarning = value; CFO:ArmoryFrame_DataSetting(); end, }, warningsize = { order = 2, -- 1.7.9.5