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); |
Thanks, Derision :) I will give that a try along with a few other things I have been wanting to test as soon as I get my new test server up and running. Going to run VMWare on my Windows PC to have another Linux installation without having to dual boot or build a 3rd PC. It should be MUCH easier (on me and my players) to do code testing once I get Linux running on VMWare.
|
This exploit is majorly serious... Players can in fact duplicate tradeable items with this.. I hope that it gets fixed soon because until then Raid Addicts will not be Unlocked... Our economy has suffered greatly due to this..
Azamorra was a great coder who donated to our server an excellent fix for this , but it seems we have lost the code for it.. Aza if your out there please come back and help the community with this fix.. King |
What are you talking about KingMort? Are you sure the issue you are referring to is related to this topic? More details would be helpful. If you are having issues with the account limiting, you can disable it in your rules.
|
Quote:
He wants to put in the code on his server, however, I looked over the topics and can't make sense of where i'm supposed to put all the code right now. What do I remove, add, etc, because at the moment i'm sort of confused on where the code goes due to it being in three seperate posts. I think what KingMort was trying to explain, from what I heard on IRC, that he wishes to disable the multi-account logon for his server, and that he's keeping it down until then. So to prevent him from having a heart attack, could one of you please post the final code in a diff or something against latest SVN? I would appriciate it greatly. :P |
http://www.eqemulator.net/forums/sho...7&postcount=10
That is all you need. It's currently running on TGC and works fine. Just find the void ClientList::GetCLEIP references and tack that code after them. Of course, players are going to complain because if they get kicked midfight, they have to wait 5 min to get back in, but oh well. It fixes several dupping/trading exploits and allows us to enable shared plat. Mort is right of course, multiple toons on the same account opens the door for many exploits, which make obtaining items or gearing a guild let's say trivial. |
Thanks Cavedude! I'll put that in myself
Quote:
|
From my testing with this code, it indeed kicks off players when they log in, but if you log in two characters to character select, and then log in them both at the same time, you are able to bypass it. Still messing with it to see if it was a fluke, though.
-S |
Nevermind... KingMort was having issues with his SVN, doh.
I ended up putting in aza77's fix for this issue, which gets it from the loginserver->world, and denies a second account from logging in altogether. If I had aza77's contact info, i'd ask for permission to post it as I don't know if he wants that specific piece posted. But I don't have his contact info, so i'm tempted to share it. |
Well it's not yours to be sharing so yeah...
Probably not a good idea |
I tried the suggestion that Derision made, but that didn't work. In fact, it stopped the limiting from happening at all as far as I could tell.
I am sure we can still come up with something. If I could only find the code that keeps you from logging in the same character more than once, I think it could be applied to this code to make a good solution. I don't know if anything changed with the situation with aza77 (didn't know them), but here are a few excerpts from the changelog that seem to show that aza77 doesn't mind sharing code: Quote:
http://eqemulator.net/forums/showthread.php?t=21609 So, I would be pretty surprised if they were upset about their code being posted. From what I can tell, they would have wanted it shared. I do believe that the author reserves all rights to decide to share or not. Since you are unable to reach them, it is up to you whether to share or not. My guess is that the code wasn't meant to be secret, but was just something that they never got around to sharing. If they were a secretive person, then I would definitely say not to share. Either way, we will get the account limiting issue resolved in the best way possible. It isn't a big deal. If the code that aza77 wrote just blocks them from logging in another character on the same account, then that is what the current code here already does, so it wouldn't be needed anyway. The only thing we need is a way to make it boot the in game character on the same account instead of blocking the one logging in. If it doesn't do that, there is no use for the code anyway. |
All times are GMT -4. The time now is 01:26 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.