Allow Only 1 Session Per Account
Since there are connection issues and some other issues with having more than 1 character logged in at the same time from a single account, I thought it would be nice if we had a way to only allow 1 session at a time per account. This won't limit how many connections they can have to the server, it will only block the same account from logging in more than one session at a time. They can still use as many accounts as they like to play more than 1 character at a time.
I think it would be good to have this implemented as a Rule, in case some admins don't want to use it, or don't want the headache of getting complaints from their players about it. This should be fairly simple code to write, but I think it surpasses my coding skills. There is probably an easier way to do it, but I am thinking something similar to TheLieka's code for IP limiting should work just fine. Here is an example of his code with a few changes I have made so far to start getting the code changed for this. Most of it is still his IP limiting code, though: \common\ruletypes.h Code:
RULE_BOOL ( World, AccountSessionLimit, false ) //Trevius Edit: Limit Accounts to only login 1 Character Per Session Default value: false (feature disabled) Code:
void GetCLEIP(int32 iIP); \world\clientlist.cpp Code:
//Lieka Edit Begin: Check current CLE Entry IPs against incoming connection \world\client.cpp Code:
if (RuleI(World, AccountSessionLimit) = true) { Required SQL: Code:
Insert into rule_values values (0, 'World:AccountSessionLimit', false); Here is a link to TheLieka's original posting for the IP Limiting, if anyone cares to compare and do some work on this: http://www.eqemulator.net/forums/showthread.php?t=24730 Make sure to read the post he made later on there with a couple of corrections to his original submission. |
Thank you very much for this. This will be great once it gets to the main code.
|
I think booting the currently logged in character is a better way to limit this than to not allow the account to login when there's already a toon on. The reason is, I see ghosts and characters seemingly stuck online long after I log out sometimes. I think in some cases you might go LD and then not be able to get back in.
In the account table, the active character name is stored when you login .. what about simply checking the Client List and booting the character listed each time you login? This way, if there is already a toon logged in on the account, it will get WorldKicked when you login a second toon. Granted this is not the way Live works, but I think it would cause less problems and be easier to implement. |
Quote:
To see the above quoted modification to this code and/or the IP Limiting code would help immensely with the problem I just described, and maybe have an effect on the character ghosting issues that Windows servers experience. |
Quote:
|
Live's way sucks. Definitely boot the char already in the game imo, it's simpler to implement and less annoying for the legit player.
|
Ya, I do think that live does boot the character in game when you log in the same account again. I wasn't really thinking of the details I guess lol. The ghosting issue that causes problems with IP limiting is really only a problem on Windows. I wish they would fix that problem for Windows servers though, as Linux doesn't have player ghosting.
But anyway, the stuff I have posted so far isn't anywhere near done. That is why I posted it in the feature request section. It is mostly all still the IP Limiting code, and hasn't been modified accept for a few minor places like the rules. But, I do think it is something the emu has been missing and will help out with a couple of major issues. I will see if I can help figure out the code to do it, but I really do suck at it lol. I can only really work by example. For someone with good coding experience, I doubt this would be too hard though. |
To start, you would need the following from what you posted above to create the rule entries:
Quote:
The actual code to both check, and then as a result kick the online character, I believe would go in world/client.cpp around line 463: Code:
446 case OP_EnterWorld: // Enter world If I can, I'll look a little deeper into this, but hopefully this gives us a place to start. |
I am still wanting to get this feature added at some point. I am noting some code that might be usable to help write the account limiting code. Note that this is all code that already exists in the source, but I think some of it may be useful for making this feature.
clientlist.h Code:
Client* FindByAccountID(int32 account_id); Code:
ClientListEntry* ClientList::FindCLEByAccountID(int32 iAccID) { Code:
#define CLE_Status_Never -1 Code:
void ClientListEntry::SetOnline(sint8 iOnline) { |
Ok, looking at this further, I think we are doing almost the exact same thing that Lieka is doing with the IP limiting. The only difference is that we want to boot the Online characters instead of the incoming characters. I have rewritten this code a bit so that it should actually work, but that it should still be kicking off the incoming character. I think if we can figure out how to kick a character that is logged in and let the new incoming one replace them, that it should finalize this code.
\common\ruletypes.h Code:
RULE_INT ( World, AccountSessionLimit, -1 ) //Max number of characters allowed on at once from a single account (-1 is disabled) Code:
void GetCLEAccount(int32 iAccID); Code:
if (RuleI(World, AccountSessionLimit) >= 0) { Code:
void ClientList::GetCLEAccount(int32 iAccID) { Code:
Insert into rule_values values (0, 'World:AccountSessionLimit', -1); On another note, I think by enabling this rule and setting it to 1 character max per account, it should also stop the possible exploit with shared bank platinum. That is just one more reason to get this working :) |
Quote:
|
I tested the code submitted above and it actually works perfectly as intended as far as I can tell. I was able to log on a single character from any account with any status, but if I tried to log on a second character from an account below the set exempt status, it would get disconnected after hitting "enter world". I also verified that the exempt status still works and you can log in as many as you want still if your account status is higher than the exempt setting.
So, all that is left is to figure out how to make it kick the character in game instead of disconnecting the new one trying to log in. I am thinking maybe the way to do it could be found in the code that keeps people from logging in the same character more than once. Since if you try to log in a character that is already online, it will boot the online character and let you log him/her in again with the new connection. This is mostly important for cases where a character may be bugged and stuck logged on. It would be extremely important on Windows servers using this feature, due to player ghosting. |
I'm going to get this one PEQ tonight, and see how it goes. Since we're Linux we don't suffer from player ghosting, and LDs usually disconnect in under a minute so it's no problem for us as written.
|
Been running it on my server a couple of days and haven't heard any issues with it yet. Seems to work exactly as intended. I am still trying to figure out where in the code it is checked if you are logging in the same character, because that is the only time it will boot the character that is online. If I can find that, I think we can add that to this code and have it kick the character in game.
Another nice bonus to this code is that on Windows servers running IP Limiting, character ghosting can cause players to be locked out of the server. But, with this rule in place, once we get it set to kick the in game character, it will resolve that issue and let them log in again. |
If you change the iterator from:
Code:
LinkedListIterator<ClientListEntry*> iterator(clientlist); Code:
LinkedListIterator<ClientListEntry*> iterator(clientlist, BACKWARD); |
All times are GMT -4. The time now is 06:51 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.