Skip to content

Commit

Permalink
Cleanup scantip
Browse files Browse the repository at this point in the history
  • Loading branch information
siweia committed Aug 2, 2020
1 parent cc12611 commit ae17d0f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
6 changes: 2 additions & 4 deletions Interface/AddOns/NDui/Modules/Infobar/Durability.lua
Expand Up @@ -70,8 +70,6 @@ local function gradientColor(perc)
return format("|cff%02x%02x%02x", r*255, g*255, b*255), r, g, b
end

local tip = B.ScanTip

info.eventList = {
"UPDATE_INVENTORY_DURABILITY", "PLAYER_ENTERING_WORLD",
}
Expand Down Expand Up @@ -138,8 +136,8 @@ info.onEnter = function(self)
local slotIcon = "|T"..GetInventoryItemTexture("player", slot)..":13:15:0:0:50:50:4:46:4:46|t " or ""
GameTooltip:AddDoubleLine(slotIcon..localSlots[i][2], floor(localSlots[i][3]*100).."%", 1,1,1, red+1,green,0)

tip:SetOwner(UIParent, "ANCHOR_NONE")
totalCost = totalCost + select(3, tip:SetInventoryItem("player", slot))
B.ScanTip:SetOwner(UIParent, "ANCHOR_NONE")
totalCost = totalCost + select(3, B.ScanTip:SetInventoryItem("player", slot))
end
end

Expand Down
15 changes: 7 additions & 8 deletions Interface/AddOns/NDui/Modules/Tooltip/CorruptionRank.lua
Expand Up @@ -188,7 +188,6 @@ function TT:Corruption_PlayerSummary()
TT:Corruption_AddSummary()
end

local tip = B.ScanTip
local cloakResString = "(%d+)%s?"..ITEM_MOD_CORRUPTION_RESISTANCE

local essenceTextureIDs = {
Expand All @@ -203,10 +202,10 @@ local essenceTextureIDs = {

function TT:Corruption_SearchEssence()
local resistance = 0
tip:SetOwner(UIParent, "ANCHOR_NONE")
tip:SetInventoryItem(InspectFrame.unit, 2)
B.ScanTip:SetOwner(UIParent, "ANCHOR_NONE")
B.ScanTip:SetInventoryItem(InspectFrame.unit, 2)
for i = 1, 10 do
local tex = _G[tip:GetName().."Texture"..i]
local tex = _G["NDui_ScanTooltipTexture"..i]
local texture = tex and tex:IsShown() and tex:GetTexture()
if texture and essenceTextureIDs[texture] then
resistance = 10
Expand All @@ -218,10 +217,10 @@ end

function TT:Corruption_SearchCloak()
local resistance = 0
tip:SetOwner(UIParent, "ANCHOR_NONE")
tip:SetInventoryItem(InspectFrame.unit, 15)
for i = 1, tip:NumLines() do
local line = _G[tip:GetName().."TextLeft"..i]
B.ScanTip:SetOwner(UIParent, "ANCHOR_NONE")
B.ScanTip:SetInventoryItem(InspectFrame.unit, 15)
for i = 1, B.ScanTip:NumLines() do
local line = _G["NDui_ScanTooltipTextLeft"..i]
local text = line and line:GetText()
local value = text and strmatch(text, cloakResString)
if value then
Expand Down
11 changes: 5 additions & 6 deletions Interface/AddOns/NDui/Modules/UFs/Nameplates.lua
Expand Up @@ -362,7 +362,6 @@ function UF:QuestIconCheck()
B:RegisterEvent("PLAYER_ENTERING_WORLD", CheckInstanceStatus)
end

local unitTip = B.ScanTip
function UF:UpdateQuestUnit(_, unit)
if not NDuiDB["Nameplate"]["QuestIndicator"] then return end
if isInInstance then
Expand All @@ -374,19 +373,19 @@ function UF:UpdateQuestUnit(_, unit)
unit = unit or self.unit

local isLootQuest, questProgress
unitTip:SetOwner(UIParent, "ANCHOR_NONE")
unitTip:SetUnit(unit)
B.ScanTip:SetOwner(UIParent, "ANCHOR_NONE")
B.ScanTip:SetUnit(unit)

for i = 2, unitTip:NumLines() do
local textLine = _G[unitTip:GetName().."TextLeft"..i]
for i = 2, B.ScanTip:NumLines() do
local textLine = _G["NDui_ScanTooltipTextLeft"..i]
local text = textLine:GetText()
if textLine and text then
local r, g, b = textLine:GetTextColor()
if r > .99 and g > .82 and b == 0 then
if isInGroup and text == DB.MyName or not isInGroup then
isLootQuest = true

local questLine = _G[unitTip:GetName().."TextLeft"..(i+1)]
local questLine = _G["NDui_ScanTooltipTextLeft"..(i+1)]
local questText = questLine:GetText()
if questLine and questText then
local current, goal = strmatch(questText, "(%d+)/(%d+)")
Expand Down
11 changes: 5 additions & 6 deletions Interface/AddOns/NDui/Plugins/AlreadyKnown.lua
Expand Up @@ -16,7 +16,6 @@ local knowables = {
[LE_ITEM_CLASS_MISCELLANEOUS] = true,
}
local knowns = {}
local tooltip = B.ScanTip

local function isPetCollected(speciesID)
if not speciesID or speciesID == 0 then return end
Expand All @@ -37,16 +36,16 @@ local function IsAlreadyKnown(link, index)
if not name then return end

if itemClassID == LE_ITEM_CLASS_BATTLEPET and index then
local speciesID = tooltip:SetGuildBankItem(GetCurrentGuildBankTab(), index)
local speciesID = B.ScanTip:SetGuildBankItem(GetCurrentGuildBankTab(), index)
return isPetCollected(speciesID)
else
if knowns[link] then return true end
if not knowables[itemClassID] then return end

tooltip:SetOwner(UIParent, "ANCHOR_NONE")
tooltip:SetHyperlink(link)
for i = 1, tooltip:NumLines() do
local text = _G[tooltip:GetName().."TextLeft"..i]:GetText() or ""
B.ScanTip:SetOwner(UIParent, "ANCHOR_NONE")
B.ScanTip:SetHyperlink(link)
for i = 1, B.ScanTip:NumLines() do
local text = _G["NDui_ScanTooltipTextLeft"..i]:GetText() or ""
if strfind(text, COLLECTED) or text == ITEM_SPELL_KNOWN then
knowns[link] = true
return true
Expand Down

0 comments on commit ae17d0f

Please sign in to comment.