197 lines
3.3 KiB
C++
197 lines
3.3 KiB
C++
|
|
#include "GamePlayer.h"
|
|||
|
|
|
|||
|
|
GamePlayer::GamePlayer(IClientUserItem* pUserItem)
|
|||
|
|
:m_pUserItem(pUserItem)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
GamePlayer::~GamePlayer()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
void GamePlayer::setUserItem(IClientUserItem* pItem)
|
|||
|
|
{
|
|||
|
|
m_pUserItem = pItem;
|
|||
|
|
m_UserLocation.ResetData();
|
|||
|
|
upPlayerInfo();
|
|||
|
|
}
|
|||
|
|
IClientUserItem* GamePlayer::getUserItem(bool bAssert)
|
|||
|
|
{
|
|||
|
|
CCAssert(m_pUserItem || !bAssert,"");
|
|||
|
|
return m_pUserItem;
|
|||
|
|
}
|
|||
|
|
uint16 GamePlayer::GetTableID()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetTableID();
|
|||
|
|
}
|
|||
|
|
uint16 GamePlayer::GetChairID()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetChairID();
|
|||
|
|
}
|
|||
|
|
uint8 GamePlayer::GetUserStatus()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetUserStatus();
|
|||
|
|
}
|
|||
|
|
SCORE GamePlayer::GetUserScore()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetUserScore();
|
|||
|
|
}
|
|||
|
|
SCORE GamePlayer::SetUserScore(SCORE score)
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->SetUserScore(score);
|
|||
|
|
}
|
|||
|
|
SCORE GamePlayer::GetUserGrade()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetUserGrade();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
uint16 GamePlayer::GetFaceID()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetFaceID();
|
|||
|
|
}
|
|||
|
|
uint8 GamePlayer::GetGender()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetGender();
|
|||
|
|
}
|
|||
|
|
uint32 GamePlayer::GetUserID()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetUserID();
|
|||
|
|
}
|
|||
|
|
uint32 GamePlayer::GetGameID()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetGameID();
|
|||
|
|
}
|
|||
|
|
std::string GamePlayer::GetNickName(bool isu8 /*= true*/)
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return "";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (isu8)
|
|||
|
|
{
|
|||
|
|
return utility::a_u8(m_pUserItem->GetNickName());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return m_pUserItem->GetNickName();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
std::string GamePlayer::GetUnionName(bool isu8/* = true*/)
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return "";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (isu8)
|
|||
|
|
{
|
|||
|
|
return utility::a_u8(m_pUserItem->GetGroupName());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return m_pUserItem->GetGroupName();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
std::string GamePlayer::GetHeadHttp()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return "";
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetUserInfo()->szHeadHttp;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void GamePlayer::SetHeadHttp(std::string strHttp)
|
|||
|
|
{
|
|||
|
|
CopyMemory(m_pUserItem->GetUserInfo()->szHeadHttp, strHttp.c_str(), strlen(strHttp.c_str()));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
tagUserInfo * GamePlayer::GetUserInfo()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return NULL;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetUserInfo();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
std::string GamePlayer::GetLogonIp()
|
|||
|
|
{
|
|||
|
|
if (!m_pUserItem)
|
|||
|
|
{
|
|||
|
|
return NULL;
|
|||
|
|
}
|
|||
|
|
return m_pUserItem->GetUserInfo()->szLogonIP;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>;
|
|||
|
|
tagUserAddr& GamePlayer::GetLocation()
|
|||
|
|
{
|
|||
|
|
return m_UserLocation;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void GamePlayer::SetLocation(CMD_GF_S_UserLocation *plocation)
|
|||
|
|
{
|
|||
|
|
if (nullptr == plocation) return;
|
|||
|
|
|
|||
|
|
m_UserLocation.isInit = true;
|
|||
|
|
|
|||
|
|
m_UserLocation.latitude = plocation->lLatitude / DOUBLE_TO_SCORE;
|
|||
|
|
m_UserLocation.accuracy = plocation->lAccuracy / DOUBLE_TO_SCORE;
|
|||
|
|
m_UserLocation.longitude = plocation->lLongitude / DOUBLE_TO_SCORE;
|
|||
|
|
|
|||
|
|
m_UserLocation.strAddress = plocation->szAddress;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void GamePlayer::SetLocation(tagUserAddr *pUserAddr)
|
|||
|
|
{
|
|||
|
|
if (nullptr == pUserAddr) return;
|
|||
|
|
|
|||
|
|
//CopyMemory(&m_UserLocation, pUserAddr, sizeof(tagUserAddr));
|
|||
|
|
m_UserLocation.isInit = pUserAddr->isInit;
|
|||
|
|
m_UserLocation.accuracy = pUserAddr->accuracy;
|
|||
|
|
m_UserLocation.latitude = pUserAddr->latitude;
|
|||
|
|
m_UserLocation.longitude = pUserAddr->longitude;
|
|||
|
|
m_UserLocation.strAddress = pUserAddr->strAddress;
|
|||
|
|
m_UserLocation.strProvider = pUserAddr->strProvider;
|
|||
|
|
}
|