feat(object): simplify getters in CGPlayer_C

This commit is contained in:
fallenoak 2026-02-06 10:36:54 -06:00
parent 4bf88801ed
commit 68ad71090e
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
3 changed files with 8 additions and 8 deletions

View File

@ -14,20 +14,20 @@ CGPlayer_C::~CGPlayer_C() {
// TODO // TODO
} }
uint32_t CGPlayer_C::GetActiveNextLevelXP() const { uint32_t CGPlayer_C::GetNextLevelXP() const {
if (this->GetGUID() != ClntObjMgrGetActivePlayer()) { if (this->GetGUID() != ClntObjMgrGetActivePlayer()) {
return 0; return 0;
} }
return this->GetNextLevelXP(); return this->CGPlayer::GetNextLevelXP();
} }
uint32_t CGPlayer_C::GetActiveXP() const { uint32_t CGPlayer_C::GetXP() const {
if (this->GetGUID() != ClntObjMgrGetActivePlayer()) { if (this->GetGUID() != ClntObjMgrGetActivePlayer()) {
return 0; return 0;
} }
return this->GetXP(); return this->CGPlayer::GetXP();
} }
void CGPlayer_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) { void CGPlayer_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {

View File

@ -15,8 +15,8 @@ class CGPlayer_C : public CGUnit_C, public CGPlayer {
// Public member functions // Public member functions
CGPlayer_C(uint32_t time, CClientObjCreate& objCreate); CGPlayer_C(uint32_t time, CClientObjCreate& objCreate);
uint32_t GetActiveNextLevelXP() const; uint32_t GetNextLevelXP() const;
uint32_t GetActiveXP() 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);
void PostInitActivePlayer(); void PostInitActivePlayer();
void SetStorage(uint32_t* storage, uint32_t* saved); void SetStorage(uint32_t* storage, uint32_t* saved);

View File

@ -189,7 +189,7 @@ int32_t Script_UnitXP(lua_State* L) {
float xp = 0.0f; float xp = 0.0f;
if (unit && unit->IsA(TYPE_PLAYER)) { if (unit && unit->IsA(TYPE_PLAYER)) {
xp = static_cast<CGPlayer_C*>(unit)->GetActiveXP(); xp = static_cast<CGPlayer_C*>(unit)->GetXP();
} }
lua_pushnumber(L, xp); lua_pushnumber(L, xp);
@ -209,7 +209,7 @@ int32_t Script_UnitXPMax(lua_State* L) {
float xpMax = 0.0f; float xpMax = 0.0f;
if (unit && unit->IsA(TYPE_PLAYER)) { if (unit && unit->IsA(TYPE_PLAYER)) {
xpMax = static_cast<CGPlayer_C*>(unit)->GetActiveNextLevelXP(); xpMax = static_cast<CGPlayer_C*>(unit)->GetNextLevelXP();
} }
lua_pushnumber(L, xpMax); lua_pushnumber(L, xpMax);