#include "Player.h" #include "Main.h" #include Vertex Player::GetCurrentPos() { return GetAgent()->GetCurrentPos(); } void Player::SetGroupId(char groupId) { this->mGroupId=groupId; } unsigned long Player::GetPing() { return mLastPing; } void Player::SetPingTimeSent(unsigned long time) { mTimePingSent=time; } char Player::GetGroupId() { return mGroupId; } PLAYER_STATS* Player::GetStats() { return &mStats; } Agent* Player::GetAgent() { return mpAgent; } void Player::SetAgent(Agent* pAgent) { mpAgent=pAgent; } //Call this function with the internal piece void Player::SetEquippedArmor(int piece, char* pItemId) { assert(piece<5); unsigned long id=Read_uLong(pItemId+8); mEquippedItems[piece+2]=id; } Item* Player::GetEquippedWeapon() { return AccessItem(mEquippedItems[0]); } Item* Player::GetEquippedOffhand() { return AccessItem(mEquippedItems[1]); } Item* Player::GetEquippedArmor(int piece) { assert(piece<5); return AccessItem(mEquippedItems[piece+2]); } void Player::SetCharacterType(bool pvp) { SetFlag(PLAYER_IS_PVP_CHAR, pvp); } bool Player::IsCharacterPvP() { return GetFlag(PLAYER_IS_PVP_CHAR); } unsigned long Player::GetAgentId() { return mpAgent->GetAgentId(); } void Player::SetStreamID(short id) { this->mStreamId=id; } unsigned long Player::GetAccountId() { if (!GetFlag(PLAYER_IS_GHOST)) { return mpLir->accountId; } return 0; } short Player::GetnetworkId() { if (!GetFlag(PLAYER_IS_GHOST)) { return mpLir->networkId; } return 0; } short Player::GetStreamId() { return this->mStreamId; } unsigned long Player::GetCharacterId() { if (!GetFlag(PLAYER_IS_GHOST)) { return mpLir->characterId; } return 0; } unsigned long Player::GetLocalId() { return this->mLocalId; } char* Player::GetPlayerName() { return this->mName; } void Player::SetProfession(int value, int profParam) { assert(value>-1); assert(profParam<2); GetAgent()->GetBattleData()->professions[profParam]=value; } unsigned char Player::GetProfession(int appParam) { return GetAgent()->GetBattleData()->professions[appParam]; } //Make sure your buffer is large enough void Player::GetPlayerNameUnicode(unsigned char* pBuffer, int* pLengthStorage) { assert(pLengthStorage!=NULL); memset(pBuffer, 0, strlen(this->mName)*2+1); strcpy((char*)pBuffer, this->mName); Util::ConvertToUnicode(pBuffer); unsigned long length=(unsigned long)strlen(this->mName)*2; *pLengthStorage=length; } void Player::SetLocalId(unsigned long id) { assert(id > 0); memset(&this->mLocalId, 0, sizeof(long)); this->mLocalId = id; } void Player::SetAppearance(int value, int appParam) { assert(value>-1); assert(appParam>-1); assert(appParam<4); mAppearance[appParam]=value & 0xFF; if (appParam==CHAR_APP_PROFESSION_HAIR_STYLE) { char temp[5]; sprintf(temp, "%x", value); memset(temp+1, 0, 4); this->SetProfession(atoi(temp), CHAR_PROF_PRIMARY); } } unsigned char Player::GetAppearance(int appParam) { assert(appParam>-1); assert(appParam<4); return mAppearance[appParam] & 0xFF; } void Player::SetFlag(int flag, bool state) { mFlags.set(flag, state); } PLAYER_DATA* Player::GetLir() { if (!GetFlag(PLAYER_IS_GHOST)) { return mpLir; } return NULL; } bool Player::GetFlag(int flag) { return mFlags.test(flag); } void Player::SetIdManagers(IDManager *isa, IDManager *eisa) { mpIsaMan=isa; mpEisaMan=eisa; }