Skip to content

Commit

Permalink
Add BoA rep item config option and fix most debug tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
Caerdon committed Sep 15, 2023
1 parent d92553f commit ce03ab8
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 23 deletions.
10 changes: 7 additions & 3 deletions CaerdonItem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,9 @@ function CaerdonItemMixin:GetTooltipData(data)
end

if strmatch(lineText, L["Use: Grants (%d+) reputation"]) then
tooltipData.canLearn = true
if CaerdonWardrobeConfig.Binding.ShowBoARepItems then
tooltipData.canLearn = true
end
elseif strmatch(lineText, L["Use: Marks your map with the location"]) then
tooltipData.canLearn = true
elseif strmatch(lineText, L["Use: Unlocks this customization"]) then
Expand Down Expand Up @@ -603,8 +605,10 @@ function CaerdonItemMixin:GetTooltipData(data)
elseif line.type == Enum.TooltipDataLineType.EquipSlot then
elseif line.type == Enum.TooltipDataLineType.ItemName then
else
print("Caerdon: TOOLTIP PROCESSING NEEDED: " .. self:GetItemLink() .. ", type: " .. tostring(line.type))
-- DevTools_Dump(line)
if CaerdonWardrobeConfig.Debug.Enabled then
print("Caerdon: TOOLTIP PROCESSING NEEDED: " .. self:GetItemLink() .. ", type: " .. tostring(line.type))
-- DevTools_Dump(line)
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion CaerdonWardrobe.toc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Title: Caerdon Wardrobe
## Notes: Shows BOE / BOA, openable, and unlearned pets, toys, mounts and wardrobe indicator on bank / bag / auction / merchant / guild bank / loot frame / loot roll / encounter journal slots
## Author: Caerdon
## Version: v3.4.4
## Version: v3.4.5
## SavedVariables: CaerdonWardrobeConfig
## OptionalDeps: WagoAnalytics, WoWUnit, AdiBags, AngrierWorldQuests, ArkInventory, Bagnon, BaudBag, cargBags_Nivaya, Combuctor, ElvUI, Inventorian, KkthnxUI, LiteBag, Pawn, Skillet, Sorted, VenturePlan, WorldQuestsList, WorldQuestTracker, ZygorGuidesViewer

Expand Down
1 change: 1 addition & 0 deletions config/Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ function NS:GetDefaultConfig()
},

ShowBoA = true,
ShowBoARepItems = false,
ShowBoE = true,
ShowGearSets = true,
ShowGearSetsAsIcon = false,
Expand Down
1 change: 1 addition & 0 deletions config/ConfigNew.lua
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ securecall(SettingsRegistrar.AddRegistrant, SettingsRegistrar, Register)
-- },

-- ShowBoA = true,
-- ShowBoARepItems = false,
-- ShowBoE = true,
-- ShowGearSets = true,
-- ShowGearSetsAsIcon = false,
Expand Down
2 changes: 2 additions & 0 deletions config/General.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function CaerdonWardrobeConfigGeneral:Register()
showQuestItems = { key = "showQuestItems", text = "Show Quest Items", tooltip = "Adds an icon to any items that are tied to a quest", configSection="Icon", configValue="ShowQuestItems"},
showGearSetsAsIcon = { key = "showGearSetsAsIcon", text = "Show Gear Set Icon", tooltip = "Show an icon on items associated with a gear set", configSection="Binding", configValue="ShowGearSetsAsIcon"},
showBoA = { key = "showBoA", text = "Show Bind on Account", tooltip = "Shows BoA on items that are bind on account", configSection="Binding", configValue="ShowBoA"},
showBoARepItems = { key = "showBoARepItems", text = "Show Bind on Account Reputation Items", tooltip = "Shows BoA on items that are bind on account reputation items", configSection="Binding", configValue="ShowBoARepItems"},
showBoE = { key = "showBoE", text = "Show Bind on Equip", tooltip = "Shows BoE on items that are bind on equip", configSection="Binding", configValue="ShowBoE"},
showGearSets = { key = "showGearSets", text = "Show Gear Sets", tooltip = "Shows gear set text on items associated with a gear set", configSection="Binding", configValue="ShowGearSets"},
bindingPosition = { key = "bindingPosition", text = "Select Binding Position", tooltip = "Configures placement of the binding text", configSection="Binding", configValue="Position"},
Expand All @@ -49,6 +50,7 @@ function CaerdonWardrobeConfigGeneral:Register()
self:ConfigureCheckboxNew(self.options["showQuestItems"])
self:ConfigureCheckboxNew(self.options["showGearSetsAsIcon"])
self:ConfigureCheckboxNew(self.options["showBoA"])
self:ConfigureCheckboxNew(self.options["showBoARepItems"])
self:ConfigureCheckboxNew(self.options["showBoE"])
self:ConfigureCheckboxNew(self.options["showGearSets"])
self:ConfigureDropdownNew(self.options["bindingPosition"], {
Expand Down
47 changes: 28 additions & 19 deletions features/Tooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,24 @@ end

function TooltipMixin:OnLoad()
-- TODO: Add Debug enable option setting
if C_TooltipInfo then
hooksecurefunc(GameTooltip, "ProcessInfo", function (...) Tooltip:OnProcessInfo(...) end)
hooksecurefunc(ItemRefTooltip, "ItemRefSetHyperlink", function (...) Tooltip:OnItemRefSetHyperlink(...) end)
hooksecurefunc("BattlePetToolTip_Show", function (...) Tooltip:OnBattlePetTooltipShow(BattlePetTooltip, ...) end)
hooksecurefunc("FloatingBattlePet_Show", function(...) Tooltip:OnBattlePetTooltipShow(FloatingBattlePetTooltip, ...) end)
hooksecurefunc("EmbeddedItemTooltip_SetItemByQuestReward", function(...) Tooltip:OnEmbeddedItemTooltipSetItemByQuestReward(...) end)
end
-- TODO: Figure out how to get Pet/Toy/Mount links working
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, function(...) Tooltip:OnTooltipSetItem(...) end)
-- TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Mount, function(...) Tooltip:OnTooltipSetItem(...) end)
-- TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Toy, function(...) Tooltip:OnTooltipSetItem(...) end)

