tooltip cleanup
This commit is contained in:
+26
-29
@@ -6,12 +6,12 @@ local GetItemInfo = GetItemInfo
|
|||||||
local GREY = "|cff999999"
|
local GREY = "|cff999999"
|
||||||
|
|
||||||
local WrappingLines = {
|
local WrappingLines = {
|
||||||
["Set: %s"] = gsub("^"..ITEM_SET_BONUS, " %%s", ""),
|
["Set: %s"] = gsub("^" .. ITEM_SET_BONUS, " %%s", ""), -- "^Set:"
|
||||||
["(%d) Set: %s"] = gsub(gsub(ITEM_SET_BONUS_GRAY, "%(%%d%)", "^%%(%%d%%)"), " %%s", ""),
|
["(%d) Set: %s"] = gsub(gsub(ITEM_SET_BONUS_GRAY, "%(%%d%)", "^%%(%%d%%)"), " %%s", ""), -- "^%(%d%) Set:"
|
||||||
["Effect: %s"] = gsub("^"..ITEM_SPELL_EFFECT, " %%s", ""),
|
["Effect: %s"] = gsub("^" .. ITEM_SPELL_EFFECT, " %%s", ""), -- "^Effect:"
|
||||||
["Equip:"] = "^"..ITEM_SPELL_TRIGGER_ONEQUIP,
|
["Equip:"] = "^" .. ITEM_SPELL_TRIGGER_ONEQUIP, -- "^Equip:"
|
||||||
["Chance on hit:"] = "^"..ITEM_SPELL_TRIGGER_ONPROC,
|
["Chance on hit:"] = "^" .. ITEM_SPELL_TRIGGER_ONPROC, -- "^Chance on hit:"
|
||||||
["Use:"] = "^"..ITEM_SPELL_TRIGGER_ONUSE,
|
["Use:"] = "^" .. ITEM_SPELL_TRIGGER_ONUSE, -- "^Use:"
|
||||||
}
|
}
|
||||||
|
|
||||||
local lines = {}
|
local lines = {}
|
||||||
@@ -24,8 +24,8 @@ local function AddSourceLine(tooltip, sourceStr)
|
|||||||
local numLines = tooltip:NumLines()
|
local numLines = tooltip:NumLines()
|
||||||
local left, right
|
local left, right
|
||||||
local leftText, rightText
|
local leftText, rightText
|
||||||
local rL, gL, bL
|
local leftR, leftG, leftB
|
||||||
local rR, gR, bR
|
local rightR, rightG, rightB
|
||||||
local wrap
|
local wrap
|
||||||
|
|
||||||
for i in pairs(lines) do
|
for i in pairs(lines) do
|
||||||
@@ -39,19 +39,21 @@ local function AddSourceLine(tooltip, sourceStr)
|
|||||||
right = getglobal(name .. "TextRight" .. i)
|
right = getglobal(name .. "TextRight" .. i)
|
||||||
leftText = left:GetText()
|
leftText = left:GetText()
|
||||||
rightText = right:IsShown() and right:GetText()
|
rightText = right:IsShown() and right:GetText()
|
||||||
rL, gL, bL = left:GetTextColor()
|
leftR, leftG, leftB = left:GetTextColor()
|
||||||
rR, gR, bR = right:GetTextColor()
|
rightR, rightG, rightB = right:GetTextColor()
|
||||||
lines[i][1] = leftText
|
lines[i][1] = leftText
|
||||||
lines[i][2] = rightText
|
lines[i][2] = rightText
|
||||||
lines[i][3] = rL
|
lines[i][3] = leftR
|
||||||
lines[i][4] = gL
|
lines[i][4] = leftG
|
||||||
lines[i][5] = bL
|
lines[i][5] = leftB
|
||||||
lines[i][6] = rR
|
lines[i][6] = rightR
|
||||||
lines[i][7] = gR
|
lines[i][7] = rightG
|
||||||
lines[i][8] = bR
|
lines[i][8] = rightB
|
||||||
end
|
end
|
||||||
|
|
||||||
if not lines[1][1] then return end
|
if not lines[1][1] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
tooltip:SetText(lines[1][1], lines[1][3], lines[1][4], lines[1][5], 1, false)
|
tooltip:SetText(lines[1][1], lines[1][3], lines[1][4], lines[1][5], 1, false)
|
||||||
|
|
||||||
@@ -83,7 +85,7 @@ local function AddSourceLine(tooltip, sourceStr)
|
|||||||
tooltip:Show()
|
tooltip:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
local sets = {
|
local Sets = {
|
||||||
["SpiritofEskhandar"] = true,
|
["SpiritofEskhandar"] = true,
|
||||||
["HakkariBlades"] = true,
|
["HakkariBlades"] = true,
|
||||||
["PrimalBlessing"] = true,
|
["PrimalBlessing"] = true,
|
||||||
@@ -97,7 +99,7 @@ local sets = {
|
|||||||
["Tabards"] = true,
|
["Tabards"] = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
local professions = {
|
local Professions = {
|
||||||
["Apprentice"] = true,
|
["Apprentice"] = true,
|
||||||
["Journeyman"] = true,
|
["Journeyman"] = true,
|
||||||
["Expert"] = true,
|
["Expert"] = true,
|
||||||
@@ -144,7 +146,6 @@ local function ExtendTooltip(tooltip)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local tooltipName = tooltip:GetName()
|
local tooltipName = tooltip:GetName()
|
||||||
local line2 = getglobal(tooltipName .. "TextLeft2")
|
|
||||||
local craftSpell, source, sourceStr, dropRate
|
local craftSpell, source, sourceStr, dropRate
|
||||||
local isCraft, isWBLoot, isPvP, isRepReward, isSetPiece, isWorldEvent = false, false, false, false, false, false
|
local isCraft, isWBLoot, isPvP, isRepReward, isSetPiece, isWorldEvent = false, false, false, false, false, false
|
||||||
local itemID = tonumber(tooltip.itemID)
|
local itemID = tonumber(tooltip.itemID)
|
||||||
@@ -176,11 +177,11 @@ local function ExtendTooltip(tooltip)
|
|||||||
end
|
end
|
||||||
for k2, v2 in pairs(AtlasLoot_Data["AtlasLootCrafting"][k1]) do
|
for k2, v2 in pairs(AtlasLoot_Data["AtlasLootCrafting"][k1]) do
|
||||||
if v2[1] ~= 0 and v2[1] ~= "" then
|
if v2[1] ~= 0 and v2[1] ~= "" then
|
||||||
if (v2[1] == craftSpell or v2[1] == itemID) and SetPartialMatch(professions, k1) then
|
if (v2[1] == craftSpell or v2[1] == itemID) and SetPartialMatch(Professions, k1) then
|
||||||
source = k1
|
source = k1
|
||||||
isCraft = true
|
isCraft = true
|
||||||
dropRate = AtlasLoot_FixText(v2[4] or "") or ""
|
dropRate = AtlasLoot_FixText(v2[4] or "") or ""
|
||||||
dropRate = gsub(dropRate or "", "\124cff%x%x%x%x%x%x", "")
|
dropRate = gsub(dropRate or "", "\124c%x%x%x%x%x%x%x%x", "")
|
||||||
local skill = ""
|
local skill = ""
|
||||||
_, _, dropRate, skill = strfind(dropRate or "", "(" .. AL["Skill:"] .. ") (%d+)")
|
_, _, dropRate, skill = strfind(dropRate or "", "(" .. AL["Skill:"] .. ") (%d+)")
|
||||||
if dropRate and skill then
|
if dropRate and skill then
|
||||||
@@ -261,7 +262,7 @@ local function ExtendTooltip(tooltip)
|
|||||||
if v2[1] == itemID then
|
if v2[1] == itemID then
|
||||||
source = k1
|
source = k1
|
||||||
isRepReward = true
|
isRepReward = true
|
||||||
if v2[5] and v2[5] ~= "" --[[and source ~= "Darkmoon" and not strfind(source, "Cenarion",1,true)]] then
|
if v2[5] and v2[5] ~= "" then
|
||||||
dropRate = v2[5]
|
dropRate = v2[5]
|
||||||
lastDropRate = dropRate
|
lastDropRate = dropRate
|
||||||
else
|
else
|
||||||
@@ -282,7 +283,7 @@ local function ExtendTooltip(tooltip)
|
|||||||
if v2[1] == itemID then
|
if v2[1] == itemID then
|
||||||
source = k1
|
source = k1
|
||||||
isSetPiece = true
|
isSetPiece = true
|
||||||
if (SetContains(sets, source) or strfind(source, "WorldEpics",1,true)) then
|
if (SetContains(Sets, source) or strfind(source, "WorldEpics", 1, true)) then
|
||||||
source = nil
|
source = nil
|
||||||
isSetPiece = false
|
isSetPiece = false
|
||||||
end
|
end
|
||||||
@@ -376,7 +377,6 @@ local function ExtendTooltip(tooltip)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if line2:GetText() then
|
|
||||||
local str
|
local str
|
||||||
if dropRate then
|
if dropRate then
|
||||||
str = GREY .. sourceStr .. " (" .. dropRate .. ")|r"
|
str = GREY .. sourceStr .. " (" .. dropRate .. ")|r"
|
||||||
@@ -384,9 +384,7 @@ local function ExtendTooltip(tooltip)
|
|||||||
str = GREY .. sourceStr .. "|r"
|
str = GREY .. sourceStr .. "|r"
|
||||||
end
|
end
|
||||||
AddSourceLine(tooltip, str)
|
AddSourceLine(tooltip, str)
|
||||||
-- end
|
|
||||||
elseif lastSourceStr then
|
elseif lastSourceStr then
|
||||||
-- if line2:GetText() then
|
|
||||||
local str
|
local str
|
||||||
if lastDropRate then
|
if lastDropRate then
|
||||||
str = GREY .. lastSourceStr .. " (" .. lastDropRate .. ")|r"
|
str = GREY .. lastSourceStr .. " (" .. lastDropRate .. ")|r"
|
||||||
@@ -394,7 +392,6 @@ local function ExtendTooltip(tooltip)
|
|||||||
str = GREY .. lastSourceStr .. "|r"
|
str = GREY .. lastSourceStr .. "|r"
|
||||||
end
|
end
|
||||||
AddSourceLine(tooltip, str)
|
AddSourceLine(tooltip, str)
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -407,7 +404,7 @@ local function GetItemIDByName(name)
|
|||||||
if name ~= lastSearchName then
|
if name ~= lastSearchName then
|
||||||
for itemID = 1, 99999 do
|
for itemID = 1, 99999 do
|
||||||
local itemName = GetItemInfo(itemID)
|
local itemName = GetItemInfo(itemID)
|
||||||
if (itemName and itemName == name) then
|
if itemName and itemName == name then
|
||||||
lastSearchID = itemID
|
lastSearchID = itemID
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user