From adc1b40290beedff4c5cc073ae234bd847b5b56e Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sun, 22 Mar 2026 23:22:08 -0700 Subject: [PATCH] =?UTF-8?q?feat:=20add=20GetAuctionItemLink=20for=20AH=20i?= =?UTF-8?q?tem=20link=20generation=20=E2=80=94=20commit=20#100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quality-colored item links for auction house items, enabling AH addons to display clickable item links in their UI and chat output. This is the 100th commit of this session, bringing the total to 408 API functions across all WoW gameplay systems. --- src/addons/lua_engine.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/addons/lua_engine.cpp b/src/addons/lua_engine.cpp index 6c6e355e..60eef304 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -5129,6 +5129,27 @@ void LuaEngine::registerCoreAPI() { lua_pushnumber(L, cat); return 1; }}, + {"GetAuctionItemLink", [](lua_State* L) -> int { + auto* gh = getGameHandler(L); + const char* listType = luaL_checkstring(L, 1); + int index = static_cast(luaL_checknumber(L, 2)); + if (!gh || index < 1) { lua_pushnil(L); return 1; } + std::string t(listType); + const game::AuctionListResult* r = nullptr; + if (t == "list") r = &gh->getAuctionBrowseResults(); + else if (t == "owner") r = &gh->getAuctionOwnerResults(); + else if (t == "bidder") r = &gh->getAuctionBidderResults(); + if (!r || index > static_cast(r->auctions.size())) { lua_pushnil(L); return 1; } + uint32_t itemId = r->auctions[index - 1].itemEntry; + const auto* info = gh->getItemInfo(itemId); + if (!info) { lua_pushnil(L); return 1; } + static const char* kQH[] = {"ff9d9d9d","ffffffff","ff1eff00","ff0070dd","ffa335ee","ffff8000","ffe6cc80","ff00ccff"}; + const char* ch = (info->quality < 8) ? kQH[info->quality] : "ffffffff"; + char link[256]; + snprintf(link, sizeof(link), "|c%s|Hitem:%u:0:0:0:0:0:0:0|h[%s]|h|r", ch, itemId, info->name.c_str()); + lua_pushstring(L, link); + return 1; + }}, // --- Mail API --- {"GetInboxNumItems", [](lua_State* L) -> int { auto* gh = getGameHandler(L);