roriscrave
Advanced OT User
- Joined
- Dec 7, 2011
- Messages
- 1,188
- Solutions
- 34
- Reaction score
- 200
My server is possible to log 2 players on the same account.
for example, the account has 2 players:
Player A and Player B.
Reproducing a bug:
All players from this account are online (player A and player B).
Player A add Player C in your vip.
PLayer B add Player C in your vip.
as the vip list is the same for players on the same account, the error occurs
code:
iologindata.cpp
player.cpp
for example, the account has 2 players:
Player A and Player B.
Reproducing a bug:
All players from this account are online (player A and player B).
Player A add Player C in your vip.
PLayer B add Player C in your vip.
as the vip list is the same for players on the same account, the error occurs
Lua:
[Error - mysql_real_query] Query: INSERT INTO `account_viplist` (`account_id`, `player_id`) VALUES (476,1010)
Message: Duplicate entry '476-1010' for key 'account_player_index'
code:
iologindata.cpp
C++:
void IOLoginData::addVIPEntry(uint32_t accountId, uint32_t guid)
{
Database& db = Database::getInstance();
std::ostringstream query;
query << "INSERT INTO `account_viplist` (`account_id`, `player_id`) VALUES (" << accountId << ',' << guid << ')';
db.executeQuery(query.str());
}
player.cpp
C:
bool Player::addVIP(uint32_t vipGuid, const std::string& vipName, VipStatus_t status)
{
if (VIPList.size() >= getMaxVIPEntries() || VIPList.size() == 200) { // max number of buddies is 200 in 9.53
sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot add more buddies.");
return false;
}
auto result = VIPList.insert(vipGuid);
if (!result.second) {
sendTextMessage(MESSAGE_STATUS_SMALL, "This player is already in your list.");
return false;
}
IOLoginData::addVIPEntry(accountNumber, vipGuid);
if (client) {
client->sendVIP(vipGuid, vipName, status);
}
return true;
}
Last edited: