Is_online Attribute error
Moderators: Community Managers, Developers
Is_online Attribute error
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
Re: Is_online Attribute error
I actually found this issue as the entire client must be reinitialized when this happens. It happens when you log in before your character object is unloaded from the server. Also, that section of code is pretty messed up as the character object is ALWAYS loaded at that point. The ChunkServer will never load a character object.
I have a fix in mind, but I need to get this character sheet code committed first.
I have a fix in mind, but I need to get this character sheet code committed first.
Re: Is_online Attribute error
I'm assuming you are logging back in right away. If you actually allow the character object to be destroyed (it takes almost a minute after a Force Close), everything will work normally.
This would fix a lot of things, if either:
- We cause the character object to be destroyed as soon as the Client objects are destroyed.
Or
- We properly define a list of Object fields that should be reset on a WorldCharacter and Client object when logging in for the first time, and do this.
This might help for now:
Search for these defines and change their values to what I've listed below:
#define CHECK_CHARACTER_DELETES 1000 // This causes character object checks every second instead of every 30 seconds.
#define CHARACTER_DELETION_DELAY_MS 0 // This causes the character object to be deleted as soon as it's on the Delete list
John, you could try this on New Telon, but I don't know how inappropriate this would be on a server with latency. I only did this on my Server, as it causes the character object (and thus the PC spawn itself) to leave the world as soon as the Client object is destroyed, which is what I believe should happen.
This would fix a lot of things, if either:
- We cause the character object to be destroyed as soon as the Client objects are destroyed.
Or
- We properly define a list of Object fields that should be reset on a WorldCharacter and Client object when logging in for the first time, and do this.
This might help for now:
Search for these defines and change their values to what I've listed below:
#define CHECK_CHARACTER_DELETES 1000 // This causes character object checks every second instead of every 30 seconds.
#define CHARACTER_DELETION_DELAY_MS 0 // This causes the character object to be deleted as soon as it's on the Delete list
John, you could try this on New Telon, but I don't know how inappropriate this would be on a server with latency. I only did this on my Server, as it causes the character object (and thus the PC spawn itself) to leave the world as soon as the Client object is destroyed, which is what I believe should happen.