-- ItemRefTooltip:HookScript("OnTooltipSetItem", function(tooltip, ...)
-- local name, link = tooltip:GetItem()
-- local item = CaerdonItem:CreateFromItemLink(itemLink)
-- Tooltip:ProcessTooltip(tooltip, item)
-- end)

-- if C_TooltipInfo then
-- hooksecurefunc(GameTooltip, "ProcessInfo", function (...) Tooltip:OnProcessInfo(...) end)
-- hooksecurefunc(ItemRefTooltip, "ItemRefSetHyperlink", function (...) Tooltip:OnItemRefSetHyperlink(...) end)
-- hooksecurefunc("BattlePetToolTip_Show", function (...) Tooltip:OnBattlePetTooltipShow(BattlePetTooltip, ...) end)
-- hooksecurefunc("FloatingBattlePet_Show", function(...) Tooltip:OnBattlePetTooltipShow(FloatingBattlePetTooltip, ...) end)
-- hooksecurefunc("EmbeddedItemTooltip_SetItemByQuestReward", function(...) Tooltip:OnEmbeddedItemTooltipSetItemByQuestReward(...) end)
-- end

-- TODO: Hack to ensure GameTooltip:SetPoint is called. Otherwise, BattlePetTooltip can puke.
-- Shouldn't need now that I switched to C_TooltipInfo...
Expand Down Expand Up @@ -399,9 +410,9 @@ function TooltipMixin:OnEmbeddedItemTooltipSetItemByQuestReward(tooltip, questLo
end
end

-- function TooltipMixin:OnTooltipSetItem(tooltip)
-- local itemName, itemLink = tooltip:GetItem()
-- if itemLink and itemName then
function TooltipMixin:OnTooltipSetItem(tooltip)
local itemName, itemLink, tooltipDataId = TooltipUtil.GetDisplayedItem(tooltip)
if itemLink and itemName then
-- local id = string.match(itemLink, "item:(%d*)")
-- if (id == "" or id == "0") and TradeSkillFrame ~= nil and TradeSkillFrame:IsVisible() and GetMouseFocus().reagentIndex then
-- local selectedRecipe = TradeSkillFrame.RecipeList:GetSelectedRecipeID()
Expand All @@ -413,13 +424,13 @@ end
-- end
-- end

-- if not tooltipItem or tooltipItem:GetItemLink() ~= itemLink then
-- tooltipItem = CaerdonItem:CreateFromItemLink(itemLink)
-- end
if not tooltipItem or tooltipItem:GetItemLink() ~= itemLink then
tooltipItem = CaerdonItem:CreateFromItemLink(itemLink)
end

-- Tooltip:ProcessTooltip(tooltip, tooltipItem)
-- end
-- end
Tooltip:ProcessTooltip(tooltip, tooltipItem)
end
end

-- This works but can't seem to do anything useful to get item info with the index (yet)
-- function TooltipMixin:OnClassTrainerFrameSetServiceButton(skillButton, skillIndex, playerMoney, selected, isTradeSkill)
Expand Down Expand Up @@ -512,7 +523,7 @@ end

local cancelFuncs = {}
function TooltipMixin:ProcessTooltip(tooltip, item, isEmbedded)
if not tooltip.info then return end -- tooltip needs access to tooltipInfo or things just break
-- if not tooltip.info then return end -- tooltip needs access to tooltipInfo or things just break

if not CaerdonWardrobeConfig.Debug.Enabled then
-- Not doing anything other than debug for tooltips right now
Expand All @@ -525,8 +536,6 @@ function TooltipMixin:ProcessTooltip(tooltip, item, isEmbedded)
end

function continueLoad()
if not tooltip.info then return end -- tooltip needs access to tooltipInfo or things just break

GameTooltip_AddBlankLineToTooltip(tooltip);
GameTooltip_AddColoredLine(tooltip, "Caerdon Wardrobe", LIGHTBLUE_FONT_COLOR);

Expand Down

0 comments on commit ce03ab8

Please sign in to comment.