Skip to content

Commit

Permalink
Fixed appearance of recipe tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Feb 3, 2020
1 parent d286a70 commit 8e797f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
globals = {'LibStub', 'BUTTON_LAG_AUCTIONHOUSE', 'LANDING_PAGE_REPORT', 'COPPER_PER_SILVER', 'SILVER_PER_GOLD', 'GOLD_AMOUNT_TEXTURE_STRING', 'SILVER_AMOUNT_TEXTURE'}
globals = {'LibStub', 'BUTTON_LAG_AUCTIONHOUSE', 'LANDING_PAGE_REPORT', 'COPPER_PER_SILVER', 'SILVER_PER_GOLD', 'GOLD_AMOUNT_TEXTURE_STRING', 'SILVER_AMOUNT_TEXTURE', 'LE_ITEM_CLASS_RECIPE', 'LE_ITEM_RECIPE_BOOK'}
ignore = {'self'}
max_line_length = false
self = false
12 changes: 11 additions & 1 deletion RECrystallize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ local ExtractLink = _G.LinkUtil.ExtractLink
local After = _G.C_Timer.After
local Round = _G.Round
local PlaySound = _G.PlaySound
local GetItemInfo = _G.GetItemInfo
local GetItemCount = _G.GetItemCount
local GetRealmName = _G.GetRealmName
local SecondsToTime = _G.SecondsToTime
local IsShiftKeyDown = _G.IsShiftKeyDown
local SendChatMessage = _G.SendChatMessage
local SetTooltipMoney = _G.SetTooltipMoney
local FormatLargeNumber = _G.FormatLargeNumber
local GetItemCount = _G.GetItemCount
local ReplicateItems = _G.C_AuctionHouse.ReplicateItems
local GetNumReplicateItems = _G.C_AuctionHouse.GetNumReplicateItems
local GetReplicateItemInfo = _G.C_AuctionHouse.GetReplicateItemInfo
Expand All @@ -33,6 +34,7 @@ local PETCAGEID = 82800

RE.DefaultConfig = {["LastScan"] = 0, ["GuildChatPC"] = false, ["DatabaseCleanup"] = 432000, ["ScanPulse"] = 1, ["DatabaseVersion"] = 1}
RE.GUIInitialized = false
RE.RecipeLock = false
RE.BlockTooltip = 0
RE.TooltipLink = ""
RE.TooltipItemVariant = ""
Expand Down Expand Up @@ -190,6 +192,7 @@ function RE:OnEvent(self, event, ...)
end

_G.GameTooltip:HookScript("OnTooltipSetItem", function(self) RE:TooltipAddPrice(self); RE.TooltipCustomCount = -1 end)
_G.GameTooltip:HookScript("OnTooltipCleared", function(_) RE.RecipeLock = false end)
hooksecurefunc("BattlePetToolTip_Show", function(speciesID, level, breedQuality, maxHealth, power, speed) RE:TooltipPetAddPrice(sFormat("|cffffffff|Hbattlepet:%s:%s:%s:%s:%s:%s:0000000000000000:0|h[XYZ]|h|r", speciesID, level, breedQuality, maxHealth, power, speed)) end)
hooksecurefunc("FloatingBattlePet_Show", function(speciesID, level, breedQuality, maxHealth, power, speed) RE:TooltipPetAddPrice(sFormat("|cffffffff|Hbattlepet:%s:%s:%s:%s:%s:%s:0000000000000000:0|h[XYZ]|h|r", speciesID, level, breedQuality, maxHealth, power, speed)) end)

Expand Down Expand Up @@ -223,6 +226,13 @@ function RE:TooltipAddPrice(self)
if self:IsForbidden() then return end
local _, link = self:GetItem()
if link and IsLinkType(link, "item") then
local itemTypeId, itemSubTypeId = select(12, GetItemInfo(link))
if not RE.RecipeLock and itemTypeId == LE_ITEM_CLASS_RECIPE and itemSubTypeId ~= LE_ITEM_RECIPE_BOOK then
RE.RecipeLock = true
return
else
RE.RecipeLock = false
end
if link ~= RE.TooltipLink then
RE.TooltipLink = link
RE.TooltipItemID = tonumber(sMatch(link, "item:(%d+)"))
Expand Down

0 comments on commit 8e797f2

Please sign in to comment.