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)
RULE_INT ( World, ExemptAccountLimitStatus, -1 ) //Trevius Edit: Exempt accounts from the AccountSessionLimit rule if their status is >= this value. Default value: -1 (feature disabled)
\world\clientlist.h
Code:
void GetCLEIP(int32 iIP);
\world\clientlist.cpp
Code:
//Lieka Edit Begin: Check current CLE Entry IPs against incoming connection
void ClientList::GetCLEIP(int32 iIP) {
ClientListEntry* countCLEIPs = 0;
LinkedListIterator<ClientListEntry*> iterator(clientlist);
int IPInstances = 0;
iterator.Reset();
while(iterator.MoreElements()) {
countCLEIPs = iterator.GetData();
if ((countCLEIPs->GetIP() == iIP) && ((countCLEIPs->Admin() <= (RuleI(World, ExemptMaxClientsStatus))) || (RuleI(World, ExemptMaxClientsStatus) < 0))) {
IPInstances++;
if (IPInstances > (RuleI(World, MaxClientsPerIP))){
countCLEIPs->SetOnline(CLE_Status_Offline);
iterator.RemoveCurrent();
}
}
iterator.Advance();
}
}
//Lieka Edit End
\world\client.cpp
Code:
if (RuleI(World, AccountSessionLimit) = true) {
client_list.GetCLEIP(this->GetAccountID()); //Lieka Edit Begin: Check current CLE Entry IPs against incoming connection
}
Required SQL:
Code:
Insert into rule_values values (0, 'World:AccountSessionLimit', false);
Insert into rule_values values (0, 'World:ExemptAccountLimitStatus', -1);
If someone can get the rest figured out, I would love to get it put in on my server. I think with this set, it will keep new players from making the mistake of using multiple characters on the same account to box together, only to find out later on that they should have used separate accounts.
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.