mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-02 15:53:51 +00:00
feat: add trade API (AcceptTrade, CancelTrade, InitiateTrade)
AcceptTrade() locks in the trade offer via CMSG_ACCEPT_TRADE. CancelTrade() cancels an open trade via CMSG_CANCEL_TRADE. InitiateTrade(unit) starts a trade with a target player. Uses existing GameHandler trade functions and TradeStatus tracking. Enables trade addons and macro-based trade acceptance.
This commit is contained in:
parent
adc1b40290
commit
397185d33c
1 changed files with 20 additions and 0 deletions
|
|
@ -5062,6 +5062,26 @@ void LuaEngine::registerCoreAPI() {
|
||||||
lua_pushboolean(L, 1); // isCastable
|
lua_pushboolean(L, 1); // isCastable
|
||||||
return 4;
|
return 4;
|
||||||
}},
|
}},
|
||||||
|
// --- Trade API ---
|
||||||
|
{"AcceptTrade", [](lua_State* L) -> int {
|
||||||
|
auto* gh = getGameHandler(L);
|
||||||
|
if (gh) gh->acceptTrade();
|
||||||
|
return 0;
|
||||||
|
}},
|
||||||
|
{"CancelTrade", [](lua_State* L) -> int {
|
||||||
|
auto* gh = getGameHandler(L);
|
||||||
|
if (gh && gh->isTradeOpen()) gh->cancelTrade();
|
||||||
|
return 0;
|
||||||
|
}},
|
||||||
|
{"InitiateTrade", [](lua_State* L) -> int {
|
||||||
|
auto* gh = getGameHandler(L);
|
||||||
|
const char* uid = luaL_checkstring(L, 1);
|
||||||
|
if (gh) {
|
||||||
|
uint64_t guid = resolveUnitGuid(gh, std::string(uid));
|
||||||
|
if (guid != 0) gh->initiateTrade(guid);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}},
|
||||||
// --- Auction House API ---
|
// --- Auction House API ---
|
||||||
{"GetNumAuctionItems", [](lua_State* L) -> int {
|
{"GetNumAuctionItems", [](lua_State* L) -> int {
|
||||||
auto* gh = getGameHandler(L);
|
auto* gh = getGameHandler(L);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue