跟随版本 0.8.19
This commit is contained in:
@@ -61,15 +61,15 @@ local S = {
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Tooltip scanner for training point cost & requirements
|
||||
-- Tooltip scanner & extended craft info
|
||||
--------------------------------------------------------------------------------
|
||||
local scanTip = nil
|
||||
|
||||
function BTUI.GetCraftExtendedInfo(index)
|
||||
local name, rank, skillType, numAvail, _, _, tpCost = GetCraftInfo(index)
|
||||
return name, rank, skillType,
|
||||
tonumber(numAvail) or 0,
|
||||
tonumber(tpCost) or 0
|
||||
local name, rank, skillType, v4, _, tpCost, reqLevel = GetCraftInfo(index)
|
||||
local canLearn = (tonumber(reqLevel) or 0) > 0
|
||||
tpCost = tonumber(tpCost) or 0
|
||||
return name, rank, skillType, canLearn, tpCost
|
||||
end
|
||||
|
||||
function BTUI.GetSkillTooltipLines(index)
|
||||
@@ -356,24 +356,26 @@ function BTUI.CreateListRow(parent, idx)
|
||||
self.rankFS:Hide()
|
||||
end
|
||||
|
||||
local tpCost = skill.tpCost or 0
|
||||
local canLearn = (tpCost > 0)
|
||||
|
||||
if canLearn then
|
||||
local remaining = BTUI.GetRemainingTP()
|
||||
if remaining >= tpCost then
|
||||
self.tpFS:SetTextColor(T.tpGood[1], T.tpGood[2], T.tpGood[3])
|
||||
else
|
||||
self.tpFS:SetTextColor(T.tpNone[1], T.tpNone[2], T.tpNone[3])
|
||||
end
|
||||
self.tpFS:SetText(tpCost .. " TP")
|
||||
self.tpFS:Show()
|
||||
if skill.canLearn then
|
||||
self.nameFS:SetTextColor(T.available[1], T.available[2], T.available[3])
|
||||
self.icon:SetVertexColor(1, 1, 1)
|
||||
local tp = skill.tpCost or 0
|
||||
if tp > 0 then
|
||||
local remaining = BTUI.GetRemainingTP()
|
||||
if remaining >= tp then
|
||||
self.tpFS:SetTextColor(T.tpGood[1], T.tpGood[2], T.tpGood[3])
|
||||
else
|
||||
self.tpFS:SetTextColor(T.tpNone[1], T.tpNone[2], T.tpNone[3])
|
||||
end
|
||||
self.tpFS:SetText(tp .. " TP")
|
||||
self.tpFS:Show()
|
||||
else
|
||||
self.tpFS:Hide()
|
||||
end
|
||||
else
|
||||
self.tpFS:Hide()
|
||||
self.nameFS:SetTextColor(T.learned[1], T.learned[2], T.learned[3])
|
||||
self.icon:SetVertexColor(0.5, 0.5, 0.5)
|
||||
self.tpFS:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -400,7 +402,7 @@ function BTUI.BuildDisplayList()
|
||||
local catOrder = {}
|
||||
|
||||
for i = 1, numCrafts do
|
||||
local name, rank, skillType, numAvail, tpCost = BTUI.GetCraftExtendedInfo(i)
|
||||
local name, rank, skillType, canLearn, tpCost = BTUI.GetCraftExtendedInfo(i)
|
||||
if name then
|
||||
if skillType == "header" then
|
||||
currentCat = name
|
||||
@@ -416,7 +418,6 @@ function BTUI.BuildDisplayList()
|
||||
table.insert(catOrder, currentCat)
|
||||
end
|
||||
end
|
||||
local canLearn = (tpCost > 0)
|
||||
local show = true
|
||||
if S.currentFilter == "available" then
|
||||
show = canLearn
|
||||
@@ -428,8 +429,7 @@ function BTUI.BuildDisplayList()
|
||||
index = i,
|
||||
name = name,
|
||||
rank = rank or "",
|
||||
skillType = skillType or "none",
|
||||
numAvail = numAvail,
|
||||
canLearn = canLearn,
|
||||
tpCost = tpCost,
|
||||
})
|
||||
end
|
||||
@@ -524,13 +524,12 @@ function BTUI.UpdateDetail()
|
||||
return
|
||||
end
|
||||
|
||||
local name, rank, skillType, numAvail, tpCost = BTUI.GetCraftExtendedInfo(S.selectedIndex)
|
||||
local name, rank, skillType, canLearn, tpCost = BTUI.GetCraftExtendedInfo(S.selectedIndex)
|
||||
local iconTex = GetCraftIcon and GetCraftIcon(S.selectedIndex)
|
||||
|
||||
detail.icon:SetTexture(iconTex); detail.iconFrame:Show()
|
||||
detail.nameFS:SetText(name or "")
|
||||
|
||||
local canLearn = (tpCost > 0)
|
||||
if canLearn then
|
||||
detail.nameFS:SetTextColor(T.available[1], T.available[2], T.available[3])
|
||||
else
|
||||
@@ -559,6 +558,8 @@ function BTUI.UpdateDetail()
|
||||
local remaining = BTUI.GetRemainingTP()
|
||||
local costColor = remaining >= tpCost and "|cff40ff40" or "|cffff4040"
|
||||
detail.costFS:SetText("训练点数: " .. costColor .. tpCost .. "|r (剩余: " .. remaining .. ")")
|
||||
elseif canLearn then
|
||||
detail.costFS:SetText("训练点数: |cff40ff40免费|r")
|
||||
else
|
||||
detail.costFS:SetText("")
|
||||
end
|
||||
@@ -974,6 +975,23 @@ function BTUI:Initialize()
|
||||
if this.disabled then return end
|
||||
if S.selectedIndex and DoCraft then
|
||||
DoCraft(S.selectedIndex)
|
||||
BTUI.FullUpdate()
|
||||
if not MF._refreshFrame then
|
||||
MF._refreshFrame = CreateFrame("Frame")
|
||||
end
|
||||
MF._refreshElapsed = 0
|
||||
MF._refreshCount = 0
|
||||
MF._refreshFrame:SetScript("OnUpdate", function()
|
||||
MF._refreshElapsed = (MF._refreshElapsed or 0) + arg1
|
||||
if MF._refreshElapsed >= 0.2 then
|
||||
MF._refreshElapsed = 0
|
||||
MF._refreshCount = (MF._refreshCount or 0) + 1
|
||||
BTUI.FullUpdate()
|
||||
if MF._refreshCount >= 3 then
|
||||
MF._refreshFrame:SetScript("OnUpdate", nil)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
MF.trainBtn = trainBtn
|
||||
@@ -1062,18 +1080,25 @@ SLASH_BTDEBUG1 = "/btdebug"
|
||||
SlashCmdList["BTDEBUG"] = function()
|
||||
local p = "|cffff80ff[BT-Debug]|r "
|
||||
local numCrafts = GetNumCrafts and GetNumCrafts() or 0
|
||||
DEFAULT_CHAT_FRAME:AddMessage(p .. "Total crafts: " .. numCrafts)
|
||||
local remaining = BTUI.GetRemainingTP()
|
||||
DEFAULT_CHAT_FRAME:AddMessage(p .. "Remaining TP: " .. remaining)
|
||||
DEFAULT_CHAT_FRAME:AddMessage(p .. "Total crafts: " .. numCrafts .. " TP: " .. BTUI.GetRemainingTP())
|
||||
local shown = 0
|
||||
for i = 1, numCrafts do
|
||||
local v1,v2,v3,v4,v5,v6,v7 = GetCraftInfo(i)
|
||||
if v1 and v3 ~= "header" then
|
||||
shown = shown + 1
|
||||
if shown <= 12 then
|
||||
if shown <= 8 then
|
||||
if SelectCraft then pcall(SelectCraft, i) end
|
||||
local nr = GetCraftNumReagents and GetCraftNumReagents(i) or 0
|
||||
local reagentCost = ""
|
||||
if nr and nr > 0 then
|
||||
for r = 1, nr do
|
||||
local rn, rt, rc, pc = GetCraftReagentInfo(i, r)
|
||||
reagentCost = reagentCost .. " [" .. tostring(rn) .. "x" .. tostring(rc) .. "]"
|
||||
end
|
||||
end
|
||||
DEFAULT_CHAT_FRAME:AddMessage(p .. i .. ": " .. tostring(v1)
|
||||
.. " " .. tostring(v2) .. " type=" .. tostring(v3)
|
||||
.. " avail=" .. tostring(v4) .. " tp=" .. tostring(v7))
|
||||
.. " " .. tostring(v2) .. " v7=" .. tostring(v7)
|
||||
.. " reagents=" .. tostring(nr) .. reagentCost)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user