### Create and Manage Auction House Tabs with LibAHTab Source: https://github.com/themousenest/auctionator/blob/master/Libs_ModernAH/LibAHTab/README.md This snippet demonstrates how to initialize LibAHTab, listen for the Auction House interaction event, and register a custom tab. It also outlines the primary API methods for checking existence, retrieving buttons, and programmatically selecting tabs. ```lua local LibAHTab = LibStub("LibAHTab-1-0") local frame = CreateFrame("Frame") local UNIQUE_TAB_ID = "My id" frame:RegisterEvent("PLAYER_INTERACTION_MANAGER_FRAME_SHOW") frame:SetScript("OnEvent", function(_, eventName, panelType) if eventName == "PLAYER_INTERACTION_MANAGER_FRAME_SHOW" and panelType == Enum.PlayerInteractionType.Auctioneer then local attachedFrame = CreateFrame("Frame") attachedFrame:SetScript("OnShow", function() -- do something when the tab is selected end) LibAHTab:CreateTab(UNIQUE_TAB_ID, attachedFrame, "Tab text") end end) -- API LibAHTab:CreateTab(UNIQUE_TAB_ID, attachedFrame, "Tab Button Text", "Optional tab header") LibAHTab:DoesIDExist(UNIQUE_TAB_ID) LibAHTab:GetButton(UNIQUE_TAB_ID) LibAHTab:SetSelected(UNIQUE_TAB_ID) ``` -------------------------------- ### Add Double Line to Battle Pet Tooltip (Lua) Source: https://github.com/themousenest/auctionator/blob/master/Libs_ModernAH/LibBattlePetTooltipLine/README.md Demonstrates how to use the LibBattlePetTooltipLine library to add a double-line with custom text and color to a battle pet tooltip. It utilizes `hooksecurefunc` to modify the `BattlePetToolTip_Show` function. The `AddDoubleLine` function takes the tooltip object, left-aligned text, and right-aligned text as arguments. ```lua local LibBattlePetTooltipLine = LibStub("LibBattlePetTooltipLine-1-0") hooksecurefunc("BattlePetToolTip_Show", function(...) LibBattlePetTooltipLine:AddDoubleLine(BattlePetTooltip, "Special Detail", RED_FONT_COLOR:WrapTextInColorCode("Me")) end) ``` -------------------------------- ### LibAHTab API Methods Source: https://github.com/themousenest/auctionator/blob/master/Libs_ModernAH/LibAHTab/README.md Core methods for managing custom Auction House tabs. ```APIDOC ## LibAHTab:CreateTab ### Description Creates a new tab in the Auction House interface. This method avoids taint issues associated with standard PanelTemplates. ### Method Lua Function Call ### Parameters - **UNIQUE_TAB_ID** (string) - Required - A unique identifier for the tab. - **attachedFrame** (frame) - Required - The frame to display when the tab is selected. - **tabText** (string) - Required - The text displayed on the tab button. - **headerText** (string) - Optional - The text displayed in the tab header. --- ## LibAHTab:DoesIDExist ### Description Checks if a tab with the specified ID has already been registered. ### Method Lua Function Call ### Parameters - **UNIQUE_TAB_ID** (string) - Required - The ID to check. ### Response - **boolean** - Returns true if the ID exists, false otherwise. --- ## LibAHTab:GetButton ### Description Retrieves the button frame associated with the given tab ID. ### Method Lua Function Call ### Parameters - **UNIQUE_TAB_ID** (string) - Required - The ID of the tab. ### Response - **frame** - The button frame object. --- ## LibAHTab:SetSelected ### Description Programmatically selects a specific tab. ### Method Lua Function Call ### Parameters - **UNIQUE_TAB_ID** (string) - Required - The ID of the tab to select. ``` -------------------------------- ### Perform Auction House Searches Source: https://github.com/themousenest/auctionator/wiki/API-Documentation Methods to trigger searches within the auction house interface. MultiSearch supports basic and advanced query structures, requiring the auction house to be open. ```lua Auctionator.API.v1.MultiSearch("MyAddon", {"Item1", "Item2"}) -- Advanced search example Auctionator.API.v1.MultiSearchAdvanced("MyAddon", { { searchString = "Ore", isExact = true, tier = 1, quality = 2, quantity = 5 } }) ``` -------------------------------- ### Register for Database Updates Source: https://github.com/themousenest/auctionator/wiki/API-Documentation Registers a callback function that executes whenever the Auctionator price database is updated. This is useful for keeping external UI elements in sync with current market data. ```lua Auctionator.API.v1.RegisterForDBUpdate("MyAddon", function() print("Database updated!") end) ``` -------------------------------- ### Retrieve Auction Prices and Perform Searches via Auctionator API Source: https://github.com/themousenest/auctionator/blob/master/Source/API/v1/README.md Provides methods to fetch the last scanned auction price for items using either an itemID or an itemLink. Additionally, it includes a function to execute multi-term searches, which requires the auction house interface to be active. ```lua -- Returns the last scanned price for an item identified by itemID -- Returns the price in coppers, or nil if one wasn't found Auctionator.API.v1.GetAuctionPriceByItemID(callerID, itemID) -- Returns the last scanned price for an item identified by itemLink -- Returns the price in coppers, or nil if one wasn't found Auctionator.API.v1.GetAuctionPriceByItemLink(callerID, itemLink) -- Searches for an array of search terms and displays the results -- The auction house MUST be open. Auctionator.API.v1.MultiSearch(callerID, terms) ``` -------------------------------- ### Retrieve Item Prices via Auctionator API Source: https://github.com/themousenest/auctionator/wiki/API-Documentation Functions to fetch the last scanned auction, disenchant, or vendor prices for items. These methods require a callerID string and return the price in coppers or nil if unavailable. ```lua local price = Auctionator.API.v1.GetAuctionPriceByItemID("MyAddon", 152512) local disenchantPrice = Auctionator.API.v1.GetDisenchantPriceByItemID("MyAddon", 152512) local vendorPrice = Auctionator.API.v1.GetVendorPriceByItemID("MyAddon", 152512) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.