update & cleanup

This commit is contained in:
Crum
2017-12-15 00:18:08 -06:00
parent 995b19530c
commit f1a66d8761
4 changed files with 75 additions and 71 deletions
@@ -3,16 +3,16 @@ local S = E:GetModule("Skins");
--Cache global variables --Cache global variables
--Lua functions --Lua functions
local _G = getfenv() local _G = _G
local unpack = unpack local unpack = unpack
local select = select local select = select
local find = string.find local find = string.find
--WoW API / Variables --WoW API / Variables
local hooksecurefunc = hooksecurefunc
local GetItemInfo = GetItemInfo local GetItemInfo = GetItemInfo
local GetItemQualityColor = GetItemQualityColor local GetItemQualityColor = GetItemQualityColor
local GetCraftReagentInfo = GetCraftReagentInfo local GetCraftReagentInfo = GetCraftReagentInfo
local GetCraftItemLink = GetCraftItemLink local GetCraftItemLink = GetCraftItemLink
local hooksecurefunc = hooksecurefunc
local function LoadSkin() local function LoadSkin()
-- if E.private.skins.blizzard.enable ~= true or not E.private.skins.blizzard.craft ~= true then return end -- if E.private.skins.blizzard.enable ~= true or not E.private.skins.blizzard.craft ~= true then return end
@@ -80,40 +80,46 @@ local function LoadSkin()
CraftIcon:SetPoint("TOPLEFT", 4, -3) CraftIcon:SetPoint("TOPLEFT", 4, -3)
local skillLink = GetCraftItemLink(id) local skillLink = GetCraftItemLink(id)
local skillEnchantID = select(3, strfind(skillLink, "enchant:(%d+)")) if skillLink then
local skillItemID = select(3, strfind(skillLink, "item:(%d+)")) local skillEnchantID = select(3, find(skillLink, "enchant:(%d+)"))
local skillID = skillEnchantID or skillItemID local skillItemID = select(3, find(skillLink, "item:(%d+)"))
if skillEnchantID or skillItemID then local skillID = skillEnchantID or skillItemID
CraftRequirements:SetTextColor(1, 0.80, 0.10) CraftRequirements:SetTextColor(1, 0.80, 0.10)
local quality = select(3, GetItemInfo(skillID)) if skillID then
if quality and quality > 1 then local quality = select(3, GetItemInfo(skillID))
CraftIcon:SetBackdropBorderColor(GetItemQualityColor(quality)) if quality and quality > 1 then
CraftName:SetTextColor(GetItemQualityColor(quality)) CraftIcon:SetBackdropBorderColor(GetItemQualityColor(quality))
else CraftName:SetTextColor(GetItemQualityColor(quality))
CraftIcon:SetBackdropBorderColor(unpack(E["media"].bordercolor)) else
CraftName:SetTextColor(1, 1, 1) CraftIcon:SetBackdropBorderColor(unpack(E["media"].bordercolor))
CraftName:SetTextColor(1, 1, 1)
end
end end
end end
local numReagents = GetCraftNumReagents(id) local numReagents = GetCraftNumReagents(id)
for i = 1, numReagents, 1 do for i = 1, numReagents, 1 do
local reagentName, reagentTexture, reagentCount, playerReagentCount = GetCraftReagentInfo(id, i) local _, _, reagentCount, playerReagentCount = GetCraftReagentInfo(id, i)
local reagentLink = GetCraftReagentItemLink(id, i) local reagentLink = GetCraftReagentItemLink(id, i)
local reagentID = select(3, strfind(reagentLink, "item:(%d+)"))
local icon = _G["CraftReagent" .. i .. "IconTexture"] local icon = _G["CraftReagent" .. i .. "IconTexture"]
local name = _G["CraftReagent" .. i .. "Name"] local name = _G["CraftReagent" .. i .. "Name"]
if reagentID then if reagentLink then
local quality = select(3, GetItemInfo(reagentID)) local reagentEnchantID = select(3, find(reagentLink, "item:(%d+)"))
if quality and quality > 1 then local reagentItemID = select(3, find(reagentLink, "item:(%d+)"))
icon.backdrop:SetBackdropBorderColor(GetItemQualityColor(quality)) local reagentID = reagentEnchantID or reagentItemID
if playerReagentCount < reagentCount then if reagentID then
name:SetTextColor(0.5, 0.5, 0.5) local quality = select(3, GetItemInfo(reagentID))
if quality and quality > 1 then
icon.backdrop:SetBackdropBorderColor(GetItemQualityColor(quality))
if playerReagentCount < reagentCount then
name:SetTextColor(0.5, 0.5, 0.5)
else
name:SetTextColor(GetItemQualityColor(quality))
end
else else
name:SetTextColor(GetItemQualityColor(quality)) icon.backdrop:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end end
else
icon.backdrop:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end end
end end
end end
@@ -3,16 +3,16 @@ local S = E:GetModule("Skins");
--Cache global variables --Cache global variables
--Lua functions --Lua functions
local _G = getfenv() local _G = _G
local unpack, select = unpack, select local unpack = unpack
local select = select
--WoW API / Variables --WoW API / Variables
local hooksecurefunc = hooksecurefunc
local GetInboxItem = GetInboxItem local GetInboxItem = GetInboxItem
local GetItemInfo = GetItemInfo local GetItemInfo = GetItemInfo
local GetItemQualityColor = GetItemQualityColor local GetItemQualityColor = GetItemQualityColor
local GetSendMailItem = GetSendMailItem local GetSendMailItem = GetSendMailItem
local hooksecurefunc = hooksecurefunc
local INBOXITEMS_TO_DISPLAY = INBOXITEMS_TO_DISPLAY local INBOXITEMS_TO_DISPLAY = INBOXITEMS_TO_DISPLAY
local ATTACHMENTS_MAX_RECEIVE = ATTACHMENTS_MAX_RECEIVE
local function LoadSkin() local function LoadSkin()
-- if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.mail ~= true then return end -- if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.mail ~= true then return end
@@ -3,11 +3,13 @@ local S = E:GetModule("Skins");
--Cache global variables --Cache global variables
--Lua functions --Lua functions
local _G = getfenv() local _G = _G
local pairs = pairs local pairs = pairs
local unpack = unpack local unpack = unpack
local find = string.find local find = string.find
--WoW API / Variables --WoW API / Variables
local GetItemInfo = GetItemInfo
local GetItemQualityColor = GetItemQualityColor
local hooksecurefunc = hooksecurefunc local hooksecurefunc = hooksecurefunc
local function LoadSkin() local function LoadSkin()
@@ -61,7 +63,6 @@ local function LoadSkin()
item:SetFrameLevel(item:GetFrameLevel() + 2) item:SetFrameLevel(item:GetFrameLevel() + 2)
icon:SetDrawLayer("OVERLAY") icon:SetDrawLayer("OVERLAY")
-- icon:Size(icon:GetWidth() -(E.Spacing*2), icon:GetHeight() -(E.Spacing*2))
icon:SetWidth(icon:GetWidth() -(E.Spacing*2)) icon:SetWidth(icon:GetWidth() -(E.Spacing*2))
icon:SetHeight(icon:GetHeight() -(E.Spacing*2)) icon:SetHeight(icon:GetHeight() -(E.Spacing*2))
icon:SetPoint("TOPLEFT", E.Border, -E.Border) icon:SetPoint("TOPLEFT", E.Border, -E.Border)
@@ -83,7 +84,6 @@ local function LoadSkin()
item:SetFrameLevel(item:GetFrameLevel() + 2) item:SetFrameLevel(item:GetFrameLevel() + 2)
icon:SetDrawLayer("OVERLAY") icon:SetDrawLayer("OVERLAY")
-- icon:Size(icon:GetWidth() -(E.Spacing*2), icon:GetHeight() -(E.Spacing*2))
icon:SetWidth(icon:GetWidth() -(E.Spacing*2)) icon:SetWidth(icon:GetWidth() -(E.Spacing*2))
icon:SetHeight(icon:GetHeight() -(E.Spacing*2)) icon:SetHeight(icon:GetHeight() -(E.Spacing*2))
icon:SetPoint("TOPLEFT", E.Border, -E.Border) icon:SetPoint("TOPLEFT", E.Border, -E.Border)
@@ -105,7 +105,6 @@ local function LoadSkin()
item:SetFrameLevel(item:GetFrameLevel() + 2) item:SetFrameLevel(item:GetFrameLevel() + 2)
icon:SetDrawLayer("OVERLAY") icon:SetDrawLayer("OVERLAY")
-- icon:Size(icon:GetWidth() -(E.Spacing*2), icon:GetHeight() -(E.Spacing*2))
icon:SetWidth(icon:GetWidth() -(E.Spacing*2)) icon:SetWidth(icon:GetWidth() -(E.Spacing*2))
icon:SetHeight(icon:GetHeight() -(E.Spacing*2)) icon:SetHeight(icon:GetHeight() -(E.Spacing*2))
icon:SetPoint("TOPLEFT", E.Border, -E.Border) icon:SetPoint("TOPLEFT", E.Border, -E.Border)
@@ -117,19 +116,24 @@ local function LoadSkin()
local function QuestQualityColors(frame, text, quality, link) local function QuestQualityColors(frame, text, quality, link)
if link and not quality then if link and not quality then
_, _, quality = GetItemInfo(link) local itemEnchantID = select(3, find(link, "enchant:(%d+)"))
local itemItemID = select(3, find(link, "item:(%d+)"))
local itemID = itemEnchantID or itemItemID
if itemID then
_, _, quality = GetItemInfo(itemID)
end
end end
if quality and quality > 1 then if quality and quality > 1 then
if frame then if frame then
frame:SetBackdropBorderColor(GetItemQualityColor(quality)) frame:SetBackdropBorderColor(GetItemQualityColor(quality))
-- frame.backdrop:SetBackdropBorderColor(GetItemQualityColor(quality)) frame.backdrop:SetBackdropBorderColor(GetItemQualityColor(quality))
end end
text:SetTextColor(GetItemQualityColor(quality)) text:SetTextColor(GetItemQualityColor(quality))
else else
if frame then if frame then
frame:SetBackdropBorderColor(unpack(E["media"].bordercolor)) frame:SetBackdropBorderColor(unpack(E["media"].bordercolor))
-- frame.backdrop:SetBackdropBorderColor(unpack(E["media"].bordercolor)) frame.backdrop:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end end
text:SetTextColor(1, 1, 1) text:SetTextColor(1, 1, 1)
end end
@@ -139,7 +143,6 @@ local function LoadSkin()
E:SetTemplate(QuestRewardItemHighlight, "Default", nil, true) E:SetTemplate(QuestRewardItemHighlight, "Default", nil, true)
QuestRewardItemHighlight:SetBackdropBorderColor(1, 1, 0) QuestRewardItemHighlight:SetBackdropBorderColor(1, 1, 0)
QuestRewardItemHighlight:SetBackdropColor(0, 0, 0, 0) QuestRewardItemHighlight:SetBackdropColor(0, 0, 0, 0)
-- QuestRewardItemHighlight:Size(142, 40)
QuestRewardItemHighlight:SetWidth(142) QuestRewardItemHighlight:SetWidth(142)
QuestRewardItemHighlight:SetHeight(40) QuestRewardItemHighlight:SetHeight(40)
@@ -306,7 +309,6 @@ local function LoadSkin()
S:HandleButton(QuestTrack) S:HandleButton(QuestTrack)
QuestTrack:SetText(TRACK_QUEST) QuestTrack:SetText(TRACK_QUEST)
QuestTrack:SetPoint("TOP", QuestLogFrame, "TOP", -64, -42) QuestTrack:SetPoint("TOP", QuestLogFrame, "TOP", -64, -42)
-- QuestTrack:Size(110, 21)
QuestTrack:SetWidth(110) QuestTrack:SetWidth(110)
QuestTrack:SetHeight(21) QuestTrack:SetHeight(21)
@@ -342,8 +344,11 @@ local function LoadSkin()
else else
QuestTrack:Enable() QuestTrack:Enable()
end end
if EmptyQuestLogFrame:IsVisible() then
QuestLogListScrollFrame:Show() QuestLogListScrollFrame:Hide()
else
QuestLogListScrollFrame:Show()
end
end) end)
for i = 1, 6 do for i = 1, 6 do
@@ -358,7 +363,6 @@ local function LoadSkin()
item:SetFrameLevel(item:GetFrameLevel() + 2) item:SetFrameLevel(item:GetFrameLevel() + 2)
icon:SetDrawLayer("OVERLAY") icon:SetDrawLayer("OVERLAY")
-- icon:Size(icon:GetWidth() -(E.Spacing*2), icon:GetHeight() -(E.Spacing*2))
icon:SetWidth(icon:GetWidth() -(E.Spacing*2)) icon:SetWidth(icon:GetWidth() -(E.Spacing*2))
icon:SetHeight(icon:GetHeight() -(E.Spacing*2)) icon:SetHeight(icon:GetHeight() -(E.Spacing*2))
icon:SetPoint("TOPLEFT", E.Border, -E.Border) icon:SetPoint("TOPLEFT", E.Border, -E.Border)
@@ -389,16 +393,6 @@ local function LoadSkin()
end end
end) end)
-- QUESTS_DISPLAYED = 25
-- for i = 7, 25 do
-- local questLogTitle = CreateFrame("Button", "QuestLogTitle" .. i, QuestLogFrame, "QuestLogTitleButtonTemplate")
-- questLogTitle:SetID(i)
-- questLogTitle:Hide()
-- questLogTitle:SetPoint("TOPLEFT", _G["QuestLogTitle" .. i - 1], "BOTTOMLEFT", 0, 1)
-- end
for i = 1, QUESTS_DISPLAYED do for i = 1, QUESTS_DISPLAYED do
local questLogTitle = _G["QuestLogTitle" .. i] local questLogTitle = _G["QuestLogTitle" .. i]
@@ -3,7 +3,7 @@ local S = E:GetModule("Skins");
--Cache global variables --Cache global variables
--Lua functions --Lua functions
local _G = getfenv() local _G = _G
local unpack = unpack local unpack = unpack
local select = select local select = select
local find = string.find local find = string.find
@@ -13,6 +13,7 @@ local GetItemQualityColor = GetItemQualityColor
local GetTradeSkillItemLink = GetTradeSkillItemLink local GetTradeSkillItemLink = GetTradeSkillItemLink
local GetTradeSkillReagentInfo = GetTradeSkillReagentInfo local GetTradeSkillReagentInfo = GetTradeSkillReagentInfo
local GetTradeSkillReagentItemLink = GetTradeSkillReagentItemLink local GetTradeSkillReagentItemLink = GetTradeSkillReagentItemLink
local hooksecurefunc = hooksecurefunc
local function LoadSkin() local function LoadSkin()
-- if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.tradeskill ~= true then return end -- if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.tradeskill ~= true then return end
@@ -142,39 +143,42 @@ local function LoadSkin()
TradeSkillSkillIcon:SetPoint("TOPLEFT", 4, -3) TradeSkillSkillIcon:SetPoint("TOPLEFT", 4, -3)
local skillLink = GetTradeSkillItemLink(id) local skillLink = GetTradeSkillItemLink(id)
local skillID = select(3, strfind(skillLink, "item:(%d+)")) if skillLink then
if skillID then
TradeSkillRequirementLabel:SetTextColor(1, 0.80, 0.10) TradeSkillRequirementLabel:SetTextColor(1, 0.80, 0.10)
local quality = select(3, GetItemInfo(skillID)) local skillID = select(3, find(skillLink, "item:(%d+)"))
if skillID then
if quality and quality > 1 then local quality = select(3, GetItemInfo(skillID))
TradeSkillSkillIcon:SetBackdropBorderColor(GetItemQualityColor(quality)) if quality and quality > 1 then
TradeSkillSkillName:SetTextColor(GetItemQualityColor(quality)) TradeSkillSkillIcon:SetBackdropBorderColor(GetItemQualityColor(quality))
else TradeSkillSkillName:SetTextColor(GetItemQualityColor(quality))
TradeSkillSkillIcon:SetBackdropBorderColor(unpack(E["media"].bordercolor)) else
TradeSkillSkillName:SetTextColor(1, 1, 1) TradeSkillSkillIcon:SetBackdropBorderColor(unpack(E["media"].bordercolor))
TradeSkillSkillName:SetTextColor(1, 1, 1)
end
end end
end end
local numReagents = GetTradeSkillNumReagents(id) local numReagents = GetTradeSkillNumReagents(id)
for i = 1, numReagents, 1 do for i = 1, numReagents, 1 do
local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(id, i) local _, _, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(id, i)
local reagentLink = GetTradeSkillReagentItemLink(id, i) local reagentLink = GetTradeSkillReagentItemLink(id, i)
local reagentID = select(3, strfind(reagentLink, "item:(%d+)"))
local icon = _G["TradeSkillReagent" .. i .. "IconTexture"] local icon = _G["TradeSkillReagent" .. i .. "IconTexture"]
local name = _G["TradeSkillReagent" .. i .. "Name"] local name = _G["TradeSkillReagent" .. i .. "Name"]
if reagentLink then if reagentLink then
local quality = select(3, GetItemInfo(reagentID)) local reagentID = select(3, find(reagentLink, "item:(%d+)"))
if quality and quality > 1 then if reagentID then
icon.backdrop:SetBackdropBorderColor(GetItemQualityColor(quality)) local quality = select(3, GetItemInfo(reagentID))
if(playerReagentCount < reagentCount) then if quality and quality > 1 then
name:SetTextColor(0.5, 0.5, 0.5) icon.backdrop:SetBackdropBorderColor(GetItemQualityColor(quality))
if playerReagentCount < reagentCount then
name:SetTextColor(0.5, 0.5, 0.5)
else
name:SetTextColor(GetItemQualityColor(quality))
end
else else
name:SetTextColor(GetItemQualityColor(quality)) icon.backdrop:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end end
else
icon.backdrop:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end end
end end
end end