leandroluck
New Member
- Joined
- Dec 24, 2010
- Messages
- 104
- Reaction score
- 1
I'm having this problems and by logging the error is leading to these functions
Link FULL LOG hastebin
Code:
void ProtocolGame::updateCoinBalance()
{
NetworkMessage msg;
msg.addByte(0xF2);
msg.addByte(0x00);
writeToOutputBuffer(msg);
g_dispatcher.addTask(
createTask(std::bind([](ProtocolGame_ptr client) {
client->sendCoinBalance();
}, getThis()))
);
}
void ProtocolGame::sendCoinBalance()
{
Database& db = Database::getInstance();
std::ostringstream query;
query << "SELECT `coins` FROM `accounts` WHERE `id`=" + std::to_string(player->getAccount());
DBResult_ptr result = db.storeQuery(query.str());
if (!result) {
return;
}
NetworkMessage msg;
msg.addByte(0xF2);
msg.addByte(0x01);
msg.addByte(0xDF);
msg.addByte(0x01);
msg.add<uint32_t>(result->getNumber<uint32_t>("coins")); //total coins
msg.add<uint32_t>(result->getNumber<uint32_t>("coins")); //transferable coins
writeToOutputBuffer(msg);
}