Don't allow an account to have multiple characters logged in at the same time unless admin status > 100

This commit is contained in:
Emagi 2025-06-17 08:13:16 -04:00
parent ac15c6b9f7
commit aa70c950b8
3 changed files with 7 additions and 5 deletions

View File

@ -583,7 +583,7 @@ int32 LoginServer::DetermineCharacterLoginRequest ( UsertoWorldRequest_Struct* u
else
status = database.GetCharacterAdminStatus ( utwr->lsaccountid , utwr->char_id );
if(status < 100 && zone_list.ClientConnected(utwr->lsaccountid))
if(status < 100 && zone_list.ClientConnected(utwr->lsaccountid, utwr->char_id))
status = -9;
if(status < 0){
LogWrite(WORLD__ERROR, 0, "World", "Login Rejected based on PLAY_ERROR (UserStatus) (MinStatus: %i), UserStatus: %i, CharID: %i",loginserver.minLockedStatus,status,utwr->char_id );
@ -592,7 +592,7 @@ int32 LoginServer::DetermineCharacterLoginRequest ( UsertoWorldRequest_Struct* u
response = PLAY_ERROR_CHAR_NOT_LOADED;
break;
case -9:
response = 0;//PLAY_ERROR_ACCOUNT_IN_USE;
response = PLAY_ERROR_ACCOUNT_IN_USE;
break;
case -8:
response = PLAY_ERROR_LOADING_ERROR;

View File

@ -1280,7 +1280,7 @@ int32 ZoneList::GetZonesPlayersCount() {
return ret;
}
bool ZoneList::ClientConnected(int32 account_id){
bool ZoneList::ClientConnected(int32 account_id, int32 char_id){
bool ret = false;
map<string, Client*>::iterator itr;
MClientList.lock();
@ -1294,7 +1294,9 @@ bool ZoneList::ClientConnected(int32 account_id){
if(client_map.size() > 0){
itr=client_map.begin();
if(itr == client_map.end()){
if(itr->second && itr->second->GetAccountID() == account_id && (itr->second->GetPlayer()->GetActivityStatus() & ACTIVITY_STATUS_LINKDEAD) == 0)
if(itr->second && itr->second->GetAccountID() == account_id && itr->second->GetCharacterID() != char_id)
ret = true;
if(itr->second && itr->second->GetAccountID() == account_id && itr->second->GetCharacterID() == char_id && ((itr->second->GetPlayer()->GetActivityStatus() & ACTIVITY_STATUS_LINKDEAD) == 0))
ret = true;
break;
}

View File

@ -532,7 +532,7 @@ class ZoneList {
client_map.erase(name);
MClientList.unlock();
}
bool ClientConnected(int32 account_id);
bool ClientConnected(int32 account_id, int32 char_id);
void RemoveClientZoneReference(ZoneServer* zone);
void ReloadClientQuests();
bool DepopFinished();