Is_online Attribute error
Posted: Sat Nov 29, 2014 2:33 am
Hi
While working on getting Friends to appear online/offline - I've come up with a bug where the 'is_online" attribute is not getting set correctly.
Scenario - if I start my server up (version 850) and log my toon in - the column is_online in character table is set to 'true' - all good
If I then log off - it is set to 'false' - all good.
If I log back in (without the server being restarted) - it stays as false.
It seems lie the code in ChunkServer::HandleClientAuthConfirm detects that the character
has already been loaded into the server (i.e it remembers) so it does not execute the code that normally sets the 'is_online" value.
A suggested fix for this is as shown below in blue ....
shared_ptr<WorldCharacter> character;
if (name){
string str_name = name;
character = character_list.GetCharacter(str_name);
if (character){
client->SetCharacterId(character->GetCharacterID());
client->SetCharacter(character);
database.ToggleIsOnline(character->GetCharacterID(), true);
}
else {
auto c_list = unreal_channel_list.GetCharacterChannelList(client->GetAccountID());
if (c_list)
c_list->IncrementCharCount();
character = make_shared<WorldCharacter>();
database.LoadCharacter(database.GetCharacterID(name), character.get());
client->SetCharacterId(character->GetCharacterID());
client->SetCharacter(character);
character_list.SetCharacter(str_name, character);
}
character->SetZoning(true);
character->SetProcessingAuthConfirmPacket(true);
Jim
While working on getting Friends to appear online/offline - I've come up with a bug where the 'is_online" attribute is not getting set correctly.
Scenario - if I start my server up (version 850) and log my toon in - the column is_online in character table is set to 'true' - all good
If I then log off - it is set to 'false' - all good.
If I log back in (without the server being restarted) - it stays as false.
It seems lie the code in ChunkServer::HandleClientAuthConfirm detects that the character
has already been loaded into the server (i.e it remembers) so it does not execute the code that normally sets the 'is_online" value.
A suggested fix for this is as shown below in blue ....
shared_ptr<WorldCharacter> character;
if (name){
string str_name = name;
character = character_list.GetCharacter(str_name);
if (character){
client->SetCharacterId(character->GetCharacterID());
client->SetCharacter(character);
database.ToggleIsOnline(character->GetCharacterID(), true);
}
else {
auto c_list = unreal_channel_list.GetCharacterChannelList(client->GetAccountID());
if (c_list)
c_list->IncrementCharCount();
character = make_shared<WorldCharacter>();
database.LoadCharacter(database.GetCharacterID(name), character.get());
client->SetCharacterId(character->GetCharacterID());
client->SetCharacter(character);
character_list.SetCharacter(str_name, character);
}
character->SetZoning(true);
character->SetProcessingAuthConfirmPacket(true);
Jim