mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-19 14:11:06 +03:00
Compare commits
No commits in common. "315ea05ba048cd4d43e332a797fddf34c882f5e8" and "aa22dd952a86b03826bc960413133c42d3e18cd8" have entirely different histories.
315ea05ba0
...
aa22dd952a
@ -36,14 +36,6 @@ OBJECT_TYPE_ID CGObject::GetTypeID() const {
|
|||||||
return this->m_typeID;
|
return this->m_typeID;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CGObject::IsA(OBJECT_TYPE type) const {
|
|
||||||
return (this->GetType() & type) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGObject::IsExactlyA(OBJECT_TYPE_ID typeID) const {
|
|
||||||
return this->m_typeID == typeID;
|
|
||||||
}
|
|
||||||
|
|
||||||
CGObjectData* CGObject::Obj() const {
|
CGObjectData* CGObject::Obj() const {
|
||||||
return this->m_obj;
|
return this->m_obj;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,8 +31,6 @@ class CGObject {
|
|||||||
WOWGUID GetGUID() const;
|
WOWGUID GetGUID() const;
|
||||||
OBJECT_TYPE GetType() const;
|
OBJECT_TYPE GetType() const;
|
||||||
OBJECT_TYPE_ID GetTypeID() const;
|
OBJECT_TYPE_ID GetTypeID() const;
|
||||||
int32_t IsA(OBJECT_TYPE type) const;
|
|
||||||
int32_t IsExactlyA(OBJECT_TYPE_ID typeID) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Protected member variables
|
// Protected member variables
|
||||||
|
|||||||
@ -41,14 +41,6 @@ uint32_t CGPlayer::TotalRemoteFieldsSaved() {
|
|||||||
return CGPlayer::GetBaseOffsetSaved() + 173;
|
return CGPlayer::GetBaseOffsetSaved() + 173;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CGPlayer::GetNextLevelXP() const {
|
|
||||||
return this->Player()->nextLevelXP;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t CGPlayer::GetXP() const {
|
|
||||||
return this->Player()->xp;
|
|
||||||
}
|
|
||||||
|
|
||||||
CGPlayerData* CGPlayer::Player() const {
|
CGPlayerData* CGPlayer::Player() const {
|
||||||
return this->m_player;
|
return this->m_player;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,10 +148,6 @@ class CGPlayer {
|
|||||||
static uint32_t TotalFieldsSaved();
|
static uint32_t TotalFieldsSaved();
|
||||||
static uint32_t TotalRemoteFieldsSaved();
|
static uint32_t TotalRemoteFieldsSaved();
|
||||||
|
|
||||||
// Public member functions
|
|
||||||
uint32_t GetNextLevelXP() const;
|
|
||||||
uint32_t GetXP() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Protected member variables
|
// Protected member variables
|
||||||
CGPlayerData* m_player;
|
CGPlayerData* m_player;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include "object/client/CGPlayer_C.hpp"
|
#include "object/client/CGPlayer_C.hpp"
|
||||||
#include "db/Db.hpp"
|
#include "db/Db.hpp"
|
||||||
#include "object/client/ObjMgr.hpp"
|
|
||||||
#include "object/Types.hpp"
|
#include "object/Types.hpp"
|
||||||
#include <storm/Error.hpp>
|
#include <storm/Error.hpp>
|
||||||
|
|
||||||
@ -12,22 +11,6 @@ CGPlayer_C::~CGPlayer_C() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CGPlayer_C::GetActiveNextLevelXP() const {
|
|
||||||
if (this->GetGUID() != ClntObjMgrGetActivePlayer()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this->GetNextLevelXP();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t CGPlayer_C::GetActiveXP() const {
|
|
||||||
if (this->GetGUID() != ClntObjMgrGetActivePlayer()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this->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) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
|||||||
@ -15,8 +15,6 @@ 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 GetActiveXP() const;
|
|
||||||
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
|
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
|
||||||
void SetStorage(uint32_t* storage, uint32_t* saved);
|
void SetStorage(uint32_t* storage, uint32_t* saved);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -173,43 +173,11 @@ int32_t Script_UnitPVPName(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_UnitXP(lua_State* L) {
|
int32_t Script_UnitXP(lua_State* L) {
|
||||||
if (!lua_isstring(L, 1)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
luaL_error(L, "Usage: UnitXP(\"unit\")");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto name = lua_tostring(L, 1);
|
|
||||||
auto unit = Script_GetUnitFromName(name);
|
|
||||||
|
|
||||||
float xp = 0.0f;
|
|
||||||
|
|
||||||
if (unit && unit->IsA(TYPE_PLAYER)) {
|
|
||||||
xp = static_cast<CGPlayer_C*>(unit)->GetActiveXP();
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_pushnumber(L, xp);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_UnitXPMax(lua_State* L) {
|
int32_t Script_UnitXPMax(lua_State* L) {
|
||||||
if (!lua_isstring(L, 1)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
luaL_error(L, "Usage: UnitXPMax(\"unit\")");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto name = lua_tostring(L, 1);
|
|
||||||
auto unit = Script_GetUnitFromName(name);
|
|
||||||
|
|
||||||
float xpMax = 0.0f;
|
|
||||||
|
|
||||||
if (unit && unit->IsA(TYPE_PLAYER)) {
|
|
||||||
xpMax = static_cast<CGPlayer_C*>(unit)->GetActiveNextLevelXP();
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_pushnumber(L, xpMax);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_UnitHealth(lua_State* L) {
|
int32_t Script_UnitHealth(lua_State* L) {
|
||||||
|
|||||||
@ -12,16 +12,6 @@ bool ParseTrailingTokens(const char* token, WOWGUID& guid, CGPlayer_C* player) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CGUnit_C* Script_GetUnitFromName(const char* name) {
|
|
||||||
WOWGUID guid;
|
|
||||||
|
|
||||||
if (!Script_GetGUIDFromToken(name, guid, false)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return static_cast<CGUnit_C*>(ClntObjMgrObjectPtr(guid, TYPE_UNIT, __FILE__, __LINE__));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Script_GetGUIDFromString(const char*& token, WOWGUID& guid) {
|
bool Script_GetGUIDFromString(const char*& token, WOWGUID& guid) {
|
||||||
// TODO
|
// TODO
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -3,10 +3,6 @@
|
|||||||
|
|
||||||
#include "util/GUID.hpp"
|
#include "util/GUID.hpp"
|
||||||
|
|
||||||
class CGUnit_C;
|
|
||||||
|
|
||||||
CGUnit_C* Script_GetUnitFromName(const char* name);
|
|
||||||
|
|
||||||
bool Script_GetGUIDFromString(const char*& token, WOWGUID& guid);
|
bool Script_GetGUIDFromString(const char*& token, WOWGUID& guid);
|
||||||
|
|
||||||
bool Script_GetGUIDFromToken(const char* token, WOWGUID& guid, bool defaultToTarget);
|
bool Script_GetGUIDFromToken(const char* token, WOWGUID& guid, bool defaultToTarget);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user