mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-05 15:42:17 +03:00
feat(object): simplify getters in CGPlayer_C
This commit is contained in:
parent
4bf88801ed
commit
68ad71090e
@ -14,20 +14,20 @@ CGPlayer_C::~CGPlayer_C() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
uint32_t CGPlayer_C::GetActiveNextLevelXP() const {
|
||||
uint32_t CGPlayer_C::GetNextLevelXP() const {
|
||||
if (this->GetGUID() != ClntObjMgrGetActivePlayer()) {
|
||||
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()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this->GetXP();
|
||||
return this->CGPlayer::GetXP();
|
||||
}
|
||||
|
||||
void CGPlayer_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
||||
|
||||
@ -15,8 +15,8 @@ class CGPlayer_C : public CGUnit_C, public CGPlayer {
|
||||
|
||||
// Public member functions
|
||||
CGPlayer_C(uint32_t time, CClientObjCreate& objCreate);
|
||||
uint32_t GetActiveNextLevelXP() const;
|
||||
uint32_t GetActiveXP() 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);
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user