feat(ui): implement Script_GetPlayerTradeMoney
Some checks failed
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Has been cancelled
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Has been cancelled
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Has been cancelled

This commit is contained in:
fallenoak 2026-02-06 22:29:43 -06:00
parent 3366ea2c89
commit 72d2c3b1a2
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
3 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,12 @@
#include "ui/game/CGTradeInfo.hpp"
uint32_t CGTradeInfo::s_playerMoney;
WOWGUID CGTradeInfo::s_tradingPlayer;
uint32_t CGTradeInfo::GetPlayerTradeMoney() {
return CGTradeInfo::s_playerMoney;
}
WOWGUID CGTradeInfo::GetTradePartner() {
return CGTradeInfo::s_tradingPlayer;
}

View File

@ -0,0 +1,19 @@
#ifndef UI_GAME_C_G_TRADE_INFO_HPP
#define UI_GAME_C_G_TRADE_INFO_HPP
#include "util/GUID.hpp"
#include <cstdint>
class CGTradeInfo {
public:
// Public static functions
static uint32_t GetPlayerTradeMoney();
static WOWGUID GetTradePartner();
private:
// Private static variables
static uint32_t s_playerMoney;
static WOWGUID s_tradingPlayer;
};
#endif

View File

@ -1,5 +1,7 @@
#include "ui/game/TradeInfoScript.hpp" #include "ui/game/TradeInfoScript.hpp"
#include "ui/FrameScript.hpp" #include "ui/FrameScript.hpp"
#include "ui/game/CGTradeInfo.hpp"
#include "util/Lua.hpp"
#include "util/Unimplemented.hpp" #include "util/Unimplemented.hpp"
namespace { namespace {
@ -41,7 +43,13 @@ int32_t Script_CancelTradeAccept(lua_State* L) {
} }
int32_t Script_GetPlayerTradeMoney(lua_State* L) { int32_t Script_GetPlayerTradeMoney(lua_State* L) {
WHOA_UNIMPLEMENTED(0); if (CGTradeInfo::GetTradePartner()) {
lua_pushnumber(L, CGTradeInfo::GetPlayerTradeMoney());
} else {
lua_pushnumber(L, 0);
}
return 1;
} }
int32_t Script_GetTargetTradeMoney(lua_State* L) { int32_t Script_GetTargetTradeMoney(lua_State* L) {