Store avatar type of current avatar in db.
This commit is contained in:
@@ -49,11 +49,16 @@ ServerDBGeneric::Stop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerDBGeneric::AsyncPlayerLogin(unsigned requestId, const string &/*playerName*/, const std::string &/*avatarHash*/)
|
ServerDBGeneric::AsyncPlayerLogin(unsigned requestId, const string &/*playerName*/)
|
||||||
{
|
{
|
||||||
m_ioService->post(boost::bind(&ServerDBCallback::PlayerLoginFailed, &m_callback, requestId));
|
m_ioService->post(boost::bind(&ServerDBCallback::PlayerLoginFailed, &m_callback, requestId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ServerDBGeneric::PlayerPostLogin(DB_id /*playerId*/, const std::string &/*avatarHash*/, const std::string &/*avatarType*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerDBGeneric::PlayerLogout(DB_id /*playerId*/)
|
ServerDBGeneric::PlayerLogout(DB_id /*playerId*/)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ public:
|
|||||||
virtual void Start();
|
virtual void Start();
|
||||||
virtual void Stop();
|
virtual void Stop();
|
||||||
|
|
||||||
virtual void AsyncPlayerLogin(unsigned requestId, const std::string &playerName, const std::string &avatarHash);
|
virtual void AsyncPlayerLogin(unsigned requestId, const std::string &playerName);
|
||||||
|
virtual void PlayerPostLogin(DB_id playerId, const std::string &avatarHash, const std::string &avatarType);
|
||||||
virtual void PlayerLogout(DB_id playerId);
|
virtual void PlayerLogout(DB_id playerId);
|
||||||
|
|
||||||
virtual void AsyncCreateGame(unsigned requestId, const std::string &gameName);
|
virtual void AsyncCreateGame(unsigned requestId, const std::string &gameName);
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ public:
|
|||||||
virtual void Start() = 0;
|
virtual void Start() = 0;
|
||||||
virtual void Stop() = 0;
|
virtual void Stop() = 0;
|
||||||
|
|
||||||
virtual void AsyncPlayerLogin(unsigned requestId, const std::string &playerName, const std::string &avatarHash) = 0;
|
virtual void AsyncPlayerLogin(unsigned requestId, const std::string &playerName) = 0;
|
||||||
|
virtual void PlayerPostLogin(DB_id playerId, const std::string &avatarHash, const std::string &avatarType) = 0;
|
||||||
virtual void PlayerLogout(DB_id playerId) = 0;
|
virtual void PlayerLogout(DB_id playerId) = 0;
|
||||||
|
|
||||||
virtual void AsyncCreateGame(unsigned requestId, const std::string &gameName) = 0;
|
virtual void AsyncCreateGame(unsigned requestId, const std::string &gameName) = 0;
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ public:
|
|||||||
virtual void Start() {}
|
virtual void Start() {}
|
||||||
virtual void Stop() {}
|
virtual void Stop() {}
|
||||||
|
|
||||||
virtual void AsyncPlayerLogin(unsigned requestId, const std::string &playerName, const std::string &avatarHash) {}
|
virtual void AsyncPlayerLogin(unsigned requestId, const std::string &playerName) {}
|
||||||
|
virtual void PlayerPostLogin(DB_id playerId, const std::string &avatarHash, const std::string &avatarType) {}
|
||||||
virtual void PlayerLogout(DB_id playerId) {}
|
virtual void PlayerLogout(DB_id playerId) {}
|
||||||
|
|
||||||
virtual void AsyncCreateGame(unsigned requestId, const std::string &gameName) {}
|
virtual void AsyncCreateGame(unsigned requestId, const std::string &gameName) {}
|
||||||
|
|||||||
@@ -1495,8 +1495,21 @@ ServerLobbyThread::InitAfterLogin(SessionWrapper session)
|
|||||||
void
|
void
|
||||||
ServerLobbyThread::EstablishSession(SessionWrapper session)
|
ServerLobbyThread::EstablishSession(SessionWrapper session)
|
||||||
{
|
{
|
||||||
if (!session.playerData.get())
|
if (!session.playerData)
|
||||||
throw ServerException(__FILE__, __LINE__, ERR_NET_INVALID_SESSION, 0);
|
throw ServerException(__FILE__, __LINE__, ERR_NET_INVALID_SESSION, 0);
|
||||||
|
|
||||||
|
// Run postlogin for DB
|
||||||
|
string tmpAvatarHash;
|
||||||
|
string tmpAvatarType;
|
||||||
|
if (!session.playerData->GetAvatarMD5().IsZero())
|
||||||
|
{
|
||||||
|
tmpAvatarHash = session.playerData->GetAvatarMD5().ToString();
|
||||||
|
tmpAvatarType = AvatarManager::GetAvatarFileExtension(AvatarManager::GetAvatarFileType(session.playerData->GetAvatarFile()));
|
||||||
|
if (!tmpAvatarType.empty())
|
||||||
|
tmpAvatarType.erase(0, 1); // Only store extension without the "."
|
||||||
|
}
|
||||||
|
m_database->PlayerPostLogin(session.playerData->GetDBId(), tmpAvatarHash, tmpAvatarType);
|
||||||
|
|
||||||
// Send ACK to client.
|
// Send ACK to client.
|
||||||
boost::shared_ptr<NetPacket> ack(new NetPacket(NetPacket::Alloc));
|
boost::shared_ptr<NetPacket> ack(new NetPacket(NetPacket::Alloc));
|
||||||
ack->GetMsg()->present = PokerTHMessage_PR_initAckMessage;
|
ack->GetMsg()->present = PokerTHMessage_PR_initAckMessage;
|
||||||
@@ -1529,10 +1542,7 @@ ServerLobbyThread::AuthenticatePlayer(SessionWrapper session)
|
|||||||
{
|
{
|
||||||
if(session.playerData)
|
if(session.playerData)
|
||||||
{
|
{
|
||||||
if (!session.playerData->GetAvatarMD5().IsZero())
|
m_database->AsyncPlayerLogin(session.playerData->GetUniqueId(), session.playerData->GetName());
|
||||||
m_database->AsyncPlayerLogin(session.playerData->GetUniqueId(), session.playerData->GetName(), session.playerData->GetAvatarMD5().ToString());
|
|
||||||
else
|
|
||||||
m_database->AsyncPlayerLogin(session.playerData->GetUniqueId(), session.playerData->GetName(), "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user