View Single Post
10-01-20, 03:39 PM   #1
Opertune
A Murloc Raider
Join Date: Sep 2020
Posts: 4
Auction house : get specific item price

Hello everyone, i'm new developer and i would like to create an addon who show specific item price when i click on a button (item set in code and no with in game auction house research).

Currently i can create frame and button when i open auction house but i don't know how work auction house api (C_AuctionHouse.GetReplicateItemInfo or C_AuctionHouse.GetCommoditySearchResultInfo).

I try with Xrystal code : https://www.wowinterface.com/forums/...ad.php?t=57985 but nothing really gets done.

My currently code :

Code:
local UIConfig = CreateFrame("Frame", "OpertuneAH", UIParent, "BasicFrameTemplateWithInset");

UIConfig:RegisterEvent("AUCTION_HOUSE_SHOW") -- Event when auction house is opened
UIConfig:RegisterEvent("AUCTION_HOUSE_CLOSED") -- Event when auction house is closed

UIConfig:SetSize(600, 535) -- Window size
UIConfig:SetScript("OnEvent",
	function(self,event,...)
		if event == "AUCTION_HOUSE_SHOW" then -- If auction house is opened we create frame
			-- Frame Settings
			UIConfig:SetPoint("CENTER", UIParent, "CENTER", 200, 155) -- Position
			UIConfig:SetMovable(true) -- Drag and drop option's
			UIConfig:EnableMouse(true) -- Drag and drop option's
			UIConfig:RegisterForDrag("LeftButton") -- Drag and drop option's
			UIConfig:SetScript("OnDragStart", UIConfig.StartMoving) -- Drag and drop option's
			UIConfig:SetScript("OnDragStop", UIConfig.StopMovingOrSizing) -- Drag and drop option's
			-- Show Frame
			UIConfig:Show()
		end
		if event == "AUCTION_HOUSE_CLOSED" then -- If auction house is closed we close the frame
			UIConfig:Hide() -- Hide Frame
			UIConfig.text:SetText("") -- Reset text area
		end 
	end)


-- Child frames and regions
-- Frame title
UIConfig.title = UIConfig:CreateFontString(nil, "OVERLAY")
UIConfig.title:SetFontObject("GameFontHighlight")
UIConfig.title:SetPoint("LEFT", UIConfig.TitleBg, "LEFT", 5, 0)
UIConfig.title:SetText("OpertuneAH")

-- Scan button
UIConfig.scanButton = CreateFrame("Button", nil, UIConfig, "GameMenuButtonTemplate")
UIConfig.scanButton:SetPoint("TOPLEFT", UIConfig, "TOPLEFT", 10, -28)
UIConfig.scanButton:SetSize(90, 25)
UIConfig.scanButton:SetText("Scan")
UIConfig.scanButton:SetNormalFontObject("GameFontNormalLarge") -- Text Color
UIConfig.scanButton:SetHighlightFontObject("GameFontHighlightLarge") -- Text Color

-- Event click button scan
UIConfig.scanButton:SetScript("OnClick",function(self,event,...)
	UIConfig.text:SetText("Hello World")
end)

-- Label text
UIConfig.text = UIConfig:CreateFontString(nil, "TEST")
UIConfig.text:SetFontObject("GameFontNormalLarge")
UIConfig.text:SetPoint("CENTER", UIConfig, "CENTER", 0, 0)
  Reply With Quote