mirror of
https://github.com/brues-code/pfUI.git
synced 2026-11-01 08:26:57 +00:00
Retire libtipscan: libpredict reads HoT set bonuses from the item set data, the professions skin shows the crafted item's tooltip frame in the detail pane
This commit is contained in:
Vendored
-5
@@ -1,11 +1,6 @@
|
||||
pfUI_locale["deDE"] = {}
|
||||
|
||||
|
||||
pfUI_locale["deDE"]["healduration"] = {
|
||||
["Rejuvenation"] = "Erhöht die Dauer Eures Zaubers 'Verjüngung' um 3 Sek.",
|
||||
["Renew"] = "Erhöht die Wirkungsdauer von 'Erneuerung' um 3 Sek.",
|
||||
}
|
||||
|
||||
pfUI_locale["deDE"]["customcast"] = {
|
||||
["AIMEDSHOT"] = "Gezielter Schuss",
|
||||
["MULTISHOT"] = "Mehrfach-Schuss",
|
||||
|
||||
Vendored
-5
@@ -1,11 +1,6 @@
|
||||
pfUI_locale["enUS"] = {}
|
||||
|
||||
|
||||
pfUI_locale["enUS"]["healduration"] = {
|
||||
["Rejuvenation"] = "Increases the duration of your Rejuvenation spell by 3 sec.",
|
||||
["Renew"] = "Increases the duration of your Renew spell by 3 sec.",
|
||||
}
|
||||
|
||||
pfUI_locale["enUS"]["customcast"] = {
|
||||
["AIMEDSHOT"] = "Aimed Shot",
|
||||
["MULTISHOT"] = "Multi-Shot",
|
||||
|
||||
Vendored
-5
@@ -1,11 +1,6 @@
|
||||
pfUI_locale["esES"] = {}
|
||||
|
||||
|
||||
pfUI_locale["esES"]["healduration"] = {
|
||||
["Rejuvenation"] = "Aumenta 3 s la duración de tu hechizo Rejuvenecimiento.",
|
||||
["Renew"] = "Aumenta en 3 s la duración de tu hechizo Renovar.",
|
||||
}
|
||||
|
||||
pfUI_locale["esES"]["customcast"] = {
|
||||
["AIMEDSHOT"] = "Disparo de puntería",
|
||||
["MULTISHOT"] = "Multidisparo",
|
||||
|
||||
Vendored
-5
@@ -1,11 +1,6 @@
|
||||
pfUI_locale["frFR"] = {}
|
||||
|
||||
|
||||
pfUI_locale["frFR"]["healduration"] = {
|
||||
["Rejuvenation"] = "Augmente la durée de votre sort Récupération de 3 sec.",
|
||||
["Renew"] = "Augmente la durée de votre sort Rénovation de 3 sec.",
|
||||
}
|
||||
|
||||
pfUI_locale["frFR"]["customcast"] = {
|
||||
["AIMEDSHOT"] = "Visée",
|
||||
["MULTISHOT"] = "Flèches multiples",
|
||||
|
||||
Vendored
-5
@@ -1,11 +1,6 @@
|
||||
pfUI_locale["koKR"] = {}
|
||||
|
||||
|
||||
pfUI_locale["koKR"]["healduration"] = {
|
||||
["Rejuvenation"] = "회복의 지속시간이 3초만큼 증가합니다.",
|
||||
["Renew"] = "소생의 지속시간이 3초만큼 증가합니다.",
|
||||
}
|
||||
|
||||
pfUI_locale["koKR"]["customcast"] = {
|
||||
["AIMEDSHOT"] = "조준 사격",
|
||||
["MULTISHOT"] = "일제 사격",
|
||||
|
||||
Vendored
-5
@@ -1,11 +1,6 @@
|
||||
pfUI_locale["ruRU"] = {}
|
||||
|
||||
|
||||
pfUI_locale["ruRU"]["healduration"] = {
|
||||
["Rejuvenation"] = "Увеличивает время действия \"Омоложения\" на 3 сек.",
|
||||
["Renew"] = "Продлевает действие \"Обновления\" на 3 сек.",
|
||||
}
|
||||
|
||||
pfUI_locale["ruRU"]["customcast"] = {
|
||||
["AIMEDSHOT"] = "Прицельный выстрел",
|
||||
["MULTISHOT"] = "Залп",
|
||||
|
||||
Vendored
-5
@@ -1,11 +1,6 @@
|
||||
pfUI_locale["zhCN"] = {}
|
||||
|
||||
|
||||
pfUI_locale["zhCN"]["healduration"] = {
|
||||
["Rejuvenation"] = "使你的回春术的持续时间延长3秒。",
|
||||
["Renew"] = "使你的恢复术的持续时间延长3秒。",
|
||||
}
|
||||
|
||||
pfUI_locale["zhCN"]["customcast"] = {
|
||||
["AIMEDSHOT"] = "瞄准射击",
|
||||
["MULTISHOT"] = "多重射击",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||
<Include file="..\libs\libtipscan.lua"/>
|
||||
<Include file="..\libs\libspell.lua"/>
|
||||
<Include file="..\libs\libdebuff.lua"/>
|
||||
<Include file="..\libs\libunitscan.lua"/>
|
||||
|
||||
+24
-14
@@ -632,7 +632,27 @@ end
|
||||
|
||||
local realm = GetRealmName()
|
||||
local resetcache = CreateFrame("Frame")
|
||||
local hotsetbonus = libtipscan:GetScanner("hotsetbonus")
|
||||
|
||||
-- set bonus spells that lengthen a HoT
|
||||
local REJUVENATION_SET_BONUS = 21871 -- Stormrage Raiment (8)
|
||||
local RENEW_SET_BONUS = 26171 -- Garments of the Oracle (5)
|
||||
|
||||
-- the set bonus spells the equipped gear grants
|
||||
local function GetActiveSetBonuses()
|
||||
local pieces = {}
|
||||
for slot = 1, 19 do
|
||||
local setID = C_Item.GetItemSetID({ equipmentSlotIndex = slot })
|
||||
if setID then pieces[setID] = (pieces[setID] or 0) + 1 end
|
||||
end
|
||||
|
||||
local active = {}
|
||||
for setID, count in pairs(pieces) do
|
||||
for _, bonus in ipairs(C_Item.GetItemSetInfo(setID).bonuses) do
|
||||
if count >= bonus.threshold then active[bonus.spellID] = true end
|
||||
end
|
||||
end
|
||||
return active
|
||||
end
|
||||
resetcache:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
resetcache:RegisterEvent("LEARNED_SPELL_IN_TAB")
|
||||
resetcache:RegisterEvent("CHARACTER_POINTS_CHANGED")
|
||||
@@ -657,19 +677,9 @@ resetcache:SetScript("OnEvent", function()
|
||||
if gear == gear_string then return end
|
||||
gear_string = gear
|
||||
|
||||
local setBonusCounter
|
||||
setBonusCounter = 0
|
||||
for i=1,10 do --there is no need to check slots above 10
|
||||
hotsetbonus:SetInventoryItem("player", i)
|
||||
if hotsetbonus:Find(L["healduration"]["Rejuvenation"]) then setBonusCounter = setBonusCounter + 1 end
|
||||
end
|
||||
rejuvDuration = setBonusCounter == 8 and 15 or 12
|
||||
setBonusCounter = 0
|
||||
for i =1,10 do
|
||||
hotsetbonus:SetInventoryItem("player", i)
|
||||
if hotsetbonus:Find(L["healduration"]["Renew"]) then setBonusCounter = setBonusCounter + 1 end
|
||||
end
|
||||
renewDuration = setBonusCounter == 5 and 18 or 15
|
||||
local bonuses = GetActiveSetBonuses()
|
||||
rejuvDuration = bonuses[REJUVENATION_SET_BONUS] and 15 or 12
|
||||
renewDuration = bonuses[RENEW_SET_BONUS] and 18 or 15
|
||||
end
|
||||
|
||||
-- flag all cached heals for renewal
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
-- load pfUI environment
|
||||
setfenv(1, pfUI:GetEnvironment())
|
||||
|
||||
--[[ libtipscan ]]--
|
||||
-- A pfUI library that provides tooltip scanner.
|
||||
--
|
||||
-- libtipscan:GetScanner(name)
|
||||
-- returns or resets a scanner for use with tooltip methods
|
||||
--
|
||||
-- libtipscan:List()
|
||||
-- prints a list of all active scanners
|
||||
--
|
||||
-- The scanner tooltip returned by :GetScanner has all the Set____ GameTooltip methods with a built-in full clear
|
||||
-- In addition the scanner has the following custom methods
|
||||
-- <scanner>:Text()
|
||||
-- return a table with all the left, right texts in {[line] = {left, right}} format
|
||||
-- <scanner>:Find(text, [exact])
|
||||
-- returns true (linenumber) and [the text found or the captures made if text is a pattern]
|
||||
-- exact is optional flag making it look only for exact matches
|
||||
-- <scanner>:Color(r,g,b)
|
||||
-- returns true (linenumber) if the r,g,b color tuple is found as text color on the scanner
|
||||
-- accepts color table as argument as well (eg. <scanner>:Color(RED_FONT_COLOR) )
|
||||
-- <scanner>:Line(line_number)
|
||||
-- returns left, right text from that tooltip line
|
||||
-- <scanner>:List()
|
||||
-- prints a list of all available scanner methods
|
||||
|
||||
-- return instantly when another libtipscan is already active
|
||||
if pfUI.api.libtipscan then return end
|
||||
|
||||
local libtipscan = {}
|
||||
local baseName = "pfUIScan"
|
||||
local methods = {
|
||||
"SetBagItem", "SetAction", "SetAuctionItem", "SetAuctionSellItem", "SetBuybackItem",
|
||||
"SetCraftItem", "SetCraftSpell", "SetHyperlink", "SetInboxItem", "SetInventoryItem",
|
||||
"SetLootItem", "SetLootRollItem", "SetMerchantItem", "SetPetAction", "SetPlayerBuff",
|
||||
"SetQuestItem", "SetQuestLogItem", "SetQuestRewardSpell", "SetSendMailItem", "SetShapeshift",
|
||||
"SetSpell", "SetTalent", "SetTrackingSpell", "SetTradePlayerItem", "SetTradeSkillItem", "SetTradeTargetItem",
|
||||
"SetTrainerService", "SetUnit", "SetUnitBuff", "SetUnitDebuff",
|
||||
}
|
||||
local extra_methods = {
|
||||
"Find", "Line", "Text", "List",
|
||||
}
|
||||
|
||||
local getFontString = function(obj)
|
||||
local name = obj:GetName()
|
||||
local r, g, b, color, a
|
||||
local text, segment
|
||||
|
||||
for i=1, obj:NumLines() do
|
||||
local left = _G[string.format("%sTextLeft%d",name,i)]
|
||||
segment = left and left:IsVisible() and left:GetText()
|
||||
segment = segment and segment ~= "" and segment or nil
|
||||
if segment then
|
||||
r, g, b, a = left:GetTextColor()
|
||||
segment = rgbhex(r,g,b) .. segment .. "|r"
|
||||
text = text and text .. "\n" .. segment or segment
|
||||
end
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
local getText = function(obj)
|
||||
local name = obj:GetName()
|
||||
local text = {}
|
||||
for i=1, obj:NumLines() do
|
||||
local left, right = _G[string.format("%sTextLeft%d",name,i)], _G[string.format("%sTextRight%d",name,i)]
|
||||
left = left and left:IsVisible() and left:GetText()
|
||||
right = right and right:IsVisible() and right:GetText()
|
||||
left = left and left ~= "" and left or nil
|
||||
right = right and right ~= "" and right or nil
|
||||
if left or right then
|
||||
text[i] = {left, right}
|
||||
end
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
local findText = function(obj, text, exact)
|
||||
local name = obj:GetName()
|
||||
for i=1, obj:NumLines() do
|
||||
local left, right = _G[string.format("%sTextLeft%d",name,i)], _G[string.format("%sTextRight%d",name,i)]
|
||||
left = left and left:IsVisible() and left:GetText()
|
||||
right = right and right:IsVisible() and right:GetText()
|
||||
if exact then
|
||||
if (left and left == text) or (right and right == text) then
|
||||
return i, text
|
||||
end
|
||||
else
|
||||
if left then
|
||||
local found,_,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 = string.find(left, text)
|
||||
if found then
|
||||
return i, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10
|
||||
end
|
||||
end
|
||||
if right then
|
||||
local found,_,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 = string.find(right, text)
|
||||
if found then
|
||||
return i, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local lineText = function(obj, line)
|
||||
local name = obj:GetName()
|
||||
if line <= obj:NumLines() then
|
||||
local left, right = _G[string.format("%sTextLeft%d",name,line)], _G[string.format("%sTextRight%d",name,line)]
|
||||
left = left and left:IsVisible() and left:GetText()
|
||||
right = right and right:IsVisible() and right:GetText()
|
||||
|
||||
if left or right then
|
||||
return left, right
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local findColor = function(obj, r,g,b)
|
||||
local name = obj:GetName()
|
||||
if type(r) == "table" then
|
||||
r,g,b = r.r or r[1], r.g or r[2], r.b or r[3]
|
||||
end
|
||||
for i=1, obj:NumLines() do
|
||||
local tr, tg, tb
|
||||
local left, right = _G[string.format("%sTextLeft%d",name,i)], _G[string.format("%sTextRight%d",name,i)]
|
||||
if left and left:IsVisible() then
|
||||
tr, tg, tb = left:GetTextColor()
|
||||
tr, tg, tb = round(tr,1), round(tg,1), round(tb,1)
|
||||
end
|
||||
if tr and (tr == r and tg == g and tb == b) then
|
||||
return i
|
||||
end
|
||||
if right and right:IsVisible() then
|
||||
tr, tg, tb = right:GetTextColor()
|
||||
tr, tg, tb = round(tr,1), round(tg,1), round(tb,1)
|
||||
end
|
||||
if tr and (tr == r and tg == g and tb == b) then
|
||||
return i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
libtipscan._registry = setmetatable({},{__index = function(t,k)
|
||||
local v = CreateFrame("GameTooltip", string.format("%s%s",baseName,k), nil, "GameTooltipTemplate")
|
||||
v:SetOwner(WorldFrame,"ANCHOR_NONE")
|
||||
v:SetScript("OnHide", function ()
|
||||
this:SetOwner(WorldFrame,"ANCHOR_NONE")
|
||||
end)
|
||||
function v:Text()
|
||||
return getText(self)
|
||||
end
|
||||
function v:FontString()
|
||||
return getFontString(self)
|
||||
end
|
||||
function v:Find(text, exact)
|
||||
return findText(self, text, exact)
|
||||
end
|
||||
function v:Color(r,g,b)
|
||||
return findColor(self,r,g,b)
|
||||
end
|
||||
function v:Line(line)
|
||||
return lineText(self, line)
|
||||
end
|
||||
for _,method in ipairs(methods) do
|
||||
local method = method
|
||||
local old = v[method]
|
||||
v[method] = function(v, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||
v:ClearLines()
|
||||
v:SetOwner(WorldFrame, "ANCHOR_NONE")
|
||||
return old(v, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||
end
|
||||
end
|
||||
function v:List()
|
||||
table.sort(methods)
|
||||
for _,method in ipairs(methods) do
|
||||
print(method)
|
||||
end
|
||||
for _,method in ipairs(extra_methods) do
|
||||
print(method)
|
||||
end
|
||||
end
|
||||
rawset(t,k,v)
|
||||
return v
|
||||
end})
|
||||
|
||||
function libtipscan:GetScanner(type)
|
||||
local scanner = self._registry[type]
|
||||
scanner:ClearLines()
|
||||
return scanner
|
||||
end
|
||||
|
||||
function libtipscan:List()
|
||||
for name, scanner in pairs(self._registry) do
|
||||
print(name)
|
||||
end
|
||||
end
|
||||
|
||||
-- add libtipscan to pfUI API
|
||||
pfUI.api.libtipscan = libtipscan
|
||||
@@ -191,13 +191,19 @@ pfUI:RegisterSkin("Profession", function ()
|
||||
reagentlabel:SetPoint("TOPLEFT", seltitle, "BOTTOMLEFT", -45, -15)
|
||||
reagentlabel:SetTextColor(1,1,1,1)
|
||||
|
||||
local scanner = libtipscan:GetScanner(name)
|
||||
-- the crafted item's tooltip, shown in the detail pane in place of
|
||||
-- the recipe name; the pane's backdrop stands in for its own
|
||||
local preview = CreateFrame("GameTooltip", "pfUI" .. name .. "ItemPreview", detailscrollchild, "GameTooltipTemplate")
|
||||
preview:SetFrameStrata(detailscrollchild:GetFrameStrata())
|
||||
preview:SetBackdrop(nil)
|
||||
|
||||
hooksecurefunc(SetSelection, function(id)
|
||||
if id and id ~= 0 then
|
||||
detailscroll:Show()
|
||||
HandleIcon(icon, icon:GetNormalTexture())
|
||||
|
||||
if name == "TradeSkill" then
|
||||
preview:Hide()
|
||||
local itemlink = GetTradeSkillItemLink(id)
|
||||
if not itemlink then return end
|
||||
local _, _, link = string.find(itemlink, "(item:%d+:%d+:%d+:%d+)")
|
||||
@@ -206,13 +212,15 @@ pfUI:RegisterSkin("Profession", function ()
|
||||
reagentlabel:SetPoint("TOPLEFT", seltitle, "BOTTOMLEFT", -45, -15-off)
|
||||
|
||||
if link then
|
||||
scanner:SetHyperlink(link)
|
||||
seltitle:SetHeight(0)
|
||||
seltitle:SetText(scanner:FontString())
|
||||
-- line text sits 10px inside the tooltip edge
|
||||
preview:SetOwner(detailscrollchild, "ANCHOR_NONE")
|
||||
preview:SetPoint("TOPLEFT", seltitle, "TOPLEFT", -10, 10)
|
||||
preview:SetHyperlink(link)
|
||||
|
||||
if seltitle:GetHeight() < 30 then
|
||||
seltitle:SetHeight(35)
|
||||
end
|
||||
-- the title keeps its place in the layout as the spacer the
|
||||
-- preview covers, so the reagents start below it
|
||||
seltitle:SetText("")
|
||||
seltitle:SetHeight(math.max(preview:GetHeight() - 20, 35))
|
||||
else
|
||||
detailscroll:Hide()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user