mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-05 15:42:17 +03:00
feat(ui): implement Script_GetMoney
This commit is contained in:
parent
68ad71090e
commit
5ee4c54827
@ -41,6 +41,10 @@ uint32_t CGPlayer::TotalRemoteFieldsSaved() {
|
|||||||
return CGPlayer::GetBaseOffsetSaved() + 173;
|
return CGPlayer::GetBaseOffsetSaved() + 173;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t CGPlayer::GetMoney() const {
|
||||||
|
return this->Player()->coinage;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t CGPlayer::GetNextLevelXP() const {
|
uint32_t CGPlayer::GetNextLevelXP() const {
|
||||||
return this->Player()->nextLevelXP;
|
return this->Player()->nextLevelXP;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -149,6 +149,7 @@ class CGPlayer {
|
|||||||
static uint32_t TotalRemoteFieldsSaved();
|
static uint32_t TotalRemoteFieldsSaved();
|
||||||
|
|
||||||
// Public member functions
|
// Public member functions
|
||||||
|
uint32_t GetMoney() const;
|
||||||
uint32_t GetNextLevelXP() const;
|
uint32_t GetNextLevelXP() const;
|
||||||
uint32_t GetXP() const;
|
uint32_t GetXP() const;
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,12 @@
|
|||||||
#include "ui/Game.hpp"
|
#include "ui/Game.hpp"
|
||||||
#include <storm/Error.hpp>
|
#include <storm/Error.hpp>
|
||||||
|
|
||||||
|
CGPlayer_C* CGPlayer_C::GetActivePtr() {
|
||||||
|
return static_cast<CGPlayer_C*>(
|
||||||
|
ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPE_PLAYER, __FILE__, __LINE__)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
CGPlayer_C::CGPlayer_C(uint32_t time, CClientObjCreate& objCreate) : CGUnit_C(time, objCreate) {
|
CGPlayer_C::CGPlayer_C(uint32_t time, CClientObjCreate& objCreate) : CGUnit_C(time, objCreate) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
@ -14,6 +20,14 @@ CGPlayer_C::~CGPlayer_C() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t CGPlayer_C::GetMoney() const {
|
||||||
|
if (this->GetGUID() != ClntObjMgrGetActivePlayer()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->CGPlayer::GetMoney();
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t CGPlayer_C::GetNextLevelXP() const {
|
uint32_t CGPlayer_C::GetNextLevelXP() const {
|
||||||
if (this->GetGUID() != ClntObjMgrGetActivePlayer()) {
|
if (this->GetGUID() != ClntObjMgrGetActivePlayer()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -10,11 +10,15 @@ class CreatureModelDataRec;
|
|||||||
|
|
||||||
class CGPlayer_C : public CGUnit_C, public CGPlayer {
|
class CGPlayer_C : public CGUnit_C, public CGPlayer {
|
||||||
public:
|
public:
|
||||||
|
// Public static functions
|
||||||
|
static CGPlayer_C* GetActivePtr();
|
||||||
|
|
||||||
// Virtual public member functions
|
// Virtual public member functions
|
||||||
virtual ~CGPlayer_C();
|
virtual ~CGPlayer_C();
|
||||||
|
|
||||||
// Public member functions
|
// Public member functions
|
||||||
CGPlayer_C(uint32_t time, CClientObjCreate& objCreate);
|
CGPlayer_C(uint32_t time, CClientObjCreate& objCreate);
|
||||||
|
uint32_t GetMoney() const;
|
||||||
uint32_t GetNextLevelXP() const;
|
uint32_t GetNextLevelXP() const;
|
||||||
uint32_t GetXP() const;
|
uint32_t GetXP() const;
|
||||||
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
|
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
|
||||||
|
|||||||
@ -282,7 +282,15 @@ int32_t Script_UnitLevel(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetMoney(lua_State* L) {
|
int32_t Script_GetMoney(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto player = CGPlayer_C::GetActivePtr();
|
||||||
|
|
||||||
|
if (player) {
|
||||||
|
lua_pushnumber(L, player->GetMoney());
|
||||||
|
} else {
|
||||||
|
lua_pushnumber(L, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetHonorCurrency(lua_State* L) {
|
int32_t Script_GetHonorCurrency(lua_State* L) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user