Name that space!

This commit is contained in:
tekkub 2010-05-02 16:20:55 -06:00
parent e96054825c
commit 24a0a17720
4 changed files with 29 additions and 22 deletions

View File

@ -1,8 +1,8 @@
local myname, ns = ...
local NUMROWS, ICONSIZE, GAP, SCROLLSTEP = 14, 17, 4, 5 local NUMROWS, ICONSIZE, GAP, SCROLLSTEP = 14, 17, 4, 5
local knowns = GVS_SCANNER
local HONOR_POINTS, ARENA_POINTS = "|cffffffff|Hitem:43308:0:0:0:0:0:0:0:0|h[Honor Points]|h|r", "|cffffffff|Hitem:43307:0:0:0:0:0:0:0:0|h[Arena Points]|h|r" local HONOR_POINTS, ARENA_POINTS = "|cffffffff|Hitem:43308:0:0:0:0:0:0:0:0|h[Honor Points]|h|r", "|cffffffff|Hitem:43307:0:0:0:0:0:0:0:0|h[Arena Points]|h|r"
GVS_SCANNER = nil
for _,f in pairs{MerchantNextPageButton, MerchantPrevPageButton, MerchantPageText} do for _,f in pairs{MerchantNextPageButton, MerchantPrevPageButton, MerchantPageText} do
@ -88,18 +88,6 @@ local function OnLeave()
end end
local function GSC(cash)
if not cash then return end
local g, s, c = floor(cash/10000), floor((cash/100)%100), cash%100
if g > 0 and s == 0 and c == 0 then return string.format(" |cffffd700%d", g)
elseif g > 0 and c == 0 then return string.format(" |cffffd700%d.|cffc7c7cf%02d", g, s)
elseif g > 0 then return string.format(" |cffffd700%d.|cffc7c7cf%02d.|cffeda55f%02d", g, s, c)
elseif s > 0 and c == 0 then return string.format(" |cffc7c7cf%d", s)
elseif s > 0 then return string.format(" |cffc7c7cf%d.|cffeda55f%02d", s, c)
else return string.format(" |cffeda55f%02d", c) end
end
local function SetValue(self, text, icon, link) local function SetValue(self, text, icon, link)
self.text:SetText(text) self.text:SetText(text)
self.icon:SetTexture(icon) self.icon:SetTexture(icon)
@ -214,7 +202,7 @@ for i=1,NUMROWS do
popout.SplitStack = PopoutSplitStack popout.SplitStack = PopoutSplitStack
row.popout = popout row.popout = popout
local ItemPrice = row:CreateFontString(nil, nil, "NumberFontNormalSmall") local ItemPrice = row:CreateFontString(nil, nil, "NumberFontNormal")
ItemPrice:SetPoint('RIGHT', popout, "LEFT", -2, 0) ItemPrice:SetPoint('RIGHT', popout, "LEFT", -2, 0)
row.ItemPrice = ItemPrice row.ItemPrice = ItemPrice
@ -268,7 +256,7 @@ local function Refresh()
local name, link2, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(link) local name, link2, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(link)
color = quality_colors[quality] color = quality_colors[quality]
if class == RECIPE and not knowns[link] then if class == RECIPE and not ns.knowns[link] then
row.backdrop:SetGradientAlpha("HORIZONTAL", unpack(grads[quality])) row.backdrop:SetGradientAlpha("HORIZONTAL", unpack(grads[quality]))
row.backdrop:Show() row.backdrop:Show()
end end
@ -291,14 +279,14 @@ local function Refresh()
row.link, row.texture, row.extendedCost = link, itemTexture, true row.link, row.texture, row.extendedCost = link, itemTexture, true
end end
if itemPrice > 0 then if itemPrice > 0 then
row.ItemPrice:SetText(GSC(itemPrice)) row.ItemPrice:SetText(ns.GSC(itemPrice))
row.Price = itemPrice row.Price = itemPrice
end end
if extendedCost and (itemPrice <= 0) then if extendedCost and (itemPrice <= 0) then
row.ItemPrice:SetText() row.ItemPrice:SetText()
row.Price = 0 row.Price = 0
elseif extendedCost and (itemPrice > 0) then elseif extendedCost and (itemPrice > 0) then
row.ItemPrice:SetText(GSC(itemPrice)) row.ItemPrice:SetText(ns.GSC(itemPrice))
else else
row.ItemName:SetPoint("RIGHT", row.ItemPrice, "LEFT", -GAP, 0) row.ItemName:SetPoint("RIGHT", row.ItemPrice, "LEFT", -GAP, 0)
row.extendedCost = nil row.extendedCost = nil

View File

@ -11,6 +11,7 @@
## LoadManagers: AddonLoader ## LoadManagers: AddonLoader
## X-LoadOn-Merchant: true ## X-LoadOn-Merchant: true
tekFunks\gsc.lua
tekKonfig\tekKonfig.xml tekKonfig\tekKonfig.xml
KnownScanner.lua KnownScanner.lua

View File

@ -1,15 +1,16 @@
local myname, ns = ...
local tip = CreateFrame("GameTooltip") local tip = CreateFrame("GameTooltip")
tip:SetOwner(WorldFrame, "ANCHOR_NONE") tip:SetOwner(WorldFrame, "ANCHOR_NONE")
local lcache = {} local lcache = {}
for i=1,40 do for i=1,40 do
lcache[i] = tip:CreateFontString() lcache[i] = tip:CreateFontString()
-- lcache[i]:SetFontObject(GameFontNormal)
tip:AddFontStrings(lcache[i], tip:CreateFontString()) tip:AddFontStrings(lcache[i], tip:CreateFontString())
end end
local knowns = setmetatable({}, {__index = function(t, i) ns.knowns = setmetatable({}, {__index = function(t, i)
tip:ClearLines() tip:ClearLines()
if not tip:IsOwned(WorldFrame) then tip:SetOwner(WorldFrame, "ANCHOR_NONE") end if not tip:IsOwned(WorldFrame) then tip:SetOwner(WorldFrame, "ANCHOR_NONE") end
tip:SetHyperlink(i) tip:SetHyperlink(i)
@ -20,5 +21,3 @@ local knowns = setmetatable({}, {__index = function(t, i)
end end
end end
end}) end})
GVS_SCANNER = knowns

19
tekFunks/gsc.lua Normal file
View File

@ -0,0 +1,19 @@
local myname, ns = ...
function ns.GSC(cash, colorblind)
if not cash then return end
local g, s, c = floor(cash/10000), floor((cash/100)%100), cash%100
if colorblind or GetCVarBool("colorblindMode") then
if g > 0 then return string.format(" |cffffd700%d.|cffc7c7cf%02d.|cffeda55f%02d", g, s, c)
elseif s > 0 then return string.format(" |cffc7c7cf%d.|cffeda55f%02d", s, c)
else return string.format(" |cffeda55f%d", c) end
else
if g > 0 and s == 0 and c == 0 then return string.format(" |cffffd700%d", g)
elseif g > 0 and c == 0 then return string.format(" |cffffd700%d.|cffc7c7cf%02d", g, s)
elseif g > 0 then return string.format(" |cffffd700%d.|cffc7c7cf%02d.|cffeda55f%02d", g, s, c)
elseif s > 0 and c == 0 then return string.format(" |cffc7c7cf%d", s)
elseif s > 0 then return string.format(" |cffc7c7cf%d.|cffeda55f%02d", s, c)
else return string.format(" |cffeda55f%d", c) end
end
end