mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 13:41:06 +03:00
Compare commits
3 Commits
4bf88801ed
...
cda8fff096
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cda8fff096 | ||
|
|
5ee4c54827 | ||
|
|
68ad71090e |
@ -41,6 +41,10 @@ uint32_t CGPlayer::TotalRemoteFieldsSaved() {
|
||||
return CGPlayer::GetBaseOffsetSaved() + 173;
|
||||
}
|
||||
|
||||
uint32_t CGPlayer::GetMoney() const {
|
||||
return this->Player()->coinage;
|
||||
}
|
||||
|
||||
uint32_t CGPlayer::GetNextLevelXP() const {
|
||||
return this->Player()->nextLevelXP;
|
||||
}
|
||||
|
||||
@ -149,6 +149,7 @@ class CGPlayer {
|
||||
static uint32_t TotalRemoteFieldsSaved();
|
||||
|
||||
// Public member functions
|
||||
uint32_t GetMoney() const;
|
||||
uint32_t GetNextLevelXP() const;
|
||||
uint32_t GetXP() const;
|
||||
|
||||
|
||||
@ -6,6 +6,12 @@
|
||||
#include "ui/Game.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) {
|
||||
// TODO
|
||||
}
|
||||
@ -14,20 +20,28 @@ CGPlayer_C::~CGPlayer_C() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
uint32_t CGPlayer_C::GetActiveNextLevelXP() const {
|
||||
uint32_t CGPlayer_C::GetMoney() const {
|
||||
if (this->GetGUID() != ClntObjMgrGetActivePlayer()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this->GetNextLevelXP();
|
||||
return this->CGPlayer::GetMoney();
|
||||
}
|
||||
|
||||
uint32_t CGPlayer_C::GetActiveXP() const {
|
||||
uint32_t CGPlayer_C::GetNextLevelXP() const {
|
||||
if (this->GetGUID() != ClntObjMgrGetActivePlayer()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this->GetXP();
|
||||
return this->CGPlayer::GetNextLevelXP();
|
||||
}
|
||||
|
||||
uint32_t CGPlayer_C::GetXP() const {
|
||||
if (this->GetGUID() != ClntObjMgrGetActivePlayer()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this->CGPlayer::GetXP();
|
||||
}
|
||||
|
||||
void CGPlayer_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
||||
|
||||
@ -10,13 +10,17 @@ class CreatureModelDataRec;
|
||||
|
||||
class CGPlayer_C : public CGUnit_C, public CGPlayer {
|
||||
public:
|
||||
// Public static functions
|
||||
static CGPlayer_C* GetActivePtr();
|
||||
|
||||
// Virtual public member functions
|
||||
virtual ~CGPlayer_C();
|
||||
|
||||
// Public member functions
|
||||
CGPlayer_C(uint32_t time, CClientObjCreate& objCreate);
|
||||
uint32_t GetActiveNextLevelXP() const;
|
||||
uint32_t GetActiveXP() const;
|
||||
uint32_t GetMoney() const;
|
||||
uint32_t GetNextLevelXP() const;
|
||||
uint32_t GetXP() const;
|
||||
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
|
||||
void PostInitActivePlayer();
|
||||
void SetStorage(uint32_t* storage, uint32_t* saved);
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include <common/MD5.hpp>
|
||||
|
||||
WOWGUID CGGameUI::s_currentObjectTrack;
|
||||
uint32_t CGGameUI::s_cursorMoney;
|
||||
CScriptObject* CGGameUI::s_gameTooltip;
|
||||
bool CGGameUI::s_inWorld;
|
||||
WOWGUID CGGameUI::s_lockedTarget;
|
||||
@ -94,6 +95,10 @@ WOWGUID& CGGameUI::GetCurrentObjectTrack() {
|
||||
return CGGameUI::s_currentObjectTrack;
|
||||
}
|
||||
|
||||
uint32_t CGGameUI::GetCursorMoney() {
|
||||
return CGGameUI::s_cursorMoney;
|
||||
}
|
||||
|
||||
WOWGUID& CGGameUI::GetLockedTarget() {
|
||||
return CGGameUI::s_lockedTarget;
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ class CGGameUI {
|
||||
// Static functions
|
||||
static void EnterWorld();
|
||||
static WOWGUID& GetCurrentObjectTrack();
|
||||
static uint32_t GetCursorMoney();
|
||||
static WOWGUID& GetLockedTarget();
|
||||
static void Initialize();
|
||||
static void InitializeGame();
|
||||
@ -25,6 +26,7 @@ class CGGameUI {
|
||||
|
||||
private:
|
||||
static WOWGUID s_currentObjectTrack;
|
||||
static uint32_t s_cursorMoney;
|
||||
static bool s_inWorld;
|
||||
static WOWGUID s_lockedTarget;
|
||||
static bool s_loggingIn;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "gx/Coordinate.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "ui/ScriptFunctionsShared.hpp"
|
||||
#include "ui/game/CGGameUI.hpp"
|
||||
#include "ui/simple/CSimpleTop.hpp"
|
||||
#include "util/StringTo.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
@ -502,7 +503,9 @@ int32_t Script_ForceQuit(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_GetCursorMoney(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
lua_pushnumber(L, CGGameUI::GetCursorMoney());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t Script_DropCursorMoney(lua_State* L) {
|
||||
|
||||
@ -189,7 +189,7 @@ int32_t Script_UnitXP(lua_State* L) {
|
||||
float xp = 0.0f;
|
||||
|
||||
if (unit && unit->IsA(TYPE_PLAYER)) {
|
||||
xp = static_cast<CGPlayer_C*>(unit)->GetActiveXP();
|
||||
xp = static_cast<CGPlayer_C*>(unit)->GetXP();
|
||||
}
|
||||
|
||||
lua_pushnumber(L, xp);
|
||||
@ -209,7 +209,7 @@ int32_t Script_UnitXPMax(lua_State* L) {
|
||||
float xpMax = 0.0f;
|
||||
|
||||
if (unit && unit->IsA(TYPE_PLAYER)) {
|
||||
xpMax = static_cast<CGPlayer_C*>(unit)->GetActiveNextLevelXP();
|
||||
xpMax = static_cast<CGPlayer_C*>(unit)->GetNextLevelXP();
|
||||
}
|
||||
|
||||
lua_pushnumber(L, xpMax);
|
||||
@ -282,7 +282,15 @@ int32_t Script_UnitLevel(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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user